diff --git a/include/monattk.h b/include/monattk.h index 9f0bb78f1..04fbef021 100644 --- a/include/monattk.h +++ b/include/monattk.h @@ -93,7 +93,7 @@ struct mhitm_data { int damage; - int hitflags; /* MM_DEF_DIED | MM_AGR_DIED | ... */ + int hitflags; /* M_ATTK_DEF_DIED | M_ATTK_AGR_DIED | ... */ boolean done; boolean permdmg; int specialdmg; @@ -105,10 +105,10 @@ struct mhitm_data { * any or all of the following can be returned. See mattackm() for more * details. */ -#define MM_MISS 0x0 /* aggressor missed */ -#define MM_HIT 0x1 /* aggressor hit defender */ -#define MM_DEF_DIED 0x2 /* defender died */ -#define MM_AGR_DIED 0x4 /* aggressor died */ -#define MM_AGR_DONE 0x8 /* aggressor is done with their turn */ +#define M_ATTK_MISS 0x0 /* aggressor missed */ +#define M_ATTK_HIT 0x1 /* aggressor hit defender */ +#define M_ATTK_DEF_DIED 0x2 /* defender died */ +#define M_ATTK_AGR_DIED 0x4 /* aggressor died */ +#define M_ATTK_AGR_DONE 0x8 /* aggressor is done with their turn */ #endif /* MONATTK_H */ diff --git a/src/dogmove.c b/src/dogmove.c index 151d5d517..e8ae95046 100644 --- a/src/dogmove.c +++ b/src/dogmove.c @@ -876,7 +876,7 @@ pet_ranged_attk(struct monst *mtmp) /* Hungry pets are unlikely to use breath/spit attacks */ if (mtarg && (!hungry || !rn2(5))) { - int mstatus = MM_MISS; + int mstatus = M_ATTK_MISS; if (mtarg == &gy.youmonst) { if (mattacku(mtmp)) @@ -887,19 +887,19 @@ pet_ranged_attk(struct monst *mtmp) * and "attacked but didn't die" cases, and this is preferable * to letting the pet attack the player and continuing to move. */ - mstatus = MM_HIT; + mstatus = M_ATTK_HIT; } else { mstatus = mattackm(mtmp, mtarg); /* Shouldn't happen, really */ - if (mstatus & MM_AGR_DIED) + if (mstatus & M_ATTK_AGR_DIED) return MMOVE_DIED; /* Allow the targeted nasty to strike back - if * the targeted beast doesn't have a ranged attack, * nothing will happen. */ - if ((mstatus & MM_HIT) && !(mstatus & MM_DEF_DIED) + if ((mstatus & M_ATTK_HIT) && !(mstatus & M_ATTK_DEF_DIED) && rn2(4) && mtarg != &gy.youmonst) { /* Can monster see? If it can, it can retaliate @@ -909,7 +909,7 @@ pet_ranged_attk(struct monst *mtmp) */ if (mtarg->mcansee && haseyes(mtarg->data)) { mstatus = mattackm(mtarg, mtmp); - if (mstatus & MM_DEF_DIED) + if (mstatus & M_ATTK_DEF_DIED) return MMOVE_DIED; } } @@ -922,9 +922,9 @@ pet_ranged_attk(struct monst *mtmp) * only ever try ranged options * 2. if the only attacks available to mattackm are ranged * options, and the monster cannot make a ranged attack, it - * will return MM_MISS. + * will return M_ATTK_MISS. */ - if (mstatus != MM_MISS) + if (mstatus != M_ATTK_MISS) return MMOVE_DONE; } return MMOVE_NOTHING; @@ -1097,16 +1097,16 @@ dog_move(register struct monst *mtmp, mstatus = mattackm(mtmp, mtmp2); /* aggressor (pet) died */ - if (mstatus & MM_AGR_DIED) + if (mstatus & M_ATTK_AGR_DIED) return MMOVE_DIED; - if ((mstatus & MM_HIT) && !(mstatus & MM_DEF_DIED) && rn2(4) + if ((mstatus & M_ATTK_HIT) && !(mstatus & M_ATTK_DEF_DIED) && rn2(4) && mtmp2->mlstmv != gm.moves && !onscary(mtmp->mx, mtmp->my, mtmp2) /* monnear check needed: long worms hit on tail */ && monnear(mtmp2, mtmp->mx, mtmp->my)) { mstatus = mattackm(mtmp2, mtmp); /* return attack */ - if (mstatus & MM_DEF_DIED) + if (mstatus & M_ATTK_DEF_DIED) return MMOVE_DIED; } return MMOVE_DONE; @@ -1117,7 +1117,7 @@ dog_move(register struct monst *mtmp, register struct monst *mtmp2 = m_at(nx, ny); mstatus = mdisplacem(mtmp, mtmp2, FALSE); /* displace monster */ - if (mstatus & MM_DEF_DIED) + if (mstatus & M_ATTK_DEF_DIED) return MMOVE_DIED; return MMOVE_NOTHING; } diff --git a/src/dokick.c b/src/dokick.c index f994a32d3..28678b919 100644 --- a/src/dokick.c +++ b/src/dokick.c @@ -207,9 +207,9 @@ kick_monster(struct monst *mon, coordxy x, coordxy y) } else if (tmp > kickdieroll) { You("kick %s.", mon_nam(mon)); sum = damageum(mon, uattk, specialdmg); - (void) passive(mon, uarmf, (sum != MM_MISS), - !(sum & MM_DEF_DIED), AT_KICK, FALSE); - if ((sum & MM_DEF_DIED)) + (void) passive(mon, uarmf, (sum != M_ATTK_MISS), + !(sum & M_ATTK_DEF_DIED), AT_KICK, FALSE); + if ((sum & M_ATTK_DEF_DIED)) break; /* Defender died */ } else { missum(mon, uattk, (tmp + armorpenalty > kickdieroll)); diff --git a/src/eat.c b/src/eat.c index 0a8df4e03..3224bd95c 100644 --- a/src/eat.c +++ b/src/eat.c @@ -582,13 +582,13 @@ eat_brains( { struct permonst *pd = mdef->data; boolean give_nutrit = FALSE; - int result = MM_HIT, xtra_dmg = rnd(10); + int result = M_ATTK_HIT, xtra_dmg = rnd(10); if (noncorporeal(pd)) { if (visflag) pline("%s brain is unharmed.", (mdef == &gy.youmonst) ? "Your" : s_suffix(Monnam(mdef))); - return MM_MISS; /* side-effects can't occur */ + return M_ATTK_MISS; /* side-effects can't occur */ } else if (magr == &gy.youmonst) { You("eat %s brain!", s_suffix(mon_nam(mdef))); } else if (mdef == &gy.youmonst) { @@ -614,12 +614,12 @@ eat_brains( monstone(magr); if (!DEADMONSTER(magr)) { /* life-saved; don't continue eating the brains */ - return MM_MISS; + return M_ATTK_MISS; } else { if (magr->mtame && !visflag) /* parallels mhitm.c's brief_feeling */ You("have a sad thought for a moment, then it passes."); - return MM_AGR_DIED; + return M_ATTK_AGR_DIED; } } } @@ -632,7 +632,7 @@ eat_brains( if (mindless(pd)) { /* (cannibalism not possible here) */ pline("%s doesn't notice.", Monnam(mdef)); /* all done; no extra harm inflicted upon target */ - return MM_MISS; + return M_ATTK_MISS; } else if (is_rider(pd)) { pline("Ingesting that is fatal."); Sprintf(gk.killer.name, "unwisely ate the brain of %s", @@ -697,11 +697,11 @@ eat_brains( if (mindless(pd)) { if (visflag && canspotmon(mdef)) pline("%s doesn't notice.", Monnam(mdef)); - return MM_MISS; + return M_ATTK_MISS; } else if (is_rider(pd)) { mondied(magr); if (DEADMONSTER(magr)) - result = MM_AGR_DIED; + result = M_ATTK_AGR_DIED; /* Rider takes extra damage regardless of whether attacker dies */ *dmg_p += xtra_dmg; } else { diff --git a/src/mcastu.c b/src/mcastu.c index 92ed3aa09..72b6264a4 100644 --- a/src/mcastu.c +++ b/src/mcastu.c @@ -210,20 +210,20 @@ castmu( if (foundyou) impossible( "spellcasting monster found you and doesn't know it?"); - return MM_MISS; + return M_ATTK_MISS; } break; } } while (--cnt > 0 && spell_would_be_useless(mtmp, mattk->adtyp, spellnum)); if (cnt == 0) - return MM_MISS; + return M_ATTK_MISS; } /* monster unable to cast spells? */ if (mtmp->mcan || mtmp->mspec_used || !ml) { cursetxt(mtmp, is_undirected_spell(mattk->adtyp, spellnum)); - return MM_MISS; + return M_ATTK_MISS; } if (mattk->adtyp == AD_SPEL || mattk->adtyp == AD_CLRC) { @@ -241,7 +241,7 @@ castmu( canseemon(mtmp) ? Monnam(mtmp) : "Something", is_waterwall(mtmp->mux,mtmp->muy) ? "empty water" : "thin air"); - return MM_MISS; + return M_ATTK_MISS; } nomul(0); @@ -249,7 +249,7 @@ castmu( Soundeffect(se_air_crackles, 60); if (canseemon(mtmp) && !Deaf) pline_The("air crackles around %s.", mon_nam(mtmp)); - return MM_MISS; + return M_ATTK_MISS; } if (canspotmon(mtmp) || !is_undirected_spell(mattk->adtyp, spellnum)) { pline("%s casts a spell%s!", @@ -275,7 +275,7 @@ castmu( impossible( "%s casting non-hand-to-hand version of hand-to-hand spell %d?", Monnam(mtmp), mattk->adtyp); - return MM_MISS; + return M_ATTK_MISS; } } else if (mattk->damd) dmg = d((int) ((ml / 2) + mattk->damn), (int) mattk->damd); @@ -284,7 +284,7 @@ castmu( if (Half_spell_damage) dmg = (dmg + 1) / 2; - ret = MM_HIT; + ret = M_ATTK_HIT; switch (mattk->adtyp) { case AD_FIRE: pline("You're enveloped in flames."); @@ -913,11 +913,11 @@ buzzmu(struct monst *mtmp, struct attack *mattk) /* don't print constant stream of curse messages for 'normal' spellcasting monsters at range */ if (!BZ_VALID_ADTYP(mattk->adtyp)) - return MM_MISS; + return M_ATTK_MISS; if (mtmp->mcan || m_seenres(mtmp, cvt_adtyp_to_mseenres(mattk->adtyp))) { cursetxt(mtmp, FALSE); - return MM_MISS; + return M_ATTK_MISS; } if (lined_up(mtmp) && rn2(3)) { nomul(0); @@ -928,9 +928,9 @@ buzzmu(struct monst *mtmp, struct attack *mattk) buzz(BZ_M_SPELL(BZ_OFS_AD(mattk->adtyp)), (int) mattk->damn, mtmp->mx, mtmp->my, sgn(gt.tbx), sgn(gt.tby)); gb.buzzer = 0; - return MM_HIT; + return M_ATTK_HIT; } - return MM_MISS; + return M_ATTK_MISS; } /*mcastu.c*/ diff --git a/src/mhitm.c b/src/mhitm.c index 88ebf4c03..583339d8c 100644 --- a/src/mhitm.c +++ b/src/mhitm.c @@ -144,7 +144,7 @@ fightm(register struct monst *mtmp) gn.notonhead = 0; result = mattackm(mtmp, mon); - if (result & MM_AGR_DIED) + if (result & M_ATTK_AGR_DIED) return 1; /* mtmp died */ /* * If mtmp has the hero swallowed, lie and say there @@ -156,14 +156,14 @@ fightm(register struct monst *mtmp) /* Allow attacked monsters a chance to hit back. Primarily * to allow monsters that resist conflict to respond. */ - if ((result & MM_HIT) && !(result & MM_DEF_DIED) && rn2(4) + if ((result & M_ATTK_HIT) && !(result & M_ATTK_DEF_DIED) && rn2(4) && mon->movement >= NORMAL_SPEED) { mon->movement -= NORMAL_SPEED; gn.notonhead = 0; (void) mattackm(mon, mtmp); /* return attack */ } - return (result & MM_HIT) ? 1 : 0; + return (result & M_ATTK_HIT) ? 1 : 0; } } } @@ -183,23 +183,23 @@ mdisplacem(register struct monst *magr, register struct monst *mdef, /* sanity checks; could matter if we unexpectedly get a long worm */ if (!magr || !mdef || magr == mdef) - return MM_MISS; + return M_ATTK_MISS; pa = magr->data, pd = mdef->data; tx = mdef->mx, ty = mdef->my; /* destination */ fx = magr->mx, fy = magr->my; /* current location */ if (m_at(fx, fy) != magr || m_at(tx, ty) != mdef) - return MM_MISS; + return M_ATTK_MISS; /* The 1 in 7 failure below matches the chance in do_attack() * for pet displacement. */ if (!rn2(7)) - return MM_MISS; + return M_ATTK_MISS; /* Grid bugs cannot displace at an angle. */ if (pa == &mons[PM_GRID_BUG] && magr->mx != mdef->mx && magr->my != mdef->my) - return MM_MISS; + return M_ATTK_MISS; /* undetected monster becomes un-hidden if it is displaced */ if (mdef->mundetected) @@ -222,7 +222,7 @@ mdisplacem(register struct monst *magr, register struct monst *mdef, if (!which_armor(magr, W_ARMG)) { if (poly_when_stoned(pa)) { mon_to_stone(magr); - return MM_HIT; /* no damage during the polymorph */ + return M_ATTK_HIT; /* no damage during the polymorph */ } if (!quietly && canspotmon(magr)) { if (gv.vis) { @@ -233,10 +233,10 @@ mdisplacem(register struct monst *magr, register struct monst *mdef, } monstone(magr); if (!DEADMONSTER(magr)) - return MM_HIT; /* lifesaved */ + return M_ATTK_HIT; /* lifesaved */ else if (magr->mtame && !gv.vis) You(brief_feeling, "peculiarly sad"); - return MM_AGR_DIED; + return M_ATTK_AGR_DIED; } } @@ -260,7 +260,7 @@ mdisplacem(register struct monst *magr, register struct monst *mdef, newsym(tx, ty); /* all happen */ flush_screen(0); /* make sure it shows up */ - return MM_HIT; + return M_ATTK_HIT; } /* @@ -272,11 +272,11 @@ mdisplacem(register struct monst *magr, register struct monst *mdef, * / / / * x x x * - * 0x8 MM_AGR_DONE - * 0x4 MM_AGR_DIED - * 0x2 MM_DEF_DIED - * 0x1 MM_HIT - * 0x0 MM_MISS + * 0x8 M_ATTK_AGR_DONE + * 0x4 M_ATTK_AGR_DIED + * 0x2 M_ATTK_DEF_DIED + * 0x1 M_ATTK_HIT + * 0x0 M_ATTK_MISS * * Each successive attack has a lower probability of hitting. Some rely on * success of previous attacks. ** this doesn't seem to be implemented -dl ** @@ -298,16 +298,16 @@ mattackm(register struct monst *magr, register struct monst *mdef) struct permonst *pa, *pd; if (!magr || !mdef) - return MM_MISS; /* mike@genat */ + return M_ATTK_MISS; /* mike@genat */ if (helpless(magr)) - return MM_MISS; + return M_ATTK_MISS; pa = magr->data; pd = mdef->data; /* Grid bugs cannot attack at an angle. */ if (pa == &mons[PM_GRID_BUG] && magr->mx != mdef->mx && magr->my != mdef->my) - return MM_MISS; + return M_ATTK_MISS; /* Calculate the armour class differential. */ tmp = find_mac(mdef) + magr->m_lev; @@ -358,7 +358,7 @@ mattackm(register struct monst *magr, register struct monst *mdef) /* Now perform all attacks for the monster. */ for (i = 0; i < NATTK; i++) { - res[i] = MM_MISS; + res[i] = M_ATTK_MISS; mattk = getmattk(magr, mdef, i, res, &alt_attk); mwep = (struct obj *) 0; attk = 1; @@ -372,20 +372,20 @@ mattackm(register struct monst *magr, register struct monst *mdef) case AT_WEAP: /* "hand to hand" attacks */ if (distmin(magr->mx, magr->my, mdef->mx, mdef->my) > 1) { /* D: Do a ranged attack here! */ - strike = (thrwmm(magr, mdef) == MM_MISS) ? 0 : 1; + strike = (thrwmm(magr, mdef) == M_ATTK_MISS) ? 0 : 1; if (strike) /* don't really know if we hit or not; pretend we did */ - res[i] |= MM_HIT; + res[i] |= M_ATTK_HIT; if (DEADMONSTER(mdef)) - res[i] = MM_DEF_DIED; + res[i] = M_ATTK_DEF_DIED; if (DEADMONSTER(magr)) - res[i] |= MM_AGR_DIED; + res[i] |= M_ATTK_AGR_DIED; break; } if (magr->weapon_check == NEED_WEAPON || !MON_WEP(magr)) { magr->weapon_check = NEED_HTH_WEAPON; if (mon_wield_item(magr) != 0) - return MM_MISS; + return M_ATTK_MISS; } possibly_unwield(magr, FALSE); if ((mwep = MON_WEP(magr)) != 0) { @@ -444,7 +444,7 @@ mattackm(register struct monst *magr, register struct monst *mdef) break; case AT_HUGS: /* automatic if prev two attacks succeed */ - strike = (i >= 2 && res[i - 1] == MM_HIT && res[i - 2] == MM_HIT); + strike = (i >= 2 && res[i - 1] == M_ATTK_HIT && res[i - 2] == M_ATTK_HIT); if (strike) res[i] = hitmm(magr, mdef, mattk, (struct obj *) 0, 0); @@ -461,7 +461,7 @@ mattackm(register struct monst *magr, register struct monst *mdef) continue; res[i] = explmm(magr, mdef, mattk); - if (res[i] == MM_MISS) { /* cancelled--no attack */ + if (res[i] == M_ATTK_MISS) { /* cancelled--no attack */ strike = 0; attk = 0; } else @@ -494,15 +494,15 @@ mattackm(register struct monst *magr, register struct monst *mdef) case AT_BREA: if (!monnear(magr, mdef->mx, mdef->my)) { - strike = (breamm(magr, mattk, mdef) == MM_MISS) ? 0 : 1; + strike = (breamm(magr, mattk, mdef) == M_ATTK_MISS) ? 0 : 1; /* We don't really know if we hit or not; pretend we did. */ if (strike) - res[i] |= MM_HIT; + res[i] |= M_ATTK_HIT; if (DEADMONSTER(mdef)) - res[i] = MM_DEF_DIED; + res[i] = M_ATTK_DEF_DIED; if (DEADMONSTER(magr)) - res[i] |= MM_AGR_DIED; + res[i] |= M_ATTK_AGR_DIED; } else strike = 0; @@ -510,15 +510,15 @@ mattackm(register struct monst *magr, register struct monst *mdef) case AT_SPIT: if (!monnear(magr, mdef->mx, mdef->my)) { - strike = (spitmm(magr, mattk, mdef) == MM_MISS) ? 0 : 1; + strike = (spitmm(magr, mattk, mdef) == M_ATTK_MISS) ? 0 : 1; /* We don't really know if we hit or not; pretend we did. */ if (strike) - res[i] |= MM_HIT; + res[i] |= M_ATTK_HIT; if (DEADMONSTER(mdef)) - res[i] = MM_DEF_DIED; + res[i] = M_ATTK_DEF_DIED; if (DEADMONSTER(magr)) - res[i] |= MM_AGR_DIED; + res[i] |= M_ATTK_AGR_DIED; } break; @@ -528,23 +528,23 @@ mattackm(register struct monst *magr, register struct monst *mdef) break; } - if (attk && !(res[i] & MM_AGR_DIED) + if (attk && !(res[i] & M_ATTK_AGR_DIED) && distmin(magr->mx, magr->my, mdef->mx, mdef->my) <= 1) res[i] = passivemm(magr, mdef, strike, - (res[i] & MM_DEF_DIED), mwep); + (res[i] & M_ATTK_DEF_DIED), mwep); - if (res[i] & MM_DEF_DIED) + if (res[i] & M_ATTK_DEF_DIED) return res[i]; - if (res[i] & MM_AGR_DIED) + if (res[i] & M_ATTK_AGR_DIED) return res[i]; /* return if aggressor can no longer attack */ if (helpless(magr)) return res[i]; - if (res[i] & MM_HIT) + if (res[i] & M_ATTK_HIT) struck = 1; /* at least one hit */ } - return (struck ? MM_HIT : MM_MISS); + return (struck ? M_ATTK_HIT : M_ATTK_MISS); } /* Returns the result of mdamagem(). */ @@ -566,7 +566,7 @@ hitmm( compat = !magr->mcan ? could_seduce(magr, mdef, mattk) : 0; if (!compat && shade_miss(magr, mdef, mwep, FALSE, gv.vis)) - return MM_MISS; /* bypass mdamagem() */ + return M_ATTK_MISS; /* bypass mdamagem() */ if (gv.vis) { char buf[BUFSZ], magr_name[BUFSZ]; @@ -667,7 +667,7 @@ gazemm(struct monst *magr, struct monst *mdef, struct attack *mattk) || (magr->minvis && !perceives(mdef->data)) || mdef->msleeping) { if (gv.vis && canspotmon(mdef)) pline("but nothing happens."); - return MM_MISS; + return M_ATTK_MISS; } /* call mon_reflects 2x, first test, then, if visible, print message */ if (magr->data == &mons[PM_MEDUSA] && mon_reflects(mdef, (char *) 0)) { @@ -678,7 +678,7 @@ gazemm(struct monst *magr, struct monst *mdef, struct attack *mattk) if (canseemon(magr)) (void) mon_reflects(magr, "The gaze is reflected away by %s %s."); - return MM_MISS; + return M_ATTK_MISS; } if (mdef->minvis && !perceives(magr->data)) { if (canseemon(magr)) { @@ -686,14 +686,14 @@ gazemm(struct monst *magr, struct monst *mdef, struct attack *mattk) "%s doesn't seem to notice that %s gaze was reflected.", Monnam(magr), mhis(magr)); } - return MM_MISS; + return M_ATTK_MISS; } if (canseemon(magr)) pline("%s is turned to stone!", Monnam(magr)); monstone(magr); if (!DEADMONSTER(magr)) - return MM_MISS; - return MM_AGR_DIED; + return M_ATTK_MISS; + return M_ATTK_AGR_DIED; } } else if (archon) { mhitm_ad_blnd(magr, mattk, mdef, (struct mhitm_data *) 0); @@ -757,7 +757,7 @@ gulpmm( struct obj *obj; if (!engulf_target(magr, mdef)) - return MM_MISS; + return M_ATTK_MISS; if (gv.vis) { pline("%s %s %s.", Monnam(magr), @@ -785,7 +785,7 @@ gulpmm( | SUPPRESS_INVISIBLE), FALSE)); } } - return MM_HIT; /* bypass mdamagem() */ + return M_ATTK_HIT; /* bypass mdamagem() */ } /* @@ -809,10 +809,10 @@ gulpmm( status = mdamagem(magr, mdef, mattk, (struct obj *) 0, 0); - if ((status & (MM_AGR_DIED | MM_DEF_DIED)) - == (MM_AGR_DIED | MM_DEF_DIED)) { + if ((status & (M_ATTK_AGR_DIED | M_ATTK_DEF_DIED)) + == (M_ATTK_AGR_DIED | M_ATTK_DEF_DIED)) { ; /* both died -- do nothing */ - } else if (status & MM_DEF_DIED) { /* defender died */ + } else if (status & M_ATTK_DEF_DIED) { /* defender died */ /* * Note: mdamagem() -> monkilled() -> mondead() -> m_detach() * -> relmon() used to call remove_monster() for the dead @@ -843,8 +843,8 @@ gulpmm( if (minliquid(magr) || (t_at(dx, dy) && mintrap(magr, NO_TRAP_FLAGS) == Trap_Killed_Mon)) - status |= MM_AGR_DIED; - } else if (status & MM_AGR_DIED) { /* aggressor died */ + status |= M_ATTK_AGR_DIED; + } else if (status & M_ATTK_AGR_DIED) { /* aggressor died */ place_monster(mdef, dx, dy); newsym(dx, dy); } else { /* both alive, put them back */ @@ -871,7 +871,7 @@ explmm(struct monst *magr, struct monst *mdef, struct attack *mattk) int result; if (magr->mcan) - return MM_MISS; + return M_ATTK_MISS; if (cansee(magr->mx, magr->my)) pline("%s explodes!", Monnam(magr)); @@ -883,19 +883,19 @@ explmm(struct monst *magr, struct monst *mdef, struct attack *mattk) || mattk->adtyp == AD_ELEC) { mon_explodes(magr, mattk); /* unconditionally set AGR_DIED here; lifesaving is accounted below */ - result = MM_AGR_DIED | (DEADMONSTER(mdef) ? MM_DEF_DIED : 0); + result = M_ATTK_AGR_DIED | (DEADMONSTER(mdef) ? M_ATTK_DEF_DIED : 0); } else { result = mdamagem(magr, mdef, mattk, (struct obj *) 0, 0); } /* Kill off aggressor if it didn't die. */ - if (!(result & MM_AGR_DIED)) { + if (!(result & M_ATTK_AGR_DIED)) { boolean was_leashed = (magr->mleashed != 0); mondead(magr); if (!DEADMONSTER(magr)) return result; /* life saved */ - result |= MM_AGR_DIED; + result |= M_ATTK_AGR_DIED; /* mondead() -> m_detach() -> m_unleash() always suppresses the m_unleash() slack message, so deliver it here instead */ @@ -918,7 +918,7 @@ mdamagem(struct monst *magr, struct monst *mdef, struct permonst *pa = magr->data, *pd = mdef->data; struct mhitm_data mhm; mhm.damage = d((int) mattk->damn, (int) mattk->damd); - mhm.hitflags = MM_MISS; + mhm.hitflags = M_ATTK_MISS; mhm.permdmg = 0; mhm.specialdmg = 0; mhm.dieroll = dieroll; @@ -938,16 +938,16 @@ mdamagem(struct monst *magr, struct monst *mdef, || (protector != ~0L && (wornitems & protector) != protector)) { if (poly_when_stoned(pa)) { mon_to_stone(magr); - return MM_HIT; /* no damage during the polymorph */ + return M_ATTK_HIT; /* no damage during the polymorph */ } if (gv.vis && canspotmon(magr)) pline("%s turns to stone!", Monnam(magr)); monstone(magr); if (!DEADMONSTER(magr)) - return MM_HIT; /* lifesaved */ + return M_ATTK_HIT; /* lifesaved */ else if (magr->mtame && !gv.vis) You(brief_feeling, "peculiarly sad"); - return MM_AGR_DIED; + return M_ATTK_AGR_DIED; } } @@ -955,7 +955,7 @@ mdamagem(struct monst *magr, struct monst *mdef, if (mhitm_knockback(magr, mdef, mattk, &mhm.hitflags, (MON_WEP(magr) != 0)) - && ((mhm.hitflags & MM_DEF_DIED) != 0 + && ((mhm.hitflags & M_ATTK_DEF_DIED) != 0 || (mdef->mstate & (MON_DETACH|MON_MIGRATING|MON_LIMBO)) != 0)) return mhm.hitflags; @@ -985,8 +985,8 @@ mdamagem(struct monst *magr, struct monst *mdef, gm.mkcorpstat_norevive = FALSE; if (!DEADMONSTER(mdef)) return mhm.hitflags; /* mdef lifesaved */ - else if (mhm.hitflags == MM_AGR_DIED) - return (MM_DEF_DIED | MM_AGR_DIED); + else if (mhm.hitflags == M_ATTK_AGR_DIED) + return (M_ATTK_DEF_DIED | M_ATTK_AGR_DIED); if (mattk->adtyp == AD_DGST) { /* various checks similar to dog_eat and meatobj. @@ -998,7 +998,7 @@ mdamagem(struct monst *magr, struct monst *mdef, } else if (pd == &mons[PM_WRAITH]) { (void) grow_up(magr, (struct monst *) 0); /* don't grow up twice */ - return (MM_DEF_DIED | (!DEADMONSTER(magr) ? 0 : MM_AGR_DIED)); + return (M_ATTK_DEF_DIED | (!DEADMONSTER(magr) ? 0 : M_ATTK_AGR_DIED)); } else if (pd == &mons[PM_NURSE]) { magr->mhp = magr->mhpmax; } @@ -1006,9 +1006,9 @@ mdamagem(struct monst *magr, struct monst *mdef, } /* caveat: above digestion handling doesn't keep `pa' up to date */ - return (MM_DEF_DIED | (grow_up(magr, mdef) ? 0 : MM_AGR_DIED)); + return (M_ATTK_DEF_DIED | (grow_up(magr, mdef) ? 0 : M_ATTK_AGR_DIED)); } - return (mhm.hitflags == MM_AGR_DIED) ? MM_AGR_DIED : MM_HIT; + return (mhm.hitflags == M_ATTK_AGR_DIED) ? M_ATTK_AGR_DIED : M_ATTK_HIT; } int @@ -1194,7 +1194,7 @@ passivemm(register struct monst *magr, register struct monst *mdef, register struct permonst *madat = magr->data; char buf[BUFSZ]; int i, tmp; - int mhit = mhitb ? MM_HIT : MM_MISS; + int mhit = mhitb ? M_ATTK_HIT : M_ATTK_MISS; for (i = 0;; i++) { if (i >= NATTK) @@ -1334,7 +1334,7 @@ passivemm(register struct monst *magr, register struct monst *mdef, assess_dmg: if ((magr->mhp -= tmp) <= 0) { monkilled(magr, "", (int) mddat->mattk[i].adtyp); - return (mdead | mhit | MM_AGR_DIED); + return (mdead | mhit | M_ATTK_AGR_DIED); } return (mdead | mhit); } diff --git a/src/mhitu.c b/src/mhitu.c index 1b44894bb..8f4b5c7e6 100644 --- a/src/mhitu.c +++ b/src/mhitu.c @@ -314,7 +314,7 @@ getmattk(struct monst *magr, struct monst *mdef, /* prevent a monster with two consecutive disease or hunger attacks from hitting with both of them on the same turn; if the first has already hit, switch to a stun attack for the second */ - if (indx > 0 && prev_result[indx - 1] > MM_MISS + if (indx > 0 && prev_result[indx - 1] > M_ATTK_MISS && (attk->adtyp == AD_DISE || attk->adtyp == AD_PEST || attk->adtyp == AD_FAMN) && attk->adtyp == mptr->mattk[indx - 1].adtyp) { @@ -457,14 +457,14 @@ mattacku(register struct monst *mtmp) && next2u(mtmp->mx, mtmp->my)) { /* Attack your steed instead */ i = mattackm(mtmp, u.usteed); - if ((i & MM_AGR_DIED)) + if ((i & M_ATTK_AGR_DIED)) return 1; /* make sure steed is still alive and within range */ - if ((i & MM_DEF_DIED) || !u.usteed + if ((i & M_ATTK_DEF_DIED) || !u.usteed || !next2u(mtmp->mx, mtmp->my)) return 0; /* Let your steed retaliate */ - return !!(mattackm(u.usteed, mtmp) & MM_DEF_DIED); + return !!(mattackm(u.usteed, mtmp) & M_ATTK_DEF_DIED); } } @@ -677,7 +677,7 @@ mattacku(register struct monst *mtmp) for (i = 0; i < NATTK; i++) { /* recalc in case attack moved hero */ calc_mattacku_vars(mtmp, &ranged, &range2, &foundyou, &youseeit); - sum[i] = MM_MISS; + sum[i] = M_ATTK_MISS; if (i > 0 && firstfoundyou /* previous attack might have moved hero */ && (mtmp->mux != u.ux || mtmp->muy != u.uy)) continue; /* fill in sum[] with 'miss' but skip other actions */ @@ -825,15 +825,15 @@ mattacku(register struct monst *mtmp) if (gc.context.botl) bot(); /* give player a chance of waking up before dying -kaa */ - if (sum[i] == MM_HIT) { /* successful attack */ + if (sum[i] == M_ATTK_HIT) { /* successful attack */ if (u.usleep && u.usleep < gm.moves && !rn2(10)) { gm.multi = -1; gn.nomovemsg = "The combat suddenly awakens you."; } } - if ((sum[i] & MM_AGR_DIED)) + if ((sum[i] & M_ATTK_AGR_DIED)) return 1; /* attacker dead */ - if ((sum[i] & MM_AGR_DONE)) + if ((sum[i] & M_ATTK_AGR_DONE)) break; /* attacker teleported, no more attacks */ /* sum[i] == 0: unsuccessful attack */ } @@ -1028,7 +1028,7 @@ hitmu(register struct monst *mtmp, register struct attack *mattk) struct permonst *olduasmon = gy.youmonst.data; int res; struct mhitm_data mhm; - mhm.hitflags = MM_MISS; + mhm.hitflags = M_ATTK_MISS; mhm.permdmg = 0; mhm.specialdmg = 0; mhm.done = FALSE; @@ -1141,7 +1141,7 @@ hitmu(register struct monst *mtmp, register struct attack *mattk) if (mhm.damage) res = passiveum(olduasmon, mtmp, mattk); else - res = MM_HIT; + res = M_ATTK_HIT; stop_occupation(); return res; } @@ -1179,9 +1179,9 @@ gulpmu(struct monst *mtmp, struct attack *mattk) int omx = mtmp->mx, omy = mtmp->my; if (!engulf_target(mtmp, &gy.youmonst)) - return MM_MISS; + return M_ATTK_MISS; if ((t && is_pit(t->ttyp)) && sobj_at(BOULDER, u.ux, u.uy)) - return MM_MISS; + return M_ATTK_MISS; if (Punished) unplacebc(); /* ball&chain go away */ @@ -1247,7 +1247,7 @@ gulpmu(struct monst *mtmp, struct attack *mattk) if (Punished) placebc(); set_ustuck((struct monst *) 0); - return (!DEADMONSTER(mtmp)) ? MM_MISS : MM_AGR_DIED; + return (!DEADMONSTER(mtmp)) ? M_ATTK_MISS : M_ATTK_AGR_DIED; } display_nhwindow(WIN_MESSAGE, FALSE); @@ -1280,7 +1280,7 @@ gulpmu(struct monst *mtmp, struct attack *mattk) } if (mtmp != u.ustuck) - return MM_MISS; + return M_ATTK_MISS; if (Punished) { /* ball&chain are in limbo while swallowed; update their internal location to be at swallower's spot */ @@ -1443,7 +1443,7 @@ gulpmu(struct monst *mtmp, struct attack *mattk) pline("Obviously %s doesn't like your taste.", mon_nam(mtmp)); expels(mtmp, mtmp->data, FALSE); } - return MM_HIT; + return M_ATTK_HIT; } /* monster explodes in your face */ @@ -1455,7 +1455,7 @@ explmu(struct monst *mtmp, struct attack *mattk, boolean ufound) int tmp; if (mtmp->mcan) - return MM_MISS; + return M_ATTK_MISS; tmp = d((int) mattk->damn, (int) mattk->damd); not_affected = defended(mtmp, (int) mattk->adtyp); @@ -1517,7 +1517,7 @@ explmu(struct monst *mtmp, struct attack *mattk, boolean ufound) if (kill_agr && !DEADMONSTER(mtmp)) mondead(mtmp); wake_nearto(mtmp->mx, mtmp->my, 7 * 7); - return (!DEADMONSTER(mtmp)) ? MM_MISS : MM_AGR_DIED; + return (!DEADMONSTER(mtmp)) ? M_ATTK_MISS : M_ATTK_AGR_DIED; } /* monster gazes at you */ @@ -1539,7 +1539,7 @@ gazemu(struct monst *mtmp, struct attack *mattk) && mtmp->mcansee); if (m_seenres(mtmp, cvt_adtyp_to_mseenres(mattk->adtyp))) - return MM_MISS; + return M_ATTK_MISS; is_medusa = (mtmp->data == &mons[PM_MEDUSA]); reflectable = (Reflecting && couldsee(mtmp->mx, mtmp->my) && is_medusa); @@ -1599,7 +1599,7 @@ gazemu(struct monst *mtmp, struct attack *mattk) if (!DEADMONSTER(mtmp)) break; - return MM_AGR_DIED; + return M_ATTK_AGR_DIED; } if (canseemon(mtmp) && couldsee(mtmp->mx, mtmp->my) && !Stone_resistance && !Unaware) { @@ -1750,7 +1750,7 @@ gazemu(struct monst *mtmp, struct attack *mattk) : (!rn2(2) ? "a bit " : "somewhat "), reactions[react]); } - return MM_MISS; + return M_ATTK_MISS; } /* mtmp hits you for n points damage */ @@ -2212,7 +2212,7 @@ passiveum( */ for (i = 0; !oldu_mattk; i++) { if (i >= NATTK) - return MM_HIT; + return M_ATTK_HIT; if (olduasmon->mattk[i].aatyp == AT_NONE || olduasmon->mattk[i].aatyp == AT_BOOM) oldu_mattk = &olduasmon->mattk[i]; @@ -2265,10 +2265,10 @@ passiveum( gs.stoned = 1; xkilled(mtmp, XKILL_NOMSG); if (!DEADMONSTER(mtmp)) - return MM_HIT; - return MM_AGR_DIED; + return M_ATTK_HIT; + return M_ATTK_AGR_DIED; } - return MM_HIT; + return M_ATTK_HIT; } case AD_ENCH: /* KMH -- remove enchantment (disenchanter) */ if (mon_currwep) { @@ -2277,12 +2277,12 @@ passiveum( (void) drain_item(mon_currwep, TRUE); /* No message */ } - return MM_HIT; + return M_ATTK_HIT; default: break; } if (!Upolyd) - return MM_HIT; + return M_ATTK_HIT; /* These affect the enemy only if you are still a monster */ if (rn2(3)) @@ -2313,15 +2313,15 @@ passiveum( return 1; pline("%s is frozen by your gaze!", Monnam(mtmp)); paralyze_monst(mtmp, tmp); - return MM_AGR_DONE; + return M_ATTK_AGR_DONE; } } } else { /* gelatinous cube */ pline("%s is frozen by you.", Monnam(mtmp)); paralyze_monst(mtmp, tmp); - return MM_AGR_DONE; + return M_ATTK_AGR_DONE; } - return MM_HIT; + return M_ATTK_HIT; case AD_COLD: /* Brown mold or blue jelly */ if (resists_cold(mtmp)) { shieldeff(mtmp->mx, mtmp->my); @@ -2377,10 +2377,10 @@ passiveum( pline("%s dies!", Monnam(mtmp)); xkilled(mtmp, XKILL_NOMSG); if (!DEADMONSTER(mtmp)) - return MM_HIT; - return MM_AGR_DIED; + return M_ATTK_HIT; + return M_ATTK_AGR_DIED; } - return MM_HIT; + return M_ATTK_HIT; } struct monst * diff --git a/src/monmove.c b/src/monmove.c index 1eecb905b..290274558 100644 --- a/src/monmove.c +++ b/src/monmove.c @@ -756,7 +756,7 @@ dochug(register struct monst* mtmp) for (a = &mdat->mattk[0]; a < &mdat->mattk[NATTK]; a++) { if (a->aatyp == AT_MAGC && (a->adtyp == AD_SPEL || a->adtyp == AD_CLRC)) { - if ((castmu(mtmp, a, FALSE, FALSE) & MM_HIT)) { + if ((castmu(mtmp, a, FALSE, FALSE) & M_ATTK_HIT)) { status = MMOVE_DONE; /* bypass m_move() */ break; } @@ -1506,9 +1506,9 @@ m_move(register struct monst* mtmp, register int after) mtmp2 = m_at(nix, niy); mstatus = mdisplacem(mtmp, mtmp2, FALSE); - if ((mstatus & MM_AGR_DIED) || (mstatus & MM_DEF_DIED)) + if ((mstatus & M_ATTK_AGR_DIED) || (mstatus & M_ATTK_DEF_DIED)) return MMOVE_DIED; - if (mstatus & MM_HIT) + if (mstatus & M_ATTK_HIT) return MMOVE_MOVED; return MMOVE_DONE; } @@ -1796,15 +1796,15 @@ m_move_aggress(struct monst* mtmp, coordxy x, coordxy y) /* note: mstatus returns 0 if mtmp2 is nonexistent */ mstatus = mattackm(mtmp, mtmp2); - if (mstatus & MM_AGR_DIED) /* aggressor died */ + if (mstatus & M_ATTK_AGR_DIED) /* aggressor died */ return MMOVE_DIED; - if ((mstatus & MM_HIT) && !(mstatus & MM_DEF_DIED) && rn2(4) + if ((mstatus & M_ATTK_HIT) && !(mstatus & M_ATTK_DEF_DIED) && rn2(4) && mtmp2->movement >= NORMAL_SPEED) { mtmp2->movement -= NORMAL_SPEED; gn.notonhead = 0; mstatus = mattackm(mtmp2, mtmp); /* return attack */ - if (mstatus & MM_DEF_DIED) + if (mstatus & M_ATTK_DEF_DIED) return MMOVE_DIED; } return MMOVE_DONE; diff --git a/src/mthrowu.c b/src/mthrowu.c index 7e73a7d1c..695503445 100644 --- a/src/mthrowu.c +++ b/src/mthrowu.c @@ -785,13 +785,13 @@ thrwmm(struct monst* mtmp, struct monst* mtarg) mtmp->weapon_check = NEED_RANGED_WEAPON; /* mon_wield_item resets weapon_check as appropriate */ if (mon_wield_item(mtmp) != 0) - return MM_MISS; + return M_ATTK_MISS; } /* Pick a weapon */ otmp = select_rwep(mtmp); if (!otmp) - return MM_MISS; + return M_ATTK_MISS; ispole = is_pole(otmp); x = mtmp->mx; @@ -806,17 +806,17 @@ thrwmm(struct monst* mtmp, struct monst* mtarg) if (ammo_and_launcher(otmp, mwep) && dist2(mtmp->mx, mtmp->my, mtarg->mx, mtarg->my) > PET_MISSILE_RANGE2) - return MM_MISS; /* Out of range */ + return M_ATTK_MISS; /* Out of range */ /* Set target monster */ gm.mtarget = mtarg; gm.marcher = mtmp; monshoot(mtmp, otmp, mwep); /* multishot shooting or throwing */ gm.marcher = gm.mtarget = (struct monst *) 0; nomul(0); - return MM_HIT; + return M_ATTK_HIT; } } - return MM_MISS; + return M_ATTK_MISS; } /* monster spits substance at monster */ @@ -835,7 +835,7 @@ spitmm(struct monst* mtmp, struct attack* mattk, struct monst* mtarg) You_hear("a dry rattle nearby."); } } - return MM_MISS; + return M_ATTK_MISS; } if (m_lined_up(mtarg, mtmp)) { boolean utarg = (mtarg == &gy.youmonst); @@ -874,13 +874,13 @@ spitmm(struct monst* mtmp, struct attack* mattk, struct monst* mtarg) dog->hungrytime -= 5; } - return MM_HIT; + return M_ATTK_HIT; } else { obj_extract_self(otmp); obfree(otmp, (struct obj *) 0); } } - return MM_MISS; + return M_ATTK_MISS; } /* Return the name of a breath weapon. If the player is hallucinating, return @@ -911,7 +911,7 @@ breamm(struct monst* mtmp, struct attack* mattk, struct monst* mtarg) You_hear("a cough."); } } - return MM_MISS; + return M_ATTK_MISS; } /* if we've seen the actual resistance, don't bother, or @@ -919,7 +919,7 @@ breamm(struct monst* mtmp, struct attack* mattk, struct monst* mtarg) if (m_seenres(mtmp, cvt_adtyp_to_mseenres(typ)) || (m_seenres(mtmp, M_SEEN_REFL) && monnear(mtmp, mtmp->mux, mtmp->muy))) - return MM_HIT; + return M_ATTK_HIT; if (!mtmp->mspec_used && rn2(3)) { if (BZ_VALID_ADTYP(typ)) { @@ -951,9 +951,9 @@ breamm(struct monst* mtmp, struct attack* mattk, struct monst* mtarg) } } else impossible("Breath weapon %d used", typ-1); } else - return MM_MISS; + return M_ATTK_MISS; } - return MM_HIT; + return M_ATTK_HIT; } /* remove an entire item from a monster's inventory; destroy that item */ diff --git a/src/uhitm.c b/src/uhitm.c index e4ce21134..66b22af0b 100644 --- a/src/uhitm.c +++ b/src/uhitm.c @@ -2088,7 +2088,7 @@ mhitm_ad_rust(struct monst *magr, struct attack *mattk, struct monst *mdef, pline("%s %s to pieces!", Monnam(mdef), !mlifesaver(mdef) ? "falls" : "starts to fall"); xkilled(mdef, XKILL_NOMSG); - mhm->hitflags |= MM_DEF_DIED; + mhm->hitflags |= M_ATTK_DEF_DIED; } erode_armor(mdef, ERODE_RUST); mhm->damage = 0; /* damageum(), int tmp */ @@ -2115,12 +2115,12 @@ mhitm_ad_rust(struct monst *magr, struct attack *mattk, struct monst *mdef, !mlifesaver(mdef) ? "falls" : "starts to fall"); monkilled(mdef, (char *) 0, AD_RUST); if (!DEADMONSTER(mdef)) { - mhm->hitflags = MM_MISS; + mhm->hitflags = M_ATTK_MISS; mhm->done = TRUE; return; } - mhm->hitflags = (MM_DEF_DIED | (grow_up(magr, mdef) ? 0 - : MM_AGR_DIED)); + mhm->hitflags = (M_ATTK_DEF_DIED | (grow_up(magr, mdef) ? 0 + : M_ATTK_AGR_DIED)); mhm->done = TRUE; return; } @@ -2194,12 +2194,12 @@ mhitm_ad_dcay(struct monst *magr, struct attack *mattk, struct monst *mdef, monkilled(mdef, (char *) 0, AD_DCAY); if (!DEADMONSTER(mdef)) { mhm->done = TRUE; - mhm->hitflags = MM_MISS; + mhm->hitflags = M_ATTK_MISS; return; } mhm->done = TRUE; - mhm->hitflags = (MM_DEF_DIED - | (grow_up(magr, mdef) ? 0 : MM_AGR_DIED)); + mhm->hitflags = (M_ATTK_DEF_DIED + | (grow_up(magr, mdef) ? 0 : M_ATTK_AGR_DIED)); return; } erode_armor(mdef, ERODE_ROT); @@ -2398,12 +2398,12 @@ mhitm_ad_fire( : "is totally engulfed in flames"); monkilled(mdef, (char *) 0, AD_FIRE); if (!DEADMONSTER(mdef)) { - mhm->hitflags = MM_MISS; + mhm->hitflags = M_ATTK_MISS; mhm->done = TRUE; return; } - mhm->hitflags = (MM_DEF_DIED - | (grow_up(magr, mdef) ? 0 : MM_AGR_DIED)); + mhm->hitflags = (M_ATTK_DEF_DIED + | (grow_up(magr, mdef) ? 0 : M_ATTK_AGR_DIED)); mhm->done = TRUE; return; } @@ -2867,14 +2867,14 @@ mhitm_ad_curs(struct monst *magr, struct attack *mattk, struct monst *mdef, } mondied(mdef); if (!DEADMONSTER(mdef)) { - mhm->hitflags = MM_MISS; + mhm->hitflags = M_ATTK_MISS; mhm->done = TRUE; return; } else if (mdef->mtame && !gv.vis) { You(brief_feeling, "strangely sad"); } - mhm->hitflags = (MM_DEF_DIED - | (grow_up(magr, mdef) ? 0 : MM_AGR_DIED)); + mhm->hitflags = (M_ATTK_DEF_DIED + | (grow_up(magr, mdef) ? 0 : M_ATTK_AGR_DIED)); mhm->done = TRUE; return; } @@ -3017,7 +3017,7 @@ mhitm_ad_drin( regardless of current shape) or is noncorporeal (can't happen here; no one can poly into a ghost or shade) so this check for missing is academic */ - if (eat_brains(magr, mdef, TRUE, (int *) 0) == MM_MISS) + if (eat_brains(magr, mdef, TRUE, (int *) 0) == M_ATTK_MISS) return; } /* adjattrib gives dunce cap message when appropriate */ @@ -3273,7 +3273,7 @@ mhitm_ad_slim( } /* munslime attempt could have been fatal */ if (DEADMONSTER(mdef)) { - mhm->hitflags = MM_DEF_DIED; /* skip death message */ + mhm->hitflags = M_ATTK_DEF_DIED; /* skip death message */ mhm->done = TRUE; return; } @@ -3314,14 +3314,14 @@ mhitm_ad_slim( if (newcham(mdef, &mons[PM_GREEN_SLIME], ncflags)) pd = mdef->data; mdef->mstrategy &= ~STRAT_WAITFORU; - mhm->hitflags = MM_HIT; + mhm->hitflags = M_ATTK_HIT; } /* munslime attempt could have been fatal, potentially to multiple monsters (SCR_FIRE) */ if (DEADMONSTER(magr)) - mhm->hitflags |= MM_AGR_DIED; + mhm->hitflags |= M_ATTK_AGR_DIED; if (DEADMONSTER(mdef)) - mhm->hitflags |= MM_DEF_DIED; + mhm->hitflags |= M_ATTK_DEF_DIED; mhm->damage = 0; } } @@ -3667,14 +3667,14 @@ do_stone_mon(struct monst *magr, struct attack *mattk UNUSED, monstone(mdef); post_stone: if (!DEADMONSTER(mdef)) { - mhm->hitflags = MM_MISS; + mhm->hitflags = M_ATTK_MISS; mhm->done = TRUE; return; } else if (mdef->mtame && !gv.vis) { You(brief_feeling, "peculiarly sad"); } - mhm->hitflags = (MM_DEF_DIED - | (grow_up(magr, mdef) ? 0 : MM_AGR_DIED)); + mhm->hitflags = (M_ATTK_DEF_DIED + | (grow_up(magr, mdef) ? 0 : M_ATTK_AGR_DIED)); mhm->done = TRUE; return; } @@ -3728,11 +3728,11 @@ mhitm_ad_phys( if (!u.ustuck && rn2(2)) { if (u_slip_free(magr, mattk)) { mhm->damage = 0; - mhm->hitflags |= MM_MISS; + mhm->hitflags |= M_ATTK_MISS; } else { set_ustuck(magr); pline("%s grabs you!", Monnam(magr)); - mhm->hitflags |= MM_HIT; + mhm->hitflags |= M_ATTK_HIT; } } else if (u.ustuck == magr) { exercise(A_STR, FALSE); @@ -3753,7 +3753,7 @@ mhitm_ad_phys( mons[otmp->corpsenm].pmnames[NEUTRAL]); if (!Stoned) { if (do_stone_u(magr)) { - mhm->hitflags = MM_HIT; + mhm->hitflags = M_ATTK_HIT; mhm->done = 1; return; } @@ -3769,7 +3769,7 @@ mhitm_ad_phys( || !artifact_hit(magr, mdef, otmp, &mhm->damage, gm.mhitu_dieroll)) { hitmsg(magr, mattk); - mhm->hitflags |= MM_HIT; + mhm->hitflags |= M_ATTK_HIT; } if (!mhm->damage) return; @@ -3805,7 +3805,7 @@ mhitm_ad_phys( } else if (mattk->aatyp != AT_TUCH || mhm->damage != 0 || magr != u.ustuck) { hitmsg(magr, mattk); - mhm->hitflags |= MM_HIT; + mhm->hitflags |= M_ATTK_HIT; } } } else { @@ -3849,14 +3849,14 @@ mhitm_ad_phys( if (gv.vis) pline("%s hits %s.", Monnam(magr), mon_nam_too(mdef, magr)); - mhm->hitflags |= MM_HIT; + mhm->hitflags |= M_ATTK_HIT; } /* artifact_hit updates 'tmp' but doesn't inflict any damage; however, it might cause carried items to be destroyed and they might do so */ if (DEADMONSTER(mdef)) { - mhm->hitflags = (MM_DEF_DIED | (grow_up(magr, mdef) ? 0 - : MM_AGR_DIED)); + mhm->hitflags = (M_ATTK_DEF_DIED | (grow_up(magr, mdef) ? 0 + : M_ATTK_AGR_DIED)); mhm->done = TRUE; return; } @@ -3919,7 +3919,7 @@ mhitm_ad_ston( */ if (!rn2(10) || flags.moonphase == NEW_MOON) { if (do_stone_u(magr)) { - mhm->hitflags = MM_HIT; + mhm->hitflags = M_ATTK_HIT; mhm->done = TRUE; return; } @@ -4028,14 +4028,14 @@ mhitm_ad_heal(struct monst *magr, struct attack *mattk, struct monst *mdef, if (goaway) { mongone(magr); mhm->done = TRUE; - mhm->hitflags = MM_DEF_DIED; /* return 2??? */ + mhm->hitflags = M_ATTK_DEF_DIED; /* return 2??? */ return; } else if (!rn2(33)) { if (!tele_restrict(magr)) (void) rloc(magr, RLOC_MSG); monflee(magr, d(3, 6), TRUE, FALSE); mhm->done = TRUE; - mhm->hitflags = MM_HIT | MM_DEF_DIED; /* return 3??? */ + mhm->hitflags = M_ATTK_HIT | M_ATTK_DEF_DIED; /* return 3??? */ return; } mhm->damage = 0; @@ -4187,12 +4187,12 @@ mhitm_ad_dgst(struct monst *magr, struct attack *mattk UNUSED, : "vomits violently and drops dead"); mondied(magr); if (!DEADMONSTER(magr)) { - mhm->hitflags = MM_MISS; /* lifesaved */ + mhm->hitflags = M_ATTK_MISS; /* lifesaved */ mhm->done = TRUE; return; } else if (magr->mtame && !gv.vis) You(brief_feeling, "queasy"); - mhm->hitflags = MM_AGR_DIED; + mhm->hitflags = M_ATTK_AGR_DIED; mhm->done = TRUE; return; } @@ -4318,7 +4318,7 @@ mhitm_ad_sedu( : "makes some remarks about how difficult theft is lately"); if (!tele_restrict(magr)) (void) rloc(magr, RLOC_MSG); - mhm->hitflags = MM_AGR_DONE; /* return 3??? */ + mhm->hitflags = M_ATTK_AGR_DONE; /* return 3??? */ mhm->done = TRUE; return; } else if (magr->mcan) { @@ -4330,7 +4330,7 @@ mhitm_ad_sedu( if (rn2(3)) { if (!tele_restrict(magr)) (void) rloc(magr, RLOC_MSG); - mhm->hitflags = MM_AGR_DONE; /* return 3??? */ + mhm->hitflags = M_ATTK_AGR_DONE; /* return 3??? */ mhm->done = TRUE; return; } @@ -4339,7 +4339,7 @@ mhitm_ad_sedu( buf[0] = '\0'; switch (steal(magr, buf)) { case -1: - mhm->hitflags = MM_AGR_DIED; /* return 2??? */ + mhm->hitflags = M_ATTK_AGR_DIED; /* return 2??? */ mhm->done = TRUE; return; case 0: @@ -4353,7 +4353,7 @@ mhitm_ad_sedu( locomotion(magr->data, "run"), buf); } monflee(magr, 0, FALSE, FALSE); - mhm->hitflags = MM_AGR_DONE; /* return 3??? */ + mhm->hitflags = M_ATTK_AGR_DONE; /* return 3??? */ mhm->done = TRUE; return; } @@ -4393,8 +4393,8 @@ mhitm_ad_sedu( mdef->mstrategy &= ~STRAT_WAITFORU; mselftouch(mdef, (const char *) 0, FALSE); if (DEADMONSTER(mdef)) { - mhm->hitflags = (MM_DEF_DIED - | (grow_up(magr, mdef) ? 0 : MM_AGR_DIED)); + mhm->hitflags = (M_ATTK_DEF_DIED + | (grow_up(magr, mdef) ? 0 : M_ATTK_AGR_DIED)); mhm->done = TRUE; return; } @@ -4425,7 +4425,7 @@ mhitm_ad_ssex(struct monst *magr, struct attack *mattk, struct monst *mdef, if (SYSOPT_SEDUCE) { if (could_seduce(magr, mdef, mattk) == 1 && !magr->mcan) if (doseduce(magr)) { - mhm->hitflags = MM_AGR_DONE; + mhm->hitflags = M_ATTK_AGR_DONE; mhm->done = TRUE; return; } @@ -4504,7 +4504,7 @@ damageum( struct mhitm_data mhm; mhm.damage = d((int) mattk->damn, (int) mattk->damd); - mhm.hitflags = MM_MISS; + mhm.hitflags = M_ATTK_MISS; mhm.permdmg = 0; mhm.specialdmg = specialdmg; mhm.done = FALSE; @@ -4512,7 +4512,7 @@ damageum( if (is_demon(gy.youmonst.data) && !rn2(13) && !uwep && u.umonnum != PM_AMOROUS_DEMON && u.umonnum != PM_BALROG) { demonpet(); - return MM_MISS; + return M_ATTK_MISS; } mhitm_adtyping(&gy.youmonst, mattk, mdef, &mhm); @@ -4542,9 +4542,9 @@ damageum( killed(mdef); /* regular "you kill " message */ } gm.mkcorpstat_norevive = FALSE; - return MM_DEF_DIED; + return M_ATTK_DEF_DIED; } - return MM_HIT; + return M_ATTK_HIT; } /* Hero, as a monster which is capable of an exploding attack mattk, is @@ -4581,14 +4581,14 @@ explum(struct monst *mdef, struct attack *mattk) if (mdef && DEADMONSTER(mdef)) { /* Other monsters may have died too, but return this if the actual target died. */ - return MM_DEF_DIED; + return M_ATTK_DEF_DIED; } break; default: break; } wake_nearto(u.ux, u.uy, 7 * 7); /* same radius as exploding monster */ - return MM_HIT; + return M_ATTK_HIT; } static void @@ -4642,7 +4642,7 @@ gulpum(struct monst *mdef, struct attack *mattk) */ if (!engulf_target(&gy.youmonst, mdef)) - return MM_MISS; + return M_ATTK_MISS; if (!(u_digest && u.uhunger >= 1500) && !u.uswallow) { if (!flaming(gy.youmonst.data)) { @@ -4668,7 +4668,7 @@ gulpum(struct monst *mdef, struct attack *mattk) } else { map_invisible(mdef->mx, mdef->my); } - return MM_HIT; + return M_ATTK_HIT; } /* engulfing a cockatrice or digesting a Rider or Medusa */ @@ -4705,7 +4705,7 @@ gulpum(struct monst *mdef, struct attack *mattk) pmname(pd, Mgender(mdef))); gk.killer.format = NO_KILLER_PREFIX; done(DIED); - return MM_MISS; /* lifesaved */ + return M_ATTK_MISS; /* lifesaved */ } if (Slow_digestion) { @@ -4765,7 +4765,7 @@ gulpum(struct monst *mdef, struct attack *mattk) exercise(A_CON, TRUE); } end_engulf(); - return MM_DEF_DIED; + return M_ATTK_DEF_DIED; case AD_PHYS: if (gy.youmonst.data == &mons[PM_FOG_CLOUD]) { pline("%s is laden with your moisture.", Monnam(mdef)); @@ -4844,7 +4844,7 @@ gulpum(struct monst *mdef, struct attack *mattk) if (DEADMONSTER(mdef)) { killed(mdef); if (DEADMONSTER(mdef)) /* not lifesaved */ - return MM_DEF_DIED; + return M_ATTK_DEF_DIED; } You("%s %s!", expel_verb, mon_nam(mdef)); if ((Slow_digestion || is_animal(gy.youmonst.data)) && u_digest) { @@ -4853,7 +4853,7 @@ gulpum(struct monst *mdef, struct attack *mattk) } } } - return MM_MISS; + return M_ATTK_MISS; } void @@ -4960,7 +4960,7 @@ mhitm_knockback( /* the attack must have hit */ /* mon-vs-mon code path doesn't set up hitflags */ - if ((u_agr || u_def) && !(*hitflags & MM_HIT)) + if ((u_agr || u_def) && !(*hitflags & M_ATTK_HIT)) return FALSE; /* steadfast defender cannot be pushed around */ @@ -5028,7 +5028,7 @@ mhitm_knockback( mhurtle(mdef, dx, dy, knockdistance); if (DEADMONSTER(mdef)) { if (!was_u) - *hitflags |= MM_DEF_DIED; + *hitflags |= M_ATTK_DEF_DIED; } else if (!rn2(4)) { mdef->mstun = 1; /* if steed and hero were knocked back, update attacker's idea @@ -5039,7 +5039,7 @@ mhitm_knockback( } if (!u_agr) { if (DEADMONSTER(magr)) - *hitflags |= MM_AGR_DIED; + *hitflags |= M_ATTK_AGR_DIED; } return TRUE; @@ -5063,7 +5063,7 @@ hmonas(struct monst *mon) with more than one, alternate right and left when checking whether silver ring causes successful hit */ for (i = 0; i < NATTK; i++) { - sum[i] = MM_MISS; + sum[i] = M_ATTK_MISS; mattk = getmattk(&gy.youmonst, mon, i, sum, &alt_attk); if (mattk->aatyp == AT_WEAP || mattk->aatyp == AT_CLAW || mattk->aatyp == AT_TUCH) @@ -5074,7 +5074,7 @@ hmonas(struct monst *mon) gs.skipdrin = FALSE; /* [see mattackm(mhitm.c)] */ for (i = 0; i < NATTK; i++) { - /* sum[i] = MM_MISS; -- now done above */ + /* sum[i] = M_ATTK_MISS; -- now done above */ mattk = getmattk(&gy.youmonst, mon, i, sum, &alt_attk); if (gs.skipdrin && mattk->aatyp == AT_TENT && mattk->adtyp == AD_DRIN) continue; @@ -5088,7 +5088,7 @@ hmonas(struct monst *mon) get to make another weapon attack (note: monsters who use weapons do not have this restriction, but they also never have the opportunity to use two weapons) */ - if (weapon_used && (sum[i - 1] > MM_MISS) + if (weapon_used && (sum[i - 1] > M_ATTK_MISS) && uwep && bimanual(uwep)) continue; /* Certain monsters don't use weapons when encountered as enemies, @@ -5144,10 +5144,10 @@ hmonas(struct monst *mon) weapon = *originalweapon; /* might receive passive erosion */ if (!monster_survived) { /* enemy dead, before any special abilities used */ - sum[i] = MM_DEF_DIED; + sum[i] = M_ATTK_DEF_DIED; break; } else - sum[i] = dhit ? MM_HIT : MM_MISS; + sum[i] = dhit ? M_ATTK_HIT : M_ATTK_MISS; /* might be a worm that gets cut in half; if so, early return */ if (m_at(u.ux + u.dx, u.uy + u.dy) != mon) { i = NATTK; /* skip additional attacks */ @@ -5342,8 +5342,8 @@ hmonas(struct monst *mon) if (silverhit && Verbose(4, hmonas3)) silver_sears(&gy.youmonst, mon, silverhit); sum[i] = damageum(mon, mattk, specialdmg); - } else if (i >= 2 && (sum[i - 1] > MM_MISS) - && (sum[i - 2] > MM_MISS)) { + } else if (i >= 2 && (sum[i - 1] > M_ATTK_MISS) + && (sum[i - 2] > M_ATTK_MISS)) { /* in case we're hugging a new target while already holding something else; yields feedback " is no longer in your clutches" */ @@ -5375,7 +5375,7 @@ hmonas(struct monst *mon) Your("attempt to surround %s is harmless.", mon_nam(mon)); } else { sum[i] = gulpum(mon, mattk); - if (sum[i] == MM_DEF_DIED && (mon->data->mlet == S_ZOMBIE + if (sum[i] == M_ATTK_DEF_DIED && (mon->data->mlet == S_ZOMBIE || mon->data->mlet == S_MUMMY) && rn2(5) && !Sick_resistance) { You_feel("%ssick.", (Sick) ? "very " : ""); @@ -5415,11 +5415,11 @@ hmonas(struct monst *mon) u.mh = -1; /* dead in the current form */ rehumanize(); } - if (sum[i] == MM_DEF_DIED) { + if (sum[i] == M_ATTK_DEF_DIED) { /* defender dead */ (void) passive(mon, weapon, 1, 0, mattk->aatyp, FALSE); } else { - (void) passive(mon, weapon, (sum[i] != MM_MISS), 1, + (void) passive(mon, weapon, (sum[i] != M_ATTK_MISS), 1, mattk->aatyp, FALSE); } @@ -5463,8 +5463,8 @@ passive(struct monst *mon, { register struct permonst *ptr = mon->data; register int i, tmp; - int mhit = mhitb ? MM_HIT : MM_MISS; - int malive = maliveb ? MM_HIT : MM_MISS; + int mhit = mhitb ? M_ATTK_HIT : M_ATTK_MISS; + int malive = maliveb ? M_ATTK_HIT : M_ATTK_MISS; for (i = 0;; i++) { if (i >= NATTK) @@ -5539,7 +5539,7 @@ passive(struct monst *mon, && !(poly_when_stoned(gy.youmonst.data) && polymon(PM_STONE_GOLEM))) { done_in_by(mon, STONING); /* "You turn to stone..." */ - return MM_DEF_DIED; + return M_ATTK_DEF_DIED; } } }