]> granicus.if.org Git - nethack/commitdiff
Allow cutting a known spider web by force-fighting it
authorPasi Kallinen <paxed@alt.org>
Mon, 25 Jul 2022 15:05:59 +0000 (18:05 +0300)
committerPasi Kallinen <paxed@alt.org>
Mon, 25 Jul 2022 15:06:10 +0000 (18:06 +0300)
Original code from xNetHack by copperwater <aosdict@gmail.com>.

doc/fixes3-7-0.txt
src/hack.c

index b21009bb6ed0d2330493a3cc3f34304febbe97b6..12d9f538a88e8f74e1b442ca73cecf0a9a6d2274 100644 (file)
@@ -977,6 +977,7 @@ change Demonbane to a mace, make it the first sac gift for priests,
 wielding Giantslayer prevents knockback from larger monsters
 scared hostile monster which cannot move away will attack
 prevent a fog cloud that has engulfed the hero from moving under closed doors
+allow cutting a known spider web with wielded weapon by force-fighting the web
 
 
 Fixes to 3.7.0-x Problems that Were Exposed Via git Repository
index 52764330a1256a366a495011b815e470c580bc2e..1f1ddda2c18899a6ecf485e7205d43bbf5c88388 100644 (file)
@@ -19,6 +19,7 @@ static boolean domove_bump_mon(struct monst *, int);
 static boolean domove_attackmon_at(struct monst *, coordxy, coordxy,
                                    boolean *);
 static boolean domove_fight_ironbars(coordxy, coordxy);
+static boolean domove_fight_web(coordxy, coordxy);
 static boolean domove_swap_with_pet(struct monst *, coordxy, coordxy);
 static boolean domove_fight_empty(coordxy, coordxy);
 static boolean air_turbulence(void);
@@ -1738,6 +1739,35 @@ domove_fight_ironbars(coordxy x, coordxy y)
     return FALSE;
 }
 
+/* force-fight a spider web with your weapon */
+static boolean
+domove_fight_web(coordxy x, coordxy y)
+{
+    struct trap *trap = t_at(x, y);
+
+    if (g.context.forcefight && trap && trap->ttyp == WEB
+        && trap->tseen && uwep) {
+        if (uwep->oartifact == ART_STING) {
+            /* guaranteed success */
+            pline("%s cuts through the web!",
+                  bare_artifactname(uwep));
+        } else if (!is_blade(uwep)) {
+            You_cant("cut a web with %s!", an(xname(uwep)));
+            return TRUE;
+        } else if (rn2(20) > ACURR(A_STR) + uwep->spe) {
+            /* TODO: add failures, maybe make an occupation? */
+            You("hack ineffectually at some of the strands.");
+            return TRUE;
+        } else {
+            You("cut through the web.");
+        }
+        deltrap(trap);
+        newsym(x, y);
+        return TRUE;
+    }
+    return FALSE;
+}
+
 /* maybe swap places with a pet? returns TRUE if swapped places */
 static boolean
 domove_swap_with_pet(struct monst *mtmp, coordxy x, coordxy y)
@@ -2351,6 +2381,9 @@ domove_core(void)
     if (domove_fight_ironbars(x, y))
         return;
 
+    if (domove_fight_web(x, y))
+        return;
+
     if (domove_fight_empty(x, y))
         return;