Unify ad_drst
This commit is contained in:
@@ -2768,6 +2768,7 @@ E void FDECL(mhitm_ad_sgld, (struct monst *, struct attack *, struct monst *, st
|
|||||||
E void FDECL(mhitm_ad_tlpt, (struct monst *, struct attack *, struct monst *, struct mhitm_data *));
|
E void FDECL(mhitm_ad_tlpt, (struct monst *, struct attack *, struct monst *, struct mhitm_data *));
|
||||||
E void FDECL(mhitm_ad_blnd, (struct monst *, struct attack *, struct monst *, struct mhitm_data *));
|
E void FDECL(mhitm_ad_blnd, (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_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 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,
|
||||||
|
|||||||
21
src/mhitm.c
21
src/mhitm.c
@@ -1216,24 +1216,9 @@ int dieroll;
|
|||||||
case AD_DRST:
|
case AD_DRST:
|
||||||
case AD_DRDX:
|
case AD_DRDX:
|
||||||
case AD_DRCO:
|
case AD_DRCO:
|
||||||
if (!cancelled && !rn2(8)) {
|
mhitm_ad_drst(magr, mattk, mdef, &mhm);
|
||||||
if (g.vis && canspotmon(magr))
|
if (mhm.done)
|
||||||
pline("%s %s was poisoned!", s_suffix(Monnam(magr)),
|
return mhm.hitflags;
|
||||||
mpoisons_subj(magr, mattk));
|
|
||||||
if (resists_poison(mdef)) {
|
|
||||||
if (g.vis && canspotmon(mdef) && canspotmon(magr))
|
|
||||||
pline_The("poison doesn't seem to affect %s.",
|
|
||||||
mon_nam(mdef));
|
|
||||||
} else {
|
|
||||||
if (rn2(10))
|
|
||||||
mhm.damage += rn1(10, 6);
|
|
||||||
else {
|
|
||||||
if (g.vis && canspotmon(mdef))
|
|
||||||
pline_The("poison was deadly...");
|
|
||||||
mhm.damage = mdef->mhp;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case AD_DRIN:
|
case AD_DRIN:
|
||||||
if (g.notonhead || !has_head(pd)) {
|
if (g.notonhead || !has_head(pd)) {
|
||||||
|
|||||||
15
src/mhitu.c
15
src/mhitu.c
@@ -1130,20 +1130,11 @@ register struct attack *mattk;
|
|||||||
return mhm.hitflags;
|
return mhm.hitflags;
|
||||||
break;
|
break;
|
||||||
case AD_DRST:
|
case AD_DRST:
|
||||||
ptmp = A_STR;
|
|
||||||
goto dopois;
|
|
||||||
case AD_DRDX:
|
case AD_DRDX:
|
||||||
ptmp = A_DEX;
|
|
||||||
goto dopois;
|
|
||||||
case AD_DRCO:
|
case AD_DRCO:
|
||||||
ptmp = A_CON;
|
mhitm_ad_drst(mtmp, mattk, &g.youmonst, &mhm);
|
||||||
dopois:
|
if (mhm.done)
|
||||||
hitmsg(mtmp, mattk);
|
return mhm.hitflags;
|
||||||
if (uncancelled && !rn2(8)) {
|
|
||||||
Sprintf(buf, "%s %s", s_suffix(Monnam(mtmp)),
|
|
||||||
mpoisons_subj(mtmp, mattk));
|
|
||||||
poisoned(buf, ptmp, mdat->mname, 30, FALSE);
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case AD_DRIN:
|
case AD_DRIN:
|
||||||
hitmsg(mtmp, mattk);
|
hitmsg(mtmp, mattk);
|
||||||
|
|||||||
87
src/uhitm.c
87
src/uhitm.c
@@ -2566,6 +2566,78 @@ struct mhitm_data *mhm;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
mhitm_ad_drst(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 */
|
||||||
|
int armpro = magic_negation(mdef);
|
||||||
|
/* since hero can't be cancelled, only defender's armor applies */
|
||||||
|
boolean negated = !(rn2(10) >= 3 * armpro);
|
||||||
|
|
||||||
|
if (!negated && !rn2(8)) {
|
||||||
|
Your("%s was poisoned!", mpoisons_subj(magr, mattk));
|
||||||
|
if (resists_poison(mdef)) {
|
||||||
|
pline_The("poison doesn't seem to affect %s.", mon_nam(mdef));
|
||||||
|
} else {
|
||||||
|
if (!rn2(10)) {
|
||||||
|
Your("poison was deadly...");
|
||||||
|
mhm->damage = mdef->mhp;
|
||||||
|
} else
|
||||||
|
mhm->damage += rn1(10, 6);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (mdef == &g.youmonst) {
|
||||||
|
/* mhitu */
|
||||||
|
int armpro = magic_negation(mdef);
|
||||||
|
boolean uncancelled = !magr->mcan && (rn2(10) >= 3 * armpro);
|
||||||
|
int ptmp;
|
||||||
|
char buf[BUFSZ];
|
||||||
|
|
||||||
|
switch (mattk->adtyp) {
|
||||||
|
case AD_DRST: ptmp = A_STR; break;
|
||||||
|
case AD_DRDX: ptmp = A_DEX; break;
|
||||||
|
case AD_DRCO: ptmp = A_CON; break;
|
||||||
|
}
|
||||||
|
hitmsg(magr, mattk);
|
||||||
|
if (uncancelled && !rn2(8)) {
|
||||||
|
Sprintf(buf, "%s %s", s_suffix(Monnam(magr)),
|
||||||
|
mpoisons_subj(magr, mattk));
|
||||||
|
poisoned(buf, ptmp, pa->mname, 30, FALSE);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
/* mhitm */
|
||||||
|
int armpro = magic_negation(mdef);
|
||||||
|
boolean cancelled = magr->mcan || !(rn2(10) >= 3 * armpro);
|
||||||
|
|
||||||
|
if (!cancelled && !rn2(8)) {
|
||||||
|
if (g.vis && canspotmon(magr))
|
||||||
|
pline("%s %s was poisoned!", s_suffix(Monnam(magr)),
|
||||||
|
mpoisons_subj(magr, mattk));
|
||||||
|
if (resists_poison(mdef)) {
|
||||||
|
if (g.vis && canspotmon(mdef) && canspotmon(magr))
|
||||||
|
pline_The("poison doesn't seem to affect %s.",
|
||||||
|
mon_nam(mdef));
|
||||||
|
} else {
|
||||||
|
if (rn2(10))
|
||||||
|
mhm->damage += rn1(10, 6);
|
||||||
|
else {
|
||||||
|
if (g.vis && canspotmon(mdef))
|
||||||
|
pline_The("poison was deadly...");
|
||||||
|
mhm->damage = mdef->mhp;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* Template for monster hits monster for AD_FOO.
|
/* Template for monster hits monster for AD_FOO.
|
||||||
- replace "break" with return
|
- replace "break" with return
|
||||||
- replace "return" with mhm->done = TRUE
|
- replace "return" with mhm->done = TRUE
|
||||||
@@ -2743,18 +2815,9 @@ int specialdmg; /* blessed and/or silver bonus against various things */
|
|||||||
case AD_DRST:
|
case AD_DRST:
|
||||||
case AD_DRDX:
|
case AD_DRDX:
|
||||||
case AD_DRCO:
|
case AD_DRCO:
|
||||||
if (!negated && !rn2(8)) {
|
mhitm_ad_drst(&g.youmonst, mattk, mdef, &mhm);
|
||||||
Your("%s was poisoned!", mpoisons_subj(&g.youmonst, mattk));
|
if (mhm.done)
|
||||||
if (resists_poison(mdef)) {
|
return mhm.hitflags;
|
||||||
pline_The("poison doesn't seem to affect %s.", mon_nam(mdef));
|
|
||||||
} else {
|
|
||||||
if (!rn2(10)) {
|
|
||||||
Your("poison was deadly...");
|
|
||||||
mhm.damage = mdef->mhp;
|
|
||||||
} else
|
|
||||||
mhm.damage += rn1(10, 6);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case AD_DRIN: {
|
case AD_DRIN: {
|
||||||
struct obj *helmet;
|
struct obj *helmet;
|
||||||
|
|||||||
Reference in New Issue
Block a user