fix pull request #540 - don't autoquiver aklys

If player throws a wielded aklys and it fails to return, and quiver
is empty when picking it back up, don't put it into that slot because
it needs to be wielded to achieve best throwing effect.  A player who
had wielded it and was using 'f' to throw it might not notice that
it isn't returning until it hasn't returned several times.  Moot if
quiver already has some missile readied.  Don't autoquiver even if
some other weapon is wielded because that might have been done just
to go retrieve the aklys.

The game doesn't keep track of whether a previously thrown item was
wielded at the time, and shouldn't be changed to auto-wield in such
situation.  Leaving quiver empty so that player is prompted for what
to throw is sufficient.

Fixes #540
This commit is contained in:
PatR
2021-07-10 19:09:17 -07:00
parent 683b78068f
commit f7436fd02d
2 changed files with 13 additions and 7 deletions

View File

@@ -1,4 +1,4 @@
/* NetHack 3.7 invent.c $NHDT-Date: 1620861205 2021/05/12 23:13:25 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.331 $ */
/* NetHack 3.7 invent.c $NHDT-Date: 1625969349 2021/07/11 02:09:09 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.334 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Derek S. Ray, 2015. */
/* NetHack may be freely redistributed. See license for details. */
@@ -924,12 +924,16 @@ addinv_core0(struct obj *obj, struct obj *other_obj,
obj->where = OBJ_INVENT;
/* fill empty quiver if obj was thrown */
if (flags.pickup_thrown && !uquiver && obj_was_thrown
if (obj_was_thrown && flags.pickup_thrown && !uquiver
/* if Mjollnir is thrown and fails to return, we want to
auto-pick it when we move to its spot, but not into quiver;
aklyses behave like Mjollnir when thrown while wielded, but
we lack sufficient information here make them exceptions */
&& obj->oartifact != ART_MJOLLNIR
auto-pick it when we move to its spot, but not into quiver
because it needs to be wielded to be re-thrown;
aklys likewise because player using 'f' to throw it might
not notice that it isn't wielded until it fails to return
several times; we never auto-wield, just omit from quiver
so that player will be prompted for what to throw and
possibly realize that re-wielding is necessary */
&& obj->oartifact != ART_MJOLLNIR && obj->otyp != AKLYS
&& (throwing_weapon(obj) || is_ammo(obj)))
setuqwep(obj);
added: