more ^G of "hidden <monster>"

Fix a couple of glitches and add an enchancement.  The monster
attributes structure left the 'hidden' field uninitialized unless user
specified "hidden".  Mimics were being flagged with mon->mundetected
because they pass the is_hider() test but they 'hide' by taking on an
appearance rather than being unseen due to mundetected.  hides_under()
monsters fail the is_hider() test, but can become mundetected if there
is at least one object present.  Eels/other fish are neither is_hider()
nor hides_under() but can be mundetected at water locations.  So alter
'hidden' handling to deal with these various circumstances.

Asking for 'hidden' for any type of creature will result in having its
location be highlighted if it can't be actively seen or detected.  So
using '2000 ^G piranha' will fill up the Plane of Water "normally" but
'2000 ^G hidden piranha' will result in a ton of draw-glyph/delay/
draw-other-glyph/delay sequences and take a painfully long time.  Moral
of the story:  don't combine 'hidden' with a large count unless you
want to spend quite a while watching the level's fill pattern.  Turning
off the 'sparkle' option will cut the flashing in half but still take
a long time.  If you really need to fill a level with hidden creatures
and can't bear the flashing/highlighting, use blessed potion of monster
detection or #wizintrinsics to have extended detect.  Then all created
monsters will be seen so none will trigger location highlighting.

If you create a 'stalker' or 'invisible stalker' or 'invisible <other-
mon>' its location won't be highlighted, but for 'hidden stalker' or
'hidden invisible stalker' or 'hidden invisible <other-mon>' it will
(provided you don't actually see it due to See_invisible or sensemon()).
This commit is contained in:
PatR
2019-06-09 06:11:09 -07:00
parent f1f085c7fd
commit 56d16fc7ee
4 changed files with 49 additions and 34 deletions

View File

@@ -1,4 +1,4 @@
$NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.45 $ $NHDT-Date: 1560009340 2019/06/08 15:55:40 $
$NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.48 $ $NHDT-Date: 1560085861 2019/06/09 13:11:01 $
This fixes36.3 file is here to capture information about updates in the 3.6.x
lineage following the release of 3.6.2 in May 2019. Please note, however,
@@ -66,13 +66,18 @@ thrown or kicked light source (lit lamp, candle, oil) should emit light as it
unlike watching a monster trying to swap out a cursed weapon for some other
weapon and failing, watching it wield a cursed weapon didn't report
that weapon becoming welded to the monster's hand/claw/whatever
wizard-mode: wish for hidden monsters that pass is_hider test
accept "hidden" as an attribute for wizard mode ^G monster creation; created
monsters which can't be seen will have their locations highlighted
Fixes to Post-3.6.2 Problems that Were Exposed Via git Repository
------------------------------------------------------------------
elemental_clog() loop needed to guard against obliteration of the monster
that was trying to be placed
using ^G to create "hidden mimic" shouldn't have marked it as undetected since
mimics 'hide' be appearing to be something else; honor "hidden" for
'hides_under' creatures if/when created at location with object(s),
also for eels and other fish if/when created at water location
curses: sometimes the message window would show a blank line after a prompt

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 extern.h $NHDT-Date: 1559994622 2019/06/08 11:50:22 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.711 $ */
/* NetHack 3.6 extern.h $NHDT-Date: 1560085861 2019/06/09 13:11:01 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.713 $ */
/* Copyright (c) Steve Creps, 1988. */
/* NetHack may be freely redistributed. See license for details. */
@@ -360,7 +360,7 @@ E void FDECL(newsym, (int, int));
E void FDECL(newsym_force, (int, int));
E void FDECL(shieldeff, (XCHAR_P, XCHAR_P));
E void FDECL(tmp_at, (int, int));
E void FDECL(flash_glyph_at, (int, int, int));
E void FDECL(flash_glyph_at, (int, int, int, int));
E void FDECL(swallowed, (int));
E void FDECL(under_ground, (int));
E void FDECL(under_water, (int));

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 display.c $NHDT-Date: 1556835736 2019/05/02 22:22:16 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.101 $ */
/* NetHack 3.6 display.c $NHDT-Date: 1560085863 2019/06/09 13:11:03 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.104 $ */
/* Copyright (c) Dean Luick, with acknowledgements to Kevin Darcy */
/* and Dave Cohrs, 1990. */
/* NetHack may be freely redistributed. See license for details. */
@@ -1068,27 +1068,30 @@ int x, y;
}
/*
* flash_glyph_at(x, y, glyph)
* flash_glyph_at(x, y, glyph, repeatcount)
*
* Briefly flash between the passed glyph and the glyph that's
* meant to be at the location.
*/
void
flash_glyph_at(x, y, tg)
int x, y, tg;
flash_glyph_at(x, y, tg, rpt)
int x, y;
int tg, rpt;
{
int i, glyph[2];
int i, glyph[2];
glyph[0] = tg;
glyph[1] = (level.flags.hero_memory)
? levl[x][y].glyph
: back_to_glyph(x, y);
for (i = 0; i < 15; i++) {
show_glyph(x, y, glyph[i % 2]);
flush_screen(1);
delay_output();
}
newsym(x, y);
rpt *= 2; /* two loop iterations per 'count' */
glyph[0] = tg;
glyph[1] = (level.flags.hero_memory) ? levl[x][y].glyph
: back_to_glyph(x, y);
/* even iteration count (guaranteed) ends with glyph[1] showing;
caller might want to override that, but no newsym() calls here
in case caller has tinkered with location visibility */
for (i = 0; i < rpt; i++) {
show_glyph(x, y, glyph[i % 2]);
flush_screen(1);
delay_output();
}
}
/*

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 read.c $NHDT-Date: 1559679496 2019/06/04 20:18:16 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.165 $ */
/* NetHack 3.6 read.c $NHDT-Date: 1560085864 2019/06/09 13:11:04 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.171 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Robert Patrick Rankin, 2012. */
/* NetHack may be freely redistributed. See license for details. */
@@ -2450,7 +2450,7 @@ struct _create_particular_data *d;
d->fem = -1; /* gender not specified */
d->randmonst = FALSE;
d->maketame = d->makepeaceful = d->makehostile = FALSE;
d->sleeping = d->saddled = d->invisible = FALSE;
d->sleeping = d->saddled = d->invisible = d->hidden = FALSE;
if ((tmpp = strstri(bufp, "saddled ")) != 0) {
d->saddled = TRUE;
@@ -2522,9 +2522,9 @@ create_particular_creation(d)
struct _create_particular_data *d;
{
struct permonst *whichpm = NULL;
int i, flashglyph, firstchoice = NON_PM;
int i, mx, my, firstchoice = NON_PM;
struct monst *mtmp;
boolean madeany = FALSE, doflash = FALSE;
boolean madeany = FALSE;
if (!d->randmonst) {
firstchoice = d->which;
@@ -2553,7 +2553,7 @@ struct _create_particular_data *d;
/* otherwise try again */
continue;
}
flashglyph = mon_to_glyph(mtmp, rn2_on_display_rng);
mx = mtmp->mx, my = mtmp->my;
/* 'is_FOO()' ought to be called 'always_FOO()' */
if (d->fem != -1 && !is_male(mtmp->data) && !is_female(mtmp->data))
mtmp->female = d->fem; /* ignored for is_neuter() */
@@ -2570,25 +2570,32 @@ struct _create_particular_data *d;
put_saddle_on_mon(otmp, mtmp);
}
if (d->invisible) {
int mx = mtmp->mx, my = mtmp->my;
mon_set_minvis(mtmp);
if (does_block(mx, my, &levl[mx][my]))
block_point(mx, my);
else
unblock_point(mx, my);
doflash = TRUE;
}
if (d->hidden && is_hider(mtmp->data)) {
if (d->hidden
&& ((is_hider(mtmp->data) && mtmp->data->mlet != S_MIMIC)
|| (hides_under(mtmp->data) && OBJ_AT(mx, my))
|| (mtmp->data->mlet == S_EEL && is_pool(mx, my))))
mtmp->mundetected = 1;
doflash = TRUE;
}
if (d->sleeping)
mtmp->msleeping = 1;
if (doflash) {
if (wizard && cansee(mtmp->mx, mtmp->my))
if (!canseemon(mtmp) && !sensemon(mtmp))
flash_glyph_at(mtmp->mx, mtmp->my, flashglyph);
/* iff asking for 'hidden', show locaton of every created monster
that can't be seen--whether that's due to successfully hiding
or vision issues (line-of-sight, invisibility, blindness) */
if (d->hidden && !canspotmon(mtmp)) {
int count = couldsee(mx, my) ? 8 : 4;
char saveviz = viz_array[my][mx];
if (!flags.sparkle)
count /= 2;
viz_array[my][mx] |= (IN_SIGHT | COULD_SEE);
flash_glyph_at(mx, my, mon_to_glyph(mtmp, newsym_rn2), count);
viz_array[my][mx] = saveviz;
newsym(mx, my);
}
madeany = TRUE;
/* in case we got a doppelganger instead of what was asked