unconscious hero vs Medusa

Reported directly to devteam by entrez:  a sleeping or unconscious
hero would still meet a monster's gaze attack even though those are
supposed to be eye-to-eye rather than just the monster looking at
you.  Don't meet the gaze when Unaware, despite the fact that the
hero isn't blind and vision remains in operation.

Initially being Unaware also blocked Medusa's gaze being reflected
but I changed things so that that still affects her.  It contradicts
the eye-to-eye aspect but is more consistent with her looking at a
blind hero who has reflection.
This commit is contained in:
PatR
2022-12-20 14:44:19 -08:00
parent 5e47afed4f
commit 53a4e3f80a
2 changed files with 28 additions and 16 deletions
+1
View File
@@ -1074,6 +1074,7 @@ if punished and iron ball was cursed and wielded--so welded to hand--falling
when doors would drop it instead of keeping it welded when doors would drop it instead of keeping it welded
if player's run-time config file had OPTIONS=role:Val and the environment had if player's run-time config file had OPTIONS=role:Val and the environment had
NETHACKOPTIONS='role:!Val' the hero would be a Val instead of !Val NETHACKOPTIONS='role:!Val' the hero would be a Val instead of !Val
sleeping or unconscious hero attacked by Medusa would meet her gaze
Fixes to 3.7.0-x Problems that Were Exposed Via git Repository Fixes to 3.7.0-x Problems that Were Exposed Via git Repository
+27 -16
View File
@@ -1518,45 +1518,56 @@ gazemu(struct monst *mtmp, struct attack *mattk)
"dulled", /* [7] */ "dulled", /* [7] */
}; };
int react = -1; int react = -1;
boolean cancelled = (mtmp->mcan != 0), already = FALSE; boolean is_medusa, reflectable,
boolean mcanseeu = canseemon(mtmp) && couldsee(mtmp->mx, mtmp->my) cancelled = (mtmp->mcan != 0), already = FALSE,
&& mtmp->mcansee; mcanseeu = (canseemon(mtmp) && couldsee(mtmp->mx, mtmp->my)
&& mtmp->mcansee);
if (m_seenres(mtmp, cvt_adtyp_to_mseenres(mattk->adtyp))) if (m_seenres(mtmp, cvt_adtyp_to_mseenres(mattk->adtyp)))
return MM_MISS; return MM_MISS;
is_medusa = (mtmp->data == &mons[PM_MEDUSA]);
reflectable = (Reflecting && couldsee(mtmp->mx, mtmp->my) && is_medusa);
/* assumes that hero has to see monster's gaze in order to be /* assumes that hero has to see monster's gaze in order to be
affected, rather than monster just having to look at hero; affected, rather than monster just having to look at hero;
Unaware: asleep or unconscious => not blind but won't see;
when hallucinating, hero's brain doesn't register what when hallucinating, hero's brain doesn't register what
it's seeing correctly so the gaze is usually ineffective it's seeing correctly so the gaze is usually ineffective
[this could be taken a lot farther and select a gaze effect [this could be taken a lot farther and select a gaze effect
appropriate to what's currently being displayed, giving appropriate to what's currently being displayed, giving
ordinary monsters a gaze attack when hero thinks he or she ordinary monsters a gaze attack when hero thinks he or she
is facing a gazing creature, but let's not go that far...] */ is facing a gazing creature, but let's not go that far...] */
if (Hallucination && rn2(4)) if ((Hallucination && rn2(4)) || (Unaware && !reflectable))
cancelled = TRUE; cancelled = TRUE;
switch (mattk->adtyp) { switch (mattk->adtyp) {
case AD_STON: case AD_STON:
/* note: Medusa is the only monster with stoning gaze, so
'is_medusa' will always be True here */
if (cancelled || !mtmp->mcansee) { if (cancelled || !mtmp->mcansee) {
if (!canseemon(mtmp)) if (!canseemon(mtmp))
break; /* silently */ break; /* silently */
pline("%s %s.", Monnam(mtmp), if (Unaware) { /* can't see attacker even though not blind */
(mtmp->data == &mons[PM_MEDUSA] && mtmp->mcan) react = is_medusa ? 4 : 2; /* irritated or puzzled */
? "doesn't look all that ugly" break;
: "gazes ineffectually"); }
if (is_medusa && Hallucination && !rn2(3))
pline("Someone seems overdue for a serpent cut.");
else
pline("%s %s.", Monnam(mtmp),
(is_medusa && mtmp->mcan && !react)
? "doesn't look all that ugly"
: "gazes ineffectually");
break; break;
} }
if (Reflecting && couldsee(mtmp->mx, mtmp->my) if (reflectable) {
&& mtmp->data == &mons[PM_MEDUSA]) {
/* hero has line of sight to Medusa and she's not blind */ /* hero has line of sight to Medusa and she's not blind */
boolean useeit = canseemon(mtmp); boolean useeit = canseemon(mtmp);
if (useeit) if (useeit)
(void) ureflects("%s gaze is reflected by your %s.", (void) ureflects("%s gaze is reflected by your %s.",
s_suffix(Monnam(mtmp))); s_suffix(Monnam(mtmp)));
if (mon_reflects( if (mon_reflects(mtmp, !useeit ? (char *) 0
mtmp, !useeit ? (char *) 0
: "The gaze is reflected away by %s %s!")) : "The gaze is reflected away by %s %s!"))
break; break;
if (!m_canseeu(mtmp)) { /* probably you're invisible */ if (!m_canseeu(mtmp)) { /* probably you're invisible */
@@ -1576,7 +1587,7 @@ gazemu(struct monst *mtmp, struct attack *mattk)
return MM_AGR_DIED; return MM_AGR_DIED;
} }
if (canseemon(mtmp) && couldsee(mtmp->mx, mtmp->my) if (canseemon(mtmp) && couldsee(mtmp->mx, mtmp->my)
&& !Stone_resistance) { && !Stone_resistance && !Unaware) {
You("meet %s gaze.", s_suffix(mon_nam(mtmp))); You("meet %s gaze.", s_suffix(mon_nam(mtmp)));
stop_occupation(); stop_occupation();
if (poly_when_stoned(gy.youmonst.data) && polymon(PM_STONE_GOLEM)) if (poly_when_stoned(gy.youmonst.data) && polymon(PM_STONE_GOLEM))
@@ -2270,11 +2281,11 @@ passiveum(
tmp = 127; tmp = 127;
if (mtmp->mcansee && haseyes(mtmp->data) && rn2(3) if (mtmp->mcansee && haseyes(mtmp->data) && rn2(3)
&& (perceives(mtmp->data) || !Invis)) { && (perceives(mtmp->data) || !Invis)) {
if (Blind) if (Blind) {
pline("As a blind %s, you cannot defend yourself.", pline("As a blind %s, you cannot defend yourself.",
pmname(gy.youmonst.data, pmname(gy.youmonst.data,
flags.female ? FEMALE : MALE)); flags.female ? FEMALE : MALE));
else { } else {
if (mon_reflects(mtmp, if (mon_reflects(mtmp,
"Your gaze is reflected by %s %s.")) "Your gaze is reflected by %s %s."))
return 1; return 1;