Unify ad_were
This commit is contained in:
@@ -2787,6 +2787,7 @@ E void FDECL(mhitm_ad_deth, (struct monst *, struct attack *, struct monst *, st
|
||||
E void FDECL(mhitm_ad_halu, (struct monst *, struct attack *, struct monst *, struct mhitm_data *));
|
||||
E void FDECL(mhitm_ad_phys, (struct monst *, struct attack *, struct monst *, struct mhitm_data *));
|
||||
E void FDECL(mhitm_ad_ston, (struct monst *, struct attack *, struct monst *, struct mhitm_data *));
|
||||
E void FDECL(mhitm_ad_were, (struct monst *, struct attack *, struct monst *, struct mhitm_data *));
|
||||
E boolean FDECL(do_stone_u, (struct monst *));
|
||||
E void FDECL(do_stone_mon, (struct monst *, struct attack *, struct monst *, struct mhitm_data *));
|
||||
E int FDECL(damageum, (struct monst *, struct attack *, int));
|
||||
|
||||
@@ -964,6 +964,10 @@ int dieroll;
|
||||
}
|
||||
goto physical;
|
||||
case AD_WERE:
|
||||
mhitm_ad_were(magr, mattk, mdef, &mhm);
|
||||
if (mhm.done)
|
||||
return mhm.hitflags;
|
||||
break;
|
||||
case AD_HEAL:
|
||||
case AD_PHYS:
|
||||
physical:
|
||||
|
||||
11
src/mhitu.c
11
src/mhitu.c
@@ -1129,14 +1129,9 @@ register struct attack *mattk;
|
||||
return mhm.hitflags;
|
||||
break;
|
||||
case AD_WERE:
|
||||
hitmsg(mtmp, mattk);
|
||||
if (uncancelled && !rn2(4) && u.ulycn == NON_PM
|
||||
&& !Protection_from_shape_changers && !defends(AD_WERE, uwep)) {
|
||||
You_feel("feverish.");
|
||||
exercise(A_CON, FALSE);
|
||||
set_ulycn(monsndx(mdat));
|
||||
retouch_equipment(2);
|
||||
}
|
||||
mhitm_ad_were(mtmp, mattk, &g.youmonst, &mhm);
|
||||
if (mhm.done)
|
||||
return mhm.hitflags;
|
||||
break;
|
||||
case AD_SGLD:
|
||||
mhitm_ad_sgld(mtmp, mattk, &g.youmonst, &mhm);
|
||||
|
||||
42
src/uhitm.c
42
src/uhitm.c
@@ -3644,6 +3644,42 @@ struct mhitm_data *mhm;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
mhitm_ad_were(magr, mattk, mdef, mhm)
|
||||
struct monst *magr;
|
||||
struct attack *mattk;
|
||||
struct monst *mdef;
|
||||
struct mhitm_data *mhm;
|
||||
{
|
||||
struct permonst *pa = magr->data;
|
||||
struct permonst *pd = mdef->data;
|
||||
|
||||
if (magr == &g.youmonst) {
|
||||
/* uhitm */
|
||||
mhitm_ad_phys(&g.youmonst, mattk, mdef, mhm);
|
||||
if (mhm->done)
|
||||
return;
|
||||
} else if (mdef == &g.youmonst) {
|
||||
/* mhitu */
|
||||
int armpro = magic_negation(mdef);
|
||||
boolean uncancelled = !magr->mcan && (rn2(10) >= 3 * armpro);
|
||||
|
||||
hitmsg(magr, mattk);
|
||||
if (uncancelled && !rn2(4) && u.ulycn == NON_PM
|
||||
&& !Protection_from_shape_changers && !defends(AD_WERE, uwep)) {
|
||||
You_feel("feverish.");
|
||||
exercise(A_CON, FALSE);
|
||||
set_ulycn(monsndx(pa));
|
||||
retouch_equipment(2);
|
||||
}
|
||||
} else {
|
||||
/* mhitm */
|
||||
mhitm_ad_phys(&g.youmonst, mattk, mdef, mhm);
|
||||
if (mhm->done)
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/* Template for monster hits monster for AD_FOO.
|
||||
- replace "break" with return
|
||||
- replace "return" with mhm->done = TRUE
|
||||
@@ -3719,7 +3755,11 @@ int specialdmg; /* blessed and/or silver bonus against various things */
|
||||
}
|
||||
#endif
|
||||
goto physical;
|
||||
case AD_WERE: /* no special effect on monsters */
|
||||
case AD_WERE:
|
||||
mhitm_ad_were(&g.youmonst, mattk, mdef, &mhm);
|
||||
if (mhm.done)
|
||||
return mhm.hitflags;
|
||||
break;
|
||||
case AD_HEAL: /* likewise */
|
||||
case AD_PHYS:
|
||||
physical:
|
||||
|
||||
Reference in New Issue
Block a user