Unify ad_ench
This commit is contained in:
@@ -2776,6 +2776,7 @@ E void FDECL(mhitm_ad_wrap, (struct monst *, struct attack *, struct monst *, st
|
|||||||
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 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 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
@@ -1231,8 +1231,9 @@ int dieroll;
|
|||||||
return mhm.hitflags;
|
return mhm.hitflags;
|
||||||
break;
|
break;
|
||||||
case AD_ENCH:
|
case AD_ENCH:
|
||||||
/* there's no msomearmor() function, so just do damage */
|
mhitm_ad_ench(magr, mattk, mdef, &mhm);
|
||||||
/* if (cancelled) break; */
|
if (mhm.done)
|
||||||
|
return mhm.hitflags;
|
||||||
break;
|
break;
|
||||||
case AD_POLY:
|
case AD_POLY:
|
||||||
if (!magr->mcan && mhm.damage < mdef->mhp)
|
if (!magr->mcan && mhm.damage < mdef->mhp)
|
||||||
|
|||||||
+3
-30
@@ -1482,36 +1482,9 @@ register struct attack *mattk;
|
|||||||
return mhm.hitflags;
|
return mhm.hitflags;
|
||||||
break;
|
break;
|
||||||
case AD_ENCH: /* KMH -- remove enchantment (disenchanter) */
|
case AD_ENCH: /* KMH -- remove enchantment (disenchanter) */
|
||||||
hitmsg(mtmp, mattk);
|
mhitm_ad_ench(mtmp, mattk, &g.youmonst, &mhm);
|
||||||
/* uncancelled is sufficient enough; please
|
if (mhm.done)
|
||||||
don't make this attack less frequent */
|
return mhm.hitflags;
|
||||||
if (uncancelled) {
|
|
||||||
struct obj *obj = some_armor(&g.youmonst);
|
|
||||||
|
|
||||||
if (!obj) {
|
|
||||||
/* some rings are susceptible;
|
|
||||||
amulets and blindfolds aren't (at present) */
|
|
||||||
switch (rn2(5)) {
|
|
||||||
case 0:
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
obj = uright;
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
obj = uleft;
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
obj = uamul;
|
|
||||||
break;
|
|
||||||
case 4:
|
|
||||||
obj = ublindf;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (drain_item(obj, FALSE)) {
|
|
||||||
pline("%s less effective.", Yobjnam2(obj, "seem"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case AD_POLY:
|
case AD_POLY:
|
||||||
if (uncancelled && Maybe_Half_Phys(mhm.damage) < (Upolyd ? u.mh : u.uhp))
|
if (uncancelled && Maybe_Half_Phys(mhm.damage) < (Upolyd ? u.mh : u.uhp))
|
||||||
|
|||||||
+56
-3
@@ -3040,6 +3040,58 @@ struct mhitm_data *mhm;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
mhitm_ad_ench(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 */
|
||||||
|
/* there's no msomearmor() function, so just do damage */
|
||||||
|
} else if (mdef == &g.youmonst) {
|
||||||
|
/* mhitu */
|
||||||
|
int armpro = magic_negation(mdef);
|
||||||
|
boolean uncancelled = !magr->mcan && (rn2(10) >= 3 * armpro);
|
||||||
|
|
||||||
|
hitmsg(magr, mattk);
|
||||||
|
/* uncancelled is sufficient enough; please
|
||||||
|
don't make this attack less frequent */
|
||||||
|
if (uncancelled) {
|
||||||
|
struct obj *obj = some_armor(mdef);
|
||||||
|
|
||||||
|
if (!obj) {
|
||||||
|
/* some rings are susceptible;
|
||||||
|
amulets and blindfolds aren't (at present) */
|
||||||
|
switch (rn2(5)) {
|
||||||
|
case 0:
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
obj = uright;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
obj = uleft;
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
obj = uamul;
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
obj = ublindf;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (drain_item(obj, FALSE)) {
|
||||||
|
pline("%s less effective.", Yobjnam2(obj, "seem"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
/* mhitm */
|
||||||
|
/* there's no msomearmor() function, so just do damage */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* Template for monster hits monster for AD_FOO.
|
/* Template for monster hits monster for AD_FOO.
|
||||||
- replace "break" with return
|
- replace "break" with return
|
||||||
@@ -3262,9 +3314,10 @@ int specialdmg; /* blessed and/or silver bonus against various things */
|
|||||||
if (mhm.done)
|
if (mhm.done)
|
||||||
return mhm.hitflags;
|
return mhm.hitflags;
|
||||||
break;
|
break;
|
||||||
case AD_ENCH: /* KMH -- remove enchantment (disenchanter) */
|
case AD_ENCH:
|
||||||
/* there's no msomearmor() function, so just do damage */
|
mhitm_ad_ench(&g.youmonst, mattk, mdef, &mhm);
|
||||||
/* if (negated) break; */
|
if (mhm.done)
|
||||||
|
return mhm.hitflags;
|
||||||
break;
|
break;
|
||||||
case AD_SLOW:
|
case AD_SLOW:
|
||||||
if (!negated && mdef->mspeed != MSLOW) {
|
if (!negated && mdef->mspeed != MSLOW) {
|
||||||
|
|||||||
Reference in New Issue
Block a user