split "assess_dmg" on passiveum() into a separate function
This commit is contained in:
28
src/mhitu.c
28
src/mhitu.c
@@ -19,6 +19,7 @@ staticfn int gulpmu(struct monst *, struct attack *);
|
||||
staticfn int explmu(struct monst *, struct attack *, boolean);
|
||||
staticfn void mayberem(struct monst *, const char *, struct obj *,
|
||||
const char *);
|
||||
staticfn int assess_dmg(struct monst *, int);
|
||||
staticfn int passiveum(struct permonst *, struct monst *, struct attack *);
|
||||
|
||||
#define ld() ((yyyymmdd((time_t) 0) - (getyear() * 10000L)) == 0xe5)
|
||||
@@ -2291,6 +2292,19 @@ mayberem(struct monst *mon,
|
||||
remove_worn_item(obj, TRUE);
|
||||
}
|
||||
|
||||
staticfn int
|
||||
assess_dmg(struct monst *mtmp, int tmp)
|
||||
{
|
||||
if ((mtmp->mhp -= tmp) <= 0) {
|
||||
pline("%s dies!", Monnam(mtmp));
|
||||
xkilled(mtmp, XKILL_NOMSG);
|
||||
if (!DEADMONSTER(mtmp))
|
||||
return M_ATTK_HIT;
|
||||
return M_ATTK_AGR_DIED;
|
||||
}
|
||||
return M_ATTK_HIT;
|
||||
}
|
||||
|
||||
/* FIXME:
|
||||
* sequencing issue: a monster's attack might cause poly'd hero
|
||||
* to revert to normal form. The messages for passive counterattack
|
||||
@@ -2345,7 +2359,7 @@ passiveum(
|
||||
erode_armor(mtmp, ERODE_CORRODE);
|
||||
if (!rn2(6))
|
||||
acid_damage(MON_WEP(mtmp));
|
||||
goto assess_dmg;
|
||||
return assess_dmg(mtmp, tmp);
|
||||
case AD_STON: /* cockatrice */
|
||||
{
|
||||
long protector = attk_protection((int) mattk->aatyp),
|
||||
@@ -2394,7 +2408,7 @@ passiveum(
|
||||
You("explode!");
|
||||
/* KMH, balance patch -- this is okay with unchanging */
|
||||
rehumanize();
|
||||
goto assess_dmg;
|
||||
return assess_dmg(mtmp, tmp);
|
||||
}
|
||||
break;
|
||||
case AD_PLYS: /* Floating eye */
|
||||
@@ -2474,15 +2488,7 @@ passiveum(
|
||||
else
|
||||
tmp = 0;
|
||||
|
||||
assess_dmg:
|
||||
if ((mtmp->mhp -= tmp) <= 0) {
|
||||
pline("%s dies!", Monnam(mtmp));
|
||||
xkilled(mtmp, XKILL_NOMSG);
|
||||
if (!DEADMONSTER(mtmp))
|
||||
return M_ATTK_HIT;
|
||||
return M_ATTK_AGR_DIED;
|
||||
}
|
||||
return M_ATTK_HIT;
|
||||
return assess_dmg(mtmp, tmp);
|
||||
}
|
||||
|
||||
struct monst *
|
||||
|
||||
Reference in New Issue
Block a user