Unify ad_samu

This commit is contained in:
Pasi Kallinen
2020-12-04 09:30:21 +02:00
parent d679d3a029
commit 4118a7ea44
3 changed files with 31 additions and 7 deletions
+1
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_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_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_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 boolean FDECL(do_stone_u, (struct monst *));
E void FDECL(do_stone_mon, (struct monst *, struct attack *, struct monst *, struct mhitm_data *)); E void FDECL(do_stone_mon, (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));
+3 -7
View File
@@ -1165,14 +1165,10 @@ register struct attack *mattk;
break; break;
case AD_SAMU: case AD_SAMU:
hitmsg(mtmp, mattk); mhitm_ad_samu(mtmp, mattk, &g.youmonst, &mhm);
/* when the Wizard or quest nemesis hits, there's a 1/20 chance if (mhm.done)
to steal a quest artifact (any, not just the one for the hero's return mhm.hitflags;
own role) or the Amulet or one of the invocation tools */
if (!rn2(20))
stealamulet(mtmp);
break; break;
case AD_TLPT: case AD_TLPT:
mhitm_ad_tlpt(mtmp, mattk, &g.youmonst, &mhm); mhitm_ad_tlpt(mtmp, mattk, &g.youmonst, &mhm);
if (mhm.done) if (mhm.done)
+27
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. /* 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