Commit Graph

10523 Commits

Author SHA1 Message Date
PatR
b37b9f25ce mention_decor vs Underwater or drowning escape
Avoid redundant
|You are on solid land again.
|You are back on floor.
when walking or teleporting out of water with the mention_decor option on.
2020-04-03 10:41:30 -07:00
Pasi Kallinen
42fc34691d Check for levl typ STONE explicitly
... instead of expecting 0 to be STONE (or unused space in this case)
2020-04-03 13:10:12 +03:00
PatR
a2338e92aa groundwork: u.uinwater manipulation
Toggle u.uinwater on or off in just one place.
2020-04-03 01:04:27 -07:00
Pasi Kallinen
5f9714bf92 Remove workarounds for ancient compilers 2020-04-03 08:21:08 +03:00
PatR
8301fc06df warning fix
Fix a warning about mixing || and && without parentheses where
parentheses were present but a closing one was misplaced.

Also, isok() was redundant in 'isok() && is_pool()' because is_pool()
starts off with its own isok() check.
2020-04-02 12:48:27 -07:00
Pasi Kallinen
2f64f419ad Unify checking if monster is ok in poison gas 2020-04-02 20:53:08 +03:00
PatR
49f4a1d8d2 partial fix for S_unexplored
I've been sitting on this for a while but have decided that I'm not
likely to make any further progress.

SYMBOLS=S_stone:8,S_unexplored:9
on tty reveals that S_stone works as intended but S_unexplored does
not.  Unexplored was being drawn as spaces, and detected or sensed
monsters moving around unexplored areas left a trail of S_unexplored
characters behind them.  ^R reverted those to spaces.

This is only a partial fix that works when the map is initially drawn
or fully redrawn.  But after tty erases parts of lines (when deleting
a menu that overlaid the map or when clearing a message line that
wrapped onto the top line of the map), unexplored locations show up
as space rather than as S_unexplored.
2020-04-01 15:49:28 -07:00
PatR
689c3e67fe restore 'use_inverse' option
'use_inverse' used to be unconditionally present but conditionally
had default value True for WIN32 and False for others.  The options
changes that moved things to optlist.h made it present for WIN32 and
absent for others.  Put it back, and change the default value to be
unconditionally True.
2020-04-01 14:58:40 -07:00
PatR
616029561b moat vs water
Far-look and getpos's autodescribe feedback described the castle moat
as "water" and Juiblex's swamp similarly.  Describe them as "moat"
and as "swamp" instead.
2020-04-01 14:22:47 -07:00
Patric Mueller
acf6f5fdff Level compiler creates correct novel with supplied name
Before this commit, the name of a novel in the level files was ignored for
setting novelidx. But the name was set nevertheless, so you got a named novel
that showed quotes from a different novel.

Now, 'des.object({ id = "novel", name="Raising Steam"});' will work as
expected.
2020-04-01 22:36:30 +02:00
nhmall
3bfb5a6c35 quiet windows x86 warnings
nhlua.c(628): warning C4244: 'function': conversion from 'lua_Integer' to 'int', possible loss of data
nhlua.c(644): warning C4244: 'function': conversion from 'lua_Integer' to 'int', possible loss of data
nhlua.c(646): warning C4244: 'function': conversion from 'lua_Integer' to 'int', possible loss of data
2020-04-01 12:58:36 -04:00
Pasi Kallinen
62538f8e62 Fix iron ball being deallocated when saving
When swallowed by an air elemental, going down into a pit
placed the attached iron ball on the floor. Saving (or
using #wizmakemap) then deallocated the iron ball.

Check being swallowed before trying to go down.
2020-04-01 12:20:18 +03:00
Pasi Kallinen
f13ee3c9bc Fix birth statistics for pets after #wizmakemap 2020-03-31 20:19:33 +03:00
Pasi Kallinen
ac2b34654f Fix lua selection error
There was a rare selection bug where selection was freed by the gc
but it was still in use. Don't remove the selections from the stack
while we're handling them.
2020-03-31 19:11:49 +03:00
PatR
aff1f4c379 'submerged' status condition
Setting up the flag for the submerged condition was unnecessarily
complicated.  The display code distinguishes between being inside
water on Plane of Water and being underwater elsewhere (I'm not
sure why...) but as far as hero and player are concerned, being
submerged in water is the same on the Water level as anywhere else.
It actually is different; levitation and flying can't take the hero
above the surface because there isn't one, but that doesn't mean
that 'submerged' should be suppressed from status there.
2020-03-31 02:38:12 -07:00
PatR
bb6be709d8 tweaks for #wizlevelflip
For interactive level flip, flip cached travel destination and
interrupted digging position.

Also, ball and chain handling wasn't right if the ball was carried.
The fix for that is untested because I don't know how to judge where
the flip area starts and stops and this code is for the case where
that boundary is straddled rather than having hero and ball and chain
all inside or all outside the flip area.
2020-03-30 04:58:28 -07:00
Pasi Kallinen
3776b7d382 Fix monsters overflowing out of rooms in special levels
In a special level, creating more monsters inside room contents
than was space in the room placed monsters outside the room,
possibly inside walls of rooms created afterwards.

Prevent monster creation if inside room contents and there's no
space for the monster.
2020-03-29 11:17:40 +03:00
Pasi Kallinen
87513ad6bf Fix polymorphing monster trying to dig undiggable wall
Not sure if this can actually happen in a non-modified game, but
my fuzz testing stopped here, so deal with it.

If a polymorphing monster turns into an earth elemental or other
wall-phasing monster, it can wander into a non-diggable area, and
then turn into a tunneling monster.
This caused mdig_tunnel to issue an impossible.
2020-03-28 15:43:10 +02:00
Pasi Kallinen
b8668da3ea 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.
2020-03-28 11:40:42 +02:00
PatR
3eed500886 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.)
2020-03-27 19:05:52 -07:00
PatR
0ac3329289 reformat monflag.h
I started out fixing some strangeness near the very bottom then
ended up redoing the whole thing.
2020-03-27 17:47:07 -07:00
Pasi Kallinen
e89c193a57 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.
2020-03-27 17:30:23 +02:00
Pasi Kallinen
d5aa6e04e4 Fix wizmakemap and teleport region 2020-03-27 08:48:29 +02:00
PatR
dbb133ece9 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
2020-03-26 01:31:46 -07:00
Pasi Kallinen
75a24d2846 Fix teleporting not unhiding polyed hero 2020-03-25 19:57:25 +02:00
Pasi Kallinen
eec9c2e209 Expose core random number functions to lua
Expose nh.rn2() and nh.random() to lua.
Add a math.random() compatibility shim to nhlib.lua
2020-03-25 12:24:32 +02:00
Pasi Kallinen
c8fb419a2c Try to fix pet location inconsistency again 2020-03-24 21:56:24 +02:00
nhmall
8961331478 bit 2020-03-22 07:39:44 -04:00
PatR
549f6fba52 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.)

Fixes #304
2020-03-22 03:19:28 -07:00
PatR
ade91fd119 fix github issue #315 - "Moving Pictures" typo
Transcription typo:  had "or", should have been "of".
2020-03-22 02:38:21 -07:00
Pasi Kallinen
596ba4bb8a Fix des tests 2020-03-21 14:03:03 +02:00
PatR
abb492007e 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.
2020-03-20 19:01:34 -07:00
Pasi Kallinen
6227bdf438 Prevent setting boulder symbol to a control character 2020-03-20 21:04:16 +02:00
Pasi Kallinen
a65fc97b44 Prevent zombies in trees in priest quest start 2020-03-20 18:37:01 +02:00
PatR
24f0aa2dc9 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;
|                            ^
2020-03-19 15:08:43 -07:00
Alex Smith
dd6ebbacea 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.
2020-03-19 19:56:16 +00:00
Pasi Kallinen
a142ac8140 Unify special level c code for stairways 2020-03-19 21:23:55 +02:00
PatR
126743ac0c 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
2020-03-18 18:46:21 -07:00
Alex Smith
c698b5654c Merge branch 'NetHack-3.7' of https://rodney.nethack.org:20040/git/NHsource into NetHack-3.7 2020-03-18 23:02:04 +00:00
Alex Smith
564dd1db8d 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.
2020-03-18 23:00:31 +00:00
Pasi Kallinen
9ab6994eae Make Juiblex resist magical digging from inside
Juiblex should be a little bit harder to beat than zapping a digging
wand once you've gotten swallowed and then whacking him once.

Make his HP halve every time you zap digging instead of setting it
to 1.

Change via UnNetHack.
2020-03-18 09:16:26 +02:00
PatR
3546b2f016 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.
2020-03-17 15:04:54 -07:00
Pasi Kallinen
750d2fe560 Alias "kirin" for "ki-rin" 2020-03-17 19:06:32 +02:00
Pasi Kallinen
a57894cedb Prevent monsters in trees in monk quest start 2020-03-17 18:09:33 +02:00
PatR
40d19525c3 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.
2020-03-16 17:32:12 -07:00
PatR
8ccc9773aa 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.
2020-03-16 15:40:52 -07:00
Pasi Kallinen
15019248ae 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.
2020-03-16 22:17:15 +02:00
Pasi Kallinen
44ba4a9e96 Don't flip column 0 2020-03-16 22:10:37 +02:00
Pasi Kallinen
712f545119 Move, rename, and comment out unused function 2020-03-16 11:46:08 +02:00
Patric Mueller
9862d2c934 Use correct archaic form for "thine audience"
Closes GitHub issue #313.
2020-03-16 10:33:31 +01:00