From b07fe59b3c29b8b7f34dfde521f1a359bcb8dff5 Mon Sep 17 00:00:00 2001 From: PatR Date: Mon, 15 Aug 2022 04:14:36 -0700 Subject: [PATCH] attack/damage by trapper and lurker above Change trappers and lurkers above to remove digestion damage. They fold themselves around rather than swallow the victim. There were are lot of places that assumed that an engulfer which is an animal would swallow and digest the victim. In hindsight, it might have been simpler to take the M1_ANIMAL flag off of trappers and lurkers above. This adds a new digests() predicate for creatures with AT_ENGL+AD_DGST (purple worm) and also enfolds() for AT_ENGL+AD_WRAP (both 't'-class critters). There are several minor fixes mixed in with this. I didn't record them as I went along but the two I remember are 1) if poly'd into a holder and holding on to a monster, the '<' and '>' commands refursed to work; release the held creature first and then treat those commands as normal; 2) throwing a non-weapon while engulfed by an ochre jelly reported "the vanishes into the ochre jelly's /currents/". This needs a lot more testing. I found and fixed multiple minor details before my own testing burned out. --- doc/fixes3-7-0.txt | 6 ++++++ include/mondata.h | 2 ++ include/monsters.h | 22 ++++++++++++-------- src/apply.c | 3 +-- src/detect.c | 8 +++++++- src/dig.c | 4 ++-- src/do.c | 51 +++++++++++++++++++++++++++++++--------------- src/dokick.c | 2 +- src/dothrow.c | 24 ++++++++++++++-------- src/engrave.c | 7 ++++++- src/explode.c | 2 +- src/hack.c | 4 ++-- src/insight.c | 29 ++++++++++++++++++-------- src/mhitm.c | 3 ++- src/mhitu.c | 43 ++++++++++++++++++++++++-------------- src/mon.c | 8 ++++---- src/mondata.c | 3 ++- src/pager.c | 4 ++-- src/pickup.c | 2 +- src/polyself.c | 4 ++-- src/read.c | 2 +- src/spell.c | 26 ++++++++++------------- src/trap.c | 11 +++++----- src/uhitm.c | 7 +++++-- src/zap.c | 2 +- 25 files changed, 179 insertions(+), 100 deletions(-) diff --git a/doc/fixes3-7-0.txt b/doc/fixes3-7-0.txt index b3473abe2..fc9fcd74d 100644 --- a/doc/fixes3-7-0.txt +++ b/doc/fixes3-7-0.txt @@ -1001,6 +1001,12 @@ blind hero was notified when brass lantern burned out even though it isn't on or off can be determined that way so still gives on/off message turn on statushilites automatically if any are defined change poison instakill to damage with attribute and max hp loss +trappers and lurkers above enfold themselves around and crush their victims, + not swallow and digest +attempting to move up or down when poly'd into a holder and holding a monster + rejected the move; release the monster instead +thowing a non-weapon while engulfed by an ochre jelly reported that the item + vanished into the jelly's "currents" Fixes to 3.7.0-x Problems that Were Exposed Via git Repository diff --git a/include/mondata.h b/include/mondata.h index e2cc23895..854ec06ad 100644 --- a/include/mondata.h +++ b/include/mondata.h @@ -86,6 +86,8 @@ #define is_wooden(ptr) ((ptr) == &mons[PM_WOOD_GOLEM]) #define thick_skinned(ptr) (((ptr)->mflags1 & M1_THICK_HIDE) != 0L) #define hug_throttles(ptr) ((ptr) == &mons[PM_ROPE_GOLEM]) +#define digests(ptr) dmgtype_fromattack((ptr), AD_DGST, AT_ENGL) /* purple w*/ +#define enfolds(ptr) dmgtype_fromattack((ptr), AD_WRAP, AT_ENGL) /* 't' */ #define slimeproof(ptr) \ ((ptr) == &mons[PM_GREEN_SLIME] || flaming(ptr) || noncorporeal(ptr)) #define lays_eggs(ptr) (((ptr)->mflags1 & M1_OVIPAROUS) != 0L) diff --git a/include/monsters.h b/include/monsters.h index 294ac954a..0d4f8dbb1 100644 --- a/include/monsters.h +++ b/include/monsters.h @@ -821,17 +821,22 @@ M2_HOSTILE, 0, 8, CLR_RED, SCORPION), /* * trappers, lurkers, &c + * Note: prior to 3.7, these were defined to do AD_DGST damage, + * but they don't swallow their victims into their stomachs and + * digest, they enfold and crush or suffocate. + * The Monster Manual states that someone engulfed by a trapper + * can't use weapons but we do not enforce that. */ MON("lurker above", S_TRAPPER, LVL(10, 3, 3, 0, 0), (G_GENO | 2), - A(ATTK(AT_ENGL, AD_DGST, 1, 8), NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, - NO_ATTK), + A(ATTK(AT_ENGL, AD_WRAP, 1, 6), ATTK(AT_ENGL, AD_PHYS, 2, 6), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), SIZ(800, 350, MS_SILENT, MZ_HUGE), 0, 0, M1_HIDE | M1_FLY | M1_ANIMAL | M1_NOEYES | M1_NOLIMBS | M1_NOHEAD | M1_CARNIVORE, M2_HOSTILE | M2_STALK | M2_STRONG, 0, 12, CLR_GRAY, LURKER_ABOVE), MON("trapper", S_TRAPPER, LVL(12, 3, 3, 0, 0), (G_GENO | 2), - A(ATTK(AT_ENGL, AD_DGST, 1, 10), NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, - NO_ATTK), + A(ATTK(AT_ENGL, AD_WRAP, 1, 8), ATTK(AT_ENGL, AD_PHYS, 2, 8), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), SIZ(800, 350, MS_SILENT, MZ_HUGE), 0, 0, M1_HIDE | M1_ANIMAL | M1_NOEYES | M1_NOLIMBS | M1_NOHEAD | M1_CARNIVORE, @@ -882,15 +887,16 @@ * vortices */ MON("fog cloud", S_VORTEX, LVL(3, 1, 0, 0, 0), (G_GENO | G_NOCORPSE | 2), - A(ATTK(AT_ENGL, AD_PHYS, 1, 6), NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, - NO_ATTK), + A(ATTK(AT_ENGL, AD_PHYS, 1, 6), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), SIZ(0, 0, MS_SILENT, MZ_HUGE), MR_SLEEP | MR_POISON | MR_STONE, 0, M1_FLY | M1_BREATHLESS | M1_NOEYES | M1_NOLIMBS | M1_NOHEAD | M1_MINDLESS | M1_AMORPHOUS | M1_UNSOLID, M2_HOSTILE | M2_NEUTER, 0, 4, CLR_GRAY, FOG_CLOUD), MON("dust vortex", S_VORTEX, LVL(4, 20, 2, 30, 0), - (G_GENO | G_NOCORPSE | 2), A(ATTK(AT_ENGL, AD_BLND, 2, 8), NO_ATTK, - NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), + (G_GENO | G_NOCORPSE | 2), + A(ATTK(AT_ENGL, AD_BLND, 2, 8), + NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK), SIZ(0, 0, MS_SILENT, MZ_HUGE), MR_SLEEP | MR_POISON | MR_STONE, 0, M1_FLY | M1_BREATHLESS | M1_NOEYES | M1_NOLIMBS | M1_NOHEAD | M1_MINDLESS, diff --git a/src/apply.c b/src/apply.c index b2c7b5e15..ad7ea0dd6 100644 --- a/src/apply.c +++ b/src/apply.c @@ -2722,8 +2722,7 @@ use_trap(struct obj *otmp) else if (Stunned) what = "while stunned"; else if (u.uswallow) - what = - is_animal(u.ustuck->data) ? "while swallowed" : "while engulfed"; + what = digests(u.ustuck->data) ? "while swallowed" : "while engulfed"; else if (Underwater) what = "underwater"; else if (Levitation) diff --git a/src/detect.c b/src/detect.c index 78311aa13..f042f719a 100644 --- a/src/detect.c +++ b/src/detect.c @@ -1676,11 +1676,17 @@ openit(void) int num = 0; if (u.uswallow) { - if (is_animal(u.ustuck->data)) { + if (digests(u.ustuck->data)) { + /* purple worm */ if (Blind) pline("Its mouth opens!"); else pline("%s opens its mouth!", Monnam(u.ustuck)); +#if 0 /* expels() will take care of this */ + } else if (enfolds(u.ustuck->data)) { + /* trapper or lurker above */ + pline("%s unfolds!", Monnam(u.ustuck)); +#endif } expels(u.ustuck, u.ustuck->data, TRUE); return -1; diff --git a/src/dig.c b/src/dig.c index 8fe5d0fda..0e92c6019 100644 --- a/src/dig.c +++ b/src/dig.c @@ -1411,14 +1411,14 @@ zap_dig(void) mtmp = u.ustuck; if (!is_whirly(mtmp->data)) { - if (is_animal(mtmp->data)) + if (digests(mtmp->data)) You("pierce %s %s wall!", s_suffix(mon_nam(mtmp)), mbodypart(mtmp, STOMACH)); if (unique_corpstat(mtmp->data)) mtmp->mhp = (mtmp->mhp + 1) / 2; else mtmp->mhp = 1; /* almost dead */ - expels(mtmp, mtmp->data, !is_animal(mtmp->data)); + expels(mtmp, mtmp->data, !digests(mtmp->data)); } return; } /* swallowed */ diff --git a/src/do.c b/src/do.c index 2ca0b940e..c6267249f 100644 --- a/src/do.c +++ b/src/do.c @@ -647,13 +647,18 @@ drop(struct obj *obj) if (u.uswallow) { /* barrier between you and the floor */ if (Verbose(0, drop1)) { - char *onam_p, monbuf[BUFSZ]; + char *onam_p, *mnam_p, monbuf[BUFSZ]; + mnam_p = mon_nam(u.ustuck); /* doname can call s_suffix, reusing its buffer */ - Strcpy(monbuf, s_suffix(mon_nam(u.ustuck))); + if (digests(u.ustuck->data)) { + Sprintf(monbuf, "%s %s", s_suffix(mnam_p), + mbodypart(u.ustuck, STOMACH)); + mnam_p = monbuf; + } onam_p = is_unpaid(obj) ? yobjnam(obj, (char *) 0) : doname(obj); - You("drop %s into %s %s.", onam_p, monbuf, - mbodypart(u.ustuck, STOMACH)); + + You("drop %s into %s.", onam_p, mnam_p); } } else { if ((obj->oclass == RING_CLASS || obj->otyp == MEAT_RING) @@ -752,9 +757,9 @@ dropz(struct obj *obj, boolean with_impact) static boolean engulfer_digests_food(struct obj *obj) { - /* animal swallower (purple worn, trapper, lurker above) eats any + /* animal swallower (purple worn) eats any corpse, glob, or meat but not other types of food */ - if (is_animal(u.ustuck->data) + if (digests(u.ustuck->data) && (obj->otyp == CORPSE || obj->globby || obj->otyp == MEATBALL || obj->otyp == HUGE_CHUNK_OF_MEAT || obj->otyp == MEAT_RING || obj->otyp == MEAT_STICK)) { @@ -1070,11 +1075,18 @@ dodown(void) } if (u.ustuck) { - You("are %s, and cannot go down.", - !u.uswallow ? "being held" : is_animal(u.ustuck->data) - ? "swallowed" - : "engulfed"); - return ECMD_TIME; + if (u.uswallow || !sticks(g.youmonst.data)) { + You("are %s, and cannot go down.", + !u.uswallow ? "being held" + : digests(u.ustuck->data) ? "swallowed" + : "engulfed"); + return ECMD_TIME; + } else { + struct monst *mtmp = u.ustuck; + + set_ustuck((struct monst *) 0); + You("release %s.", mon_nam(mtmp)); + } } if (!stairs_down && !ladder_down) { @@ -1168,11 +1180,18 @@ doup(void) return ECMD_OK; } if (u.ustuck) { - You("are %s, and cannot go up.", - !u.uswallow ? "being held" : is_animal(u.ustuck->data) - ? "swallowed" - : "engulfed"); - return ECMD_TIME; + if (u.uswallow || !sticks(g.youmonst.data)) { + You("are %s, and cannot go up.", + !u.uswallow ? "being held" + : digests(u.ustuck->data) ? "swallowed" + : "engulfed"); + return ECMD_TIME; + } else { + struct monst *mtmp = u.ustuck; + + set_ustuck((struct monst *) 0); + You("release %s.", mon_nam(mtmp)); + } } if (near_capacity() > SLT_ENCUMBER) { /* No levitation check; inv_weight() already allows for it */ diff --git a/src/dokick.c b/src/dokick.c index 1236dc690..4f1b8797a 100644 --- a/src/dokick.c +++ b/src/dokick.c @@ -933,7 +933,7 @@ dokick(void) You_cant("move your %s!", body_part(LEG)); break; case 1: - if (is_animal(u.ustuck->data)) { + if (digests(u.ustuck->data)) { pline("%s burps loudly.", Monnam(u.ustuck)); break; } diff --git a/src/dothrow.c b/src/dothrow.c index a75fac95f..bdf78ef5c 100644 --- a/src/dothrow.c +++ b/src/dothrow.c @@ -2068,10 +2068,14 @@ thitmonst( mon->mstrategy &= ~STRAT_WAITMASK; } } else if (guaranteed_hit) { + char trail[BUFSZ]; + char *monname; + struct permonst *md = u.ustuck->data; + /* this assumes that guaranteed_hit is due to swallowing */ wakeup(mon, TRUE); if (obj->otyp == CORPSE && touch_petrifies(&mons[obj->corpsenm])) { - if (is_animal(u.ustuck->data)) { + if (is_animal(md)) { minstapetrify(u.ustuck, TRUE); /* Don't leave a cockatrice corpse available in a statue */ if (!u.uswallow) { @@ -2080,9 +2084,12 @@ thitmonst( } } } - pline("%s into %s %s.", Tobjnam(obj, "vanish"), - s_suffix(mon_nam(mon)), - is_animal(u.ustuck->data) ? "entrails" : "currents"); + Strcpy(trail, + digests(md) ? " entrails" : is_whirly(md) ? " currents" : ""); + monname = mon_nam(mon); + if (*trail) + monname = s_suffix(monname); + pline("%s into %s%s.", Tobjnam(obj, "vanish"), monname, trail); } else { tmiss(obj, mon, TRUE); } @@ -2429,10 +2436,11 @@ throw_gold(struct obj *obj) freeinv(obj); if (u.uswallow) { const char *swallower = mon_nam(u.ustuck); - if (is_animal(u.ustuck->data)) - swallower = s_suffix(swallower); - pline_The("gold disappears into %s%s.", swallower, - is_animal(u.ustuck->data) ? " entrails" : ""); + + if (digests(u.ustuck->data)) + /* note: s_suffix() returns a modifiable buffer */ + swallower = strcat(s_suffix(swallower), " entrails"); + pline_The("gold disappears into %s.", swallower); add_to_minv(u.ustuck, obj); return ECMD_TIME; } diff --git a/src/engrave.c b/src/engrave.c index 975b79a09..b76ed91b8 100644 --- a/src/engrave.c +++ b/src/engrave.c @@ -192,7 +192,10 @@ surface(coordxy x, coordxy y) struct rm *lev = &levl[x][y]; if (u_at(x, y) && u.uswallow && is_animal(u.ustuck->data)) - return "maw"; + /* 'husk' is iffy but maw is wrong for 't' class */ + return digests(u.ustuck->data) ? "maw" + : enfolds(u.ustuck->data) ? "husk" + : "nonesuch"; /* can't happen (fingers crossed...) */ else if (IS_AIR(lev->typ) && Is_airlevel(&u.uz)) return "air"; else if (is_pool(x, y)) @@ -461,6 +464,8 @@ u_can_engrave(void) cant_reach_floor(u.ux, u.uy, FALSE, FALSE); return FALSE; } + /* Note: for amorphous engulfers, writing attempt is allowed here + but yields the 'jello' result in doengrave() */ } else if (is_lava(u.ux, u.uy)) { You_cant("write on the %s!", surface(u.ux, u.uy)); return FALSE; diff --git a/src/explode.c b/src/explode.c index 227bb636b..ee56eb6dc 100644 --- a/src/explode.c +++ b/src/explode.c @@ -372,7 +372,7 @@ explode( if (engulfing_u(mtmp)) { const char *adj = (char *) 0; - if (is_animal(u.ustuck->data)) { + if (digests(u.ustuck->data)) { switch (adtyp) { case AD_FIRE: adj = "heartburn"; diff --git a/src/hack.c b/src/hack.c index 5412e47f2..41acee2a7 100644 --- a/src/hack.c +++ b/src/hack.c @@ -1404,7 +1404,7 @@ is_valid_travelpt(coordxy x, coordxy y) (all failures and most successful escapes leave hero at original spot) */ static boolean trapmove( - coordxy x, coordxy y, /* targetted destination, */ + coordxy x, coordxy y, /* targetted destination, */ struct trap *desttrap) /* nonnull if another trap at */ { boolean anchored = FALSE; @@ -3204,7 +3204,7 @@ pickup_checks(void) /* uswallow case added by GAN 01/29/87 */ if (u.uswallow) { if (!u.ustuck->minvent) { - if (is_animal(u.ustuck->data)) { + if (digests(u.ustuck->data)) { You("pick up %s tongue.", s_suffix(mon_nam(u.ustuck))); pline("But it's kind of slimy, so you drop it."); } else diff --git a/src/insight.c b/src/insight.c index 3dfada4ad..bce4ae428 100644 --- a/src/insight.c +++ b/src/insight.c @@ -1036,7 +1036,7 @@ status_enlightenment(int mode, int final) } if (u.uswallow) { /* implies u.ustuck is non-Null */ Snprintf(buf, sizeof buf, "%s by %s", - is_animal(u.ustuck->data) ? "swallowed" : "engulfed", + digests(u.ustuck->data) ? "swallowed" : "engulfed", heldmon); if (dmgtype(u.ustuck->data, AD_DGST)) { /* if final, death via digestion can be deduced by u.uswallow @@ -3023,13 +3023,26 @@ mstatusline(struct monst *mtmp) : ", [? speed]"); if (mtmp->minvis) Strcat(info, ", invisible"); - if (mtmp == u.ustuck) - Strcat(info, sticks(g.youmonst.data) ? ", held by you" - : !u.uswallow ? ", holding you" - : attacktype_fordmg(u.ustuck->data, AT_ENGL, AD_DGST) - ? ", digesting you" - : is_animal(u.ustuck->data) ? ", swallowing you" - : ", engulfing you"); + if (mtmp == u.ustuck) { + struct permonst *pm = u.ustuck->data; + + /* being swallowed/engulfed takes priority over sticks(youmonst); + this used to have that backwards and checked sticks() first */ + Strcat(info, u.uswallow ? (digests(pm) + ? ", digesting you" + /* note: the "swallowing you" case won't + happen because all animal engulfers + either digest their victims (purple + worm) or enfold them (trappers and + lurkers above) */ + : (is_animal(pm) && !enfolds(pm)) + ? ", swallowing you" + : ", engulfing you") + /* !u.uswallow; if both youmonst and ustuck are holders, + youmonst wins */ + : (!sticks(g.youmonst.data) ? ", holding you" + : ", held by you")); + } if (mtmp == u.usteed) { Strcat(info, ", carrying you"); if (Wounded_legs) { diff --git a/src/mhitm.c b/src/mhitm.c index a51dc9db5..1b539c923 100644 --- a/src/mhitm.c +++ b/src/mhitm.c @@ -766,7 +766,8 @@ gulpmm( /* [this two-part formatting dates back to when only one x_monnam result could be included in an expression because the next one would overwrite first's result -- that's no longer the case] */ - Sprintf(buf, "%s swallows", Monnam(magr)); + Sprintf(buf, "%s %s", Monnam(magr), + digests(magr->data) ? "swallows" : "engulfs"); pline("%s %s.", buf, mon_nam(mdef)); } if (!flaming(magr->data)) { diff --git a/src/mhitu.c b/src/mhitu.c index 27c2c9de9..77f32c639 100644 --- a/src/mhitu.c +++ b/src/mhitu.c @@ -232,14 +232,17 @@ wildmiss(struct monst *mtmp, struct attack *mattk) } void -expels(struct monst *mtmp, - struct permonst *mdat, /* if mtmp is polymorphed, mdat != mtmp->data */ - boolean message) +expels( + struct monst *mtmp, + struct permonst *mdat, /* if mtmp is polymorphed, mdat != mtmp->data */ + boolean message) { g.context.botl = 1; if (message) { - if (is_animal(mdat)) { + if (digests(mdat)) { You("get regurgitated!"); + } else if (enfolds(mdat)) { + pline("%s unfolds and you are released!", Monnam(mtmp)); } else { char blast[40]; struct attack *attk = attacktype_fordmg(mdat, AT_ENGL, AD_ANY); @@ -717,7 +720,7 @@ mattacku(register struct monst *mtmp) } else { missmu(mtmp, (tmp == j), mattk); } - } else if (is_animal(mtmp->data)) { + } else if (digests(mtmp->data)) { pline("%s gulps some air!", Monnam(mtmp)); } else { if (youseeit) @@ -897,8 +900,13 @@ diseasemu(struct permonst *mdat) boolean u_slip_free(struct monst *mtmp, struct attack *mattk) { - struct obj *obj = (uarmc ? uarmc : uarm); + struct obj *obj; + /* greased armor does not protect against AT_ENGL+AD_WRAP */ + if (mattk->aatyp == AT_ENGL) + return FALSE; + + obj = (uarmc ? uarmc : uarm); if (!obj) obj = uarmu; if (mattk->adtyp == AD_DRIN) @@ -1165,8 +1173,8 @@ gulpmu(struct monst *mtmp, struct attack *mattk) dismount_steed(DISMOUNT_ENGULFED); } else { urgent_pline("%s %s!", Monnam(mtmp), - is_animal(mtmp->data) ? "swallows you whole" - : "engulfs you"); + digests(mtmp->data) ? "swallows you whole" + : "engulfs you"); } stop_occupation(); reset_occupations(); /* behave as if you had moved */ @@ -1278,7 +1286,8 @@ gulpmu(struct monst *mtmp, struct attack *mattk) if (Amphibious && !flaming(g.youmonst.data)) tmp = 0; } else { - You("are pummeled with debris!"); + You("are %s!", enfolds(mtmp->data) ? "being squashed" + : "pummeled with debris"); exercise(A_STR, FALSE); } break; @@ -1378,17 +1387,20 @@ gulpmu(struct monst *mtmp, struct attack *mattk) ; /* life-saving has already expelled swallowed hero */ } else if (touch_petrifies(g.youmonst.data) && !resists_ston(mtmp)) { pline("%s very hurriedly %s you!", Monnam(mtmp), - is_animal(mtmp->data) ? "regurgitates" : "expels"); + digests(mtmp->data) ? "regurgitates" + : enfolds(mtmp->data) ? "releases" + : "expels"); expels(mtmp, mtmp->data, FALSE); } else if (!u.uswldtim || g.youmonst.data->msize >= MZ_HUGE) { /* As of 3.6.2: u.uswldtim used to be set to 0 by life-saving but it expels now so the !u.uswldtim case is no longer possible; however, polymorphing into a huge form while already swallowed is still possible */ - You("get %s!", is_animal(mtmp->data) ? "regurgitated" : "expelled"); + You("get %s!", digests(mtmp->data) ? "regurgitated" + : enfolds(mtmp->data) ? "released" + : "expelled"); if (Verbose(1, gulpmu) - && (is_animal(mtmp->data) - || (dmgtype(mtmp->data, AD_DGST) && Slow_digestion))) + && (digests(mtmp->data) && Slow_digestion)) pline("Obviously %s doesn't like your taste.", mon_nam(mtmp)); expels(mtmp, mtmp->data, FALSE); } @@ -1712,8 +1724,9 @@ mdamageu(struct monst *mtmp, int n) * 2 if wrong gender for nymph */ int -could_seduce(struct monst *magr, struct monst *mdef, - struct attack *mattk) /* non-Null: current attack; Null: general capability */ +could_seduce( + struct monst *magr, struct monst *mdef, + struct attack *mattk) /* non-Null: current atk; Null: general capability */ { struct permonst *pagr; boolean agrinvis, defperc; diff --git a/src/mon.c b/src/mon.c index d3a271fca..cbcbadb06 100644 --- a/src/mon.c +++ b/src/mon.c @@ -2893,13 +2893,13 @@ monstone(struct monst* mdef) unmap_object(x, y); if (cansee(x, y)) newsym(x, y); - /* We don't currently trap the hero in the statue in this case but we - * could */ + /* we don't currently trap the hero in the statue in this case but we + could */ if (engulfing_u(mdef)) wasinside = TRUE; mondead(mdef); if (wasinside) { - if (is_animal(mdef->data)) + if (digests(mdef->data)) You("%s through an opening in the new %s.", u_locomotion("jump"), xname(otmp)); } @@ -4675,7 +4675,7 @@ newcham( if (is_vampshifter(mtmp)) { Sprintf(msgtrail, " which was a shapeshifted %s", noname_monnam(mtmp, ARTICLE_NONE)); - } else if (is_animal(mdat)) { + } else if (digests(mdat)) { Strcpy(msgtrail, "'s stomach"); } else { msgtrail[0] = '\0'; diff --git a/src/mondata.c b/src/mondata.c index 764be9124..e66bfed72 100644 --- a/src/mondata.c +++ b/src/mondata.c @@ -456,7 +456,8 @@ breakarm(register struct permonst* ptr) boolean sticks(register struct permonst* ptr) { - return (boolean) (dmgtype(ptr, AD_STCK) || dmgtype(ptr, AD_WRAP) + return (boolean) (dmgtype(ptr, AD_STCK) + || (dmgtype(ptr, AD_WRAP) && !attacktype(ptr, AT_ENGL)) || attacktype(ptr, AT_HUGS)); } diff --git a/src/pager.c b/src/pager.c index b9a5d2b5b..3983216e2 100644 --- a/src/pager.c +++ b/src/pager.c @@ -352,8 +352,8 @@ look_at_monster(char *buf, name); if (u.ustuck == mtmp) { if (u.uswallow || iflags.save_uswallow) /* monster detection */ - Strcat(buf, is_animal(mtmp->data) - ? ", swallowing you" : ", engulfing you"); + Strcat(buf, digests(mtmp->data) ? ", swallowing you" + : ", engulfing you"); else Strcat(buf, (Upolyd && sticks(g.youmonst.data)) ? ", being held" : ", holding you"); diff --git a/src/pickup.c b/src/pickup.c index c7bb2603c..973da2d65 100644 --- a/src/pickup.c +++ b/src/pickup.c @@ -1064,7 +1064,7 @@ query_objlist(const char *qstr, /* query string */ any = cg.zeroany; if (sorted && n > 1) { Sprintf(buf, "%s Creatures", - is_animal(u.ustuck->data) ? "Swallowed" : "Engulfed"); + digests(u.ustuck->data) ? "Swallowed" : "Engulfed"); add_menu(win, &nul_glyphinfo, &any, 0, 0, iflags.menu_headings, clr, buf, MENU_ITEMFLAGS_NONE); } diff --git a/src/polyself.c b/src/polyself.c index 655616953..f68477049 100644 --- a/src/polyself.c +++ b/src/polyself.c @@ -1590,8 +1590,8 @@ dohide(void) if (u.ustuck || (u.utrap && (u.utraptype != TT_PIT || on_ceiling))) { You_cant("hide while you're %s.", !u.ustuck ? "trapped" - : u.uswallow ? (is_animal(u.ustuck->data) ? "swallowed" - : "engulfed") + : u.uswallow ? (digests(u.ustuck->data) ? "swallowed" + : "engulfed") : !sticks(g.youmonst.data) ? "being held" : (humanoid(u.ustuck->data) ? "holding someone" : "holding that creature")); diff --git a/src/read.c b/src/read.c index 5089314a6..284569e7b 100644 --- a/src/read.c +++ b/src/read.c @@ -2385,7 +2385,7 @@ litroom( if (u.uswallow) { if (Blind) ; /* no feedback */ - else if (is_animal(u.ustuck->data)) + else if (digests(u.ustuck->data)) pline("%s %s is lit.", s_suffix(Monnam(u.ustuck)), mbodypart(u.ustuck, STOMACH)); else if (is_whirly(u.ustuck->data)) diff --git a/src/spell.c b/src/spell.c index 7ef754713..8e2bc0e48 100644 --- a/src/spell.c +++ b/src/spell.c @@ -822,24 +822,20 @@ cast_protection(void) if (u.uspellprot) { pline_The("%s haze around you becomes more dense.", hgolden); } else { + struct permonst *pm = u.ustuck ? u.ustuck->data : 0; + rmtyp = levl[u.ux][u.uy].typ; atmosphere = u.uswallow - ? ((u.ustuck->data == &mons[PM_FOG_CLOUD]) - ? "mist" - : is_whirly(u.ustuck->data) - ? "maelstrom" - : is_animal(u.ustuck->data) - ? "maw" + ? ((pm == &mons[PM_FOG_CLOUD]) ? "mist" + : is_whirly(u.ustuck->data) ? "maelstrom" + : enfolds(pm) ? "folds" + : is_animal(u.ustuck->data) ? "maw" : "ooze") - : (u.uinwater - ? hliquid("water") - : (rmtyp == CLOUD) - ? "cloud" - : IS_TREE(rmtyp) - ? "vegetation" - : IS_STWALL(rmtyp) - ? "stone" - : "air"); + : (u.uinwater ? hliquid("water") + : (rmtyp == CLOUD) ? "cloud" + : IS_TREE(rmtyp) ? "vegetation" + : IS_STWALL(rmtyp) ? "stone" + : "air"); pline_The("%s around you begins to shimmer with %s haze.", atmosphere, an(hgolden)); } diff --git a/src/trap.c b/src/trap.c index 3ba2729a5..ede15c763 100644 --- a/src/trap.c +++ b/src/trap.c @@ -3419,10 +3419,11 @@ float_up(void) } else if (u.uinwater) { spoteffects(TRUE); } else if (u.uswallow) { - You(is_animal(u.ustuck->data) ? "float away from the %s." - : "spiral up into %s.", - is_animal(u.ustuck->data) ? surface(u.ux, u.uy) - : mon_nam(u.ustuck)); + /* FIXME: this isn't correct for trapper/lurker above */ + if (is_animal(u.ustuck->data)) + You("float away from the %s.", surface(u.ux, u.uy)); + else + You("spiral up into %s.", mon_nam(u.ustuck)); } else if (Hallucination) { pline("Up, up, and awaaaay! You're walking on air!"); } else if (Is_airlevel(&u.uz)) { @@ -3506,7 +3507,7 @@ float_down( } if (u.uswallow) { You("float down, but you are still %s.", - is_animal(u.ustuck->data) ? "swallowed" : "engulfed"); + digests(u.ustuck->data) ? "swallowed" : "engulfed"); (void) encumber_msg(); return 1; } diff --git a/src/uhitm.c b/src/uhitm.c index 568f54517..68c351ba9 100644 --- a/src/uhitm.c +++ b/src/uhitm.c @@ -4547,7 +4547,7 @@ gulpum(struct monst *mdef, struct attack *mattk) if (DEADMONSTER(mdef)) /* not lifesaved */ return MM_DEF_DIED; } - You("%s %s!", is_animal(g.youmonst.data) ? "regurgitate" : "expel", + You("%s %s!", digests(g.youmonst.data) ? "regurgitate" : "expel", mon_nam(mdef)); if (Slow_digestion || is_animal(g.youmonst.data)) { pline("Obviously, you didn't like %s taste.", @@ -4559,7 +4559,10 @@ gulpum(struct monst *mdef, struct attack *mattk) } void -missum(struct monst *mdef, struct attack *mattk, boolean wouldhavehit) +missum( + struct monst *mdef, + struct attack *mattk, + boolean wouldhavehit) { if (wouldhavehit) /* monk is missing due to penalty for wearing suit */ Your("armor is rather cumbersome..."); diff --git a/src/zap.c b/src/zap.c index e6f6c4d9d..1900846fe 100644 --- a/src/zap.c +++ b/src/zap.c @@ -490,7 +490,7 @@ release_hold(void) if (!mtmp) { impossible("release_hold when not held?"); } else if (u.uswallow) { /* possible for sticky hero to be swallowed */ - if (is_animal(mtmp->data)) { + if (digests(mtmp->data)) { if (!Blind) pline("%s opens its mouth!", Monnam(mtmp)); else -- 2.50.0