]> granicus.if.org Git - nethack/commitdiff
Thrown items can get stuck in webs
authorPasi Kallinen <paxed@alt.org>
Sun, 20 Feb 2022 10:23:00 +0000 (12:23 +0200)
committerPasi Kallinen <paxed@alt.org>
Sun, 20 Feb 2022 10:23:00 +0000 (12:23 +0200)
doc/fixes3-7-0.txt
src/zap.c

index a83507506c65682452c5c935aeb6ac35a63a315c..7f22a6317607434c2a234eb480b2477e912e1054 100644 (file)
@@ -792,6 +792,7 @@ allow creating unhidden traps in special levels
 reading magic marker shows the specific red ink color
 imps and other creatures cussing hero wake up nearby monsters
 make ravens oviparous
+thrown items can get stuck in webs
 
 
 Fixes to 3.7.0-x Problems that Were Exposed Via git Repository
index efe8b0f43add0b8da120b3662ea7b9e616da6bd8..9830c0b69170fef11f45efc19cab9cf9755ce8d0 100644 (file)
--- a/src/zap.c
+++ b/src/zap.c
@@ -3405,6 +3405,7 @@ bhit(int ddx, int ddy, int range,  /* direction and range */
 {
     struct monst *mtmp, *result = (struct monst *) 0;
     struct obj *obj = *pobj;
+    struct trap *ttmp;
     uchar typ;
     boolean shopdoor = FALSE, point_blank = TRUE;
     boolean in_skip = FALSE, allow_skip = FALSE;
@@ -3517,6 +3518,18 @@ bhit(int ddx, int ddy, int range,  /* direction and range */
             maybe_explode_trap(t_at(g.bhitpos.x, g.bhitpos.y), obj);
 
         mtmp = m_at(g.bhitpos.x, g.bhitpos.y);
+        ttmp = t_at(g.bhitpos.x, g.bhitpos.y);
+
+        if (!mtmp && ttmp && (ttmp->ttyp == WEB)
+            && (weapon == THROWN_WEAPON || weapon == KICKED_WEAPON)
+            && !rn2(3)) {
+            if (cansee(g.bhitpos.x, g.bhitpos.y)) {
+                pline("%s gets stuck in a web!", Yname2(obj));
+                ttmp->tseen = TRUE;
+                newsym(g.bhitpos.x, g.bhitpos.y);
+            }
+            break;
+        }
 
         /*
          * skipping rocks