Unify ad_wrap
This commit is contained in:
@@ -2772,6 +2772,7 @@ E void FDECL(mhitm_ad_curs, (struct monst *, struct attack *, struct monst *, st
|
|||||||
E void FDECL(mhitm_ad_drst, (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 void FDECL(mhitm_ad_drin, (struct monst *, struct attack *, struct monst *, struct mhitm_data *));
|
E void FDECL(mhitm_ad_drin, (struct monst *, struct attack *, struct monst *, struct mhitm_data *));
|
||||||
E void FDECL(mhitm_ad_stck, (struct monst *, struct attack *, struct monst *, struct mhitm_data *));
|
E void FDECL(mhitm_ad_stck, (struct monst *, struct attack *, struct monst *, struct mhitm_data *));
|
||||||
|
E void FDECL(mhitm_ad_wrap, (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,
|
||||||
|
|||||||
+4
-3
@@ -1250,9 +1250,10 @@ int dieroll;
|
|||||||
if (mhm.done)
|
if (mhm.done)
|
||||||
return mhm.hitflags;
|
return mhm.hitflags;
|
||||||
break;
|
break;
|
||||||
case AD_WRAP: /* monsters cannot grab one another, it's too hard */
|
case AD_WRAP:
|
||||||
if (magr->mcan)
|
mhitm_ad_wrap(magr, mattk, mdef, &mhm);
|
||||||
mhm.damage = 0;
|
if (mhm.done)
|
||||||
|
return mhm.hitflags;
|
||||||
break;
|
break;
|
||||||
case AD_ENCH:
|
case AD_ENCH:
|
||||||
/* there's no msomearmor() function, so just do damage */
|
/* there's no msomearmor() function, so just do damage */
|
||||||
|
|||||||
+3
-32
@@ -1239,38 +1239,9 @@ register struct attack *mattk;
|
|||||||
return mhm.hitflags;
|
return mhm.hitflags;
|
||||||
break;
|
break;
|
||||||
case AD_WRAP:
|
case AD_WRAP:
|
||||||
if ((!mtmp->mcan || u.ustuck == mtmp) && !sticks(g.youmonst.data)) {
|
mhitm_ad_wrap(mtmp, mattk, &g.youmonst, &mhm);
|
||||||
if (!u.ustuck && !rn2(10)) {
|
if (mhm.done)
|
||||||
if (u_slip_free(mtmp, mattk)) {
|
return mhm.hitflags;
|
||||||
mhm.damage = 0;
|
|
||||||
} else {
|
|
||||||
set_ustuck(mtmp); /* before message, for botl update */
|
|
||||||
pline("%s swings itself around you!", Monnam(mtmp));
|
|
||||||
}
|
|
||||||
} else if (u.ustuck == mtmp) {
|
|
||||||
if (is_pool(mtmp->mx, mtmp->my) && !Swimming && !Amphibious) {
|
|
||||||
boolean moat = (levl[mtmp->mx][mtmp->my].typ != POOL)
|
|
||||||
&& (levl[mtmp->mx][mtmp->my].typ != WATER)
|
|
||||||
&& !Is_medusa_level(&u.uz)
|
|
||||||
&& !Is_waterlevel(&u.uz);
|
|
||||||
|
|
||||||
pline("%s drowns you...", Monnam(mtmp));
|
|
||||||
g.killer.format = KILLED_BY_AN;
|
|
||||||
Sprintf(g.killer.name, "%s by %s",
|
|
||||||
moat ? "moat" : "pool of water",
|
|
||||||
an(mtmp->data->mname));
|
|
||||||
done(DROWNING);
|
|
||||||
} else if (mattk->aatyp == AT_HUGS) {
|
|
||||||
You("are being crushed.");
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
mhm.damage = 0;
|
|
||||||
if (flags.verbose)
|
|
||||||
pline("%s brushes against your %s.", Monnam(mtmp),
|
|
||||||
body_part(LEG));
|
|
||||||
}
|
|
||||||
} else
|
|
||||||
mhm.damage = 0;
|
|
||||||
break;
|
break;
|
||||||
case AD_WERE:
|
case AD_WERE:
|
||||||
hitmsg(mtmp, mattk);
|
hitmsg(mtmp, mattk);
|
||||||
|
|||||||
+79
-24
@@ -2775,6 +2775,82 @@ struct mhitm_data *mhm;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
mhitm_ad_wrap(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 */
|
||||||
|
if (!sticks(pd)) {
|
||||||
|
if (!u.ustuck && !rn2(10)) {
|
||||||
|
if (m_slips_free(mdef, mattk)) {
|
||||||
|
mhm->damage = 0;
|
||||||
|
} else {
|
||||||
|
You("swing yourself around %s!", mon_nam(mdef));
|
||||||
|
set_ustuck(mdef);
|
||||||
|
}
|
||||||
|
} else if (u.ustuck == mdef) {
|
||||||
|
/* Monsters don't wear amulets of magical breathing */
|
||||||
|
if (is_pool(u.ux, u.uy) && !is_swimmer(pd)
|
||||||
|
&& !amphibious(pd)) {
|
||||||
|
You("drown %s...", mon_nam(mdef));
|
||||||
|
mhm->damage = mdef->mhp;
|
||||||
|
} else if (mattk->aatyp == AT_HUGS)
|
||||||
|
pline("%s is being crushed.", Monnam(mdef));
|
||||||
|
} else {
|
||||||
|
mhm->damage = 0;
|
||||||
|
if (flags.verbose)
|
||||||
|
You("brush against %s %s.", s_suffix(mon_nam(mdef)),
|
||||||
|
mbodypart(mdef, LEG));
|
||||||
|
}
|
||||||
|
} else
|
||||||
|
mhm->damage = 0;
|
||||||
|
} else if (mdef == &g.youmonst) {
|
||||||
|
/* mhitu */
|
||||||
|
if ((!magr->mcan || u.ustuck == magr) && !sticks(pd)) {
|
||||||
|
if (!u.ustuck && !rn2(10)) {
|
||||||
|
if (u_slip_free(magr, mattk)) {
|
||||||
|
mhm->damage = 0;
|
||||||
|
} else {
|
||||||
|
set_ustuck(magr); /* before message, for botl update */
|
||||||
|
pline("%s swings itself around you!", Monnam(magr));
|
||||||
|
}
|
||||||
|
} else if (u.ustuck == magr) {
|
||||||
|
if (is_pool(magr->mx, magr->my) && !Swimming && !Amphibious) {
|
||||||
|
boolean moat = (levl[magr->mx][magr->my].typ != POOL)
|
||||||
|
&& (levl[magr->mx][magr->my].typ != WATER)
|
||||||
|
&& !Is_medusa_level(&u.uz)
|
||||||
|
&& !Is_waterlevel(&u.uz);
|
||||||
|
|
||||||
|
pline("%s drowns you...", Monnam(magr));
|
||||||
|
g.killer.format = KILLED_BY_AN;
|
||||||
|
Sprintf(g.killer.name, "%s by %s",
|
||||||
|
moat ? "moat" : "pool of water",
|
||||||
|
an(magr->data->mname));
|
||||||
|
done(DROWNING);
|
||||||
|
} else if (mattk->aatyp == AT_HUGS) {
|
||||||
|
You("are being crushed.");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
mhm->damage = 0;
|
||||||
|
if (flags.verbose)
|
||||||
|
pline("%s brushes against your %s.", Monnam(magr),
|
||||||
|
body_part(LEG));
|
||||||
|
}
|
||||||
|
} else
|
||||||
|
mhm->damage = 0;
|
||||||
|
} else {
|
||||||
|
/* mhitm */
|
||||||
|
if (magr->mcan)
|
||||||
|
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
|
||||||
@@ -2968,30 +3044,9 @@ int specialdmg; /* blessed and/or silver bonus against various things */
|
|||||||
return mhm.hitflags;
|
return mhm.hitflags;
|
||||||
break;
|
break;
|
||||||
case AD_WRAP:
|
case AD_WRAP:
|
||||||
if (!sticks(pd)) {
|
mhitm_ad_wrap(&g.youmonst, mattk, mdef, &mhm);
|
||||||
if (!u.ustuck && !rn2(10)) {
|
if (mhm.done)
|
||||||
if (m_slips_free(mdef, mattk)) {
|
return mhm.hitflags;
|
||||||
mhm.damage = 0;
|
|
||||||
} else {
|
|
||||||
You("swing yourself around %s!", mon_nam(mdef));
|
|
||||||
set_ustuck(mdef);
|
|
||||||
}
|
|
||||||
} else if (u.ustuck == mdef) {
|
|
||||||
/* Monsters don't wear amulets of magical breathing */
|
|
||||||
if (is_pool(u.ux, u.uy) && !is_swimmer(pd)
|
|
||||||
&& !amphibious(pd)) {
|
|
||||||
You("drown %s...", mon_nam(mdef));
|
|
||||||
mhm.damage = mdef->mhp;
|
|
||||||
} else if (mattk->aatyp == AT_HUGS)
|
|
||||||
pline("%s is being crushed.", Monnam(mdef));
|
|
||||||
} else {
|
|
||||||
mhm.damage = 0;
|
|
||||||
if (flags.verbose)
|
|
||||||
You("brush against %s %s.", s_suffix(mon_nam(mdef)),
|
|
||||||
mbodypart(mdef, LEG));
|
|
||||||
}
|
|
||||||
} else
|
|
||||||
mhm.damage = 0;
|
|
||||||
break;
|
break;
|
||||||
case AD_PLYS:
|
case AD_PLYS:
|
||||||
if (!negated && mdef->mcanmove && !rn2(3) && mhm.damage < mdef->mhp) {
|
if (!negated && mdef->mcanmove && !rn2(3) && mhm.damage < mdef->mhp) {
|
||||||
|
|||||||
Reference in New Issue
Block a user