cursed potions of invisibility for monsters
Extend the recently changed behavior for cursed potion of invisibility. Monsters won't drink potions of invisibility if already invisible so can't accidentally or voluntarily make themselves visible again, but let player make them become visible by hitting them with thrown or wielded cursed potion of invisibility. They don't have any concept of temporary invisibility that might let them remain invisible while losing permanent invisibility, so they just lose the latter and immediately become visible.
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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)
|
||||
|
||||
19
src/potion.c
19
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:
|
||||
|
||||
10
src/worn.c
10
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 */
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user