fix github issue #198 - mon wielding cursed weapon
Fixes #198 Watching a monster try to switch from a cursed weapon to some other weapon (of any bless/curse state) reported that the old weapon was welded to the monster's hand and wouldn't switch to the new one. But watching a monster try to wield a cursed weapon didn't say that it was becoming welded at the time. Report correctly pointed out that the weld-to-hand check wouldn't work unless the weapon was already flagged as wielded, and the code in question was deferring wielding so that the message wouldn't include "(weapon in hand)" in the formatted object description. There was also another problem: it was erroneously testing the monster's old weapon (if any, after unwielding it), instead of the new one being wielded. Also, Sunsword starting to emit light when first wielded by a monster only reported that it was shining if hero could see the monster. Give an alternate message if hero sees the location instead. (Just the monster's/Sunsword's location rather than any newly lit spot within Sunsword's radius.)
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
$NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.43 $ $NHDT-Date: 1559994620 2019/06/08 11:50:20 $
|
||||
$NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.44 $ $NHDT-Date: 1559998716 2019/06/08 12:58:36 $
|
||||
|
||||
This fixes36.3 file is here to capture information about updates in the 3.6.x
|
||||
lineage following the release of 3.6.2 in May 2019. Please note, however,
|
||||
@@ -63,6 +63,9 @@ thrown or kicked light source (lit lamp, candle, oil) should emit light as it
|
||||
traverses the map; dungeon features, objects, or monsters seen while
|
||||
it's in transit will become part of hero's memory of the level, and
|
||||
any messages delivered won't have stale light from it around the hero
|
||||
unlike watching a monster trying to swap out a cursed weapon for some other
|
||||
weapon and failing, watching it wield a cursed weapon didn't report
|
||||
that weapon becoming welded to the monster's hand/claw/whatever
|
||||
|
||||
|
||||
Fixes to Post-3.6.2 Problems that Were Exposed Via git Repository
|
||||
|
||||
20
src/weapon.c
20
src/weapon.c
@@ -1,4 +1,4 @@
|
||||
/* NetHack 3.6 weapon.c $NHDT-Date: 1548209744 2019/01/23 02:15:44 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.69 $ */
|
||||
/* NetHack 3.6 weapon.c $NHDT-Date: 1559998716 2019/06/08 12:58:36 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.70 $ */
|
||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||
/*-Copyright (c) Robert Patrick Rankin, 2011. */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
@@ -831,8 +831,18 @@ register struct monst *mon;
|
||||
setmnotwielded(mon, mw_tmp);
|
||||
mon->weapon_check = NEED_WEAPON;
|
||||
if (canseemon(mon)) {
|
||||
boolean newly_welded;
|
||||
|
||||
pline("%s wields %s!", Monnam(mon), doname(obj));
|
||||
if (mwelded(mw_tmp)) {
|
||||
/* 3.6.3: mwelded() predicate expects the object to have its
|
||||
W_WEP bit set in owormmask, but the pline here and for
|
||||
artifact_light don't want that because they'd have '(weapon
|
||||
in hand/claw)' appended; so we set it for the mwelded test
|
||||
and then clear it, until finally setting it for good below */
|
||||
obj->owornmask |= W_WEP;
|
||||
newly_welded = mwelded(obj);
|
||||
obj->owornmask &= ~W_WEP;
|
||||
if (newly_welded) {
|
||||
pline("%s %s to %s %s!", Tobjnam(obj, "weld"),
|
||||
is_plural(obj) ? "themselves" : "itself",
|
||||
s_suffix(mon_nam(mon)), mbodypart(mon, HAND));
|
||||
@@ -845,6 +855,12 @@ register struct monst *mon;
|
||||
pline("%s %s in %s %s!", Tobjnam(obj, "shine"),
|
||||
arti_light_description(obj), s_suffix(mon_nam(mon)),
|
||||
mbodypart(mon, HAND));
|
||||
/* 3.6.3: artifact might be getting wielded by invisible monst */
|
||||
else if (cansee(mon->mx, mon->my))
|
||||
pline("Light begins shining %s.",
|
||||
(distu(mon->mx, mon->my) <= 5 * 5)
|
||||
? "nearby"
|
||||
: "in the distance");
|
||||
}
|
||||
obj->owornmask = W_WEP;
|
||||
return 1;
|
||||
|
||||
Reference in New Issue
Block a user