Use DEADMONSTER instead of checking mhp

This commit is contained in:
Pasi Kallinen
2018-08-30 20:05:18 +03:00
parent f1d0636ba0
commit d2eba695c8
24 changed files with 125 additions and 125 deletions

View File

@@ -155,7 +155,7 @@ struct obj *obj;
}
m_useup(mon, obj);
mon->mhp -= dam;
if (mon->mhp <= 0) {
if (DEADMONSTER(mon)) {
monkilled(mon, "", AD_RBRE);
return 1;
}
@@ -1273,7 +1273,7 @@ register struct obj *otmp;
break;
}
if (reveal_invis) {
if (mtmp->mhp > 0 && cansee(bhitpos.x, bhitpos.y)
if (!DEADMONSTER(mtmp) && cansee(bhitpos.x, bhitpos.y)
&& !canspotmon(mtmp))
map_invisible(bhitpos.x, bhitpos.y);
}
@@ -1406,7 +1406,7 @@ struct monst *mtmp;
(otmp->otyp == WAN_MAGIC_MISSILE) ? 2 : 6, mtmp->mx, mtmp->my,
sgn(mtmp->mux - mtmp->mx), sgn(mtmp->muy - mtmp->my));
m_using = FALSE;
return (mtmp->mhp <= 0) ? 1 : 2;
return (DEADMONSTER(mtmp)) ? 1 : 2;
case MUSE_FIRE_HORN:
case MUSE_FROST_HORN:
if (oseen) {
@@ -1420,7 +1420,7 @@ struct monst *mtmp;
rn1(6, 6), mtmp->mx, mtmp->my, sgn(mtmp->mux - mtmp->mx),
sgn(mtmp->muy - mtmp->my));
m_using = FALSE;
return (mtmp->mhp <= 0) ? 1 : 2;
return (DEADMONSTER(mtmp)) ? 1 : 2;
case MUSE_WAN_TELEPORTATION:
case MUSE_WAN_STRIKING:
zap_oseen = oseen;
@@ -1473,7 +1473,7 @@ struct monst *mtmp;
drop_boulder_on_player(confused, !is_cursed, FALSE, TRUE);
}
return (mtmp->mhp <= 0) ? 1 : 2;
return (DEADMONSTER(mtmp)) ? 1 : 2;
}
#if 0
case MUSE_SCR_FIRE: {
@@ -1513,7 +1513,7 @@ struct monst *mtmp;
mtmp2->mhp -= num;
if (resists_cold(mtmp2))
mtmp2->mhp -= 3 * num;
if (mtmp2->mhp < 1) {
if (DEADMONSTER(mtmp2)) {
mondied(mtmp2);
break;
}
@@ -2260,7 +2260,7 @@ boolean stoning; /* True: stop petrification, False: cure stun && confusion */
mon->mhp -= rnd(15);
if (vis)
pline("%s has a very bad case of stomach acid.", Monnam(mon));
if (mon->mhp <= 0) {
if (DEADMONSTER(mon)) {
pline("%s dies!", Monnam(mon));
if (by_you)
/* hero gets credit (experience) and blame (possible loss
@@ -2502,7 +2502,7 @@ boolean by_you; /* true: if mon kills itself, hero gets credit/blame */
for fire breath, dmg is going to be 0 (fire breathers are
immune to fire damage) but for wand of fire or fire horn,
'mon' could have taken damage so might die */
if (mon->mhp <= 0) {
if (DEADMONSTER(mon)) {
if (by_you) {
/* mon killed self but hero gets credit and blame (except
for pacifist conduct); xkilled()'s message would say
@@ -2520,7 +2520,7 @@ boolean by_you; /* true: if mon kills itself, hero gets credit/blame */
}
}
if (vis) {
if (res && mon->mhp > 0)
if (res && !DEADMONSTER(mon))
pline("%s slime is burned away!", s_suffix(Monnam(mon)));
if (otyp != STRANGE_OBJECT)
makeknown(otyp);