From 9c4a6afe4692f0badcac30f689fef3dd51e13001 Mon Sep 17 00:00:00 2001 From: PatR Date: Thu, 21 Feb 2019 13:28:18 -0800 Subject: [PATCH] fix bz 1604 - re-do vs autoquiver One-line fix is much shorter than attempting to describe the problem. ^A could misuse previous input if 'f' needed to fill the quiver and there was nothing suitable, so that the sequence became 'f'. If previous was an inventory letter that was occupied, and the item it that slot wasn't already worn in some other slot, it would be put in quiver slot. Then player would be asked for direction rather than immediately throwing it since the what-to-throw prompt had just used up the last of the ^A queue. Miscellaneous formatting included.... --- doc/fixes36.2 | 7 ++++++- src/dothrow.c | 38 ++++++++++++++++++++------------------ 2 files changed, 26 insertions(+), 19 deletions(-) diff --git a/doc/fixes36.2 b/doc/fixes36.2 index 0062daf43..0d7c7a64b 100644 --- a/doc/fixes36.2 +++ b/doc/fixes36.2 @@ -1,4 +1,4 @@ -$NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.259 $ $NHDT-Date: 1550629490 2019/02/20 02:24:50 $ +$NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.260 $ $NHDT-Date: 1550784489 2019/02/21 21:28:09 $ This fixes36.2 file is here to capture information about updates in the 3.6.x lineage following the release of 3.6.1 in April 2018. Please note, however, @@ -373,6 +373,11 @@ when donning armor, defer flagging its +/- value--which can be deduced from then (player might still deduce the +/- value but hero won't learn it) a monster with resistances supplied by worn armor would lose them if that monster went through a shape change even if the armor stayed worn +after using 'f' to fire/throw with autoquiver enabled and numpad off, then + using ^A to repeat, if ammo was just used up and there's nothing + suitable to autoquiver it would pick the item in the inventory slot + corresponding to the direction letter from preceding 'fire' (and if + there was such an item, then ask for direction since ^A data ran out) Fixes to Post-3.6.1 Problems that Were Exposed Via git Repository diff --git a/src/dothrow.c b/src/dothrow.c index 7541bc978..05923e867 100644 --- a/src/dothrow.c +++ b/src/dothrow.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 dothrow.c $NHDT-Date: 1545597420 2018/12/23 20:37:00 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.155 $ */ +/* NetHack 3.6 dothrow.c $NHDT-Date: 1550784489 2019/02/21 21:28:09 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.157 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2013. */ /* NetHack may be freely redistributed. See license for details. */ @@ -384,6 +384,8 @@ dofire() /* if autoquiver is disabled or has failed, prompt for missile; fill quiver with it if it's not wielded */ if (!obj) { + /* direction of previous throw is not suitable answer here */ + in_doagain = FALSE; obj = getobj(uslinging() ? bullets : toss_objs, "throw"); /* Q command doesn't allow gold in quiver */ if (obj && !obj->owornmask && obj->oclass != COIN_CLASS) @@ -727,12 +729,11 @@ int x, y; } /* FIXME: - * Each trap should really trigger on the recoil if - * it would trigger during normal movement. However, - * not all the possible side-effects of this are - * tested [as of 3.4.0] so we trigger those that - * we have tested, and offer a message for the - * ones that we have not yet tested. + * Each trap should really trigger on the recoil if it would + * trigger during normal movement. However, not all the possible + * side-effects of this are tested [as of 3.4.0] so we trigger + * those that we have tested, and offer a message for the ones + * that we have not yet tested. */ if ((ttmp = t_at(x, y)) != 0) { if (stopping_short) { @@ -1037,7 +1038,7 @@ boolean hitsroof; } else if (petrifier && !Stone_resistance && !(poly_when_stoned(youmonst.data) && polymon(PM_STONE_GOLEM))) { - petrify: + petrify: killer.format = KILLED_BY; Strcpy(killer.name, "elementary physics"); /* "what goes up..." */ You("turn to stone."); @@ -1104,9 +1105,9 @@ boolean twoweap; /* used to restore twoweapon mode if wielded weapon returns */ if ((obj->cursed || obj->greased) && (u.dx || u.dy) && !rn2(7)) { boolean slipok = TRUE; - if (ammo_and_launcher(obj, uwep)) + if (ammo_and_launcher(obj, uwep)) { pline("%s!", Tobjnam(obj, "misfire")); - else { + } else { /* only slip if it's greased or meant to be thrown */ if (obj->greased || throwing_weapon(obj)) /* BUG: this message is grammatically incorrect if obj has @@ -1150,7 +1151,8 @@ boolean twoweap; /* used to restore twoweapon mode if wielded weapon returns */ if (u.dz < 0 /* Mjollnir must we wielded to be thrown--caller verifies this; aklys must we wielded as primary to return when thrown */ - && ((Role_if(PM_VALKYRIE) && obj->oartifact == ART_MJOLLNIR) || tethered_weapon) + && ((Role_if(PM_VALKYRIE) && obj->oartifact == ART_MJOLLNIR) + || tethered_weapon) && !impaired) { pline("%s the %s and returns to your hand!", Tobjnam(obj, "hit"), ceiling(u.ux, u.uy)); @@ -1190,8 +1192,8 @@ boolean twoweap; /* used to restore twoweapon mode if wielded weapon returns */ } } else { /* crossbow range is independent of strength */ - crossbowing = - (ammo_and_launcher(obj, uwep) && weapon_type(uwep) == P_CROSSBOW); + crossbowing = (ammo_and_launcher(obj, uwep) + && weapon_type(uwep) == P_CROSSBOW); urange = (crossbowing ? 18 : (int) ACURRSTR) / 2; /* balls are easy to throw or at least roll; * also, this insures the maximum range of a ball is greater @@ -1360,7 +1362,8 @@ boolean twoweap; /* used to restore twoweapon mode if wielded weapon returns */ thrownobj = (struct obj *) 0; return; } else { - if (tethered_weapon) tmp_at(DISP_END, 0); + if (tethered_weapon) + tmp_at(DISP_END, 0); /* when this location is stepped on, the weapon will be auto-picked up due to 'obj->was_thrown' of 1; addinv() prevents thrown Mjollnir from being placed @@ -1425,8 +1428,7 @@ boolean twoweap; /* used to restore twoweapon mode if wielded weapon returns */ } } -/* an object may hit a monster; various factors adjust the chance of hitting - */ +/* an object may hit a monster; various factors adjust chance of hitting */ int omon_adj(mon, obj, mon_notices) struct monst *mon; @@ -1525,7 +1527,7 @@ register struct obj *obj; /* thrownobj or kickedobj or uwep */ * No bonuses for fleeing or stunned targets (they don't dodge * melee blows as readily, but dodging arrows is hard anyway). * Not affected by traps, etc. - * Certain items which don't in themselves do damage ignore tmp. + * Certain items which don't in themselves do damage ignore 'tmp'. * Distance and monster size affect chance to hit. */ tmp = -1 + Luck + find_mac(mon) + u.uhitinc @@ -1848,7 +1850,7 @@ register struct obj *obj; (void) mpickobj(mon, obj); /* may merge and free obj */ ret = 1; -nopick: + nopick: if (!Blind) pline1(buf); if (!tele_restrict(mon))