Pasi Kallinen [Sat, 28 Mar 2020 09:40:39 +0000 (11:40 +0200)]
Fix purple worm ending up in solid wall
If you're in a vault, the vault guard enters, and your tame purple worm
swallows and kills the guard, the worm ended up inside the vault wall.
Instead return the attacker to the old location, if the defender's
position isn't good.
PatR [Sat, 28 Mar 2020 02:05:52 +0000 (19:05 -0700)]
fix #K669 - 'nasty' monster summoning
Report complained about multiple Archons causing his character to
be swarmed by monsters on the Plane of Fire. I don't think that
the behavior has changed significantly from how it worked in 3.4.3.
Nobody can summon an Archon directly because they're excluded from
the nasties[] list. But whenever summoning picks a genocided
'nasty', the result gets replaced by random monster of appropriate
difficulty for the level (which could be an Archon for a high level
character in the endgame). [Note that that won't pick an Archon
in Gehennom or at arch-lich outside of there because the random
monster creation honors the only-in-hell and never-in-hell flags;
picking from the nasties[] list doesn't.]
This prevents that for any creature (except arch-lich or the Wizard)
casting the summon nasties spell. If a replacement creature is a
spellcaster it now has to have lower difficulty than the summoner.
If not, it will be discarded even though its difficulty is classified
as appropriate. So to summon an Archon, the summoner has to have
higher difficulty than an Archon; arch-lich and the Wizard are the
only ones meeting that criterium. When summoner is an arch-lich,
it can't summon another arch-lich (since that wouldn't have lower
difficulty than the summoner) and can summon (via replacement for
genocided type, and only if outside of Gehennom) at most one Archon.
When summoner is the Wizard, he could summon an arch-lich (when in
Gehennom; demoted to master lich elsewhere--see below) or an Archon
(outside Gehennom only), but at most one per summoning.
For post-Wizard harassment, which effectively has infinite
difficulty level, it could still happen. However, each instance of
harassment is only allowed to create at most one Archon or arch-lich
now, so chain summoning should be lessoned. Also if it tries to
pick an arch-lich when outside of Gehennom it will switch to master
lich instead (which won't be allowed to summon an Archon or an arch-
lich or even another master lich).
(The monmove.c bit is unrelated, just some comment formatting that
I had laying around that got mixed in.)
Pasi Kallinen [Fri, 27 Mar 2020 15:19:27 +0000 (17:19 +0200)]
Fix flipping while punished
... if either you, the ball, or the chain are outside the flip area.
Just unplace the b&c and then put it down under the hero.
This can only happen via #wizlevelflip, as normal level flipping
is done when creating the level and b&c are not on the map.
PatR [Thu, 26 Mar 2020 08:31:46 +0000 (01:31 -0700)]
teleds() vs ball&chain
I think this should fix #K672 but without a test case I can't be sure.
The ball and chain handling in teleds() was a bit convoluted and this
streamlines it a bit.
There is still the situation that one place uses 'can't drag ball if
dist > 1' and another uses 'no need to move ball if dist <= 2'. That
seems contradictory but I want to prevent my head from spinning so
haven't tried to puzzle it out. Instead of relying on multiple flag
variables to decide whether to call placebc(), the ball and chain (or
just chain when ball is carried) will be replaced if they were on the
map before moving the hero and aren't there after assigning hero's
new location
PatR [Sun, 22 Mar 2020 10:19:28 +0000 (03:19 -0700)]
fix github issue #304 - #offer old corpses
Same race corpses, deceased pet corpses, wraith corpses, and unicorn
corpses could be sacrificed even when otherwise too old. This
prevents that for wraith and unicorn corpses but leaves the same
race and dead pet cases as is. I'm not sure that this is the right
way to resolve things but at least has the virute of being simple.
This also lets chaotics get the trivial bonus for sacrificing a
wraith corpse even though alignment matches. Alignment doesn't
matter for anything else (except unicorns) and giving up a wraith
corpse that isn't too old to eat is a tangible sacrifice. Unless
the hero is vegetarian (or the supersets vegan and foodless) since
giving up a corpse that won't be eaten isn't worthy of a bonus.
(It will still retain regular sacrifice value in that situation.)
PatR [Sat, 21 Mar 2020 02:01:34 +0000 (19:01 -0700)]
praying on unaligned altar outside Gehennom
From a reddit thread, praying on the altar in orctown behaved like an
ordinary prayer directed at Moloch rather than being an exceptional
event. Make it always be rejected. The penalty is very trivial.
PatR [Thu, 19 Mar 2020 22:08:43 +0000 (15:08 -0700)]
warning fix
This one is more interesting that most....
|sp_lev.c:3745:9: warning: declaration shadows a variable in the
| global scope [-Wshadow]
|boolean ladder;
| ^
|../include/rm.h:538:20: note: expanded from macro 'ladder'
|#define ladder flags /* up or down */
| ^
|../include/flag.h:428:29: note: previous declaration is here
|extern NEARDATA struct flag flags;
| ^
Alex Smith [Thu, 19 Mar 2020 19:56:16 +0000 (19:56 +0000)]
Correct timing when attaching lit candles to the candelabrum
Before this commit, attaching a lit candle would reduce the amount
of fuel in the candelabrum to 0, 15 or 75 turns due to a failure to
account for time stored in the candle's burn timer. Fixing this is
very important because a time of 0 turns on the candelabrum is not
supposed to be possible.
PatR [Thu, 19 Mar 2020 01:46:21 +0000 (18:46 -0700)]
X11 fancy status overloaded conditions
Add 'tethered' and 'holding' as displable status conditions for X11.
For tty-style status, they're ordinary. For 'fancy status', tethered
is displayed in the 'trapped' slot (since they'll never both be shown
at the same time) and holding is displayed in the 'held' slot (same
situation).
It's more proof of concept for overloading of status conditions than
adding useful specific conditions. This was the third iteration; the
first two were either too fragile or used even more code. It could
probably be simplified by making some mutally exclusive conditions be
more like hunger and encumbrance instead of being distinct flags
Alex Smith [Wed, 18 Mar 2020 23:00:31 +0000 (23:00 +0000)]
Safety valve against candelabrum's .age becoming 0
This may have happened in a 3.7 game on Hardfought. Even if it didn't,
I'm still uncomfortable with the potential for the game to potentially
become unwinnable as a consequence of age field corruption. Add an
impossible() for when this situation happens, and code after the
impossible() to repair the game by removing the candles.
PatR [Tue, 17 Mar 2020 22:04:54 +0000 (15:04 -0700)]
X11 'fancy' status condition highlighting
X11's "fancy status" does its own highlighting that predates
STATUS_HILITES, showing things which have changed in inverse video
for a turn. However, it excluded conditions plus hunger and
encumbrance. Make it highlight those similarly when they come On
(and when they change from one non-blank state to another in the
case of hunger or encumbrance). There's no corresponding
unhighlight when going Off because they're blanked out instead.
PatR [Tue, 17 Mar 2020 00:32:12 +0000 (17:32 -0700)]
updating 'time' status
Handling botl updates for 'time' was inconsistent. Set the flag to
do that when moves is incremented (where the update is suppressed if
running) or when running stops short.
losehp() would cancel running/traveling if called when in normal form
but not if called when polymorphed, so theoretically you could take
damage and keep on running. I don't have a test case to verify that.
PatR [Mon, 16 Mar 2020 22:40:52 +0000 (15:40 -0700)]
fix #K608 - ball and chain distance warning
This fixes the reported situation of recoiling from a throw while
levitating and carrying the ball not bringing the chain but it might
introduce other problems. If it does, drag_ball() would be the place
to fix that, not hurtle_step().
Separate bug (not fixed): throwing while the ball is on the floor
ought to let you recoil to as far as the chain will reach but it just
yields "you feel a tug from the ball" and you don't recoil at all.
Pasi Kallinen [Mon, 16 Mar 2020 20:13:17 +0000 (22:13 +0200)]
Fix pet location inconsistency
... if the pet attacked hero or another monster by eg.
swallowing them, the pet's location might've changed
during that attack. Count it as movement, so return
immediately.
Pasi Kallinen [Sun, 15 Mar 2020 09:29:32 +0000 (11:29 +0200)]
Major amnesia revamp
Instead of forgetting maps and objects, make amnesia forget skills.
Forgetting maps and objects could be circumvented with taking notes,
or by using an external tool to remember the forgotten levels.
Forgetting skills allows the player to optionally go down another
skill path, if they trained the wrong weapon in the early game.
Amnesia still forgets spells.
As a replacement for the deja vu messages when entering a forgotten
level, those messages will now indicate a ghost with your own name
existing on the level, given only when the level is entered for
the first time.
These changes based on fiqhack, with some adjustments.
Pasi Kallinen [Sat, 14 Mar 2020 19:02:25 +0000 (21:02 +0200)]
Tone down scare monster by excluding humans and uniques
Scroll of scare monster completely shut down most of the actual
challenging monsters, such as uniques. Tone it down, so you can
use it to ignore the smaller threats while dealing with uniques,
or get most of the effect in the early game when you're usually
dealing with normal monsters.
PatR [Sat, 14 Mar 2020 10:47:27 +0000 (03:47 -0700)]
X11 status overhaul
I started out adding a few new status conditions to X11's "fancy status"
(the default) to gauge how difficult it was going to be. In the process
I found several latent bugs. After fixing those, I decided that the same
status conditions should be added to the alternate "tty-style status".
Lots more latent bugs, some of the same nature, others different. Things
spiraled until the code change is very substantial.
Code for the old two-line status is still present but I don't know how
to activate it. Unlike tty-style status, it composes and displays two
lines of text and isn't capable of highlighting portions of that text,
so it would be considered deprecated anyway.
All testing was done with the default NetHack.ad (except when turning
'fancy_status' off) so I don't know whether the new code might override
previously customizable status settings. I'm not sure whether this list
covers all the fixes....
both tty-style and fancy
add new status conditions 'grabbed' (by eel), 'held', 'trapped', and
'sinking-into-lava' (others will eventually follow); grab and lava
are on by default, the others have to be enabled via options
both tty-style (not handled) and fancy (faulty boolean logic)
polymorphing didn't change Xp to HD (silver lining: rehumanizing
didn't need to reverse it)
tty-style only; fancy was ok
force white text (on black background) instead of settling for gray
turning on optional showexp, showscore, and/or time worked but turning
them back off again didn't remove the relevant fields
polymorphing when showexp was on didn't suppress Exp-points
tty-style only; fancy uses different layout
condense conditions into simple left-to-right space separated list
instead of giving them specific locations and having gaps of blank
space for conditions that aren't in effect
tty-style only; not applicable for fancy (status_hilites not implemented)
all highlights stuck if 'statushilites' was reset to 0 to disable them
displaying anything with bold attribute stuck; it wouldn't revert to
normal text if a different highlight rule without bold was used for
subsequent updates
avoid inverting leading space that separates from preceding field when
highlighting with inverse video attribute
add support for 'dim' attribute using gray foreground (only viable
after the fix for white foreground)
fancy only
reorganize the field layout so that things line up nicely instead of
having columns with six, seven, or eight lines be spread over same
amount of vertical space
line up the values of the six characteristics, similar to how vertical
status works in curses: all two digits; when exceptional strength is
present, the '18' lines up and rest goes past implicit right margin
use status conditions as provided by core instead of duplicating them
(other fields still duplicate stuff done in botl.c); doing this
required forcing 'VIA_WINDOWPORT()' if built without STATUS_HILITES
Pasi Kallinen [Sat, 14 Mar 2020 09:28:29 +0000 (11:28 +0200)]
Flip timed effects
In wizard mode, freezing some water on the ground, then
flipping the level did not flip the coordinate of the ice
thawing timed effect. This could cause an impossible complaint.
Pasi Kallinen [Fri, 13 Mar 2020 17:28:56 +0000 (19:28 +0200)]
Fix vault guard leaving monsters encased in stone
For some reason the vault guard fake corridor code checked
if the hero was outside the corridor before removing monsters.
But the vault end of the corridor usually gets sealed off
even while you're still in the corridor. This left monsters
stuck in solid rock.
Pasi Kallinen [Thu, 12 Mar 2020 17:13:08 +0000 (19:13 +0200)]
Fix priest generated inside temple wall
In a rare case, a random room's width can be 2 tiles, and if
that room was converted into a temple, the priest ended up
inside the wall. Try to put the priest on a random valid position
around the altar, or on it.
PatR [Wed, 11 Mar 2020 11:40:51 +0000 (04:40 -0700)]
fountain vs perm_invent
From a reddit thread. Quaffing from a fountain can curse some of
hero's inventory, but when doing so it wasn't updating the persistent
inventory window if that was enabled.
It could also set the cursed flag on goid pieces; so could dipping.
PatR [Tue, 10 Mar 2020 22:59:01 +0000 (15:59 -0700)]
ball and chain panic when teleporting
"remove_obj: obj not on floor" when trying to move the iron ball.
For the circumstances involved, the ball wasn't supposed to be
moved anyway, just the chain.
I could reproduce the problem using the steps specified. I didn't
track down the precise point of failure but after this fix the
panic can't be reproduced anymore.
Pasi Kallinen [Tue, 10 Mar 2020 16:08:40 +0000 (18:08 +0200)]
Make sure random doors don't open into solid wall
When making a random door into a random wall or random position
in a room, keep trying harder to find a location that doesn't
have solid wall behind it.
Pasi Kallinen [Tue, 10 Mar 2020 06:02:08 +0000 (08:02 +0200)]
Prevent wizmode panic
In wizard mode, if you angered your quest leader and got expelled from
the quest (which removes the quest portal from the dungeon), then used
the wizmode level teleport menu to teleport back to the quest start and
talked with the angry leader, you would get booted back to the dungeon,
and the game panicked because the dungeon end of the portal didn't
exist anymore.
PatR [Sun, 8 Mar 2020 23:02:22 +0000 (16:02 -0700)]
fixes37.0
Remove the entry about creating Guidebook.dat on Unix since it got
moved to 3.6.6.
The orc town raiders were introduced in 3.6.2, not to-be-3.7, so the
fixes entry for unintentionally giving orc zombies and orc mummies
clan names should be in the general fixes section rather than the
exposed by git section.
PatR [Sun, 8 Mar 2020 21:51:22 +0000 (14:51 -0700)]
minor #wizmakemap fix - revoked achievements
When replacing Mines' End or top of Sokoban, the achievement for
finding the special prize there is reset. But the code to do so was
accidentally inside the monster processing loop and got repeated for
each monster on the old instance of the level (essentially a no-op
after the first one though). That code had been updated more than
once without noticing. Move it out of the loop.
PatR [Sun, 8 Mar 2020 17:29:39 +0000 (10:29 -0700)]
^G limit
Relax the count limit from 255 to ROWNO*(COLNO-1) so that it can
be big enough to fill an entire level yet remain small enough to
not churn away seemingly forever if an absurd amount is specified
for 'random' or for a class rather than a type. (By-type already
gives up as soon as failure occurs, so is implicitly limited to a
count matching the available space on the level.) Also impose the
same limit on 'count ^G monster' as '^G count monster'.
PatR [Sat, 7 Mar 2020 19:20:45 +0000 (11:20 -0800)]
remove mhitm.c's 'otmp'
Get rid of a couple of variables that were file scope and then
incorporated into 'g'. This should prevent the situation where
attacking a shade gave bogus feedback about glorkum although I
never did reproduce that.
This eliminates g.otmp and g.dieroll but leaves a couple of others.
g.vis really should go away....
PatR [Sat, 7 Mar 2020 18:47:51 +0000 (10:47 -0800)]
mon's glorkum pass harmlessly through the shade
I couldn't reproduce the problem; it appears to depend upon whether
the file-scope variable 'otmp' has a stale value, and that might
happen after a monster has tried to steal mon's saddle. However,
the code pointed out in the report is clearly wrong. This prevents
feedback of "glorkum" (with plural verb since quantity of 0 isn't 1),
but the potential stale value hasn't been dealt with.
Pasi Kallinen [Sat, 7 Mar 2020 15:05:39 +0000 (17:05 +0200)]
Fix flipping non-existent stairs
If the stair or ladder x coord is 0, it doesn't exist.
Flipping it, caused "u_on_newpos: trying to place hero off map <80,0>"
when coming back up from the valley into the castle, and the
castle was flipped.
PatR [Fri, 6 Mar 2020 17:24:33 +0000 (09:24 -0800)]
fix #H4545 - stack of scrolls of scare monster
Reported 3.5 years ago. Specifying a count for pickup to pick up a
subset of a stack was processed after scrolls of scare monster were
handled, so a whole stack of those got picked up or crumbled to dust
whether you gave a count or not. Also, if you were too encumbered to
pick up the full stack, they still all crumbled or all changed state
to crumble next time, then for the latter case you picked up as big a
subset as you could handle.
PatR [Thu, 5 Mar 2020 21:55:45 +0000 (13:55 -0800)]
avoid #wizrumorcheck crash on bad rumor input
If either rumors.tru or rumors.fal was empty when makedefs made
'rumors', init_rumors() will set true_rumor_size to -1 to indicate
that rumors aren't available. It also closes the input file, and
then #wizrumorcheck closed that again, triggering a crash in the
dlb code.
Fortune cookies and oracles work ok (just not very interesting)
when rumors aren't available. Only the check command had trouble
with that.
PatR [Sat, 22 Feb 2020 09:41:04 +0000 (01:41 -0800)]
fix github issue #302 - divide by 0 crash
The traceback points directly to the problem: divide by 0 happens
if the 'bogusmon' file only contains the "do not edit" line, which
would happen if 'bogusmon.txt' is empty. makedefs probably ought to
complain about that.
There is now one hardcoded bogus monster to fall back to: 'bogon'.
Random tombstone epitaphs report divide by 0 if their text source is
empty, but it is done by rn2() rather than rn2_for_display_rng() so
is just a warning for pre-release code. It would crash for release
version though.
I tried placing an empty engravings file and expected similar results
but didn't see any response. Not sure what that means.
After the fix, empty epitaph file yields blank result so graves that
want a random epitaph won't have any epitaph.
PatR [Mon, 2 Mar 2020 23:58:42 +0000 (15:58 -0800)]
Mister Fantastic's sea monster form
While polymorphed and underwater, an eel bite killed the hero who
rehumaized and crawled out of the water, then the eel continued with
its second attack and "wrapped itself around you" even though no
longer adjacent. That's a long reach....
| ...@.
| .;}..
| .}}..
Make any additional attacks silently miss if hero changes location
during the attack sequence of a monster who has pinpointed the hero.
PatR [Mon, 2 Mar 2020 23:16:50 +0000 (15:16 -0800)]
conditional status condition tracking
If 'sinking-into-lava' is disabled as a displayed status condition
but general 'trapped' is enabled, then display 'trapped' when in lava.
Similarly, if 'grabbed-by-eel' is disabled but more general 'held' is
enabled, display 'held' when grabbed.
PatR [Mon, 2 Mar 2020 23:05:06 +0000 (15:05 -0800)]
panictrace_libc
Try to make the tracebacks generated via PANICTRACE's libc method
be more readable. There tends to be a lot of blank space in the
middle of lines, depending on the length of the program's or
libraries' file names, which can make lines wrap and the whole
thing sometimes be harder to make out. Narrow it by squeezing out
some spaces from each line before writing to reduce the chance of
line wrapping. That isn't guaranteed to make things ledgible but
seems to help quite a bit. Also, force the line number inserted
by nethack to be two digits so when spanning from line 9 to line 10
it doesn't cause the field positions to shift by a column. (Using
'#panic' doesn't have enough stack frames to illustrate that.)
I think the original libc formatting was designed for the address
column to hold a 32-bit value ('0x' prefix and 8 hex digits), and
eventually extending that to handle 64 bits ('0x' prefix and 16 hex
digits) made things wider than intended. But the gradual increase
in the length of function names we use is also a factor.