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:
PatR
2026-02-12 10:33:09 -08:00
parent b074657f2b
commit a561538c2a
8 changed files with 35 additions and 22 deletions

View File

@@ -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)