Unify ad_dcay
This commit is contained in:
@@ -2757,6 +2757,7 @@ E boolean FDECL(shade_miss, (struct monst *, struct monst *, struct obj *,
|
||||
BOOLEAN_P, BOOLEAN_P));
|
||||
E void FDECL(mhitm_ad_rust, (struct monst *, struct attack *, struct monst *, struct mhitm_data *));
|
||||
E void FDECL(mhitm_ad_corr, (struct monst *, struct attack *, struct monst *, struct mhitm_data *));
|
||||
E void FDECL(mhitm_ad_dcay, (struct monst *, struct attack *, struct monst *, struct mhitm_data *));
|
||||
E int FDECL(damageum, (struct monst *, struct attack *, int));
|
||||
E void FDECL(missum, (struct monst *, struct attack *, BOOLEAN_P));
|
||||
E int FDECL(passive, (struct monst *, struct obj *, BOOLEAN_P, int,
|
||||
|
||||
19
src/mhitm.c
19
src/mhitm.c
@@ -1111,22 +1111,9 @@ int dieroll;
|
||||
return mhm.hitflags;
|
||||
break;
|
||||
case AD_DCAY:
|
||||
if (magr->mcan)
|
||||
break;
|
||||
if (completelyrots(pd)) { /* PM_WOOD_GOLEM || PM_LEATHER_GOLEM */
|
||||
/* note: the life-saved case is hypothetical because
|
||||
life-saving doesn't work for golems */
|
||||
if (g.vis && canseemon(mdef))
|
||||
pline("%s %s to pieces!", Monnam(mdef),
|
||||
!mlifesaver(mdef) ? "falls" : "starts to fall");
|
||||
monkilled(mdef, (char *) 0, AD_DCAY);
|
||||
if (!DEADMONSTER(mdef))
|
||||
return 0;
|
||||
return (MM_DEF_DIED | (grow_up(magr, mdef) ? 0 : MM_AGR_DIED));
|
||||
}
|
||||
erode_armor(mdef, ERODE_CORRODE);
|
||||
mdef->mstrategy &= ~STRAT_WAITFORU;
|
||||
mhm.damage = 0;
|
||||
mhitm_ad_dcay(magr, mattk, mdef, &mhm);
|
||||
if (mhm.done)
|
||||
return mhm.hitflags;
|
||||
break;
|
||||
case AD_STON:
|
||||
if (magr->mcan)
|
||||
|
||||
13
src/mhitu.c
13
src/mhitu.c
@@ -1498,16 +1498,9 @@ register struct attack *mattk;
|
||||
return mhm.hitflags;
|
||||
break;
|
||||
case AD_DCAY:
|
||||
hitmsg(mtmp, mattk);
|
||||
if (mtmp->mcan)
|
||||
break;
|
||||
if (completelyrots(g.youmonst.data)) {
|
||||
You("rot!");
|
||||
/* KMH -- this is okay with unchanging */
|
||||
rehumanize();
|
||||
break;
|
||||
}
|
||||
erode_armor(&g.youmonst, ERODE_ROT);
|
||||
mhitm_ad_dcay(mtmp, mattk, &g.youmonst, &mhm);
|
||||
if (mhm.done)
|
||||
return mhm.hitflags;
|
||||
break;
|
||||
case AD_HEAL:
|
||||
/* a cancelled nurse is just an ordinary monster,
|
||||
|
||||
66
src/uhitm.c
66
src/uhitm.c
@@ -1776,6 +1776,62 @@ struct mhitm_data *mhm;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
mhitm_ad_dcay(magr, mattk, mdef, mhm)
|
||||
struct monst *magr;
|
||||
struct attack *mattk;
|
||||
struct monst *mdef;
|
||||
struct mhitm_data *mhm;
|
||||
{
|
||||
struct permonst *pd = mdef->data;
|
||||
|
||||
if (magr == &g.youmonst) {
|
||||
/* uhitm */
|
||||
if (completelyrots(pd)) { /* wood golem or leather golem */
|
||||
pline("%s %s to pieces!", Monnam(mdef),
|
||||
!mlifesaver(mdef) ? "falls" : "starts to fall");
|
||||
xkilled(mdef, XKILL_NOMSG);
|
||||
}
|
||||
erode_armor(mdef, ERODE_ROT);
|
||||
mhm->damage = 0;
|
||||
} else if (mdef == &g.youmonst) {
|
||||
/* mhitu */
|
||||
hitmsg(magr, mattk);
|
||||
if (magr->mcan)
|
||||
return;
|
||||
if (completelyrots(pd)) {
|
||||
You("rot!");
|
||||
/* KMH -- this is okay with unchanging */
|
||||
rehumanize();
|
||||
return;
|
||||
}
|
||||
erode_armor(mdef, ERODE_ROT);
|
||||
} else {
|
||||
/* mhitm */
|
||||
if (magr->mcan)
|
||||
return;
|
||||
if (completelyrots(pd)) { /* PM_WOOD_GOLEM || PM_LEATHER_GOLEM */
|
||||
/* note: the life-saved case is hypothetical because
|
||||
life-saving doesn't work for golems */
|
||||
if (g.vis && canseemon(mdef))
|
||||
pline("%s %s to pieces!", Monnam(mdef),
|
||||
!mlifesaver(mdef) ? "falls" : "starts to fall");
|
||||
monkilled(mdef, (char *) 0, AD_DCAY);
|
||||
if (!DEADMONSTER(mdef)) {
|
||||
mhm->done = TRUE;
|
||||
mhm->hitflags = MM_MISS;
|
||||
return;
|
||||
}
|
||||
mhm->done = TRUE;
|
||||
mhm->hitflags = (MM_DEF_DIED | (grow_up(magr, mdef) ? 0 : MM_AGR_DIED));
|
||||
return;
|
||||
}
|
||||
erode_armor(mdef, ERODE_CORRODE);
|
||||
mdef->mstrategy &= ~STRAT_WAITFORU;
|
||||
mhm->damage = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* Template for monster hits monster for AD_FOO.
|
||||
- replace "break" with return
|
||||
- replace "return" with mhm->done = TRUE
|
||||
@@ -2064,13 +2120,9 @@ int specialdmg; /* blessed and/or silver bonus against various things */
|
||||
return mhm.hitflags;
|
||||
break;
|
||||
case AD_DCAY:
|
||||
if (completelyrots(pd)) { /* wood golem or leather golem */
|
||||
pline("%s %s to pieces!", Monnam(mdef),
|
||||
!mlifesaver(mdef) ? "falls" : "starts to fall");
|
||||
xkilled(mdef, XKILL_NOMSG);
|
||||
}
|
||||
erode_armor(mdef, ERODE_ROT);
|
||||
mhm.damage = 0;
|
||||
mhitm_ad_dcay(&g.youmonst, mattk, mdef, &mhm);
|
||||
if (mhm.done)
|
||||
return mhm.hitflags;
|
||||
break;
|
||||
case AD_DREN:
|
||||
if (!negated && !rn2(4))
|
||||
|
||||
Reference in New Issue
Block a user