Unify ad_elec
This commit is contained in:
@@ -2762,6 +2762,7 @@ E void FDECL(mhitm_ad_dren, (struct monst *, struct attack *, struct monst *, st
|
|||||||
E void FDECL(mhitm_ad_drli, (struct monst *, struct attack *, struct monst *, struct mhitm_data *));
|
E void FDECL(mhitm_ad_drli, (struct monst *, struct attack *, struct monst *, struct mhitm_data *));
|
||||||
E void FDECL(mhitm_ad_fire, (struct monst *, struct attack *, struct monst *, struct mhitm_data *));
|
E void FDECL(mhitm_ad_fire, (struct monst *, struct attack *, struct monst *, struct mhitm_data *));
|
||||||
E void FDECL(mhitm_ad_cold, (struct monst *, struct attack *, struct monst *, struct mhitm_data *));
|
E void FDECL(mhitm_ad_cold, (struct monst *, struct attack *, struct monst *, struct mhitm_data *));
|
||||||
|
E void FDECL(mhitm_ad_elec, (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
-16
@@ -1026,22 +1026,9 @@ int dieroll;
|
|||||||
return mhm.hitflags;
|
return mhm.hitflags;
|
||||||
break;
|
break;
|
||||||
case AD_ELEC:
|
case AD_ELEC:
|
||||||
if (cancelled) {
|
mhitm_ad_elec(magr, mattk, mdef, &mhm);
|
||||||
mhm.damage = 0;
|
if (mhm.done)
|
||||||
break;
|
return mhm.hitflags;
|
||||||
}
|
|
||||||
if (g.vis && canseemon(mdef))
|
|
||||||
pline("%s gets zapped!", Monnam(mdef));
|
|
||||||
mhm.damage += destroy_mitem(mdef, WAND_CLASS, AD_ELEC);
|
|
||||||
if (resists_elec(mdef)) {
|
|
||||||
if (g.vis && canseemon(mdef))
|
|
||||||
pline_The("zap doesn't shock %s!", mon_nam(mdef));
|
|
||||||
shieldeff(mdef->mx, mdef->my);
|
|
||||||
golemeffects(mdef, AD_ELEC, mhm.damage);
|
|
||||||
mhm.damage = 0;
|
|
||||||
}
|
|
||||||
/* only rings damage resistant players in destroy_item */
|
|
||||||
mhm.damage += destroy_mitem(mdef, RING_CLASS, AD_ELEC);
|
|
||||||
break;
|
break;
|
||||||
case AD_ACID:
|
case AD_ACID:
|
||||||
if (magr->mcan) {
|
if (magr->mcan) {
|
||||||
|
|||||||
+3
-13
@@ -1108,19 +1108,9 @@ register struct attack *mattk;
|
|||||||
return mhm.hitflags;
|
return mhm.hitflags;
|
||||||
break;
|
break;
|
||||||
case AD_ELEC:
|
case AD_ELEC:
|
||||||
hitmsg(mtmp, mattk);
|
mhitm_ad_elec(mtmp, mattk, &g.youmonst, &mhm);
|
||||||
if (uncancelled) {
|
if (mhm.done)
|
||||||
You("get zapped!");
|
return mhm.hitflags;
|
||||||
if (Shock_resistance) {
|
|
||||||
pline_The("zap doesn't shock you!");
|
|
||||||
mhm.damage = 0;
|
|
||||||
}
|
|
||||||
if ((int) mtmp->m_lev > rn2(20))
|
|
||||||
destroy_item(WAND_CLASS, AD_ELEC);
|
|
||||||
if ((int) mtmp->m_lev > rn2(20))
|
|
||||||
destroy_item(RING_CLASS, AD_ELEC);
|
|
||||||
} else
|
|
||||||
mhm.damage = 0;
|
|
||||||
break;
|
break;
|
||||||
case AD_SLEE:
|
case AD_SLEE:
|
||||||
hitmsg(mtmp, mattk);
|
hitmsg(mtmp, mattk);
|
||||||
|
|||||||
+76
-16
@@ -2140,6 +2140,79 @@ struct mhitm_data *mhm;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
mhitm_ad_elec(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) {
|
||||||
|
mhm->damage = 0;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!Blind)
|
||||||
|
pline("%s is zapped!", Monnam(mdef));
|
||||||
|
mhm->damage += destroy_mitem(mdef, WAND_CLASS, AD_ELEC);
|
||||||
|
if (resists_elec(mdef)) {
|
||||||
|
if (!Blind)
|
||||||
|
pline_The("zap doesn't shock %s!", mon_nam(mdef));
|
||||||
|
golemeffects(mdef, AD_ELEC, mhm->damage);
|
||||||
|
shieldeff(mdef->mx, mdef->my);
|
||||||
|
mhm->damage = 0;
|
||||||
|
}
|
||||||
|
/* only rings damage resistant players in destroy_item */
|
||||||
|
mhm->damage += destroy_mitem(mdef, RING_CLASS, AD_ELEC);
|
||||||
|
} else if (mdef == &g.youmonst) {
|
||||||
|
/* mhitu */
|
||||||
|
int armpro = magic_negation(mdef);
|
||||||
|
boolean uncancelled = !magr->mcan && (rn2(10) >= 3 * armpro);
|
||||||
|
|
||||||
|
hitmsg(magr, mattk);
|
||||||
|
if (uncancelled) {
|
||||||
|
You("get zapped!");
|
||||||
|
if (Shock_resistance) {
|
||||||
|
pline_The("zap doesn't shock you!");
|
||||||
|
mhm->damage = 0;
|
||||||
|
}
|
||||||
|
if ((int) magr->m_lev > rn2(20))
|
||||||
|
destroy_item(WAND_CLASS, AD_ELEC);
|
||||||
|
if ((int) magr->m_lev > rn2(20))
|
||||||
|
destroy_item(RING_CLASS, AD_ELEC);
|
||||||
|
} else
|
||||||
|
mhm->damage = 0;
|
||||||
|
} else {
|
||||||
|
/* mhitm */
|
||||||
|
int armpro = magic_negation(mdef);
|
||||||
|
boolean cancelled = magr->mcan || !(rn2(10) >= 3 * armpro);
|
||||||
|
|
||||||
|
if (cancelled) {
|
||||||
|
mhm->damage = 0;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (g.vis && canseemon(mdef))
|
||||||
|
pline("%s gets zapped!", Monnam(mdef));
|
||||||
|
mhm->damage += destroy_mitem(mdef, WAND_CLASS, AD_ELEC);
|
||||||
|
if (resists_elec(mdef)) {
|
||||||
|
if (g.vis && canseemon(mdef))
|
||||||
|
pline_The("zap doesn't shock %s!", mon_nam(mdef));
|
||||||
|
shieldeff(mdef->mx, mdef->my);
|
||||||
|
golemeffects(mdef, AD_ELEC, mhm->damage);
|
||||||
|
mhm->damage = 0;
|
||||||
|
}
|
||||||
|
/* only rings damage resistant players in destroy_item */
|
||||||
|
mhm->damage += destroy_mitem(mdef, RING_CLASS, AD_ELEC);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Template for monster hits monster for AD_FOO.
|
/* Template for monster hits monster for AD_FOO.
|
||||||
- replace "break" with return
|
- replace "break" with return
|
||||||
@@ -2251,22 +2324,9 @@ int specialdmg; /* blessed and/or silver bonus against various things */
|
|||||||
return mhm.hitflags;
|
return mhm.hitflags;
|
||||||
break;
|
break;
|
||||||
case AD_ELEC:
|
case AD_ELEC:
|
||||||
if (negated) {
|
mhitm_ad_elec(&g.youmonst, mattk, mdef, &mhm);
|
||||||
mhm.damage = 0;
|
if (mhm.done)
|
||||||
break;
|
return mhm.hitflags;
|
||||||
}
|
|
||||||
if (!Blind)
|
|
||||||
pline("%s is zapped!", Monnam(mdef));
|
|
||||||
mhm.damage += destroy_mitem(mdef, WAND_CLASS, AD_ELEC);
|
|
||||||
if (resists_elec(mdef)) {
|
|
||||||
if (!Blind)
|
|
||||||
pline_The("zap doesn't shock %s!", mon_nam(mdef));
|
|
||||||
golemeffects(mdef, AD_ELEC, mhm.damage);
|
|
||||||
shieldeff(mdef->mx, mdef->my);
|
|
||||||
mhm.damage = 0;
|
|
||||||
}
|
|
||||||
/* only rings damage resistant players in destroy_item */
|
|
||||||
mhm.damage += destroy_mitem(mdef, RING_CLASS, AD_ELEC);
|
|
||||||
break;
|
break;
|
||||||
case AD_ACID:
|
case AD_ACID:
|
||||||
if (resists_acid(mdef))
|
if (resists_acid(mdef))
|
||||||
|
|||||||
Reference in New Issue
Block a user