Unify ad_plys
This commit is contained in:
@@ -2773,6 +2773,7 @@ E void FDECL(mhitm_ad_drst, (struct monst *, struct attack *, struct monst *, st
|
|||||||
E void FDECL(mhitm_ad_drin, (struct monst *, struct attack *, struct monst *, struct mhitm_data *));
|
E void FDECL(mhitm_ad_drin, (struct monst *, struct attack *, struct monst *, struct mhitm_data *));
|
||||||
E void FDECL(mhitm_ad_stck, (struct monst *, struct attack *, struct monst *, struct mhitm_data *));
|
E void FDECL(mhitm_ad_stck, (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_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 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
-7
@@ -1092,13 +1092,9 @@ int dieroll;
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case AD_PLYS:
|
case AD_PLYS:
|
||||||
if (!cancelled && mdef->mcanmove) {
|
mhitm_ad_plys(magr, mattk, mdef, &mhm);
|
||||||
if (g.vis && canspotmon(mdef)) {
|
if (mhm.done)
|
||||||
Strcpy(buf, Monnam(mdef));
|
return mhm.hitflags;
|
||||||
pline("%s is frozen by %s.", buf, mon_nam(magr));
|
|
||||||
}
|
|
||||||
paralyze_monst(mdef, rnd(10));
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case AD_SLOW:
|
case AD_SLOW:
|
||||||
if (!cancelled && mdef->mspeed != MSLOW) {
|
if (!cancelled && mdef->mspeed != MSLOW) {
|
||||||
|
|||||||
+3
-15
@@ -1141,21 +1141,9 @@ register struct attack *mattk;
|
|||||||
return mhm.hitflags;
|
return mhm.hitflags;
|
||||||
break;
|
break;
|
||||||
case AD_PLYS:
|
case AD_PLYS:
|
||||||
hitmsg(mtmp, mattk);
|
mhitm_ad_plys(mtmp, mattk, &g.youmonst, &mhm);
|
||||||
if (uncancelled && g.multi >= 0 && !rn2(3)) {
|
if (mhm.done)
|
||||||
if (Free_action) {
|
return mhm.hitflags;
|
||||||
You("momentarily stiffen.");
|
|
||||||
} else {
|
|
||||||
if (Blind)
|
|
||||||
You("are frozen!");
|
|
||||||
else
|
|
||||||
You("are frozen by %s!", mon_nam(mtmp));
|
|
||||||
g.nomovemsg = You_can_move_again;
|
|
||||||
nomul(-rnd(10));
|
|
||||||
g.multi_reason = "paralyzed by a monster";
|
|
||||||
exercise(A_DEX, FALSE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case AD_DRLI: /* drain life */
|
case AD_DRLI: /* drain life */
|
||||||
mhitm_ad_drli(mtmp, mattk, &g.youmonst, &mhm);
|
mhitm_ad_drli(mtmp, mattk, &g.youmonst, &mhm);
|
||||||
|
|||||||
+70
-5
@@ -2851,6 +2851,63 @@ struct mhitm_data *mhm;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
mhitm_ad_plys(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 && mdef->mcanmove && !rn2(3) && mhm->damage < mdef->mhp) {
|
||||||
|
if (!Blind)
|
||||||
|
pline("%s is frozen by you!", Monnam(mdef));
|
||||||
|
paralyze_monst(mdef, rnd(10));
|
||||||
|
}
|
||||||
|
} else if (mdef == &g.youmonst) {
|
||||||
|
/* mhitu */
|
||||||
|
int armpro = magic_negation(mdef);
|
||||||
|
boolean uncancelled = !magr->mcan && (rn2(10) >= 3 * armpro);
|
||||||
|
|
||||||
|
hitmsg(magr, mattk);
|
||||||
|
if (uncancelled && g.multi >= 0 && !rn2(3)) {
|
||||||
|
if (Free_action) {
|
||||||
|
You("momentarily stiffen.");
|
||||||
|
} else {
|
||||||
|
if (Blind)
|
||||||
|
You("are frozen!");
|
||||||
|
else
|
||||||
|
You("are frozen by %s!", mon_nam(magr));
|
||||||
|
g.nomovemsg = You_can_move_again;
|
||||||
|
nomul(-rnd(10));
|
||||||
|
g.multi_reason = "paralyzed by a monster";
|
||||||
|
exercise(A_DEX, FALSE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
/* mhitm */
|
||||||
|
int armpro = magic_negation(mdef);
|
||||||
|
boolean cancelled = magr->mcan || !(rn2(10) >= 3 * armpro);
|
||||||
|
|
||||||
|
if (!cancelled && mdef->mcanmove) {
|
||||||
|
if (g.vis && canspotmon(mdef)) {
|
||||||
|
char buf[BUFSZ];
|
||||||
|
Strcpy(buf, Monnam(mdef));
|
||||||
|
pline("%s is frozen by %s.", buf, mon_nam(magr));
|
||||||
|
}
|
||||||
|
paralyze_monst(mdef, rnd(10));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Template for monster hits monster for AD_FOO.
|
/* Template for monster hits monster for AD_FOO.
|
||||||
- replace "break" with return
|
- replace "break" with return
|
||||||
@@ -2867,12 +2924,22 @@ struct mhitm_data *mhm;
|
|||||||
|
|
||||||
if (magr == &g.youmonst) {
|
if (magr == &g.youmonst) {
|
||||||
/* uhitm */
|
/* uhitm */
|
||||||
|
int armpro = magic_negation(mdef);
|
||||||
|
/* since hero can't be cancelled, only defender's armor applies */
|
||||||
|
boolean negated = !(rn2(10) >= 3 * armpro);
|
||||||
|
|
||||||
/* TODO */
|
/* TODO */
|
||||||
} else if (mdef == &g.youmonst) {
|
} else if (mdef == &g.youmonst) {
|
||||||
/* mhitu */
|
/* mhitu */
|
||||||
|
int armpro = magic_negation(mdef);
|
||||||
|
boolean uncancelled = !magr->mcan && (rn2(10) >= 3 * armpro);
|
||||||
|
|
||||||
/* TODO */
|
/* TODO */
|
||||||
} else {
|
} else {
|
||||||
/* mhitm */
|
/* mhitm */
|
||||||
|
int armpro = magic_negation(mdef);
|
||||||
|
boolean cancelled = magr->mcan || !(rn2(10) >= 3 * armpro);
|
||||||
|
|
||||||
/* TODO */
|
/* TODO */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3049,11 +3116,9 @@ int specialdmg; /* blessed and/or silver bonus against various things */
|
|||||||
return mhm.hitflags;
|
return mhm.hitflags;
|
||||||
break;
|
break;
|
||||||
case AD_PLYS:
|
case AD_PLYS:
|
||||||
if (!negated && mdef->mcanmove && !rn2(3) && mhm.damage < mdef->mhp) {
|
mhitm_ad_plys(&g.youmonst, mattk, mdef, &mhm);
|
||||||
if (!Blind)
|
if (mhm.done)
|
||||||
pline("%s is frozen by you!", Monnam(mdef));
|
return mhm.hitflags;
|
||||||
paralyze_monst(mdef, rnd(10));
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case AD_SLEE:
|
case AD_SLEE:
|
||||||
if (!negated && !mdef->msleeping && sleep_monst(mdef, rnd(10), -1)) {
|
if (!negated && !mdef->msleeping && sleep_monst(mdef, rnd(10), -1)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user