fix pull request #367 - mind flayer psychic blast

hitting a hidden monster didn't reveal that monster.  It stayed
hidden despite the feedback describing it as if it could be seen.

The pull request's two line fix handled a monster's blast hitting
another monster but left two related issues as-is:  monster's blast
hitting hidden poly'd hero left hero unrevealed and poly'd hero's
blast left hidden monster unrevealed.  Same code, different bug:
poly'd hero's blast affected mindless monsters.

This unhides an affected target before the message about it being
hit rather than after.  That would look better if preceded by a
message describing the object (mimic or hides-under) or furniture
(mimic) or empty spot (ceiling hider) as being or concealing a
monster but I didn't put in sufficient effort to accomplish that.

Fixes #367
Fixes #362
This commit is contained in:
PatR
2020-07-14 04:55:53 -07:00
parent 12498ffa44
commit a37975b625
4 changed files with 46 additions and 14 deletions

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 monmove.c $NHDT-Date: 1586091452 2020/04/05 12:57:32 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.137 $ */
/* NetHack 3.6 monmove.c $NHDT-Date: 1594727747 2020/07/14 11:55:47 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.141 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Michael Allison, 2006. */
/* NetHack may be freely redistributed. See license for details. */
@@ -562,13 +562,27 @@ register struct monst *mtmp;
&& (!Conflict || resist(mtmp, RING_CLASS, 0, 0))) {
pline("It feels quite soothing.");
} else if (!u.uinvulnerable) {
register boolean m_sen = sensemon(mtmp);
int dmg;
boolean m_sen = sensemon(mtmp);
if (m_sen || (Blind_telepat && rn2(2)) || !rn2(10)) {
int dmg;
/* hiding monsters are brought out of hiding when hit by
a psychic blast, so do the same for hiding poly'd hero */
if (u.uundetected) {
u.uundetected = 0;
newsym(u.ux, u.uy);
} else if (U_AP_TYPE != M_AP_NOTHING
/* hero has no way to hide as monster but
check for that theoretical case anyway */
&& U_AP_TYPE != M_AP_MONSTER) {
g.youmonst.m_ap_type = M_AP_NOTHING;
g.youmonst.mappearance = 0;
newsym(u.ux, u.uy);
}
pline("It locks on to your %s!",
m_sen ? "telepathy" : Blind_telepat ? "latent telepathy"
: "mind");
m_sen ? "telepathy"
: Blind_telepat ? "latent telepathy"
: "mind"); /* note: hero is never mindless */
dmg = rnd(15);
if (Half_spell_damage)
dmg = (dmg + 1) / 2;
@@ -587,13 +601,13 @@ register struct monst *mtmp;
continue;
if ((telepathic(m2->data) && (rn2(2) || m2->mblinded))
|| !rn2(10)) {
/* wake it up first, to bring hidden monster out of hiding */
wakeup(m2, FALSE);
if (cansee(m2->mx, m2->my))
pline("It locks on to %s.", mon_nam(m2));
m2->mhp -= rnd(15);
if (DEADMONSTER(m2))
monkilled(m2, "", AD_DRIN);
else
m2->msleeping = 0;
}
}
}