-/* 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. */
/* 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.");
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);
-/* 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. */
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;
>= (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 */
}
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 */
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;
-
- if (g.vis && mdef->mcansee && canspotmon(mdef))
- pline("%s is blinded.", Monnam(mdef));
+ char buf[BUFSZ];
+ unsigned rnd_tmp;
+
+ 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;
mdef->mcansee = 0;
mdef->mstrategy &= ~STRAT_WAITFORU;
}
- mhm->damage = 0;
+ if (mhm)
+ mhm->damage = 0;
}
}
}
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);