From a0256ef5cb0e518ab08585b97bbfcd2a01f15eeb Mon Sep 17 00:00:00 2001 From: Pasi Kallinen Date: Sat, 27 Apr 2024 21:13:02 +0300 Subject: [PATCH] Fix monster vs monster breath attacks The same routine handles both monster-vs-hero and monster-vs-monster breath attacks, but the code was considering what the attacker knows about hero's resistances even when attacking another monster. Also unconditionally prevent the monster breath attack if the monster knows about hero reflecting - previously the monster could use the breath if it were just far enough from hero, even when hero had reflection. --- src/mthrowu.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/mthrowu.c b/src/mthrowu.c index 5079f7dc0..adf4cfb99 100644 --- a/src/mthrowu.c +++ b/src/mthrowu.c @@ -902,6 +902,7 @@ int breamm(struct monst *mtmp, struct attack *mattk, struct monst *mtarg) { int typ = get_atkdam_type(mattk->adtyp); + boolean utarget = (mtarg == &gy.youmonst); if (m_lined_up(mtarg, mtmp)) { if (mtmp->mcan) { @@ -918,14 +919,12 @@ breamm(struct monst *mtmp, struct attack *mattk, struct monst *mtarg) /* 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))) + if (utarget && (m_seenres(mtmp, cvt_adtyp_to_mseenres(typ)) + || m_seenres(mtmp, M_SEEN_REFL))) return M_ATTK_HIT; if (!mtmp->mspec_used && rn2(3)) { if (BZ_VALID_ADTYP(typ)) { - boolean utarget = (mtarg == &gy.youmonst); if (canseemon(mtmp)) pline("%s breathes %s!", Monnam(mtmp), breathwep_name(typ));