diff --git a/include/extern.h b/include/extern.h index 5710dfa1a..2593f9362 100644 --- a/include/extern.h +++ b/include/extern.h @@ -1,4 +1,4 @@ -/* NetHack 3.7 extern.h $NHDT-Date: 1764044196 2025/11/24 20:16:36 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.1509 $ */ +/* NetHack 3.7 extern.h $NHDT-Date: 1770949988 2026/02/12 18:33:08 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.1523 $ */ /* Copyright (c) Steve Creps, 1988. */ /* NetHack may be freely redistributed. See license for details. */ @@ -3891,7 +3891,7 @@ extern int wornmask_to_armcat(long); extern long armcat_to_wornmask(int); extern long wearslot(struct obj *) NONNULLARG1; extern void check_wornmask_slots(void); -extern void mon_set_minvis(struct monst *) NONNULLARG1; +extern void mon_set_minvis(struct monst *, boolean) NONNULLARG1; extern void mon_adjust_speed(struct monst *, int, struct obj *) NONNULLARG1; extern void update_mon_extrinsics(struct monst *, struct obj *, boolean, boolean) NONNULLARG12; diff --git a/src/makemon.c b/src/makemon.c index c95fe8439..130694401 100644 --- a/src/makemon.c +++ b/src/makemon.c @@ -1,4 +1,4 @@ -/* NetHack 3.7 makemon.c $NHDT-Date: 1720128166 2024/07/04 21:22:46 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.249 $ */ +/* NetHack 3.7 makemon.c $NHDT-Date: 1770949988 2026/02/12 18:33:08 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.271 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2012. */ /* NetHack may be freely redistributed. See license for details. */ @@ -1294,7 +1294,7 @@ makemon( mtmp->seen_resistance = M_SEEN_NOTHING; mtmp->mpeaceful = (mmflags & MM_ANGRY) ? FALSE : peace_minded(ptr); if ((mmflags & MM_MINVIS) != 0) /* for ^G */ - mon_set_minvis(mtmp); /* call after place_monster() */ + mon_set_minvis(mtmp, FALSE); /* call after place_monster() */ switch (ptr->mlet) { case S_MIMIC: diff --git a/src/mcastu.c b/src/mcastu.c index 95e9a1c65..29792429f 100644 --- a/src/mcastu.c +++ b/src/mcastu.c @@ -1,4 +1,4 @@ -/* NetHack 3.7 mcastu.c $NHDT-Date: 1726168598 2024/09/12 19:16:38 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.105 $ */ +/* NetHack 3.7 mcastu.c $NHDT-Date: 1770949988 2026/02/12 18:33:08 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.111 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2011. */ /* NetHack may be freely redistributed. See license for details. */ @@ -566,7 +566,7 @@ cast_wizard_spell(struct monst *mtmp, int dmg, int spellnum) if (canseemon(mtmp)) pline_mon(mtmp, "%s suddenly %s!", Monnam(mtmp), !See_invisible ? "disappears" : "becomes transparent"); - mon_set_minvis(mtmp); + mon_set_minvis(mtmp, FALSE); if (cansee(mtmp->mx, mtmp->my) && !canspotmon(mtmp)) map_invisible(mtmp->mx, mtmp->my); dmg = 0; diff --git a/src/mon.c b/src/mon.c index 883db340c..4488bd8fc 100644 --- a/src/mon.c +++ b/src/mon.c @@ -1,4 +1,4 @@ -/* NetHack 3.7 mon.c $NHDT-Date: 1753856387 2025/07/29 22:19:47 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.611 $ */ +/* NetHack 3.7 mon.c $NHDT-Date: 1770949988 2026/02/12 18:33:08 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.621 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Derek S. Ray, 2015. */ /* NetHack may be freely redistributed. See license for details. */ @@ -1784,7 +1784,7 @@ mon_givit(struct monst *mtmp, struct permonst *ptr) char mtmpbuf[BUFSZ]; Strcpy(mtmpbuf, Monnam(mtmp)); - mon_set_minvis(mtmp); + mon_set_minvis(mtmp, FALSE); if (vis) pline_mon(mtmp, "%s %s.", mtmpbuf, !canspotmon(mtmp) ? "vanishes" diff --git a/src/muse.c b/src/muse.c index c3c0b39d2..8c95e00ec 100644 --- a/src/muse.c +++ b/src/muse.c @@ -1,4 +1,4 @@ -/* NetHack 3.7 muse.c $NHDT-Date: 1737392015 2025/01/20 08:53:35 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.234 $ */ +/* NetHack 3.7 muse.c $NHDT-Date: 1770949988 2026/02/12 18:33:08 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.241 $ */ /* Copyright (C) 1990 by Ken Arromdee */ /* NetHack may be freely redistributed. See license for details. */ @@ -2426,7 +2426,7 @@ use_misc(struct monst *mtmp) mquaffmsg(mtmp, otmp); /* format monster's name before altering its visibility */ Strcpy(nambuf, mon_nam(mtmp)); - mon_set_minvis(mtmp); + mon_set_minvis(mtmp, !otmp->cursed ? FALSE : TRUE); if (vismon && mtmp->minvis) { /* was seen, now invisible */ if (canspotmon(mtmp)) { pline("%s body takes on a %s transparency.", @@ -2439,6 +2439,10 @@ use_misc(struct monst *mtmp) } if (oseen) makeknown(otmp->otyp); + } else if (!vismon && canseemon(mtmp)) { + /* cursed potion; this won't happen because a monster will only + drink a potion of invisibility when not already invisible */ + pline("%s suddenly appears!", Monnam(mtmp)); } if (otmp->otyp == POT_INVISIBILITY) { if (otmp->cursed) diff --git a/src/potion.c b/src/potion.c index 072d33b29..2ea79fb44 100644 --- a/src/potion.c +++ b/src/potion.c @@ -1,4 +1,4 @@ -/* NetHack 3.7 potion.c $NHDT-Date: 1737605675 2025/01/22 20:14:35 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.274 $ */ +/* NetHack 3.7 potion.c $NHDT-Date: 1770949988 2026/02/12 18:33:08 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.279 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2013. */ /* NetHack may be freely redistributed. See license for details. */ @@ -1777,12 +1777,19 @@ potionhit(struct monst *mon, struct obj *obj, int how) mon->mconf = TRUE; break; case POT_INVISIBILITY: { - boolean sawit = canspotmon(mon); + boolean sawit = canspotmon(mon), + cursed_potion = obj->cursed ? TRUE : FALSE; - angermon = FALSE; - mon_set_minvis(mon); - if (sawit && !canspotmon(mon) && cansee(mon->mx, mon->my)) - map_invisible(mon->mx, mon->my); + angermon = mon->minvis && cursed_potion; + mon_set_minvis(mon, cursed_potion); + if (sawit && !canspotmon(mon)) { + if (cansee(mon->mx, mon->my)) + map_invisible(mon->mx, mon->my); + } else if (!sawit && canspotmon(mon)) { + /* if an invisible mon glyph was present, mon_set_minvis()'s + newsym() has gotten rid of it */ + pline("%s appears!", Monnam(mon)); + } break; } case POT_SLEEPING: diff --git a/src/worn.c b/src/worn.c index 176a7793c..6b2c082c1 100644 --- a/src/worn.c +++ b/src/worn.c @@ -1,4 +1,4 @@ -/* NetHack 3.7 worn.c $NHDT-Date: 1736530208 2025/01/10 09:30:08 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.116 $ */ +/* NetHack 3.7 worn.c $NHDT-Date: 1770949988 2026/02/12 18:33:08 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.119 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2013. */ /* NetHack may be freely redistributed. See license for details. */ @@ -463,11 +463,13 @@ check_wornmask_slots(void) } /* check_wornmask_slots() */ void -mon_set_minvis(struct monst *mon) +mon_set_minvis( + struct monst *mon, + boolean cursed_potion) { - mon->perminvis = 1; + mon->perminvis = !cursed_potion ? 1 : 0; if (!mon->invis_blkd) { - mon->minvis = 1; + mon->minvis = mon->perminvis; newsym(mon->mx, mon->my); /* make it disappear */ if (mon->wormno) see_wsegs(mon); /* and any tail too */ diff --git a/src/zap.c b/src/zap.c index b3540afba..ec49363f5 100644 --- a/src/zap.c +++ b/src/zap.c @@ -1,4 +1,4 @@ -/* NetHack 3.7 zap.c $NHDT-Date: 1741793439 2025/03/12 07:30:39 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.564 $ */ +/* NetHack 3.7 zap.c $NHDT-Date: 1770949988 2026/02/12 18:33:08 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.584 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2013. */ /* NetHack may be freely redistributed. See license for details. */ @@ -353,7 +353,7 @@ bhitm(struct monst *mtmp, struct obj *otmp) seemimic(mtmp); /* format monster's name before altering its visibility */ Strcpy(nambuf, Monnam(mtmp)); - mon_set_minvis(mtmp); + mon_set_minvis(mtmp, FALSE); if (!oldinvis && knowninvisible(mtmp)) { pline("%s turns transparent!", nambuf); reveal_invis = TRUE;