home · contact · privacy
7DRL: Add an "axe" tool type to chop down trees with.
authorChristian Heller <c.heller@plomlompom.de>
Thu, 12 Mar 2015 15:59:18 +0000 (16:59 +0100)
committerChristian Heller <c.heller@plomlompom.de>
Thu, 12 Mar 2015 15:59:18 +0000 (16:59 +0100)
SERVER_COMMANDS
confserver/world
roguelike-server
src/client/draw_wins.c

index b8385d31c7c2a7bea420d48157f657536894941d..3ae0b2041c60bc99924824ce1e155d9013445716 100644 (file)
@@ -248,3 +248,5 @@ SLIPPERS [0 to infinity]
 FAVOR_STAGE [0 to 65535]
 
 PLANT_0 [0 to infinity]
+
+TT_TOOLS gain the "axe" argument.
index 669c08859dfce36db45e910e34ab66b25450f176..e6c85acfa5c1949f50f8f138b43341dc4bb93ecb 100644 (file)
@@ -92,6 +92,13 @@ TT_NAME 'PLANT #2'
 TT_TOOLPOWER 0
 TT_PROLIFERATE 512
 
+TT_ID 9
+TT_TOOL axe
+TT_SYMBOL /
+TT_NAME AXE
+TT_TOOLPOWER 5000
+TT_START_NUMBER 1
+
 TT_ID 0
 TT_CORPSE_ID 6
 TT_ID 1
@@ -108,6 +115,10 @@ TT_ID 6
 TT_CORPSE_ID 4
 TT_ID 7
 TT_CORPSE_ID 4
+TT_ID 8
+TT_CORPSE_ID 4
+TT_ID 9
+TT_CORPSE_ID 4
 
 FAVOR_STAGE 0
 SLIPPERS 1
index 53cd75148ff46a43b01d4f7a1a0fa3e2fba34214..305c8aa7dbdbbbaf93af77fcf8ea1a09504c49e2 100755 (executable)
@@ -736,6 +736,7 @@ def actor_move(t):
     """If passable, move/collide(=attack) thing into T_ARGUMENT's direction."""
     # 7DRL: Player wounding (worse: killing) others will lower God's favor.
     # 7DRL: Player entering the altar triggers enter_altar().
+    # 7DRL: Player with axe chops down trees.
     passable = False
     move_result = mv_yx_in_dir_legal(chr(t["T_ARGUMENT"]),
                                      t["T_POSY"], t["T_POSX"])
@@ -762,6 +763,28 @@ def actor_move(t):
             if test and t == world_db["Things"][0]:  # #
                 add_gods_favor(-test)  # #
             return
+        if ord("X") == world_db["MAP"][pos]:  # #
+            carries_axe = False  # #
+            for id in t["T_CARRIES"]:  # # 
+                type = world_db["Things"][id]["T_TYPE"]  # #
+                if world_db["ThingTypes"][type]["TT_TOOL"] == "axe":  # #
+                    carries_axe = True  # #
+            if carries_axe:  # #
+                axe_name = world_db["ThingTypes"][type]["TT_NAME"]  # #
+                if t == world_db["Things"][0]:  # #
+                    strong_write(io_db["file_out"], "LOG With your "  # #
+                                                    + axe_name  # #
+                                                    + ", you chop!\n")  # #
+                    add_gods_favor(-1)  # #
+                chop_power = world_db["ThingTypes"][type]["TT_TOOLPOWER"]
+                if chop_power > 0 and 0 == int(rand.next() / chop_power):  # #
+                    if t == world_db["Things"][0]:  # #
+                        strong_write(io_db["file_out"],  # #
+                                     "LOG You chop the tree down.\n")  # #
+                    add_gods_favor(-10)  # #
+                    world_db["MAP"][pos] = ord(".")   # #
+                    build_fov_map(t)  # #
+                return   # #
         passable = ("." == chr(world_db["MAP"][pos]) or
                     ":" == chr(world_db["MAP"][pos]) or # #
                     "_" == chr(world_db["MAP"][pos])) # #
@@ -852,6 +875,12 @@ def actor_use(t):
                              + "Island God laughs.\n")  # #
             t["T_LIFEPOINTS"] = 1  # #
             decrement_lifepoints(t)  # #
+        elif (world_db["ThingTypes"][type]["TT_TOOL"] == "axe"  # #
+              and t == world_db["Things"][0]):  # #
+                strong_write(io_db["file_out"],  # #
+                             "LOG To use this item for chopping, move "  # #
+                             "towards a tree while carrying it in "  # #
+                             "your inventory.\n")  # #
         elif world_db["ThingTypes"][type]["TT_TOOL"] == "food":
             t["T_CARRIES"].remove(id)
             del world_db["Things"][id]
index 822b0b7777f5863d176ce9cf71f725bfdd34e207..d0b66a97bf89afc91fbc4617fe0ac10b05034c87 100644 (file)
@@ -447,7 +447,7 @@ extern void draw_win_map(struct Win * win)
                 { //
                     a = COLOR_PAIR(9); //
                 } //
-                else if ('m' == c) //
+                else if ('m' == c || '/' == c) //
                 { //
                     a = COLOR_PAIR(10); //
                 } //