fix pull request #1223 - wand of striking by monst

Pull request by elunna with assistance by entrez tried to fix up
wand of striking discovery when the wand is zapped by a monster.

The fix didn't match the intended behavior (which may or may not be
the desired behavior...), so this skips the code in the pull request.
[I can't post comments on github anymore since I declined to switch
to their 2-factor authentication.  But I can still read submissions
without logging in.]

This also tries to fix a couple of inconsistencies between zapping
by the hero versus by a monster.  If the zap "boinged" :-) due to
target's magic resistance, zap by hero didn't discover the wand but
zap by monster did.  Conversely, a zap by the hero that reached a
target and missed did discover it but one by a monster did not.

Now a zap of not-yet-discovered wand of striking by the hero which
hits, whether or not the hit gets resisted, will become discovered
provided that the spot where target is hit can be seen (the target
itself need not be), and one which misses or which can't be seen
hitting something will no longer be.

Supersedes #1223
Closes #1223
This commit is contained in:
PatR
2024-03-13 13:28:05 -07:00
parent ff82541b74
commit 9ee55d87eb
2 changed files with 9 additions and 4 deletions

View File

@@ -1562,7 +1562,10 @@ mbhitm(struct monst *mtmp, struct obj *otmp)
} else {
miss("wand", mtmp);
}
if (learnit && cansee(mtmp->mx, mtmp->my) && gz.zap_oseen)
/* need to see the wand being zapped and also the spot where the
target is hit; don't have to see the target itself though */
if (learnit && gz.zap_oseen && (hits_you
|| cansee(mtmp->mx, mtmp->my)))
makeknown(WAN_STRIKING);
break;
case WAN_TELEPORTATION:

View File

@@ -178,10 +178,11 @@ bhitm(struct monst *mtmp, struct obj *otmp)
reveal_invis = TRUE;
if (disguised_mimic)
seemimic(mtmp);
learn_it = cansee(gb.bhitpos.x, gb.bhitpos.y);
if (resists_magm(mtmp)) { /* match effect on player */
shieldeff(mtmp->mx, mtmp->my);
pline("Boing!");
break; /* skip makeknown */
/* 3.7: used to 'break' to avoid setting learn_it here */
} else if (u.uswallow || rnd(20) < 10 + find_mac(mtmp)) {
dmg = d(2, 12);
if (dbldam)
@@ -190,9 +191,10 @@ bhitm(struct monst *mtmp, struct obj *otmp)
dmg = spell_damage_bonus(dmg);
hit(zap_type_text, mtmp, exclam(dmg));
(void) resist(mtmp, otmp->oclass, dmg, TELL);
} else
} else {
miss(zap_type_text, mtmp);
learn_it = TRUE;
learn_it = FALSE;
}
break;
case WAN_SLOW_MONSTER:
case SPE_SLOW_MONSTER: