mon->mhp manipulation
I've hunted for other instances where monster hit points were set to zero or less without calling the routine that kills off the monster (see recent mon_unslime() vs zhitm()) and didn't find any for mhp subtraction. I haven't checked for direct assignment yet. For a while I thought I'd found several cases where a monster was intended to be killed but got left with positive hit points, but it turned out that lifesaved_monster(), of all places, was setting them to zero. I've moved that to its callers so that it isn't so well hidden. And changed several ''if ((mon->mhp -= dmg) <= 0)'' into separate subtraction and 'if' just so the mhp manipulation is a bit more visible. I think the only actual change here is the message for monster being killed by lava, where glass golems now melt instead of burn.
This commit is contained in:
17
src/muse.c
17
src/muse.c
@@ -140,7 +140,7 @@ struct obj *obj;
|
||||
int dam = d(obj->spe + 2, 6);
|
||||
|
||||
/* 3.6.1: no Deaf filter; 'if' message doesn't warrant it, 'else'
|
||||
message doesn't need it since Your_hear() has one of its own */
|
||||
message doesn't need it since You_hear() has one of its own */
|
||||
if (vis) {
|
||||
pline("%s zaps %s, which suddenly explodes!", Monnam(mon),
|
||||
an(xname(obj)));
|
||||
@@ -154,11 +154,11 @@ struct obj *obj;
|
||||
? "nearby" : "in the distance");
|
||||
}
|
||||
m_useup(mon, obj);
|
||||
if (mon->mhp <= dam) {
|
||||
mon->mhp -= dam;
|
||||
if (mon->mhp <= 0) {
|
||||
monkilled(mon, "", AD_RBRE);
|
||||
return 1;
|
||||
} else
|
||||
mon->mhp -= dam;
|
||||
}
|
||||
m.has_defense = m.has_offense = m.has_misc = 0;
|
||||
/* Only one needed to be set to 0 but the others are harmless */
|
||||
}
|
||||
@@ -1498,10 +1498,13 @@ struct monst *mtmp;
|
||||
else
|
||||
losehp(num, "scroll of fire", KILLED_BY_AN);
|
||||
for (mtmp2 = fmon; mtmp2; mtmp2 = mtmp2->nmon) {
|
||||
if (DEADMONSTER(mtmp2)) continue;
|
||||
if (mtmp == mtmp2) continue;
|
||||
if (DEADMONSTER(mtmp2))
|
||||
continue;
|
||||
if (mtmp == mtmp2)
|
||||
continue;
|
||||
if (dist2(mtmp2->mx, mtmp2->my, mtmp->mx, mtmp->my) < 3) {
|
||||
if (resists_fire(mtmp2)) continue;
|
||||
if (resists_fire(mtmp2))
|
||||
continue;
|
||||
mtmp2->mhp -= num;
|
||||
if (resists_cold(mtmp2))
|
||||
mtmp2->mhp -= 3 * num;
|
||||
|
||||
Reference in New Issue
Block a user