Unify ad_slee
This commit is contained in:
@@ -2774,6 +2774,7 @@ E void FDECL(mhitm_ad_drin, (struct monst *, struct attack *, struct monst *, st
|
|||||||
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 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 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
-9
@@ -1081,15 +1081,9 @@ int dieroll;
|
|||||||
return mhm.hitflags;
|
return mhm.hitflags;
|
||||||
break;
|
break;
|
||||||
case AD_SLEE:
|
case AD_SLEE:
|
||||||
if (!cancelled && !mdef->msleeping
|
mhitm_ad_slee(magr, mattk, mdef, &mhm);
|
||||||
&& sleep_monst(mdef, rnd(10), -1)) {
|
if (mhm.done)
|
||||||
if (g.vis && canspotmon(mdef)) {
|
return mhm.hitflags;
|
||||||
Strcpy(buf, Monnam(mdef));
|
|
||||||
pline("%s is put to sleep by %s.", buf, mon_nam(magr));
|
|
||||||
}
|
|
||||||
mdef->mstrategy &= ~STRAT_WAITFORU;
|
|
||||||
slept_monst(mdef);
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case AD_PLYS:
|
case AD_PLYS:
|
||||||
mhitm_ad_plys(magr, mattk, mdef, &mhm);
|
mhitm_ad_plys(magr, mattk, mdef, &mhm);
|
||||||
|
|||||||
+3
-10
@@ -1112,16 +1112,9 @@ register struct attack *mattk;
|
|||||||
return mhm.hitflags;
|
return mhm.hitflags;
|
||||||
break;
|
break;
|
||||||
case AD_SLEE:
|
case AD_SLEE:
|
||||||
hitmsg(mtmp, mattk);
|
mhitm_ad_slee(mtmp, mattk, &g.youmonst, &mhm);
|
||||||
if (uncancelled && g.multi >= 0 && !rn2(5)) {
|
if (mhm.done)
|
||||||
if (Sleep_resistance)
|
return mhm.hitflags;
|
||||||
break;
|
|
||||||
fall_asleep(-rnd(10), TRUE);
|
|
||||||
if (Blind)
|
|
||||||
You("are put to sleep!");
|
|
||||||
else
|
|
||||||
You("are put to sleep by %s!", mon_nam(mtmp));
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case AD_BLND:
|
case AD_BLND:
|
||||||
mhitm_ad_blnd(mtmp, mattk, &g.youmonst, &mhm);
|
mhitm_ad_blnd(mtmp, mattk, &g.youmonst, &mhm);
|
||||||
|
|||||||
+56
-5
@@ -2907,6 +2907,59 @@ struct mhitm_data *mhm;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
mhitm_ad_slee(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->msleeping && sleep_monst(mdef, rnd(10), -1)) {
|
||||||
|
if (!Blind)
|
||||||
|
pline("%s is put to sleep by you!", Monnam(mdef));
|
||||||
|
slept_monst(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 && g.multi >= 0 && !rn2(5)) {
|
||||||
|
if (Sleep_resistance)
|
||||||
|
return;
|
||||||
|
fall_asleep(-rnd(10), TRUE);
|
||||||
|
if (Blind)
|
||||||
|
You("are put to sleep!");
|
||||||
|
else
|
||||||
|
You("are put to sleep by %s!", mon_nam(magr));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
/* mhitm */
|
||||||
|
int armpro = magic_negation(mdef);
|
||||||
|
boolean cancelled = magr->mcan || !(rn2(10) >= 3 * armpro);
|
||||||
|
|
||||||
|
if (!cancelled && !mdef->msleeping
|
||||||
|
&& sleep_monst(mdef, rnd(10), -1)) {
|
||||||
|
if (g.vis && canspotmon(mdef)) {
|
||||||
|
char buf[BUFSZ];
|
||||||
|
Strcpy(buf, Monnam(mdef));
|
||||||
|
pline("%s is put to sleep by %s.", buf, mon_nam(magr));
|
||||||
|
}
|
||||||
|
mdef->mstrategy &= ~STRAT_WAITFORU;
|
||||||
|
slept_monst(mdef);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Template for monster hits monster for AD_FOO.
|
/* Template for monster hits monster for AD_FOO.
|
||||||
@@ -3121,11 +3174,9 @@ int specialdmg; /* blessed and/or silver bonus against various things */
|
|||||||
return mhm.hitflags;
|
return mhm.hitflags;
|
||||||
break;
|
break;
|
||||||
case AD_SLEE:
|
case AD_SLEE:
|
||||||
if (!negated && !mdef->msleeping && sleep_monst(mdef, rnd(10), -1)) {
|
mhitm_ad_slee(&g.youmonst, mattk, mdef, &mhm);
|
||||||
if (!Blind)
|
if (mhm.done)
|
||||||
pline("%s is put to sleep by you!", Monnam(mdef));
|
return mhm.hitflags;
|
||||||
slept_monst(mdef);
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case AD_SLIM:
|
case AD_SLIM:
|
||||||
if (negated)
|
if (negated)
|
||||||
|
|||||||
Reference in New Issue
Block a user