]> granicus.if.org Git - nethack/commitdiff
U234, buglist, and related iron ball bugs
authorcohrs <cohrs>
Mon, 4 Aug 2003 21:37:19 +0000 (21:37 +0000)
committercohrs <cohrs>
Mon, 4 Aug 2003 21:37:19 +0000 (21:37 +0000)
Several bug reports have been filed regarding the use of attached iron balls to
move in ways that are otherwise disallowed: moving diagonally from a
doorway, moving through boulders, squeezing through small openings, passing
over traps and diagonally between boulders on sokoban levels.  Modified
bhit to deal with this.  All these cases now cause the iron ball to stop if
appropriate for your form, level of burden, and so on.  Since both boulders
and iron balls are big, boulders now always stop thrown iron balls,
even if not attached.  Since iron balls don't cause any damage as they pull
you along, I didn't add any damage for the new "jerks to a halt" cases.

doc/fixes34.2
src/zap.c

index 652181efe99bb47fe45830b6916e6995837b4c59..c56e03ea4e12f04de6f351a3fa5f4776a14c0dad 100644 (file)
@@ -120,6 +120,8 @@ refine cmdassist handling for grid bugs
 when casting force bolt spell while engulfed go ahead and use the engulfers 
        name in the hit message rather than "it"
 a fog cloud shouldn't pummel you with debris
+do not let an attached iron ball drag the hero through a location that the hero
+       could not move normally
 
 
 Platform- and/or Interface-Specific Fixes
index 23f72db83ba379556bfa82213a0bc3c0bbeea57b..50f505f6ef731d936484f8cf2517f97ba0fefd8b 100644 (file)
--- a/src/zap.c
+++ b/src/zap.c
@@ -2782,6 +2782,32 @@ struct obj *obj;                 /* object tossed/used */
                    break;      /* physical objects fall onto sink */
 #endif
            }
+           /* limit range of ball so hero won't make an invalid move */
+           if (weapon == THROWN_WEAPON && range > 0 &&
+               obj->otyp == HEAVY_IRON_BALL) {
+               struct obj *bobj;
+               struct trap *t;
+               if ((bobj = sobj_at(BOULDER, x, y)) != 0) {
+                   if (cansee(x,y))
+                       pline("%s hits %s.",
+                             The(distant_name(obj, xname)), an(xname(bobj)));
+                   range = 0;
+               } else if (obj == uball) {
+                   if (!test_move(x - ddx, y - ddy, ddx, ddy, TEST_MOVE)) {
+                       /* nb: it didn't hit anything directly */
+                       if (cansee(x,y))
+                           pline("%s jerks to an abrupt halt.",
+                                 The(distant_name(obj, xname))); /* lame */
+                       range = 0;
+                   } else if (In_sokoban(&u.uz) && (t = t_at(x, y)) != 0 &&
+                              (t->ttyp == PIT || t->ttyp == SPIKED_PIT ||
+                               t->ttyp == HOLE || t->ttyp == TRAPDOOR)) {
+                       /* hero falls into the trap, so ball stops */
+                       range = 0;
+                   }
+               }
+           }
+
            /* thrown/kicked missile has moved away from its starting spot */
            point_blank = FALSE;        /* affects passing through iron bars */
        }