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));
|
BOOLEAN_P, BOOLEAN_P));
|
||||||
E void FDECL(mhitm_ad_rust, (struct monst *, struct attack *, struct monst *, struct mhitm_data *));
|
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_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 int FDECL(damageum, (struct monst *, struct attack *, int));
|
||||||
E void FDECL(missum, (struct monst *, struct attack *, BOOLEAN_P));
|
E void FDECL(missum, (struct monst *, struct attack *, BOOLEAN_P));
|
||||||
E int FDECL(passive, (struct monst *, struct obj *, BOOLEAN_P, int,
|
E int FDECL(passive, (struct monst *, struct obj *, BOOLEAN_P, int,
|
||||||
|
|||||||
+3
-16
@@ -1111,22 +1111,9 @@ int dieroll;
|
|||||||
return mhm.hitflags;
|
return mhm.hitflags;
|
||||||
break;
|
break;
|
||||||
case AD_DCAY:
|
case AD_DCAY:
|
||||||
if (magr->mcan)
|
mhitm_ad_dcay(magr, mattk, mdef, &mhm);
|
||||||
break;
|
if (mhm.done)
|
||||||
if (completelyrots(pd)) { /* PM_WOOD_GOLEM || PM_LEATHER_GOLEM */
|
return mhm.hitflags;
|
||||||
/* 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;
|
|
||||||
break;
|
break;
|
||||||
case AD_STON:
|
case AD_STON:
|
||||||
if (magr->mcan)
|
if (magr->mcan)
|
||||||
|
|||||||
+3
-10
@@ -1498,16 +1498,9 @@ register struct attack *mattk;
|
|||||||
return mhm.hitflags;
|
return mhm.hitflags;
|
||||||
break;
|
break;
|
||||||
case AD_DCAY:
|
case AD_DCAY:
|
||||||
hitmsg(mtmp, mattk);
|
mhitm_ad_dcay(mtmp, mattk, &g.youmonst, &mhm);
|
||||||
if (mtmp->mcan)
|
if (mhm.done)
|
||||||
break;
|
return mhm.hitflags;
|
||||||
if (completelyrots(g.youmonst.data)) {
|
|
||||||
You("rot!");
|
|
||||||
/* KMH -- this is okay with unchanging */
|
|
||||||
rehumanize();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
erode_armor(&g.youmonst, ERODE_ROT);
|
|
||||||
break;
|
break;
|
||||||
case AD_HEAL:
|
case AD_HEAL:
|
||||||
/* a cancelled nurse is just an ordinary monster,
|
/* a cancelled nurse is just an ordinary monster,
|
||||||
|
|||||||
+59
-7
@@ -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.
|
/* Template for monster hits monster for AD_FOO.
|
||||||
- replace "break" with return
|
- replace "break" with return
|
||||||
- replace "return" with mhm->done = TRUE
|
- replace "return" with mhm->done = TRUE
|
||||||
@@ -2064,13 +2120,9 @@ int specialdmg; /* blessed and/or silver bonus against various things */
|
|||||||
return mhm.hitflags;
|
return mhm.hitflags;
|
||||||
break;
|
break;
|
||||||
case AD_DCAY:
|
case AD_DCAY:
|
||||||
if (completelyrots(pd)) { /* wood golem or leather golem */
|
mhitm_ad_dcay(&g.youmonst, mattk, mdef, &mhm);
|
||||||
pline("%s %s to pieces!", Monnam(mdef),
|
if (mhm.done)
|
||||||
!mlifesaver(mdef) ? "falls" : "starts to fall");
|
return mhm.hitflags;
|
||||||
xkilled(mdef, XKILL_NOMSG);
|
|
||||||
}
|
|
||||||
erode_armor(mdef, ERODE_ROT);
|
|
||||||
mhm.damage = 0;
|
|
||||||
break;
|
break;
|
||||||
case AD_DREN:
|
case AD_DREN:
|
||||||
if (!negated && !rn2(4))
|
if (!negated && !rn2(4))
|
||||||
|
|||||||
Reference in New Issue
Block a user