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.
This commit is contained in:
@@ -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));
|
||||
|
||||
Reference in New Issue
Block a user