diff --git a/doc/fixes3-7-0.txt b/doc/fixes3-7-0.txt index 69eb14bba..a7dbffed3 100644 --- a/doc/fixes3-7-0.txt +++ b/doc/fixes3-7-0.txt @@ -1326,10 +1326,11 @@ prioritize paying shopkeeper next to you even if multiple are detected avoid impossible "trapped without a trap (fmon)" from 'sanity_check' when a drum of earthquake made a pit at a monster's spot and pit creation caused adjacent pool/moat/lava to flood that spot; if a non-floater, - non-flyer monster survived that it got marked as trapped even though + non-flyer monster survived that, it got marked as trapped even though flooding deleted the trap demons cannot be frightened by showing them their reflection HP regeneration formula has changed, primarily to be less fast in the endgame +riding negates stealth unless the steed is flying Fixes to 3.7.0-x General Problems Exposed Via git Repository diff --git a/include/extern.h b/include/extern.h index cb0234696..1c7f2e5e4 100644 --- a/include/extern.h +++ b/include/extern.h @@ -2792,6 +2792,7 @@ extern void exercise_steed(void); extern void kick_steed(void); extern void dismount_steed(int); extern void place_monster(struct monst *, coordxy, coordxy); +extern void poly_steed(struct monst *, struct permonst *); extern boolean stucksteed(boolean); /* ### symbols.c ### */ diff --git a/include/prop.h b/include/prop.h index 1d4e3ee11..57f07b998 100644 --- a/include/prop.h +++ b/include/prop.h @@ -1,4 +1,4 @@ -/* NetHack 3.7 prop.h $NHDT-Date: 1596498555 2020/08/03 23:49:15 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.22 $ */ +/* NetHack 3.7 prop.h $NHDT-Date: 1702274027 2023/12/11 05:53:47 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.24 $ */ /* Copyright (c) 1989 Mike Threepoint */ /* NetHack may be freely redistributed. See license for details. */ @@ -129,14 +129,14 @@ struct prop { long intrinsic; /* Timed properties */ #define TIMEOUT 0x00ffffffL /* Up to 16 million turns */ - /* Permanent properties */ -#define FROMEXPER 0x01000000L /* Gain/lose with experience, for role */ -#define FROMRACE 0x02000000L /* Gain/lose with experience, for race */ +/* Permanent properties */ +#define FROMEXPER 0x01000000L /* Gain/lose with experience, for role */ +#define FROMRACE 0x02000000L /* Gain/lose with experience, for race */ #define FROMOUTSIDE 0x04000000L /* By corpses, prayer, thrones, etc. */ -#define INTRINSIC (FROMOUTSIDE | FROMRACE | FROMEXPER) +#define INTRINSIC (FROMOUTSIDE | FROMRACE | FROMEXPER) /* Control flags */ -#define FROMFORM 0x10000000L /* Polyd; conferred by monster form */ -#define I_SPECIAL 0x20000000L /* Property is controllable */ +#define FROMFORM 0x10000000L /* Polyd; conferred by monster form */ +#define I_SPECIAL 0x20000000L /* Property is controllable */ }; /*** Definitions for backwards compatibility ***/ diff --git a/include/youprop.h b/include/youprop.h index c41fdba48..b9cfcec75 100644 --- a/include/youprop.h +++ b/include/youprop.h @@ -1,4 +1,4 @@ -/* NetHack 3.7 youprop.h $NHDT-Date: 1596498577 2020/08/03 23:49:37 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.32 $ */ +/* NetHack 3.7 youprop.h $NHDT-Date: 1702274029 2023/12/11 05:53:49 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.44 $ */ /* Copyright (c) 1989 Mike Threepoint */ /* NetHack may be freely redistributed. See license for details. */ @@ -200,6 +200,7 @@ #define HStealth u.uprops[STEALTH].intrinsic #define EStealth u.uprops[STEALTH].extrinsic +/* BStealth has FROMOUTSIDE set if mounted on non-flying steed */ #define BStealth u.uprops[STEALTH].blocked #define Stealth ((HStealth || EStealth) && !BStealth) @@ -384,6 +385,10 @@ * Some pseudo-properties. */ +/* the code will needs lots of updating to use this so leave it commented +#define Riding (u.usteed != NULL) +*/ + /* unconscious() includes u.usleep but not is_fainted(); the multi test is redundant but allows the function calls to be skipped most of the time */ #define Unaware (gm.multi < 0 && (unconscious() || is_fainted())) diff --git a/src/do_wear.c b/src/do_wear.c index 1b3f4450a..da99bae3b 100644 --- a/src/do_wear.c +++ b/src/do_wear.c @@ -85,7 +85,9 @@ on_msg(struct obj *otmp) } /* putting on or taking off an item which confers stealth; - give feedback and discover it iff stealth state is changing */ + give feedback and discover it iff stealth state is changing; + stealth is blocked by riding unless hero+steed fly (handled with + BStealth by mount and dismount routines) */ static void toggle_stealth( @@ -101,7 +103,7 @@ toggle_stealth( && !BStealth) { /* stealth blocked by something */ if (obj->otyp == RIN_STEALTH) learnring(obj, TRUE); - else + else /* discover elven cloak or elven boots */ makeknown(obj->otyp); if (on) { @@ -112,7 +114,13 @@ toggle_stealth( else You("walk very quietly."); } else { - You("sure are noisy."); + boolean riding = (u.usteed != NULL); + + You("%s%s are noisy.", riding ? "and " : "sure", + riding ? x_monnam(u.usteed, ARTICLE_YOUR, (char *) NULL, + (SUPPRESS_SADDLE | SUPPRESS_HALLUCINATION), + FALSE) + : ""); } } } @@ -123,10 +131,11 @@ toggle_stealth( hero is able to see self (or sense monsters); for timed, 'obj' is Null and this is only called for the message */ void -toggle_displacement(struct obj *obj, - long oldprop, /* prop[].extrinsic, with obj->owornmask - stripped by caller */ - boolean on) +toggle_displacement( + struct obj *obj, + long oldprop, /* prop[].extrinsic, with obj->owornmask + stripped by caller */ + boolean on) { if (on ? gi.initial_don : gc.context.takeoff.cancelled_don) return; diff --git a/src/insight.c b/src/insight.c index ea3203768..2055689b1 100644 --- a/src/insight.c +++ b/src/insight.c @@ -1455,7 +1455,7 @@ attributes_enlightenment( { static NEARDATA const char if_surroundings_permitted[] = " if surroundings permitted"; - int ltmp, armpro; + int ltmp, armpro, warnspecies; char buf[BUFSZ]; /*\ @@ -1566,9 +1566,10 @@ attributes_enlightenment( : "certain monsters"); you_are(buf, ""); } - if (Warn_of_mon && gc.context.warntype.speciesidx >= LOW_PM) { + warnspecies = gc.context.warntype.speciesidx; + if (Warn_of_mon && warnspecies >= LOW_PM) { Sprintf(buf, "aware of the presence of %s", - makeplural(mons[gc.context.warntype.speciesidx].pmnames[NEUTRAL])); + makeplural(mons[warnspecies].pmnames[NEUTRAL])); you_are(buf, from_what(WARN_OF_MON)); } if (Undead_warning) @@ -1630,8 +1631,13 @@ attributes_enlightenment( you_are("visible", from_what(-INVIS)); if (Displaced) you_are("displaced", from_what(DISPLACED)); - if (Stealth) + if (Stealth) { you_are("stealthy", from_what(STEALTH)); + } else if (BStealth && (HStealth || EStealth)) { + Sprintf(buf, " steathy%s", + (BStealth == FROMOUTSIDE) ? " if not mounted" : ""); + enl_msg(You_, "would be", "would have been", buf, ""); + } if (Aggravate_monster) enl_msg("You aggravate", "", "d", " monsters", from_what(AGGRAVATE_MONSTER)); diff --git a/src/mon.c b/src/mon.c index a00489ab8..1938814ea 100644 --- a/src/mon.c +++ b/src/mon.c @@ -5054,6 +5054,8 @@ newcham( } } } + if (mtmp == u.usteed) + poly_steed(mtmp, olddata); return 1; } diff --git a/src/polyself.c b/src/polyself.c index 8d17f1932..1c7dbc0c7 100644 --- a/src/polyself.c +++ b/src/polyself.c @@ -1,4 +1,4 @@ -/* NetHack 3.7 polyself.c $NHDT-Date: 1681429658 2023/04/13 23:47:38 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.197 $ */ +/* NetHack 3.7 polyself.c $NHDT-Date: 1702274031 2023/12/11 05:53:51 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.204 $ */ /* Copyright (C) 1987, 1988, 1989 by Ken Arromdee */ /* NetHack may be freely redistributed. See license for details. */ @@ -133,6 +133,15 @@ float_vs_flight(void) BLevitation |= I_SPECIAL; else BLevitation &= ~I_SPECIAL; + + /* riding blocks stealth unless hero+steed fly, so a change in flying + might cause a change in stealth */ + if (u.usteed) { + if (!Flying && !Levitation) + BStealth |= FROMOUTSIDE; + else + BStealth &= ~FROMOUTSIDE; + } gc.context.botl = TRUE; } diff --git a/src/steed.c b/src/steed.c index 1db6b2db5..75229ff32 100644 --- a/src/steed.c +++ b/src/steed.c @@ -1,4 +1,4 @@ -/* NetHack 3.7 steed.c $NHDT-Date: 1671838909 2022/12/23 23:41:49 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.108 $ */ +/* NetHack 3.7 steed.c $NHDT-Date: 1702274036 2023/12/11 05:53:56 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.115 $ */ /* Copyright (c) Kevin Hugo, 1998-1999. */ /* NetHack may be freely redistributed. See license for details. */ @@ -226,8 +226,10 @@ mount_steed( return (FALSE); } - if (Upolyd && (!humanoid(gy.youmonst.data) || verysmall(gy.youmonst.data) - || bigmonst(gy.youmonst.data) || slithy(gy.youmonst.data))) { + if (Upolyd && (!humanoid(gy.youmonst.data) + || verysmall(gy.youmonst.data) + || bigmonst(gy.youmonst.data) + || slithy(gy.youmonst.data))) { You("won't fit on a saddle."); return (FALSE); } @@ -269,6 +271,7 @@ mount_steed( pline("%s is not saddled.", Monnam(mtmp)); return (FALSE); } + ptr = mtmp->data; if (touch_petrifies(ptr) && !Stone_resistance) { char kbuf[BUFSZ]; @@ -354,6 +357,13 @@ mount_steed( if (uwep && is_pole(uwep)) gu.unweapon = FALSE; u.usteed = mtmp; + if (!Flying && !Levitation) { + boolean was_stealthy = Stealth != 0; + + BStealth |= FROMOUTSIDE; + if (was_stealthy) + You("aren't stealthy anymore."); + } remove_monster(mtmp->mx, mtmp->my); teleds(mtmp->mx, mtmp->my, TELEDS_ALLOW_DRAG); gc.context.botl = TRUE; @@ -631,9 +641,14 @@ dismount_steed( if (repair_leg_damage) heal_legs(1); - /* Release the steed and saddle */ - u.usteed = 0; + /* Release the steed */ + u.usteed = (struct monst *) NULL; u.ugallop = 0L; + if (BStealth) { + BStealth &= ~FROMOUTSIDE; + if (Stealth) + You("seem less noisy now."); + } if (u.utraptype == TT_BEARTRAP || u.utraptype == TT_PIT @@ -817,6 +832,33 @@ maybewakesteed(struct monst* steed) finish_meating(steed); } +/* steed has taken on a new shape */ +void +poly_steed( + struct monst *steed, + struct permonst *oldshape) +{ + if (!can_saddle(steed) || !can_ride(steed)) { + /* removing of no longer wearable saddle was handled during the + shape change (newcham -> mon_break_armor -> m_lose_armor) */ + dismount_steed(DISMOUNT_POLY); + } else { + char buf[BUFSZ]; + + Strcpy(buf, x_monnam(steed, ARTICLE_YOUR, (char *) 0, + SUPPRESS_SADDLE, FALSE)); + if (oldshape != steed->data) + (void) strsubst(buf, "your ", "your new "); + You("adjust yourself in the saddle on %s.", buf); + + /* riding blocks stealth unless hero+steed fly */ + if (!Flying && !Levitation) + BStealth |= FROMOUTSIDE; + else + BStealth &= ~FROMOUTSIDE; + } +} + /* decide whether hero's steed is able to move; doesn't check for holding traps--those affect the hero directly */ boolean diff --git a/src/trap.c b/src/trap.c index 3bd83449c..7baf41b34 100644 --- a/src/trap.c +++ b/src/trap.c @@ -1,4 +1,4 @@ -/* NetHack 3.7 trap.c $NHDT-Date: 1699640827 2023/11/10 18:27:07 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.554 $ */ +/* NetHack 3.7 trap.c $NHDT-Date: 1702274034 2023/12/11 05:53:54 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.559 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2013. */ /* NetHack may be freely redistributed. See license for details. */ @@ -2923,20 +2923,8 @@ steedintrap(struct trap *trap, struct obj *otmp) break; case POLY_TRAP: if (!resists_magm(steed) && !resist(steed, WAND_CLASS, 0, NOTELL)) { - struct permonst *mdat = steed->data; - + /* newcham() will probably end up calling poly_steed() */ (void) newcham(steed, (struct permonst *) 0, NC_SHOW_MSG); - if (!can_saddle(steed) || !can_ride(steed)) { - dismount_steed(DISMOUNT_POLY); - } else { - char buf[BUFSZ]; - - Strcpy(buf, x_monnam(steed, ARTICLE_YOUR, (char *) 0, - SUPPRESS_SADDLE, FALSE)); - if (mdat != steed->data) - (void) strsubst(buf, "your ", "your new "); - You("adjust yourself in the saddle on %s.", buf); - } } steedhit = TRUE; break;