Use DEADMONSTER instead of checking mhp
This commit is contained in:
36
src/mhitm.c
36
src/mhitm.c
@@ -247,7 +247,7 @@ boolean quietly;
|
||||
if (!quietly && canspotmon(magr))
|
||||
pline("%s turns to stone!", Monnam(magr));
|
||||
monstone(magr);
|
||||
if (magr->mhp > 0)
|
||||
if (!DEADMONSTER(magr))
|
||||
return MM_HIT; /* lifesaved */
|
||||
else if (magr->mtame && !vis)
|
||||
You(brief_feeling, "peculiarly sad");
|
||||
@@ -633,7 +633,7 @@ struct attack *mattk;
|
||||
if (canseemon(magr))
|
||||
pline("%s is turned to stone!", Monnam(magr));
|
||||
monstone(magr);
|
||||
if (magr->mhp > 0)
|
||||
if (!DEADMONSTER(magr))
|
||||
return MM_MISS;
|
||||
return MM_AGR_DIED;
|
||||
}
|
||||
@@ -782,7 +782,7 @@ struct attack *mattk;
|
||||
/* Kill off aggressor if it didn't die. */
|
||||
if (!(result & MM_AGR_DIED)) {
|
||||
mondead(magr);
|
||||
if (magr->mhp > 0)
|
||||
if (!DEADMONSTER(magr))
|
||||
return result; /* life saved */
|
||||
result |= MM_AGR_DIED;
|
||||
}
|
||||
@@ -826,7 +826,7 @@ register struct attack *mattk;
|
||||
if (vis && canspotmon(magr))
|
||||
pline("%s turns to stone!", Monnam(magr));
|
||||
monstone(magr);
|
||||
if (magr->mhp > 0)
|
||||
if (!DEADMONSTER(magr))
|
||||
return MM_HIT; /* lifesaved */
|
||||
else if (magr->mtame && !vis)
|
||||
You(brief_feeling, "peculiarly sad");
|
||||
@@ -850,7 +850,7 @@ register struct attack *mattk;
|
||||
? "coughs spasmodically and collapses"
|
||||
: "vomits violently and drops dead");
|
||||
mondied(magr);
|
||||
if (magr->mhp > 0)
|
||||
if (!DEADMONSTER(magr))
|
||||
return 0; /* lifesaved */
|
||||
else if (magr->mtame && !vis)
|
||||
You(brief_feeling, "queasy");
|
||||
@@ -864,7 +864,7 @@ register struct attack *mattk;
|
||||
m_useup(mdef, obj);
|
||||
|
||||
/* Is a corpse for nutrition possible? It may kill magr */
|
||||
if (!corpse_chance(mdef, magr, TRUE) || magr->mhp < 1)
|
||||
if (!corpse_chance(mdef, magr, TRUE) || DEADMONSTER(magr))
|
||||
break;
|
||||
|
||||
/* Pets get nutrition from swallowing monster whole.
|
||||
@@ -924,7 +924,7 @@ register struct attack *mattk;
|
||||
tmp = 1;
|
||||
if (otmp->oartifact) {
|
||||
(void) artifact_hit(magr, mdef, otmp, &tmp, dieroll);
|
||||
if (mdef->mhp <= 0)
|
||||
if (DEADMONSTER(mdef))
|
||||
return (MM_DEF_DIED
|
||||
| (grow_up(magr, mdef) ? 0 : MM_AGR_DIED));
|
||||
}
|
||||
@@ -951,7 +951,7 @@ register struct attack *mattk;
|
||||
if (vis && canseemon(mdef))
|
||||
pline("%s burns completely!", Monnam(mdef));
|
||||
mondead(mdef); /* was mondied() but that dropped paper scrolls */
|
||||
if (mdef->mhp > 0)
|
||||
if (!DEADMONSTER(mdef))
|
||||
return 0;
|
||||
else if (mdef->mtame && !vis)
|
||||
pline("May %s roast in peace.", mon_nam(mdef));
|
||||
@@ -1029,7 +1029,7 @@ register struct attack *mattk;
|
||||
if (vis && canseemon(mdef))
|
||||
pline("%s falls to pieces!", Monnam(mdef));
|
||||
mondied(mdef);
|
||||
if (mdef->mhp > 0)
|
||||
if (!DEADMONSTER(mdef))
|
||||
return 0;
|
||||
else if (mdef->mtame && !vis)
|
||||
pline("May %s rust in peace.", mon_nam(mdef));
|
||||
@@ -1053,7 +1053,7 @@ register struct attack *mattk;
|
||||
if (vis && canseemon(mdef))
|
||||
pline("%s falls to pieces!", Monnam(mdef));
|
||||
mondied(mdef);
|
||||
if (mdef->mhp > 0)
|
||||
if (!DEADMONSTER(mdef))
|
||||
return 0;
|
||||
else if (mdef->mtame && !vis)
|
||||
pline("May %s rot in peace.", mon_nam(mdef));
|
||||
@@ -1080,7 +1080,7 @@ register struct attack *mattk;
|
||||
pline("%s turns to stone!", Monnam(mdef));
|
||||
monstone(mdef);
|
||||
post_stone:
|
||||
if (mdef->mhp > 0)
|
||||
if (!DEADMONSTER(mdef))
|
||||
return 0;
|
||||
else if (mdef->mtame && !vis)
|
||||
You(brief_feeling, "peculiarly sad");
|
||||
@@ -1184,7 +1184,7 @@ register struct attack *mattk;
|
||||
pline("%s is destroyed!", Monnam(mdef));
|
||||
}
|
||||
mondied(mdef);
|
||||
if (mdef->mhp > 0)
|
||||
if (!DEADMONSTER(mdef))
|
||||
return 0;
|
||||
else if (mdef->mtame && !vis)
|
||||
You(brief_feeling, "strangely sad");
|
||||
@@ -1280,7 +1280,7 @@ register struct attack *mattk;
|
||||
possibly_unwield(mdef, FALSE);
|
||||
mdef->mstrategy &= ~STRAT_WAITFORU;
|
||||
mselftouch(mdef, (const char *) 0, FALSE);
|
||||
if (mdef->mhp <= 0)
|
||||
if (DEADMONSTER(mdef))
|
||||
return (MM_DEF_DIED
|
||||
| (grow_up(magr, mdef) ? 0 : MM_AGR_DIED));
|
||||
if (pa->mlet == S_NYMPH && !tele_restrict(magr)) {
|
||||
@@ -1343,7 +1343,7 @@ register struct attack *mattk;
|
||||
if (cancelled)
|
||||
break; /* physical damage only */
|
||||
if (!rn2(4) && !slimeproof(pd)) {
|
||||
if (!munslime(mdef, FALSE) && mdef->mhp > 0) {
|
||||
if (!munslime(mdef, FALSE) && !DEADMONSTER(mdef)) {
|
||||
if (newcham(mdef, &mons[PM_GREEN_SLIME], FALSE, vis && canseemon(mdef)))
|
||||
pd = mdef->data;
|
||||
mdef->mstrategy &= ~STRAT_WAITFORU;
|
||||
@@ -1351,9 +1351,9 @@ register struct attack *mattk;
|
||||
}
|
||||
/* munslime attempt could have been fatal,
|
||||
potentially to multiple monsters (SCR_FIRE) */
|
||||
if (magr->mhp < 1)
|
||||
if (DEADMONSTER(magr))
|
||||
res |= MM_AGR_DIED;
|
||||
if (mdef->mhp < 1)
|
||||
if (DEADMONSTER(mdef))
|
||||
res |= MM_DEF_DIED;
|
||||
tmp = 0;
|
||||
}
|
||||
@@ -1385,7 +1385,7 @@ register struct attack *mattk;
|
||||
mdef->mhp = 0;
|
||||
}
|
||||
monkilled(mdef, "", (int) mattk->adtyp);
|
||||
if (mdef->mhp > 0)
|
||||
if (!DEADMONSTER(mdef))
|
||||
return res; /* mdef lifesaved */
|
||||
else if (res == MM_AGR_DIED)
|
||||
return (MM_DEF_DIED | MM_AGR_DIED);
|
||||
@@ -1400,7 +1400,7 @@ register struct attack *mattk;
|
||||
} else if (pd == &mons[PM_WRAITH]) {
|
||||
(void) grow_up(magr, (struct monst *) 0);
|
||||
/* don't grow up twice */
|
||||
return (MM_DEF_DIED | (magr->mhp > 0 ? 0 : MM_AGR_DIED));
|
||||
return (MM_DEF_DIED | (!DEADMONSTER(magr) ? 0 : MM_AGR_DIED));
|
||||
} else if (pd == &mons[PM_NURSE]) {
|
||||
magr->mhp = magr->mhpmax;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user