fix #H3841 - inconsistent Archon gaze behavior

From six years ago:  hero is "blinded by the Archon's radiance"
even if the attacking Archon has been blinded, but monsters hit
by same thing were protected from it by that blindness.  Make
monsters attacked by Archons be affected similarly to the hero.

Hypothetical case of hero-as-Archon versus monster is ignored
because hero can't polymorph into that shape.
This commit is contained in:
PatR
2021-03-03 14:40:19 -08:00
parent 10a9d358c5
commit cd43027a49
3 changed files with 55 additions and 23 deletions

View File

@@ -1,4 +1,4 @@
NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.465 $ $NHDT-Date: 1614474790 2021/02/28 01:13:10 $
NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.466 $ $NHDT-Date: 1614811211 2021/03/03 22:40:11 $
General Fixes and Modified Features
-----------------------------------
@@ -392,6 +392,8 @@ don't force fake player monks to always be male
it was theoretically possible to overflow an internal buffer containing
inventory letters by carrying more than 52 separate lit candles and
using the '(' or '*' commands
hero would be blinded and stunned by an Archon's radiance (gaze attack) even
if the Archon was blind, but monsters would not
Fixes to 3.7.0-x Problems that Were Exposed Via git Repository

View File

@@ -1,4 +1,4 @@
/* NetHack 3.7 mhitm.c $NHDT-Date: 1606558747 2020/11/28 10:19:07 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.145 $ */
/* NetHack 3.7 mhitm.c $NHDT-Date: 1614811211 2021/03/03 22:40:11 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.191 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Robert Patrick Rankin, 2011. */
/* NetHack may be freely redistributed. See license for details. */
@@ -628,21 +628,25 @@ hitmm(register struct monst *magr, register struct monst *mdef,
/* Returns the same values as mdamagem(). */
static int
gazemm(register struct monst *magr, register struct monst *mdef,
struct attack *mattk)
gazemm(struct monst *magr, struct monst *mdef, struct attack *mattk)
{
char buf[BUFSZ];
/* an Archon's gaze affects target even if Archon itself is blinded */
boolean archon = (magr->data == &mons[PM_ARCHON]
&& mattk->adtyp == AD_BLND);
if (g.vis) {
if (mdef->data->mlet == S_MIMIC
&& M_AP_TYPE(mdef) != M_AP_NOTHING)
seemimic(mdef);
Sprintf(buf, "%s gazes at", Monnam(magr));
Sprintf(buf, "%s gazes %s", Monnam(magr),
(archon && !mdef->mcansee) ? "toward" : "at");
pline("%s %s...", buf,
canspotmon(mdef) ? mon_nam(mdef) : "something");
}
if (magr->mcan || !magr->mcansee || !mdef->mcansee
if (magr->mcan || !mdef->mcansee
|| (archon ? resists_blnd(mdef) : !magr->mcansee)
|| (magr->minvis && !perceives(mdef->data)) || mdef->msleeping) {
if (g.vis && canspotmon(mdef))
pline("but nothing happens.");
@@ -674,6 +678,15 @@ gazemm(register struct monst *magr, register struct monst *mdef,
return MM_MISS;
return MM_AGR_DIED;
}
} else if (archon) {
mhitm_ad_blnd(magr, mattk, mdef, (struct mhitm_data *) 0);
/* an Archon's blinding radiance also stuns;
this is different from the way the hero gets stunned because
a stunned monster recovers randomly instead of via countdown;
both cases make an effort to prevent the target from being
continuously stunned due to repeated gaze attacks */
if (rn2(2))
mdef->mstun = 1;
}
return mdamagem(magr, mdef, mattk, (struct obj *) 0, 0);

View File

@@ -1,4 +1,4 @@
/* NetHack 3.7 uhitm.c $NHDT-Date: 1609442602 2020/12/31 19:23:22 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.292 $ */
/* NetHack 3.7 uhitm.c $NHDT-Date: 1614811212 2021/03/03 22:40:12 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.299 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Robert Patrick Rankin, 2012. */
/* NetHack may be freely redistributed. See license for details. */
@@ -1848,7 +1848,8 @@ mhitm_ad_drli(struct monst *magr, struct attack *mattk, struct monst *mdef,
boolean negated = !(rn2(10) >= 3 * armpro);
if (!negated && !rn2(3) && !resists_drli(mdef)) {
mhm->damage = d(2, 6); /* Stormbringer uses monhp_per_lvl(usually 1d8) */
mhm->damage = d(2, 6); /* Stormbringer uses monhp_per_lvl
* (usually 1d8) */
pline("%s becomes weaker!", Monnam(mdef));
if (mdef->mhpmax - mhm->damage > (int) mdef->m_lev) {
mdef->mhpmax -= mhm->damage;
@@ -2321,14 +2322,15 @@ mhitm_ad_tlpt(struct monst *magr, struct attack *mattk, struct monst *mdef,
>= (tmphp = (Upolyd ? u.mh : u.uhp))) {
mhm->damage = tmphp - 1;
if (Half_physical_damage)
mhm->damage *= 2; /* doesn't actually increase damage; we only
* get here if half the original damage would
* would have been fatal, so double reduced
* damage will be less than original damage */
mhm->damage *= 2; /* doesn't actually increase damage;
* we only get here if half the
* original damage would would have
* been fatal, so double reduced
* damage will be less than original */
if (mhm->damage < 1) { /* implies (tmphp <= 1) */
mhm->damage = 1;
/* this might increase current HP beyond maximum HP but
it will be immediately reduced below, so that should
/* this might increase current HP beyond maximum HP but it
will be immediately reduced by caller, so that should
be indistinguishable from zero damage; we don't drop
damage all the way to zero because that inhibits any
passive counterattack if poly'd hero has one */
@@ -2367,8 +2369,11 @@ mhitm_ad_tlpt(struct monst *magr, struct attack *mattk, struct monst *mdef,
}
void
mhitm_ad_blnd(struct monst *magr, struct attack *mattk, struct monst *mdef,
struct mhitm_data *mhm)
mhitm_ad_blnd(
struct monst *magr, /* attacker */
struct attack *mattk, /* magr's attack */
struct monst *mdef, /* defender */
struct mhitm_data *mhm) /* optional for monster vs monster */
{
if (magr == &g.youmonst) {
/* uhitm */
@@ -2388,17 +2393,26 @@ mhitm_ad_blnd(struct monst *magr, struct attack *mattk, struct monst *mdef,
if (!Blind)
pline("%s blinds you!", Monnam(magr));
make_blinded(Blinded + (long) mhm->damage, FALSE);
if (!Blind)
if (!Blind) /* => Eyes of the Overworld */
Your1(vision_clears);
}
mhm->damage = 0;
} else {
/* mhitm */
if (can_blnd(magr, mdef, mattk->aatyp, (struct obj *) 0)) {
register unsigned rnd_tmp;
char buf[BUFSZ];
unsigned rnd_tmp;
if (g.vis && mdef->mcansee && canspotmon(mdef))
pline("%s is blinded.", Monnam(mdef));
if (g.vis && mdef->mcansee && canspotmon(mdef)) {
/* feedback for becoming blinded is given if observed
telepathically (canspotmon suffices) but additional
info about archon's glow is only given if seen */
Snprintf(buf, sizeof buf, "%s is blinded", Monnam(mdef));
if (mdef->data == &mons[PM_ARCHON] && canseemon(mdef))
Snprintf(eos(buf), sizeof buf - strlen(buf),
" by %s radiance", s_suffix(mon_nam(magr)));
pline("%s.", buf);
}
rnd_tmp = d((int) mattk->damn, (int) mattk->damd);
if ((rnd_tmp += mdef->mblinded) > 127)
rnd_tmp = 127;
@@ -2406,7 +2420,8 @@ mhitm_ad_blnd(struct monst *magr, struct attack *mattk, struct monst *mdef,
mdef->mcansee = 0;
mdef->mstrategy &= ~STRAT_WAITFORU;
}
mhm->damage = 0;
if (mhm)
mhm->damage = 0;
}
}
@@ -4023,8 +4038,10 @@ mhitm_adtyping(struct monst *magr, struct attack *mattk, struct monst *mdef,
}
int
damageum(struct monst *mdef, struct attack *mattk,
int specialdmg) /* blessed and/or silver bonus against various things */
damageum(
struct monst *mdef, /* target */
struct attack *mattk, /* hero's attack */
int specialdmg) /* blessed and/or silver bonus against various things */
{
struct mhitm_data mhm;
mhm.damage = d((int) mattk->damn, (int) mattk->damd);