From 01dea35a221314320980b53c7c88bd79a3796a75 Mon Sep 17 00:00:00 2001 From: PatR Date: Fri, 7 Oct 2022 01:07:43 -0700 Subject: [PATCH] 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 --- doc/fixes3-7-0.txt | 4 +++- include/monsters.h | 22 ++++++++++++-------- src/uhitm.c | 51 +++++++++++++++++++++++++++++----------------- 3 files changed, 49 insertions(+), 28 deletions(-) diff --git a/doc/fixes3-7-0.txt b/doc/fixes3-7-0.txt index f2a441b72..1f815d31e 100644 --- a/doc/fixes3-7-0.txt +++ b/doc/fixes3-7-0.txt @@ -1,4 +1,4 @@ -HDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.1049 $ $NHDT-Date: 1664966382 2022/10/05 10:39:42 $ +HDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.1051 $ $NHDT-Date: 1665130022 2022/10/07 08:07:02 $ General Fixes and Modified Features ----------------------------------- @@ -1043,6 +1043,8 @@ hero with exceptional strength (18/01..18/100) retained that when polymorphed into any monster lacking the strongmonst attribute give hero poly'd into a giant 19 strength instead of 18/100 wait for a response after displaying wishing help; affects X11 +guardian nagas' constriction attack could never hit because the two preceding + attacks must both hit and those were mutually exclusive: bite and spit Fixes to 3.7.0-x Problems that Were Exposed Via git Repository diff --git a/include/monsters.h b/include/monsters.h index bf3d7f768..a855fa4d9 100644 --- a/include/monsters.h +++ b/include/monsters.h @@ -1,4 +1,4 @@ -/* NetHack 3.7 monsters.h $NHDT-Date: 1648318980 2022/03/26 18:23:00 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.97 $ */ +/* NetHack 3.7 monsters.h $NHDT-Date: 1665130023 2022/10/07 08:07:03 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.103 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Michael Allison, 2006. */ /* NetHack may be freely redistributed. See license for details. */ @@ -1707,8 +1707,8 @@ M1_NOLIMBS | M1_SLITHY | M1_THICK_HIDE | M1_NOTAKE | M1_OMNIVORE, M2_STRONG, 0, 4, CLR_GREEN, GUARDIAN_NAGA_HATCHLING), MON("red naga", S_NAGA, LVL(6, 12, 4, 0, -4), (G_GENO | 1), - A(ATTK(AT_BITE, AD_PHYS, 2, 4), ATTK(AT_BREA, AD_FIRE, 2, 6), NO_ATTK, - NO_ATTK, NO_ATTK, NO_ATTK), + A(ATTK(AT_BITE, AD_PHYS, 2, 4), ATTK(AT_BREA, AD_FIRE, 2, 6), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), SIZ(2600, 400, MS_MUMBLE, MZ_HUGE), MR_FIRE | MR_POISON, MR_FIRE | MR_POISON, M1_NOLIMBS | M1_SLITHY | M1_THICK_HIDE | M1_OVIPAROUS | M1_NOTAKE | M1_OMNIVORE, @@ -1722,19 +1722,25 @@ | M1_NOTAKE | M1_CARNIVORE, M2_STRONG, 0, 10, CLR_BLACK, BLACK_NAGA), MON("golden naga", S_NAGA, LVL(10, 14, 2, 70, 5), (G_GENO | 1), - A(ATTK(AT_BITE, AD_PHYS, 2, 6), ATTK(AT_MAGC, AD_SPEL, 4, 6), NO_ATTK, - NO_ATTK, NO_ATTK, NO_ATTK), + A(ATTK(AT_BITE, AD_PHYS, 2, 6), ATTK(AT_MAGC, AD_SPEL, 4, 6), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), SIZ(2600, 400, MS_MUMBLE, MZ_HUGE), MR_POISON, MR_POISON, M1_NOLIMBS | M1_SLITHY | M1_THICK_HIDE | M1_OVIPAROUS | M1_NOTAKE | M1_OMNIVORE, M2_STRONG, 0, 13, HI_GOLD, GOLDEN_NAGA), + /* 3.7: guardian naga used to have three attacks: bite, spit, hug + but in order for the hug to succeed the two preceding attacks had + to have hit, and its not possible to both bite and spit, hence + the hug never hit; change to spit, bite, touch, hug; if the bite + and touch hit, the hug will too */ MON("guardian naga", S_NAGA, LVL(12, 16, 0, 50, 7), (G_GENO | 1), - A(ATTK(AT_BITE, AD_PLYS, 1, 6), ATTK(AT_SPIT, AD_DRST, 1, 6), - ATTK(AT_HUGS, AD_PHYS, 2, 4), NO_ATTK, NO_ATTK, NO_ATTK), + A(ATTK(AT_SPIT, AD_DRST, 1, 6), ATTK(AT_BITE, AD_PLYS, 1, 6), + ATTK(AT_TUCH, AD_PHYS, 0, 0), ATTK(AT_HUGS, AD_WRAP, 2, 4), + NO_ATTK, NO_ATTK), SIZ(2600, 400, MS_MUMBLE, MZ_HUGE), MR_POISON, MR_POISON, M1_NOLIMBS | M1_SLITHY | M1_THICK_HIDE | M1_OVIPAROUS | M1_POIS | M1_NOTAKE | M1_OMNIVORE, - M2_STRONG, 0, 16, CLR_GREEN, GUARDIAN_NAGA), + M2_STRONG, 0, 17, CLR_GREEN, GUARDIAN_NAGA), /* * Ogres */ diff --git a/src/uhitm.c b/src/uhitm.c index ea6449e67..a267a43c7 100644 --- a/src/uhitm.c +++ b/src/uhitm.c @@ -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;