Unify ad_stck
This commit is contained in:
@@ -2771,6 +2771,7 @@ E void FDECL(mhitm_ad_blnd, (struct monst *, struct attack *, struct monst *, st
|
|||||||
E void FDECL(mhitm_ad_curs, (struct monst *, struct attack *, struct monst *, struct mhitm_data *));
|
E void FDECL(mhitm_ad_curs, (struct monst *, struct attack *, struct monst *, struct mhitm_data *));
|
||||||
E void FDECL(mhitm_ad_drst, (struct monst *, struct attack *, struct monst *, struct mhitm_data *));
|
E void FDECL(mhitm_ad_drst, (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_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 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
-2
@@ -1246,8 +1246,9 @@ int dieroll;
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case AD_STCK:
|
case AD_STCK:
|
||||||
if (cancelled)
|
mhitm_ad_stck(magr, mattk, mdef, &mhm);
|
||||||
mhm.damage = 0;
|
if (mhm.done)
|
||||||
|
return mhm.hitflags;
|
||||||
break;
|
break;
|
||||||
case AD_WRAP: /* monsters cannot grab one another, it's too hard */
|
case AD_WRAP: /* monsters cannot grab one another, it's too hard */
|
||||||
if (magr->mcan)
|
if (magr->mcan)
|
||||||
|
|||||||
+3
-4
@@ -1234,10 +1234,9 @@ register struct attack *mattk;
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case AD_STCK:
|
case AD_STCK:
|
||||||
hitmsg(mtmp, mattk);
|
mhitm_ad_stck(mtmp, mattk, &g.youmonst, &mhm);
|
||||||
if (uncancelled && !u.ustuck && !sticks(g.youmonst.data)) {
|
if (mhm.done)
|
||||||
set_ustuck(mtmp);
|
return mhm.hitflags;
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case AD_WRAP:
|
case AD_WRAP:
|
||||||
if ((!mtmp->mcan || u.ustuck == mtmp) && !sticks(g.youmonst.data)) {
|
if ((!mtmp->mcan || u.ustuck == mtmp) && !sticks(g.youmonst.data)) {
|
||||||
|
|||||||
+39
-2
@@ -2739,6 +2739,42 @@ struct mhitm_data *mhm;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
mhitm_ad_stck(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 && !sticks(pd) && distu(mdef->mx, mdef->my) <= 2)
|
||||||
|
u.ustuck = mdef; /* it's now stuck to you */
|
||||||
|
} else if (mdef == &g.youmonst) {
|
||||||
|
/* mhitu */
|
||||||
|
int armpro = magic_negation(mdef);
|
||||||
|
boolean uncancelled = !magr->mcan && (rn2(10) >= 3 * armpro);
|
||||||
|
|
||||||
|
hitmsg(magr, mattk);
|
||||||
|
if (uncancelled && !u.ustuck && !sticks(pd)) {
|
||||||
|
set_ustuck(magr);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
/* mhitm */
|
||||||
|
int armpro = magic_negation(mdef);
|
||||||
|
boolean cancelled = magr->mcan || !(rn2(10) >= 3 * armpro);
|
||||||
|
|
||||||
|
if (cancelled)
|
||||||
|
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
|
||||||
@@ -2927,8 +2963,9 @@ int specialdmg; /* blessed and/or silver bonus against various things */
|
|||||||
return mhm.hitflags;
|
return mhm.hitflags;
|
||||||
break;
|
break;
|
||||||
case AD_STCK:
|
case AD_STCK:
|
||||||
if (!negated && !sticks(pd) && distu(mdef->mx, mdef->my) <= 2)
|
mhitm_ad_stck(&g.youmonst, mattk, mdef, &mhm);
|
||||||
u.ustuck = mdef; /* it's now stuck to you */
|
if (mhm.done)
|
||||||
|
return mhm.hitflags;
|
||||||
break;
|
break;
|
||||||
case AD_WRAP:
|
case AD_WRAP:
|
||||||
if (!sticks(pd)) {
|
if (!sticks(pd)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user