From 97238fc01ab45156217e65a5a7a08b6a23385702 Mon Sep 17 00:00:00 2001 From: PatR Date: Thu, 30 Nov 2023 16:37:07 -0800 Subject: [PATCH] github issue #1157 - wand of striking Issue reported by elunna: hero witnessing a wand of striking being zapped by a monster didn't have that type of wand become discovered. Monsters observing hero resisting--or failing to resist--the effect on hero didn't learn about target's current resistance capability. Barely tested. Fixes #1157 --- doc/fixes3-7-0.txt | 2 ++ src/muse.c | 23 +++++++++++++---------- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/doc/fixes3-7-0.txt b/doc/fixes3-7-0.txt index 8de10f2f7..a977833fa 100644 --- a/doc/fixes3-7-0.txt +++ b/doc/fixes3-7-0.txt @@ -1757,6 +1757,8 @@ when using 'm #overview' in the endgame, don't include non-endgame levels when a tethered aklys gets caught in a web, make sure it doesn't return and that the display of the tether gets cleaned up add 'X' as a potential context-sensitive item-action for uwep and uswapwep +monsters weren't noticing hero's possession or lack of magic resistance when + hero getting zapped by a wand of striking was or wasn't resisted Fixes to 3.7.0-x Platform and/or Interface Problems Exposed Via git Repository diff --git a/src/muse.c b/src/muse.c index 886c7c60b..9b86770bb 100644 --- a/src/muse.c +++ b/src/muse.c @@ -1468,7 +1468,8 @@ static int mbhitm(struct monst *mtmp, struct obj *otmp) { int tmp; - boolean reveal_invis = FALSE, hits_you = (mtmp == &gy.youmonst); + boolean reveal_invis = FALSE, learnit = FALSE, + hits_you = (mtmp == &gy.youmonst); if (!hits_you && otmp->otyp != WAN_UNDEAD_TURNING) { mtmp->msleeping = 0; @@ -1480,34 +1481,39 @@ mbhitm(struct monst *mtmp, struct obj *otmp) reveal_invis = TRUE; if (hits_you) { if (Antimagic) { + monstseesu(M_SEEN_MAGR); /* monsters notice hero resisting */ shieldeff(u.ux, u.uy); Soundeffect(se_boing, 40); pline("Boing!"); + learnit = TRUE; } else if (rnd(20) < 10 + u.uac) { + monstunseesu(M_SEEN_MAGR); /* mons see hero not resisting */ pline_The("wand hits you!"); tmp = d(2, 12); if (Half_spell_damage) tmp = (tmp + 1) / 2; losehp(tmp, "wand", KILLED_BY_AN); - } else + learnit = TRUE; + } else { pline_The("wand misses you."); + } stop_occupation(); nomul(0); } else if (resists_magm(mtmp)) { shieldeff(mtmp->mx, mtmp->my); Soundeffect(se_boing, 40); pline("Boing!"); + learnit = TRUE; } else if (rnd(20) < 10 + find_mac(mtmp)) { tmp = d(2, 12); hit("wand", mtmp, exclam(tmp)); (void) resist(mtmp, otmp->oclass, tmp, TELL); - if (cansee(mtmp->mx, mtmp->my) && gz.zap_oseen) - makeknown(WAN_STRIKING); + learnit = TRUE; } else { miss("wand", mtmp); - if (cansee(mtmp->mx, mtmp->my) && gz.zap_oseen) - makeknown(WAN_STRIKING); } + if (learnit && cansee(mtmp->mx, mtmp->my) && gz.zap_oseen) + makeknown(WAN_STRIKING); break; case WAN_TELEPORTATION: if (hits_you) { @@ -1527,9 +1533,7 @@ mbhitm(struct monst *mtmp, struct obj *otmp) case SPE_CANCELLATION: (void) cancel_monst(mtmp, otmp, FALSE, TRUE, FALSE); break; - case WAN_UNDEAD_TURNING: { - boolean learnit = FALSE; - + case WAN_UNDEAD_TURNING: if (hits_you) { unturn_you(); learnit = gz.zap_oseen; @@ -1555,7 +1559,6 @@ mbhitm(struct monst *mtmp, struct obj *otmp) if (learnit) makeknown(WAN_UNDEAD_TURNING); break; - } default: break; }