Unify ad_samu

This commit is contained in:
Pasi Kallinen
2020-12-01 11:28:41 +02:00
parent d679d3a029
commit 4118a7ea44
3 changed files with 31 additions and 7 deletions

View File

@@ -2792,6 +2792,7 @@ E void FDECL(mhitm_ad_heal, (struct monst *, struct attack *, struct monst *, st
E void FDECL(mhitm_ad_stun, (struct monst *, struct attack *, struct monst *, struct mhitm_data *));
E void FDECL(mhitm_ad_legs, (struct monst *, struct attack *, struct monst *, struct mhitm_data *));
E void FDECL(mhitm_ad_dgst, (struct monst *, struct attack *, struct monst *, struct mhitm_data *));
E void FDECL(mhitm_ad_samu, (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));

View File

@@ -1165,14 +1165,10 @@ register struct attack *mattk;
break;
case AD_SAMU:
hitmsg(mtmp, mattk);
/* when the Wizard or quest nemesis hits, there's a 1/20 chance
to steal a quest artifact (any, not just the one for the hero's
own role) or the Amulet or one of the invocation tools */
if (!rn2(20))
stealamulet(mtmp);
mhitm_ad_samu(mtmp, mattk, &g.youmonst, &mhm);
if (mhm.done)
return mhm.hitflags;
break;
case AD_TLPT:
mhitm_ad_tlpt(mtmp, mattk, &g.youmonst, &mhm);
if (mhm.done)

View File

@@ -3959,6 +3959,33 @@ struct mhitm_data *mhm;
}
}
void
mhitm_ad_samu(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 */
mhm->damage = 0;
} else if (mdef == &g.youmonst) {
/* mhitu */
hitmsg(magr, mattk);
/* when the Wizard or quest nemesis hits, there's a 1/20 chance
to steal a quest artifact (any, not just the one for the hero's
own role) or the Amulet or one of the invocation tools */
if (!rn2(20))
stealamulet(magr);
} else {
/* mhitm */
mhm->damage = 0;
}
}
/* Template for monster hits monster for AD_FOO.
- replace "break" with return
- replace "return" with mhm->done = TRUE