From: cohrs Date: Mon, 4 Aug 2003 21:37:19 +0000 (+0000) Subject: U234, buglist, and related iron ball bugs X-Git-Tag: MOVE2GIT~1861 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=001c2ae58ad670eb02d5660f70dd65e064d3a810;p=nethack U234, buglist, and related iron ball bugs 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. --- diff --git a/doc/fixes34.2 b/doc/fixes34.2 index 652181efe..c56e03ea4 100644 --- a/doc/fixes34.2 +++ b/doc/fixes34.2 @@ -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 diff --git a/src/zap.c b/src/zap.c index 23f72db83..50f505f6e 100644 --- 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 */ }