Unify ad_slim
This commit is contained in:
@@ -2775,6 +2775,7 @@ E void FDECL(mhitm_ad_stck, (struct monst *, struct attack *, struct monst *, st
|
|||||||
E void FDECL(mhitm_ad_wrap, (struct monst *, struct attack *, struct monst *, struct mhitm_data *));
|
E void FDECL(mhitm_ad_wrap, (struct monst *, struct attack *, struct monst *, struct mhitm_data *));
|
||||||
E void FDECL(mhitm_ad_plys, (struct monst *, struct attack *, struct monst *, struct mhitm_data *));
|
E void FDECL(mhitm_ad_plys, (struct monst *, struct attack *, struct monst *, struct mhitm_data *));
|
||||||
E void FDECL(mhitm_ad_slee, (struct monst *, struct attack *, struct monst *, struct mhitm_data *));
|
E void FDECL(mhitm_ad_slee, (struct monst *, struct attack *, struct monst *, struct mhitm_data *));
|
||||||
|
E void FDECL(mhitm_ad_slim, (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
-18
@@ -1216,24 +1216,9 @@ int dieroll;
|
|||||||
return mhm.hitflags;
|
return mhm.hitflags;
|
||||||
break;
|
break;
|
||||||
case AD_SLIM:
|
case AD_SLIM:
|
||||||
if (cancelled)
|
mhitm_ad_slim(magr, mattk, mdef, &mhm);
|
||||||
break; /* physical damage only */
|
if (mhm.done)
|
||||||
if (!rn2(4) && !slimeproof(pd)) {
|
return mhm.hitflags;
|
||||||
if (!munslime(mdef, FALSE) && !DEADMONSTER(mdef)) {
|
|
||||||
if (newcham(mdef, &mons[PM_GREEN_SLIME], FALSE,
|
|
||||||
(boolean) (g.vis && canseemon(mdef))))
|
|
||||||
pd = mdef->data;
|
|
||||||
mdef->mstrategy &= ~STRAT_WAITFORU;
|
|
||||||
mhm.hitflags = MM_HIT;
|
|
||||||
}
|
|
||||||
/* munslime attempt could have been fatal,
|
|
||||||
potentially to multiple monsters (SCR_FIRE) */
|
|
||||||
if (DEADMONSTER(magr))
|
|
||||||
mhm.hitflags |= MM_AGR_DIED;
|
|
||||||
if (DEADMONSTER(mdef))
|
|
||||||
mhm.hitflags |= MM_DEF_DIED;
|
|
||||||
mhm.damage = 0;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case AD_STCK:
|
case AD_STCK:
|
||||||
mhitm_ad_stck(magr, mattk, mdef, &mhm);
|
mhitm_ad_stck(magr, mattk, mdef, &mhm);
|
||||||
|
|||||||
+3
-16
@@ -1477,22 +1477,9 @@ register struct attack *mattk;
|
|||||||
/* plus the normal damage */
|
/* plus the normal damage */
|
||||||
break;
|
break;
|
||||||
case AD_SLIM:
|
case AD_SLIM:
|
||||||
hitmsg(mtmp, mattk);
|
mhitm_ad_slim(mtmp, mattk, &g.youmonst, &mhm);
|
||||||
if (!uncancelled)
|
if (mhm.done)
|
||||||
break;
|
return mhm.hitflags;
|
||||||
if (flaming(g.youmonst.data)) {
|
|
||||||
pline_The("slime burns away!");
|
|
||||||
mhm.damage = 0;
|
|
||||||
} else if (Unchanging || noncorporeal(g.youmonst.data)
|
|
||||||
|| g.youmonst.data == &mons[PM_GREEN_SLIME]) {
|
|
||||||
You("are unaffected.");
|
|
||||||
mhm.damage = 0;
|
|
||||||
} else if (!Slimed) {
|
|
||||||
You("don't feel very well.");
|
|
||||||
make_slimed(10L, (char *) 0);
|
|
||||||
delayed_killer(SLIMED, KILLED_BY_AN, mtmp->data->mname);
|
|
||||||
} else
|
|
||||||
pline("Yuck!");
|
|
||||||
break;
|
break;
|
||||||
case AD_ENCH: /* KMH -- remove enchantment (disenchanter) */
|
case AD_ENCH: /* KMH -- remove enchantment (disenchanter) */
|
||||||
hitmsg(mtmp, mattk);
|
hitmsg(mtmp, mattk);
|
||||||
|
|||||||
+82
-15
@@ -2960,6 +2960,85 @@ struct mhitm_data *mhm;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
mhitm_ad_slim(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 */
|
||||||
|
int armpro = magic_negation(mdef);
|
||||||
|
/* since hero can't be cancelled, only defender's armor applies */
|
||||||
|
boolean negated = !(rn2(10) >= 3 * armpro);
|
||||||
|
|
||||||
|
if (negated)
|
||||||
|
return; /* physical damage only */
|
||||||
|
if (!rn2(4) && !slimeproof(pd)) {
|
||||||
|
if (!munslime(mdef, TRUE) && !DEADMONSTER(mdef)) {
|
||||||
|
/* this assumes newcham() won't fail; since hero has
|
||||||
|
a slime attack, green slimes haven't been geno'd */
|
||||||
|
You("turn %s into slime.", mon_nam(mdef));
|
||||||
|
if (newcham(mdef, &mons[PM_GREEN_SLIME], FALSE, FALSE))
|
||||||
|
pd = mdef->data;
|
||||||
|
}
|
||||||
|
/* munslime attempt could have been fatal */
|
||||||
|
if (DEADMONSTER(mdef)) {
|
||||||
|
mhm->hitflags = MM_DEF_DIED; /* skip death message */
|
||||||
|
mhm->done = TRUE;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
mhm->damage = 0;
|
||||||
|
}
|
||||||
|
} else if (mdef == &g.youmonst) {
|
||||||
|
/* mhitu */
|
||||||
|
int armpro = magic_negation(mdef);
|
||||||
|
boolean uncancelled = !magr->mcan && (rn2(10) >= 3 * armpro);
|
||||||
|
|
||||||
|
hitmsg(magr, mattk);
|
||||||
|
if (!uncancelled)
|
||||||
|
return;
|
||||||
|
if (flaming(pd)) {
|
||||||
|
pline_The("slime burns away!");
|
||||||
|
mhm->damage = 0;
|
||||||
|
} else if (Unchanging || noncorporeal(pd)
|
||||||
|
|| pd == &mons[PM_GREEN_SLIME]) {
|
||||||
|
You("are unaffected.");
|
||||||
|
mhm->damage = 0;
|
||||||
|
} else if (!Slimed) {
|
||||||
|
You("don't feel very well.");
|
||||||
|
make_slimed(10L, (char *) 0);
|
||||||
|
delayed_killer(SLIMED, KILLED_BY_AN, magr->data->mname);
|
||||||
|
} else
|
||||||
|
pline("Yuck!");
|
||||||
|
} else {
|
||||||
|
/* mhitm */
|
||||||
|
int armpro = magic_negation(mdef);
|
||||||
|
boolean cancelled = magr->mcan || !(rn2(10) >= 3 * armpro);
|
||||||
|
|
||||||
|
if (cancelled)
|
||||||
|
return; /* physical damage only */
|
||||||
|
if (!rn2(4) && !slimeproof(pd)) {
|
||||||
|
if (!munslime(mdef, FALSE) && !DEADMONSTER(mdef)) {
|
||||||
|
if (newcham(mdef, &mons[PM_GREEN_SLIME], FALSE,
|
||||||
|
(boolean) (g.vis && canseemon(mdef))))
|
||||||
|
pd = mdef->data;
|
||||||
|
mdef->mstrategy &= ~STRAT_WAITFORU;
|
||||||
|
mhm->hitflags = MM_HIT;
|
||||||
|
}
|
||||||
|
/* munslime attempt could have been fatal,
|
||||||
|
potentially to multiple monsters (SCR_FIRE) */
|
||||||
|
if (DEADMONSTER(magr))
|
||||||
|
mhm->hitflags |= MM_AGR_DIED;
|
||||||
|
if (DEADMONSTER(mdef))
|
||||||
|
mhm->hitflags |= MM_DEF_DIED;
|
||||||
|
mhm->damage = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Template for monster hits monster for AD_FOO.
|
/* Template for monster hits monster for AD_FOO.
|
||||||
@@ -3179,21 +3258,9 @@ int specialdmg; /* blessed and/or silver bonus against various things */
|
|||||||
return mhm.hitflags;
|
return mhm.hitflags;
|
||||||
break;
|
break;
|
||||||
case AD_SLIM:
|
case AD_SLIM:
|
||||||
if (negated)
|
mhitm_ad_slim(&g.youmonst, mattk, mdef, &mhm);
|
||||||
break; /* physical damage only */
|
if (mhm.done)
|
||||||
if (!rn2(4) && !slimeproof(pd)) {
|
return mhm.hitflags;
|
||||||
if (!munslime(mdef, TRUE) && !DEADMONSTER(mdef)) {
|
|
||||||
/* this assumes newcham() won't fail; since hero has
|
|
||||||
a slime attack, green slimes haven't been geno'd */
|
|
||||||
You("turn %s into slime.", mon_nam(mdef));
|
|
||||||
if (newcham(mdef, &mons[PM_GREEN_SLIME], FALSE, FALSE))
|
|
||||||
pd = mdef->data;
|
|
||||||
}
|
|
||||||
/* munslime attempt could have been fatal */
|
|
||||||
if (DEADMONSTER(mdef))
|
|
||||||
return 2; /* skip death message */
|
|
||||||
mhm.damage = 0;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case AD_ENCH: /* KMH -- remove enchantment (disenchanter) */
|
case AD_ENCH: /* KMH -- remove enchantment (disenchanter) */
|
||||||
/* there's no msomearmor() function, so just do damage */
|
/* there's no msomearmor() function, so just do damage */
|
||||||
|
|||||||
Reference in New Issue
Block a user