fix github issue #894 - guardian nagas can't grab

Issue reported by eakaye:  for a 'hugs' attack to succeed, the
monster must have at least three attacks and the two preceding the
hug attack need to both hit.  Guardian nagas had three attacks but
the first was melee 'bite' and the second was ranged 'spit'.  Those
are mutually exclusive, so they would never both hit and nagas never
grabbed their prey.

Make the spit attack be first, the bite attack be second, insert a
touch attack for 0 damage third, and make the hug be fourth.  Also,
change their hug damage type from 'phys' to 'wrap'.  The first and
2nd+3rd+4th are still mutually exclusive.

The resulting message feedback left something to be desired and has
been tweaked.

The difficulty-level formula used by deprecated 'makedefs -m' now
generates 17 rather than 16 for guardian naga so I changed revised
monster to match.  They are definitely more difficult now that their
constriction attack has a chance to hit.

Fixes #894
This commit is contained in:
PatR
2022-10-07 01:07:43 -07:00
parent 14ef7b6005
commit 01dea35a22
3 changed files with 49 additions and 28 deletions

View File

@@ -1,4 +1,4 @@
/* NetHack 3.7 uhitm.c $NHDT-Date: 1664966387 2022/10/05 10:39:47 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.365 $ */
/* NetHack 3.7 uhitm.c $NHDT-Date: 1665130027 2022/10/07 08:07:07 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.366 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Robert Patrick Rankin, 2012. */
/* NetHack may be freely redistributed. See license for details. */
@@ -1648,8 +1648,8 @@ m_slips_free(struct monst *mdef, struct attack *mattk)
if (obj && (obj->greased || obj->otyp == OILSKIN_CLOAK)
&& (!obj->cursed || rn2(3))) {
You("%s %s %s %s!",
mattk->adtyp == AD_WRAP ? "slip off of"
: "grab, but cannot hold onto",
(mattk->adtyp == AD_WRAP) ? "slip off of"
: "grab, but cannot hold onto",
s_suffix(mon_nam(mdef)), obj->greased ? "greased" : "slippery",
/* avoid "slippery slippery cloak"
for undiscovered oilskin cloak */
@@ -2844,10 +2844,12 @@ mhitm_ad_stck(
}
void
mhitm_ad_wrap(struct monst *magr, struct attack *mattk, struct monst *mdef,
struct mhitm_data *mhm)
mhitm_ad_wrap(
struct monst *magr, struct attack *mattk,
struct monst *mdef, struct mhitm_data *mhm)
{
struct permonst *pd = mdef->data;
struct permonst *pd = mdef->data, *pa = magr->data;
boolean coil = slithy(pa) && (pa->mlet == S_SNAKE || pa->mlet == S_NAGA);
if (magr == &g.youmonst) {
/* uhitm */
@@ -2856,7 +2858,8 @@ mhitm_ad_wrap(struct monst *magr, struct attack *mattk, struct monst *mdef,
if (m_slips_free(mdef, mattk)) {
mhm->damage = 0;
} else {
You("swing yourself around %s!", mon_nam(mdef));
You("%s yourself around %s!",
coil ? "coil" : "swing", mon_nam(mdef));
set_ustuck(mdef);
}
} else if (u.ustuck == mdef) {
@@ -2869,9 +2872,13 @@ mhitm_ad_wrap(struct monst *magr, struct attack *mattk, struct monst *mdef,
pline("%s is being crushed.", Monnam(mdef));
} else {
mhm->damage = 0;
if (Verbose(4, mhitm_ad_wrap1))
You("brush against %s %s.", s_suffix(mon_nam(mdef)),
mbodypart(mdef, LEG));
if (Verbose(4, mhitm_ad_wrap1)) {
if (coil)
You("brush against %s.", mon_nam(mdef));
else
You("brush against %s %s.", s_suffix(mon_nam(mdef)),
mbodypart(mdef, LEG));
}
}
} else
mhm->damage = 0;
@@ -2883,8 +2890,8 @@ mhitm_ad_wrap(struct monst *magr, struct attack *mattk, struct monst *mdef,
mhm->damage = 0;
} else {
set_ustuck(magr); /* before message, for botl update */
urgent_pline("%s swings itself around you!",
Monnam(magr));
urgent_pline("%s %s itself around you!",
Some_Monnam(magr), coil ? "coils" : "swings");
}
} else if (u.ustuck == magr) {
if (is_pool(magr->mx, magr->my) && !Swimming && !Amphibious) {
@@ -2904,9 +2911,13 @@ mhitm_ad_wrap(struct monst *magr, struct attack *mattk, struct monst *mdef,
}
} else {
mhm->damage = 0;
if (Verbose(4, mhitm_ad_wrap2))
pline("%s brushes against your %s.", Monnam(magr),
body_part(LEG));
if (Verbose(4, mhitm_ad_wrap2)) {
if (coil)
pline("%s brushes against you.", Monnam(magr));
else
pline("%s brushes against your %s.", Monnam(magr),
body_part(LEG));
}
}
} else
mhm->damage = 0;
@@ -2918,8 +2929,9 @@ mhitm_ad_wrap(struct monst *magr, struct attack *mattk, struct monst *mdef,
}
void
mhitm_ad_plys(struct monst *magr, struct attack *mattk, struct monst *mdef,
struct mhitm_data *mhm)
mhitm_ad_plys(
struct monst *magr, struct attack *mattk,
struct monst *mdef, struct mhitm_data *mhm)
{
boolean negated = mhitm_mgc_atk_negated(magr, mdef);
@@ -4170,8 +4182,9 @@ mhitm_ad_ssex(struct monst *magr, struct attack *mattk, struct monst *mdef,
}
void
mhitm_adtyping(struct monst *magr, struct attack *mattk, struct monst *mdef,
struct mhitm_data *mhm)
mhitm_adtyping(
struct monst *magr, struct attack *mattk,
struct monst *mdef, struct mhitm_data *mhm)
{
switch (mattk->adtyp) {
case AD_STUN: mhitm_ad_stun(magr, mattk, mdef, mhm); break;