]> granicus.if.org Git - nethack/log
nethack
5 years agoAdd selection gradient doc placeholder
Pasi Kallinen [Mon, 6 Apr 2020 16:03:28 +0000 (19:03 +0300)]
Add selection gradient doc placeholder

5 years agoRe-implement gradient selections
copperwater [Sat, 29 Feb 2020 16:06:30 +0000 (11:06 -0500)]
Re-implement gradient selections

Uncomments and makes available selection.gradient in Lua. (The backend C
code for this still existed, it just wasn't used.)

The only valid way to specify a gradient is with a table. I considered
adding non-table versions, but decided that there are too many
independent variables that can be optional. A non-table version, without
named parameters, would be confusing to read, especially since most of
the arguments are ints.

Also adds an impossible in the (possibly unreachable) case that
selection_do_gradient gets called with a bad gradient type.

5 years agoPrint out Lua error message when encountering an error
copperwater [Sun, 1 Mar 2020 20:20:16 +0000 (15:20 -0500)]
Print out Lua error message when encountering an error

Rather than spitting out an error code number that is not particularly
useful. The string contains the line number and the nature of the error,
which is much more useful for debugging or reporting an issue.

5 years agofix segfault fix
PatR [Mon, 6 Apr 2020 15:24:39 +0000 (08:24 -0700)]
fix segfault fix

Previous fix prevented getting skill feedback about bare-handed
combat/martial arts.

5 years agoFix one more prototype warning
Pasi Kallinen [Mon, 6 Apr 2020 15:24:15 +0000 (18:24 +0300)]
Fix one more prototype warning

5 years agoPrevent segfault when not wielding anything
Pasi Kallinen [Mon, 6 Apr 2020 15:09:47 +0000 (18:09 +0300)]
Prevent segfault when not wielding anything

5 years ago^X weapon feedback
PatR [Mon, 6 Apr 2020 13:25:17 +0000 (06:25 -0700)]
^X weapon feedback

Report weapon skill in the ^X status section when dual-wielding,
The effective skill level is the lower of the weapon's skill and
two-weapon skill, separately for primary and secondary.  It's a
much bigger chunk of code than most enlightenment/^X features so
I put it in its own routine.

5 years agodual-wielding tweaks
PatR [Mon, 6 Apr 2020 13:12:25 +0000 (06:12 -0700)]
dual-wielding tweaks

Reject arrows and darts as candidates for wielding two weapons at
once.

Make the check for being able to two-weapon when polymorphed be more
robust.  Instead of just testing whether the monster form's second
atttack is a weapon attack and then assuming that the first one is
too, test the first three to validate that at least two of those are
AT_WEAP.  The existing code works but seemed fragile.

5 years agoAnd some more warning fixes
Pasi Kallinen [Mon, 6 Apr 2020 12:41:26 +0000 (15:41 +0300)]
And some more warning fixes

5 years agoFix even more warnings
Pasi Kallinen [Mon, 6 Apr 2020 08:54:30 +0000 (11:54 +0300)]
Fix even more warnings

5 years agoFix more warnings
Pasi Kallinen [Mon, 6 Apr 2020 07:25:17 +0000 (10:25 +0300)]
Fix more warnings

5 years ago'A' tweak
PatR [Sun, 5 Apr 2020 22:32:00 +0000 (15:32 -0700)]
'A' tweak

Get rid of a couple of unnecessary calls to set_twoweap() to clear
u.twoweap when using 'A' to 'take off' either weapon.  setuwep() and
setuswapwep() don't do that, but they call setworn() which does.

Make the feedback when disarming with 'A' be more specific when you
are two-weaponing at the time either weapon is unwielded.

5 years agowarning fix
PatR [Sun, 5 Apr 2020 21:31:01 +0000 (14:31 -0700)]
warning fix

A couple of the new prototypes used 'char' where 'CHAR_P' is needed.

Also, move them out of middle of long block of command declarations.
I started to reorder the prototypes into the order in which those
functions appear in the file but gave that up pretty quickly.

5 years agoX11 vs S_unexplored
PatR [Sun, 5 Apr 2020 20:37:06 +0000 (13:37 -0700)]
X11 vs S_unexplored

X11 was still initializing a blank map to 'stone' instead of to
'unexplored'.  When the core started forcing 'unexplored' as part
of cls(), you could see the S_stone background show up and then be
overwritten with S_unexplored.

Also, X11 is [still] drawing unused column 0.  That was also 'stone'
but has been changed to 'nothing' so is now blank for both tiles map
and text map (regardless of S_unexplored value).  The extra useless
column doesn't look too bad normally but does if a vertical scroll
bar is added to support a clipped map.

5 years agoFix more warnings
Pasi Kallinen [Sun, 5 Apr 2020 18:53:45 +0000 (21:53 +0300)]
Fix more warnings

5 years agoFix warnings
Pasi Kallinen [Sun, 5 Apr 2020 18:36:33 +0000 (21:36 +0300)]
Fix warnings

Add missing prototypes and rename one shadowed declaration.

5 years agoRefactor mongets to return the object it creates
copperwater [Wed, 18 Sep 2019 15:12:09 +0000 (11:12 -0400)]
Refactor mongets to return the object it creates

The impetus for this was to avoid ugly constructions such as the one
below (none of which currently appear in vanilla NetHack):

mongets(mtmp, LONG_SWORD);
struct obj* sword = m_carrying(mtmp, LONG_SWORD);
if (sword)
  /* do thing to sword */

Most cases where mongets is used discard the returned value (which used
to be the created object's spe); the only places that do use it are the
series of statements that give various human monsters armor and prevent
them from getting too much armor. These statements included hardcoded
constants representing the base AC of the armor, which would have caused
discrepancies if armor's base AC were ever changed.

With mongets now returning a pointer to the created object, it can just
be passed into ARM_BONUS instead, which covers both the base AC and the
enchantment. (It will also cover erosion, if anyone ever decides that
armor should rarely generate as pre-eroded).

The overall algorithm is not changed by this; human monsters should
receive armor with the same probabilities as before.

5 years agoDon't interrupt tin opening if being slimed and tin is chameleon
copperwater [Thu, 31 Jan 2019 01:54:30 +0000 (20:54 -0500)]
Don't interrupt tin opening if being slimed and tin is chameleon

Another SliceHack feature. It's possible for you to eat the chameleon
tin and turn into a fiery monster that burns off the slime in its
natural form, either extremely luckily at random or if you have
polymorph control.

5 years agoBlessed teleport scrolls now give a single controlled teleport
copperwater [Mon, 30 Oct 2017 23:22:44 +0000 (19:22 -0400)]
Blessed teleport scrolls now give a single controlled teleport

This buffs the blessed effect of the teleport scroll by providing the
reader control over their destination even if they lack teleport
control. This seems like it makes the blessed/uncursed distinction
actually meaningful, rather than mostly pointless.

5 years agoPets will not eat shapeshifter corpses except in extreme circumstances
copperwater [Fri, 19 Oct 2018 14:21:25 +0000 (10:21 -0400)]
Pets will not eat shapeshifter corpses except in extreme circumstances

Ported from SpliceHack, and generalized to all shapeshifters (Splice
only implemented it for chameleons). It's very aggravating when your
powerful but hungry pet chows down on a shapeshifter before you can stop
them and then turns into something much more useless, so this aims to
prevent that.

The extreme circumstances under which a pet will eat a shapeshifter are:
  1. The pet is starving, and prefers polymorph to starvation
  2. The pet's tameness is 1

The reasoning behind the second condition is that if you mistreat your
pet almost to the point of untaming it, it might want to take a chance
on turning into something that might get some more respect from you.
Practically, whenever this happens, this will result in the player now
owning a newly polymorphed and *still* nearly feral pet.

5 years agopurple worms
PatR [Sun, 5 Apr 2020 12:57:37 +0000 (05:57 -0700)]
purple worms

Compiler complained about 'ptr' possibly being used unitinialized
in meatcorpse() and in this case it was right.  meatcorpse() was
cloned from meatobj() but the necessary initialization was missing.

Purple worm would devore an entire stack of corpses in one bite.
Split one off and have it eat that instead.

I'm not sure whether attempting to revive a Rider corpse can force
a monster off the level to make room.  If so, meatobj() and
meatcorpse() weren't prepared to handle that, nor was their caller.
It appears that the monster (either g.cube or purple worm) will
only eat as it moves so can't revive a Rider on a completely full
level since it won't be able to move in that situation.  I fixed
the caller to be prepared to handle a result of 3 (no further
action allowed) instead of just dealing with 2 (died), but I didn't
fix either of the meatfoo() routines to return 3 since bumping the
eating monster off the level seems to not be possible.

Don't let purple worms eat lichen corpses, regardless of whether
they'll swallow live ones.

5 years agoMake demon lords hostile if wielding Demonbane as well as Excalibur
copperwater [Tue, 25 Sep 2018 01:03:03 +0000 (21:03 -0400)]
Make demon lords hostile if wielding Demonbane as well as Excalibur

This makes a lot of sense. Why would they hate one artifact sword so
much and not really care about the one that is especially designed to
kill their type personally?

5 years agoScroll of remove curse becomes learned when items' curses are removed
copperwater [Wed, 1 Nov 2017 02:15:44 +0000 (22:15 -0400)]
Scroll of remove curse becomes learned when items' curses are removed

The scroll of remove curse is trivially identified by checking inventory
after reading it to see whether anything became uncursed. This leads to
annoying tactics like remembering which scroll you just read so you can
go call it "remove curse" on the discoveries list.

This simply autoidentifies it when an item that was known to be cursed
has its curse removed.

5 years agoDeliberate level teleporter activation ignores magic resistance
copperwater [Fri, 1 Feb 2019 17:08:54 +0000 (12:08 -0500)]
Deliberate level teleporter activation ignores magic resistance

This is aimed at providing a little quality of life in the form of not
having to divest yourself of your sources of magic resistance before
using a level teleporter. The player is already able to use regular
teleport traps while Antimagic; there's no reason why it should be
different for level teleporters.

This ultimately comes from "Stevie-O's level teleporter jump patch", by
way of SliceHack. I simplified it a bit: deliberately jumping onto the
trap always takes time even if it fails to levelport you (which would
only happen with level teleporters in the End Game, which don't exist).

5 years agoYou may survive food poisoning with a Con/100 chance
copperwater [Sat, 26 Jan 2019 23:32:02 +0000 (18:32 -0500)]
You may survive food poisoning with a Con/100 chance

Another feature from SliceHack. Randomly averting an instadeath might
seem a little too generous, but the only time you get food poisoning is
if you're a new player who hasn't learned about tainted corpses yet or
if you just did something stupid. So, be a little nicer in those
scenarios.

If you survive, your Con silently decreases by 1. Hey, it's better than
dying.

5 years agoPotions of hallucination can give enlightenment
copperwater [Thu, 31 Jan 2019 04:47:05 +0000 (23:47 -0500)]
Potions of hallucination can give enlightenment

This is also from SliceHack, but with the odds of enlightenment toned
down a bit, to 4/9 for a blessed potion and 1/6 for an uncursed potion
(SliceHack had it at 50% blessed, 20% cursed, and strangely, 0%
uncursed). It gives a much-needed use to one of the potions that's
commonly blanked or discarded.

5 years agoConfused scroll of light conjures tame cancelled lights
Pasi Kallinen [Sun, 5 Apr 2020 10:21:54 +0000 (13:21 +0300)]
Confused scroll of light conjures tame cancelled lights

Tame cancelled lights are actually quite interesting and useful: they
are a mobile light source that will follow you around, and because they
are cancelled they won't explode at hostile monsters.

This replaces the existing confused scroll effect of creating an area of
darkness (the cursed scroll of light still produces this effect). If you
are confused *and* the scroll is cursed, it summons black lights instead
of yellow ones.

Original change by copperwater <aosdict@gmail.com>, added with
formatting and some functional changes.

5 years agoPurple worm changes
Pasi Kallinen [Sun, 5 Apr 2020 09:43:54 +0000 (12:43 +0300)]
Purple worm changes

Shriekers only spawn purple worms when they're appropriate difficulty.
Non-tame Purple worms eat corpses off the ground.
Baby purple worms attack shriekers.
Hero polyed into baby purple worm is warned against shriekers.

Original changes by copperwater <aosdict@gmail.com>, added with some
formatting adjustments and consolidation.

5 years agowizard mode wishing for terrain
PatR [Sat, 4 Apr 2020 10:29:40 +0000 (03:29 -0700)]
wizard mode wishing for terrain

Changing terrain type without moving wasn't registering as moving to
different terrain.  A Passes_walls hero who has levitation blocked
while moving through solid rock can wish for furniture.  Levitation
remained blocked unless hero moved off that spot and then back on.

Doesn't affect normal play.  Changing terrain by digging already
deals with similar situation; not sure whether there are any other
situations that might need to handle it.

5 years agoswitch_terrain() logic bug causing status updates
PatR [Sat, 4 Apr 2020 09:41:13 +0000 (02:41 -0700)]
switch_terrain() logic bug causing status updates

When moving onto a different terrain type, the logic for whether to
block or unblock levitation and flying (for the case of moving in
or out of walls and solid stone with Passes_walls while levitating)
was correct but the XOR logic for whether to do a status update
because of such a change was incorrect.  So stepping from room floor
to furniture or to doorway and vice versa or from corridor to doorway
and vice versa was requesting a status update when there was no need
for one.

Some other code must be requesting a status update when it is needed
for this (or possibly even more often than that?) because the status
line does seem to show the current state of Lev and Fly accurately.
Otherwise this should have been noticed when switch_terrain() was
first implemented.

5 years agogroundwork: u.twoweap manipulation
PatR [Fri, 3 Apr 2020 18:42:17 +0000 (11:42 -0700)]
groundwork: u.twoweap manipulation

Toggle u.twoweap on or off in just one place.

5 years agoset_uinwater() bit
PatR [Fri, 3 Apr 2020 18:39:40 +0000 (11:39 -0700)]
set_uinwater() bit

Assignment target is a one bit wide bitfield; callers only pass 0 or 1
but guarantee that value fits so that no compiler has reason to complain.

5 years agoMake hezrous stink
Pasi Kallinen [Fri, 3 Apr 2020 18:05:45 +0000 (21:05 +0300)]
Make hezrous stink

5 years agoFlip poison gas clouds
Pasi Kallinen [Fri, 3 Apr 2020 17:41:46 +0000 (20:41 +0300)]
Flip poison gas clouds

5 years agomention_decor vs Underwater or drowning escape
PatR [Fri, 3 Apr 2020 17:41:30 +0000 (10:41 -0700)]
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.

5 years agoCheck for levl typ STONE explicitly
Pasi Kallinen [Fri, 3 Apr 2020 10:10:08 +0000 (13:10 +0300)]
Check for levl typ STONE explicitly

... instead of expecting 0 to be STONE (or unused space in this case)

5 years agogroundwork: u.uinwater manipulation
PatR [Fri, 3 Apr 2020 08:04:27 +0000 (01:04 -0700)]
groundwork: u.uinwater manipulation

Toggle u.uinwater on or off in just one place.

5 years agoRemove workarounds for ancient compilers
Pasi Kallinen [Fri, 3 Apr 2020 05:21:08 +0000 (08:21 +0300)]
Remove workarounds for ancient compilers

5 years agowarning fix
PatR [Thu, 2 Apr 2020 19:48:27 +0000 (12:48 -0700)]
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.

5 years agoUnify checking if monster is ok in poison gas
Pasi Kallinen [Thu, 2 Apr 2020 15:15:13 +0000 (18:15 +0300)]
Unify checking if monster is ok in poison gas

5 years agopartial fix for S_unexplored
PatR [Wed, 1 Apr 2020 22:49:28 +0000 (15:49 -0700)]
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.

5 years agorestore 'use_inverse' option
PatR [Wed, 1 Apr 2020 21:58:40 +0000 (14:58 -0700)]
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.

5 years agomoat vs water
PatR [Wed, 1 Apr 2020 21:22:47 +0000 (14:22 -0700)]
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.

5 years agoLevel compiler creates correct novel with supplied name
Patric Mueller [Wed, 1 Apr 2020 20:36:30 +0000 (22:36 +0200)]
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.

5 years agoquiet windows x86 warnings
nhmall [Wed, 1 Apr 2020 16:58:36 +0000 (12:58 -0400)]
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

5 years agoFix iron ball being deallocated when saving
Pasi Kallinen [Wed, 1 Apr 2020 09:20:14 +0000 (12:20 +0300)]
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.

5 years agoFix birth statistics for pets after #wizmakemap
Pasi Kallinen [Tue, 31 Mar 2020 17:19:29 +0000 (20:19 +0300)]
Fix birth statistics for pets after #wizmakemap

5 years agoFix lua selection error
Pasi Kallinen [Tue, 31 Mar 2020 16:07:21 +0000 (19:07 +0300)]
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.

5 years ago'submerged' status condition
PatR [Tue, 31 Mar 2020 09:38:12 +0000 (02:38 -0700)]
'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.

5 years agotweaks for #wizlevelflip
PatR [Mon, 30 Mar 2020 11:58:28 +0000 (04:58 -0700)]
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.

5 years agoFix monsters overflowing out of rooms in special levels
Pasi Kallinen [Sun, 29 Mar 2020 08:17:37 +0000 (11:17 +0300)]
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.

5 years agoFix polymorphing monster trying to dig undiggable wall
Pasi Kallinen [Sat, 28 Mar 2020 13:43:00 +0000 (15:43 +0200)]
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.

5 years agoFix purple worm ending up in solid wall
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.

5 years agofix #K669 - 'nasty' monster summoning
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.)

5 years agoreformat monflag.h
PatR [Sat, 28 Mar 2020 00:47:07 +0000 (17:47 -0700)]
reformat monflag.h

I started out fixing some strangeness near the very bottom then
ended up redoing the whole thing.

5 years agoFix flipping while punished
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.

5 years agoFix wizmakemap and teleport region
Pasi Kallinen [Fri, 27 Mar 2020 06:48:29 +0000 (08:48 +0200)]
Fix wizmakemap and teleport region

5 years agoteleds() vs ball&chain
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

5 years agoFix teleporting not unhiding polyed hero
Pasi Kallinen [Wed, 25 Mar 2020 17:57:21 +0000 (19:57 +0200)]
Fix teleporting not unhiding polyed hero

5 years agoExpose core random number functions to lua
Pasi Kallinen [Wed, 25 Mar 2020 10:24:02 +0000 (12:24 +0200)]
Expose core random number functions to lua

Expose nh.rn2() and nh.random() to lua.
Add a math.random() compatibility shim to nhlib.lua

5 years agoTry to fix pet location inconsistency again
Pasi Kallinen [Tue, 24 Mar 2020 19:56:19 +0000 (21:56 +0200)]
Try to fix pet location inconsistency again

5 years agobit
nhmall [Sun, 22 Mar 2020 11:39:44 +0000 (07:39 -0400)]
bit

5 years agofix github issue #304 - #offer old corpses
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.)

Fixes #304

5 years agofix github issue #315 - "Moving Pictures" typo
PatR [Sun, 22 Mar 2020 09:38:21 +0000 (02:38 -0700)]
fix github issue #315 - "Moving Pictures" typo

Transcription typo:  had "or", should have been "of".

5 years agoFix des tests
Pasi Kallinen [Sat, 21 Mar 2020 12:03:03 +0000 (14:03 +0200)]
Fix des tests

5 years agopraying on unaligned altar outside Gehennom
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.

5 years agoPrevent setting boulder symbol to a control character
Pasi Kallinen [Fri, 20 Mar 2020 19:04:16 +0000 (21:04 +0200)]
Prevent setting boulder symbol to a control character

5 years agoPrevent zombies in trees in priest quest start
Pasi Kallinen [Fri, 20 Mar 2020 16:37:01 +0000 (18:37 +0200)]
Prevent zombies in trees in priest quest start

5 years agowarning fix
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;
|                            ^

5 years agoCorrect timing when attaching lit candles to the candelabrum
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.

5 years agoUnify special level c code for stairways
Pasi Kallinen [Thu, 19 Mar 2020 19:23:55 +0000 (21:23 +0200)]
Unify special level c code for stairways

5 years agoX11 fancy status overloaded conditions
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

5 years agoMerge branch 'NetHack-3.7' of https://rodney.nethack.org:20040/git/NHsource into...
Alex Smith [Wed, 18 Mar 2020 23:02:04 +0000 (23:02 +0000)]
Merge branch 'NetHack-3.7' of https://rodney.nethack.org:20040/git/NHsource into NetHack-3.7

5 years agoSafety valve against candelabrum's .age becoming 0
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.

5 years agoMake Juiblex resist magical digging from inside
Pasi Kallinen [Wed, 18 Mar 2020 07:16:22 +0000 (09:16 +0200)]
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.

5 years agoX11 'fancy' status condition highlighting
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.

5 years agoAlias "kirin" for "ki-rin"
Pasi Kallinen [Tue, 17 Mar 2020 17:06:32 +0000 (19:06 +0200)]
Alias "kirin" for "ki-rin"

5 years agoPrevent monsters in trees in monk quest start
Pasi Kallinen [Tue, 17 Mar 2020 16:09:33 +0000 (18:09 +0200)]
Prevent monsters in trees in monk quest start

5 years agoupdating 'time' status
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.

5 years agofix #K608 - ball and chain distance warning
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.

5 years agoFix pet location inconsistency
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.

5 years agoDon't flip column 0
Pasi Kallinen [Mon, 16 Mar 2020 20:10:37 +0000 (22:10 +0200)]
Don't flip column 0

5 years agoMove, rename, and comment out unused function
Pasi Kallinen [Mon, 16 Mar 2020 09:46:08 +0000 (11:46 +0200)]
Move, rename, and comment out unused function

5 years agoUse correct archaic form for "thine audience"
Patric Mueller [Mon, 16 Mar 2020 09:32:09 +0000 (10:32 +0100)]
Use correct archaic form for "thine audience"

Closes GitHub issue #313.

5 years agoUse TAINT_AGE for old corpses instead of hardcoded value
Pasi Kallinen [Mon, 16 Mar 2020 09:27:33 +0000 (11:27 +0200)]
Use TAINT_AGE for old corpses instead of hardcoded value

5 years agobotl fixes
PatR [Mon, 16 Mar 2020 09:19:28 +0000 (02:19 -0700)]
botl fixes

Add a couple of missing status updates.

5 years agoPrevent ogres in trees in barbarian quest start
Pasi Kallinen [Mon, 16 Mar 2020 06:58:07 +0000 (08:58 +0200)]
Prevent ogres in trees in barbarian quest start

5 years agoMajor amnesia revamp
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.

5 years agoLock castle chest
Pasi Kallinen [Sat, 14 Mar 2020 19:46:06 +0000 (21:46 +0200)]
Lock castle chest

Just to keep the wand in the chest. Even if the soldiers pick up
the chest, they won't open it, and the wand is better protected.

5 years agoTone down scare monster by excluding humans and uniques
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.

5 years agoX11 status overhaul
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

5 years agoFlip timed effects
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.

5 years agoFix vault guard leaving monsters encased in stone
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.

5 years agomsdos build fix
nhmall [Fri, 13 Mar 2020 14:48:17 +0000 (10:48 -0400)]
msdos build fix

../include/optlist.h:510:62: error: macro "NHOPTC" requires 10 arguments, but only 9 given
                 "color mappings for internal screen routines")
                                                              ^

../include/optlist.h:562:52: error: macro "NHOPTP" requires 10 arguments, but only 9 given
                 "prefix for old micro IBM_ options")
                                                    ^

5 years agoFix priest generated inside temple wall
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.

5 years agoHandle gone portal for migrating monsters
Pasi Kallinen [Wed, 11 Mar 2020 17:52:09 +0000 (19:52 +0200)]
Handle gone portal for migrating monsters

If the quest portal was gone, due to hero expulsion, migrating monsters
caused an impossible.

5 years agoFlip locations only if inside the flip area
Pasi Kallinen [Wed, 11 Mar 2020 17:21:38 +0000 (19:21 +0200)]
Flip locations only if inside the flip area

Objects and hero outside the level area (embedded in undiggable
rock by eg. polying into earth elemental) cannot be flipped.

5 years agofountain vs perm_invent
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.

5 years agoball and chain panic when teleporting
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.

5 years agoHandle gone portal when going back in quest
Pasi Kallinen [Tue, 10 Mar 2020 19:49:38 +0000 (21:49 +0200)]
Handle gone portal when going back in quest