Unify ad_slow
This commit is contained in:
@@ -2777,6 +2777,7 @@ E void FDECL(mhitm_ad_plys, (struct monst *, struct attack *, struct monst *, st
|
|||||||
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 void FDECL(mhitm_ad_slim, (struct monst *, struct attack *, struct monst *, struct mhitm_data *));
|
||||||
E void FDECL(mhitm_ad_ench, (struct monst *, struct attack *, struct monst *, struct mhitm_data *));
|
E void FDECL(mhitm_ad_ench, (struct monst *, struct attack *, struct monst *, struct mhitm_data *));
|
||||||
|
E void FDECL(mhitm_ad_slow, (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
-8
@@ -1091,14 +1091,9 @@ int dieroll;
|
|||||||
return mhm.hitflags;
|
return mhm.hitflags;
|
||||||
break;
|
break;
|
||||||
case AD_SLOW:
|
case AD_SLOW:
|
||||||
if (!cancelled && mdef->mspeed != MSLOW) {
|
mhitm_ad_slow(magr, mattk, mdef, &mhm);
|
||||||
unsigned int oldspeed = mdef->mspeed;
|
if (mhm.done)
|
||||||
|
return mhm.hitflags;
|
||||||
mon_adjust_speed(mdef, -1, (struct obj *) 0);
|
|
||||||
mdef->mstrategy &= ~STRAT_WAITFORU;
|
|
||||||
if (mdef->mspeed != oldspeed && g.vis && canspotmon(mdef))
|
|
||||||
pline("%s slows down.", Monnam(mdef));
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case AD_CONF:
|
case AD_CONF:
|
||||||
/* Since confusing another monster doesn't have a real time
|
/* Since confusing another monster doesn't have a real time
|
||||||
|
|||||||
+3
-3
@@ -1409,9 +1409,9 @@ register struct attack *mattk;
|
|||||||
return mhm.hitflags;
|
return mhm.hitflags;
|
||||||
break;
|
break;
|
||||||
case AD_SLOW:
|
case AD_SLOW:
|
||||||
hitmsg(mtmp, mattk);
|
mhitm_ad_slow(mtmp, mattk, &g.youmonst, &mhm);
|
||||||
if (uncancelled && HFast && !defends(AD_SLOW, uwep) && !rn2(4))
|
if (mhm.done)
|
||||||
u_slow_down();
|
return mhm.hitflags;
|
||||||
break;
|
break;
|
||||||
case AD_DREN:
|
case AD_DREN:
|
||||||
mhitm_ad_dren(mtmp, mattk, &g.youmonst, &mhm);
|
mhitm_ad_dren(mtmp, mattk, &g.youmonst, &mhm);
|
||||||
|
|||||||
+50
-7
@@ -3093,6 +3093,53 @@ struct mhitm_data *mhm;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
mhitm_ad_slow(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->mspeed != MSLOW) {
|
||||||
|
unsigned int oldspeed = mdef->mspeed;
|
||||||
|
|
||||||
|
mon_adjust_speed(mdef, -1, (struct obj *) 0);
|
||||||
|
if (mdef->mspeed != oldspeed && canseemon(mdef))
|
||||||
|
pline("%s slows down.", Monnam(mdef));
|
||||||
|
}
|
||||||
|
} else if (mdef == &g.youmonst) {
|
||||||
|
/* mhitu */
|
||||||
|
int armpro = magic_negation(mdef);
|
||||||
|
boolean uncancelled = !magr->mcan && (rn2(10) >= 3 * armpro);
|
||||||
|
|
||||||
|
hitmsg(magr, mattk);
|
||||||
|
if (uncancelled && HFast && !defends(AD_SLOW, uwep) && !rn2(4))
|
||||||
|
u_slow_down();
|
||||||
|
} else {
|
||||||
|
/* mhitm */
|
||||||
|
int armpro = magic_negation(mdef);
|
||||||
|
boolean cancelled = magr->mcan || !(rn2(10) >= 3 * armpro);
|
||||||
|
|
||||||
|
if (!cancelled && mdef->mspeed != MSLOW) {
|
||||||
|
unsigned int oldspeed = mdef->mspeed;
|
||||||
|
|
||||||
|
mon_adjust_speed(mdef, -1, (struct obj *) 0);
|
||||||
|
mdef->mstrategy &= ~STRAT_WAITFORU;
|
||||||
|
if (mdef->mspeed != oldspeed && g.vis && canspotmon(mdef))
|
||||||
|
pline("%s slows down.", Monnam(mdef));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* 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
|
||||||
@@ -3320,13 +3367,9 @@ int specialdmg; /* blessed and/or silver bonus against various things */
|
|||||||
return mhm.hitflags;
|
return mhm.hitflags;
|
||||||
break;
|
break;
|
||||||
case AD_SLOW:
|
case AD_SLOW:
|
||||||
if (!negated && mdef->mspeed != MSLOW) {
|
mhitm_ad_slow(&g.youmonst, mattk, mdef, &mhm);
|
||||||
unsigned int oldspeed = mdef->mspeed;
|
if (mhm.done)
|
||||||
|
return mhm.hitflags;
|
||||||
mon_adjust_speed(mdef, -1, (struct obj *) 0);
|
|
||||||
if (mdef->mspeed != oldspeed && canseemon(mdef))
|
|
||||||
pline("%s slows down.", Monnam(mdef));
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case AD_CONF:
|
case AD_CONF:
|
||||||
if (!mdef->mconf) {
|
if (!mdef->mconf) {
|
||||||
|
|||||||
Reference in New Issue
Block a user