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_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 void FDECL(missum, (struct monst *, struct attack *, BOOLEAN_P));
E int FDECL(passive, (struct monst *, struct obj *, BOOLEAN_P, int,
return mhm.hitflags;
break;
case AD_ENCH:
- /* there's no msomearmor() function, so just do damage */
- /* if (cancelled) break; */
+ mhitm_ad_ench(magr, mattk, mdef, &mhm);
+ if (mhm.done)
+ return mhm.hitflags;
break;
case AD_POLY:
if (!magr->mcan && mhm.damage < mdef->mhp)
return mhm.hitflags;
break;
case AD_ENCH: /* KMH -- remove enchantment (disenchanter) */
- hitmsg(mtmp, mattk);
- /* uncancelled is sufficient enough; please
- don't make this attack less frequent */
- 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"));
- }
- }
+ mhitm_ad_ench(mtmp, mattk, &g.youmonst, &mhm);
+ if (mhm.done)
+ return mhm.hitflags;
break;
case AD_POLY:
if (uncancelled && Maybe_Half_Phys(mhm.damage) < (Upolyd ? u.mh : u.uhp))
}
}
+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.
- replace "break" with return
if (mhm.done)
return mhm.hitflags;
break;
- case AD_ENCH: /* KMH -- remove enchantment (disenchanter) */
- /* there's no msomearmor() function, so just do damage */
- /* if (negated) break; */
+ case AD_ENCH:
+ mhitm_ad_ench(&g.youmonst, mattk, mdef, &mhm);
+ if (mhm.done)
+ return mhm.hitflags;
break;
case AD_SLOW:
if (!negated && mdef->mspeed != MSLOW) {