held artifacts evading your grasp (trunk only)

From a bug report, trying
to invoke a wielded artifact after changing alignment resulted in "the
<artifact> evades your grasp" but it remained wielded, contradicting the
message.  This adjusts the message in touch_artifact() if the object is
already in inventory, and adds retouch_object() to handle cases where
failing to be able to touch ought to force unwearing/unwielding.
This commit is contained in:
nethack.rankin
2007-03-10 05:54:17 +00:00
parent b8a51d3649
commit f67a4547ac
7 changed files with 73 additions and 15 deletions

View File

@@ -150,11 +150,11 @@ struct obj *wep;
} else if (wep->otyp == CORPSE && cant_wield_corpse(wep)) {
/* hero must have been life-saved to get here; use a turn */
res++; /* corpse won't be wielded */
} else if (uarms && bimanual(wep))
} else if (uarms && bimanual(wep)) {
You("cannot wield a two-handed %s while wearing a shield.",
is_sword(wep) ? "sword" :
wep->otyp == BATTLE_AXE ? "axe" : "weapon");
else if (wep->oartifact && !touch_artifact(wep, &youmonst)) {
} else if (!retouch_object(&wep, FALSE)) {
res++; /* takes a turn even though it doesn't get wielded */
} else {
/* Weapon WILL be wielded after this point */