Monsters can see player resistances

If monsters see you resist something, generally elemental or magical
attack, or if they see you reflect an attack, they learn that and
will adjust their attack accordingly.

Originally from SporkHack, but this version comes via EvilHack with
some minor changes.
This commit is contained in:
Pasi Kallinen
2021-05-17 19:01:09 +03:00
parent 2a10b3003d
commit 2288452278
19 changed files with 164 additions and 21 deletions

View File

@@ -89,6 +89,7 @@ thitu(
if (is_acid && Acid_resistance) {
pline("It doesn't seem to hurt you.");
monstseesu(M_SEEN_ACID);
} else if (obj && obj->oclass == POTION_CLASS) {
/* an explosion which scatters objects might hit hero with one
(potions deliberately thrown at hero are handled by m_throw) */
@@ -821,6 +822,14 @@ breamm(struct monst* mtmp, struct attack* mattk, struct monst* mtarg)
}
return MM_MISS;
}
/* if we've seen the actual resistance, don't bother, or
* if we're close by and they reflect, just jump the player */
if (m_seenres(mtmp, cvt_adtyp_to_mseenres(typ))
|| (m_seenres(mtmp, M_SEEN_REFL)
&& monnear(mtmp, mtmp->mux, mtmp->muy)))
return MM_HIT;
if (!mtmp->mspec_used && rn2(3)) {
if ((typ >= AD_MAGM) && (typ <= AD_ACID)) {
boolean utarget = (mtarg == &g.youmonst);