PatR [Sun, 20 Jun 2021 23:45:42 +0000 (16:45 -0700)]
"<foo> appears in cloud of smoke."
Have water demons appear in a cloud of vapor rather than a cloud of
smoke. This adds a few other alternatives but they'll never happen.
Elementals could only be summoned by Angels but Angels never call
msummon() as far as I can tell. Vortices aren't summoned at all
but the smoke/vapor/&c routine has provisions for them.
The cloud of smoke message used to be given only when the summoner
is a demon. Now it will be given if the last--or only--summoned
creature can be seen to arrive, no matter whether summoned by a
demon, a non-demon (which I think isn't possible), or post-Wizard
harassment.
PatR [Thu, 17 Jun 2021 23:03:45 +0000 (16:03 -0700)]
gender for figurines
Use (obj->spe & CORPSTAT_GENDER) for figurines as well as for
statues and corpses.
Support wishing for
"{female,male,neuter} {corpse,statue,figurine} [of <monster>]".
and
"{female,male,neuter} <monster> {corpse,statue,figurine}".
Also
"{corpse,statue,figurine} of {female,male,neuter} <monster>"
where the qualifier might be in the middle instead of a prefix.
Pasi Kallinen [Wed, 9 Jun 2021 06:02:31 +0000 (09:02 +0300)]
Add assistance to fire-command
Allows the fire-command to autowield a launcher; it will now
do either swapweapon or wield an appropriate launcher, if you
have ammo quivered.
This assistance can be turned off with the fireassist boolean option.
Adds a rudimentary command queue, which allows the code to add keys
or extended commands into the queue, and they're executed as if
the user did them. Time passes normally when doing the queue,
and the queue will get cleared if hero is interrupted.
PatR [Wed, 16 Jun 2021 01:42:30 +0000 (18:42 -0700)]
fix bullwhip-induced panic
While testing some corpse/statue name manipulation changes I managed
to trigger a panic during end-of-game cleanup. Using a bullwhip to
snatch a wielded cockatrice corpse from a monster's inventory into
the hero's inventory and being turned to stone due to lack of gloves
took the corpse out of the monster's inventory but didn't place it
anywhere. If no life-saving took place, it led to an "obj_is_local"
panic during timer cleanup when freeing the level.
This patch includes some of the stuff I've been testing rather than
just the fix for the panic (which is the very last bit of the diff).
PatR [Sat, 12 Jun 2021 10:07:30 +0000 (03:07 -0700)]
mon_pmname(), obj_pmname()
Revive some code from 5 or so years ago that's been sitting in a
defunct local git branch. There are a couple of references to
figurines having gender; the old, unfinished code did already have
support for that, the current code doesn't. It probably won't take
much effort to add it in but I want to get this first part out of
the way.
Replace some of the
pmname(mon->data, Mgender[mon]) calls with simpler
mon_pmname(mon) and some
pmname(&mons[statue->corpsenm],
(statue->spe & CORPSTAT_GENDER) == ... ? ... : ...) with simpler
obj_pmname(obj). There are other instances of them which haven't
been changed but could be.
PatR [Sat, 12 Jun 2021 09:25:16 +0000 (02:25 -0700)]
corpse/statue gender fix when wishing
Wishing for "{corpse,statue} of gnome queen" would produce a corpse or
statue of a gnome queen, but wishing for "gnome queen {corpse,statue}"
would produce corpse or statue of a gnome king. The matching for
gender-specific monster name was only passing back the corresponding
gender when an exact match occurred (which happens for "foo of pmname"
but not for "pmname foo" since 'pmname' through end of string is what
the name_to_mon() matching code is looking at).
PatR [Tue, 8 Jun 2021 10:43:46 +0000 (03:43 -0700)]
fix github issue #531 - genderless corpses
Dead monsters that had traits saved with the corpse would revive as
the same gender, but ordinary corpses revived with random gender so
could be different from before they got killed.
Since corpses of monsters lacked gender, those for monsters with
gender-specific names were described by the neuter name.
This is a fairly big change for a fairly minor problem and needs a
lot more testing.
^X feedback and end of game disclosure reported
Your two weapon skill {is,was} [also] limited by being <skill rating>
with with <secondary weapon>.
when the skill rating for the secondary weapon is/was less than the
skill rating for two-weapon combat. The corresponding message for
primary weapon did not duplicate the word "with".
Pasi Kallinen [Sun, 6 Jun 2021 16:02:10 +0000 (19:02 +0300)]
Change autopickup and color default values
Change the default value of autopickup to off. Having it on is
harmful for new players, making them very easily burdened.
We can't expect new players to know how to configure
pickup_types, pickup_burden, and pickup exceptions.
Change the default value of color to on. We can safely assume
new users have a terminal that supports color, and most people
want color.
PatR [Sun, 6 Jun 2021 12:54:53 +0000 (05:54 -0700)]
curses menu: support backspace/delete for counts
Have curses call the core get_count() routine instead rolling its
own so that backspace and delete are supported. That part was
trivial to accomplish. Unfortunately it brought the disappearing
menu phenomenon back so it became more complicated overall.
PatR [Sat, 5 Jun 2021 23:11:50 +0000 (16:11 -0700)]
fix #K3357 - curses menu disappears
This fixes the disappearing menu, but not curses menu count entry
failing to honor backspace/delete. Entering two or more digits
to get a "Count:12" message, followed by non-digit which removes
that, resulted in the menu for apply/loot in-out container operation
vanishing while it was still waiting for a choice. (Typing a choice
blindly did work.)
The code intended to handle this. I don't understand why refresh()
wasn't working. Reordering stuff didn't help until I changed that
from refresh() to wrefresh(win).
The original Count:123 display was limited to 25 characters and
menus to half the main window, so they didn't overlap. I made the
count display wider--because it is now also used for 'autodescribe'
feedback when moving the cursor around the map--so made something
that originally was impossible become possible. One line of the
menu does get erased while "Count:" is displayed, but then gets put
back by the wrefresh().
PatR [Sat, 5 Jun 2021 22:37:03 +0000 (15:37 -0700)]
fix pull request #527 - cursed levitation
The stair handling reorganization changed drinking a cursed potion
of levitation to only check whether stairs up existed on the level
instead of whether the hero drank the potion while at their spot.
That resulted in always attempting to go up and then getting "you
can't go up here" when not at stairs instead of the intended "you
hit your head on the ceiling".
PatR [Sat, 5 Jun 2021 22:17:55 +0000 (15:17 -0700)]
fix pull request #526 - 'menucolor' help message
being given when it shouldn't be. A change for perm_invent handling
back in March screwed up the if/then/else logic for code executed
when finishing MENUCOLOR manipulation via the 'O' command. That
resulted in the reminder to set menucolors to True being given even
when it was already True if perm_invent happened to be False.
I noticed this myself recently, then neglected to investigate it or
even write it down anywhere.
Patric Mueller [Fri, 4 Jun 2021 09:06:47 +0000 (11:06 +0200)]
curses: remove unnecessary special handling for dark gray
On terminals with at least 16 colors there should be no need for special
handling dark gray.
The curses code uses COLORS < 16, COLORS <= 16, COLORS > 16, or COLORS >= 16
at several places although I'm not sure if they are correct or which could
possibly be off-by-one errors.
But realistically in this case, we only need to distinguish between 8 color
terminals and terminals supporting more than 8 colors as this will mean the
terminal supports at least 256 colors.
Pasi Kallinen [Fri, 4 Jun 2021 06:13:27 +0000 (09:13 +0300)]
Don't bind quit to any key by default
Quit is not a commmand you usually need very often, and generally
don't want to use by accident.
Apparently, on Spanish keyboard layout, n-with-tilde is interpreted
by the Windows NetHack as M-q, and the key is next to l. Loot also
asks for confirmation, just like quit.
Prevent stuff like this by not binding the quit command to any key.
nhmall [Thu, 3 Jun 2021 16:14:27 +0000 (12:14 -0400)]
change references from winnt to windows
rename sys/winnt to sys/windows
move vs (visual studio) folder out of win/win32 and into sys/windows
rename include/ntconf.h to include/windconf.h
rename winnt.c to windsys.c
place visual studio projects into individual subfolders.
This will hopefully resolve GitHub issue #484 as well.
PatR [Thu, 3 Jun 2021 00:13:56 +0000 (17:13 -0700)]
unix/Makefile.top fetch-Lua bit
% make spotless
% sh sys/unix/setup.sh sys/unix/hints/macOS.2020
% make fetch-Lua
worked, but the last ended with
|rm include/nhlua.h
|rm: include/nhlua.h: No such file or directory
|make: [fetch-Lua] Error 1 (ignored)
which might frighten skittish users (like me). Check whether the
constructed header file exists (so is assumed to be for an earlier
Lua version) and only delete it in that case. No more scary report
of benign failure when it isn't there (after 'make spotless' or for
brand new source setup).
Also, some time ago we came to the conclusion that 'if [ ]' was an
extension for GNU 'bash' and wouldn't work with some older actual
'sh' implementations. This replaces the one post-3.6 instance of
|if [ ! -d foo ] then bar; fi
in Makefile.top with
|if test -d foo; then true; else bar; fi
Testing was successful but done with bash rather than an old sh. :-}
PatR [Wed, 2 Jun 2021 00:14:50 +0000 (17:14 -0700)]
fix pull request #521 - valk+warrior alignment
Valkyrie player monster was set to be chaotic even though valk
hero is lawful by default and can also be neutral but not chaotic.
Change it to be lawful. Warrior quest monsters attending leader
were also chaotic; change to lawful to match revised valk. If
hero is a neutral valk then both the player monster and warriors
get changed to neutral at start of game (and stay that way even
if hero changes alignment). The leader defaults to neutral but
gets changed to lawful for lawful valk hero.
Attentdant quest monsters with the healer leader were lawful but
if they gain enough experience they get promoted to healer, so
make them neutral like the latter.
I've added some miscellaneous comments and done a small amount of
reformatting. Comment about alignment changing in bones applies
to all roles that can be played with different alignments, not
just to valkyries. It isn't new; I just thought that it ought to
be mentioned somewhere.
PatR [Mon, 31 May 2021 22:28:19 +0000 (15:28 -0700)]
append_str(pager.c) again
More for issue #524.
The revised append_str() was still vulnerable to unsigned subtraction
overflowing from small negative value to huge positive one, if caller
ever passed an outbuf buffer which already had more than BUFSZ
characters in it.
Also the semantics were changed. If there wasn't room for the whole
" or "+string to be appended, it used to add as much as would fit.
The revised version changed that to all-or-nothing. This changes it
back, although players will probably never know the difference.
PatR [Mon, 31 May 2021 00:31:47 +0000 (17:31 -0700)]
add ^ and " choices to / command
Like /m for nearby monsters and /O for all objects, implement /^
and /" to view a list of nearby traps or all known traps. Only
lists discovered traps (or mimics immitating traps, or detected
door or chest traps iff still shown as such on map), but lists
map traps even when an object or monster at the same location is
blocking view of them.
For traps on the Water and Air levels that have been mapped, they
will only be listed when within line of sight so that this feature
can't be used to track portal location as it moves around. However,
when within line of sight it does allow the portal to be recognized
if that has become covered.
PatR [Sun, 30 May 2021 08:31:54 +0000 (01:31 -0700)]
whatis / quick-whatis for '^'
When using '//' or ';' to examine the map and player uses '^' to
move the cursor to the next displayed trap, have cursor go to
locations containing webs, the vibrating square, or other non-'^'
trap when such is the next trap symbol up. Otherwise looking at
webs is very tedious because '"' is treated as a look-at command
rather than than a target symbol.
PatR [Sat, 29 May 2021 20:34:32 +0000 (13:34 -0700)]
special level loading error
For the baalz 'lit=0' fix, I first tried 'lit=false'. That isn't
supported and triggered an error, but the error reporting passed
a null pointer to sprintf() for a %s argument. OSX's stdio shows
"null" instead of crashing in that situation; most implementations
wouldn't be so forgiving.
It intends to complain about "false" but that won't work if the
unexpected value doesn't get put into the lua table. I don't know
how to fix that aspect of this. This fix just avoids passing a
null pointer to sprintf. Plus some miscellaneous reformatting.
PatR [Mon, 24 May 2021 01:14:13 +0000 (18:14 -0700)]
Unix 'make update'
Revise Makefile.top to remove the obsolete commands which change
the last modified date of save and bones files during 'make update'.
Using file dates to validate save files against nethack hasn't been
useful for many years.
Pasi Kallinen [Sun, 23 May 2021 16:02:38 +0000 (19:02 +0300)]
Monsters can gain resistances by eating corpses
This is based on both the EvilHack implementation by
k21971 <keith.simpson1971@gmail.com>, and xNetHack
implementation by copperwater <aosdict@gmail.com>.
Pasi Kallinen [Sun, 23 May 2021 05:55:58 +0000 (08:55 +0300)]
Unlock your quest by killing your quest leader
Allow killing your quest leader, just to make games winnable if you
converted before doing the quest.
Boost the quest leaders and give them some equipment. King Arthur
gets Excalibur. Killing quest leader gives really bad luck and
makes your god angry at you, and killing quest guardians gives
smaller penalties.
This is based on both the EvilHack implementation by
k21971 <keith.simpson1971@gmail.com>, and xNetHack
implementation by copperwater <aosdict@gmail.com>.
copperwater [Wed, 30 Jan 2019 13:17:52 +0000 (08:17 -0500)]
Pets are more careful about attacking monsters at low health
Another SliceHack feature. However, the math implemented by SliceHack
seemed incorrect, so I tweaked it.
Pets previously attacked monsters of up to one level higher than them as
long as they were above 25% health. Now, they will attack monsters as
follows:
100%: up to level + 2 (pets could not attack this high before)
80%+: up to level + 1
60%+: up to same level
40%+: up to level - 1
25%+: up to level - 2
The case that prevents any attacks below 25% health still exists.
Pasi Kallinen [Sat, 22 May 2021 10:27:54 +0000 (13:27 +0300)]
Exploding spheres cause real explosions
Despite active explosion attacks being called explosions in-game,
they only affected a single target, and were handled differently
from actual explosions. Make them do an actual explosion instead.
This should make spheres more interesting and inspire different
tactics handling them.
Because spheres deal more damage on average and can destroy items
in their explosions, their difficulty has been increased slightly.
Polyselfed hero exploding won't cause elemental damage to their
own gear.
Originally from xNetHack by copperwater <aosdict@gmail.com>.
Pasi Kallinen [Fri, 21 May 2021 14:54:53 +0000 (17:54 +0300)]
Lua: nhcore script with function callbacks
Adds possible callbacks for "start_new_game", "restore_old_game",
"moveloop_turn", and "game_exit" which when defined, will be called
from core code at the appropriate time.
Adds lua hooks for dump_fmtstr (only if DUMPLOG), dnum_name, u.moves,
u.uhave_amulet, and u.depth.
PatR [Fri, 21 May 2021 15:40:39 +0000 (08:40 -0700)]
fix github issue #514 - 'O' segfault
The #version command retrieves the lua version number to include
in its output, but it was leaving the 'in_lua' flag set. So if a
later 'O' command tried to complain about a bad option value, the
error reporting routine crashed.
PatR [Fri, 21 May 2021 01:56:03 +0000 (18:56 -0700)]
fix github issue #515 - grappling hook internals
Grappling hook used to have an undiscovered description of "iron hook"
and when that was removed, the oc_name_known flag was left set as if
for something that could become discovered. I'm not sure whether that
made any difference anywhere.
Gold piece was in a similar situation, except that it wasn't because
an alternate description had been present and then removed. That one
definitely didn't make any difference anywhere.
Pasi Kallinen [Thu, 20 May 2021 17:40:56 +0000 (20:40 +0300)]
Make anti-magic fields drain more energy
... and make them actually deal damage based on the energy
it would've drained, if you have Antimagic.
Also prevent them appearing too early in the dungeon.
Allow drain energy attacks (and anti-magic traps) drain more
than your level of energy.
Make eating magical monsters such as wizards and shamans give
the same tiny buzz bonus as eating a newt.
PatR [Thu, 20 May 2021 10:04:31 +0000 (03:04 -0700)]
tribute: Interesting Times
Add missing italics to several words in passage 1.
Add three new passages, bringing the total to 13.
The third one ended up being fairly long. I made note of it
intending just the bacon joke but when transcribing I backed up
quite a ways. The context is fairly unusual for a Discworld story.
PatR [Wed, 19 May 2021 01:31:04 +0000 (18:31 -0700)]
fix pull request #513 - applying books
Applying a novel to flip through its pages described them as having
"ink" rather than "magical ink" but that wasn't a very suitable way
to distinguish them from spellbooks since their ink never fades.
The Book of the Dead's pages "glowed faintly red" even when the
hero couldn't see them.
PatR [Tue, 18 May 2021 23:26:38 +0000 (16:26 -0700)]
fix github issue #511 - no death message when
level-drained below level 1. No "you die" or equivalent, just
straight to being life-saved or to "do you want your possessions
identifed?". Change it to issue "Goodbye level 1." The fact
that it is has been fatal will become obvious. An issue comment
on github pointed out where the fix was needed.
PatR [Tue, 18 May 2021 22:41:51 +0000 (15:41 -0700)]
fix github issue #512 - fuzzer vs #exploremode
When the fuzzer is running, don't allow a randomly generated M-X
keystroke to switch from debug mode to explore mode.
[Unintended side-effect of the combination of two earlier changes:
assigning M-X as default key for #exploremode and allowing someone
in debug mode to voluntarily downgrade to explore mode (which should
never impact normal play and makes some types of testing simpler).]
Pasi Kallinen [Tue, 18 May 2021 15:58:30 +0000 (18:58 +0300)]
Change touch of death from instadeath to maxhp reduction and damage
Touch of death will now do 50 + 8d6 damage, and drain max HP for half
of that. If the drain is equal or greater than your max HP, then it
will kill you instantly.
Pasi Kallinen [Mon, 17 May 2021 16:01:09 +0000 (19:01 +0300)]
Monsters can see player resistances
If monsters see you resist something, generally elemental or magical
attack, or if they see you reflect an attack, they learn that and
will adjust their attack accordingly.
Originally from SporkHack, but this version comes via EvilHack with
some minor changes.
PatR [Sun, 16 May 2021 02:13:29 +0000 (19:13 -0700)]
tweaks to role-specific prediscovered objects
Characters who start out knowing non-magic armor should not know
cornuthaum and dunce cap. (Which suggests that those probably
ought to be classified as magic.)
Take away knowledge of polearms from barbarians and valkyries.
Add knowledge of all bows/crossbows, arrows/bolts, and spears to
rangers.
Add knowledge of all daggers to rogues. (Very minor; non-elves
recognize elven daggers and non-orcs recognize orcish daggers.)
PatR [Thu, 13 May 2021 16:38:53 +0000 (09:38 -0700)]
more object->dknown handling
Fix a couple of places that set obj->dknown to 0 to deal with some
special cases where it should be left at 1. (Other places do that
but deal with potions where hardcoded 0 remains appropriate.)
PatR [Wed, 12 May 2021 23:13:40 +0000 (16:13 -0700)]
fix issue #509 - shop 'glob' pricing segfault
A recent change made it possible for a glob to have its dknown flag
cleared and that exposed globby_bill_fixup() passing Null shopkeeper
to get_cost(), triggering a crash.
Make the routine that clears dknown/known/bknown/&c also be the
routine used to initialize those flags for a new object so that it
is the place that handles various special cases. That hides the
shop bug again.
But also fix the shop bug even though it won't be triggered.
PatR [Tue, 11 May 2021 22:59:19 +0000 (15:59 -0700)]
fix saddle sanity check code
Fix some bad code for "no saddle" caused by careless editing that
changed (uncomitted)
char *ns = 0;
if (foo)
ns = "foo";
else if (bar)
ns = "bar";
by splicing lines together and accidentally ended up with
char *ns;
ns = foo ? ns = "foo" : bar ? ns = "bar" : 0;
when
char *ns;
ns = foo ? "foo" : bar ? "bar" : 0;
was intended.
I'm a bit surprised that the intermediate form without any
parentheses around 'ns = "bar"' compiles at all. C99? I don't
think that it would have if it had been processed as C90 or pre-ANSI.
nhmall [Tue, 11 May 2021 13:24:21 +0000 (09:24 -0400)]
three warnings building with gcc 10
---
insight.c: In function ‘status_enlightenment’:
insight.c:937:28: warning: ‘ (’ directive writing 2 bytes into a region of size between 0 and 255 [-Wformat-overflow=]
937 | Sprintf(buf, "%s %s (%s)", ustick ? "holding" : "held by",
| ^~
In file included from ../include/config.h:631,
from ../include/hack.h:10,
from insight.c:15:
../include/global.h:274:24: note: ‘sprintf’ output 5 or more bytes (assuming 260) into a destination of size 256
274 | #define Sprintf (void) sprintf
insight.c:937:9: note: in expansion of macro ‘Sprintf’
937 | Sprintf(buf, "%s %s (%s)", ustick ? "holding" : "held by",
| ^~~~~~~
insight.c:918:29: warning: ‘%s’ directive writing up to 255 bytes into a region of size 252 [-Wformat-overflow=]
918 | Sprintf(buf, "%s by %s",
| ^~
919 | is_animal(u.ustuck->data) ? "swallowed" : "engulfed",
920 | heldmon);
| ~~~~~~~
In file included from ../include/config.h:631,
from ../include/hack.h:10,
from insight.c:15:
../include/global.h:274:24: note: ‘sprintf’ output 5 or more bytes (assuming 260) into a destination of size 256
274 | #define Sprintf (void) sprintf
insight.c:918:9: note: in expansion of macro ‘Sprintf’
918 | Sprintf(buf, "%s by %s",
| ^~~~~~~
PatR [Sun, 9 May 2021 19:54:45 +0000 (12:54 -0700)]
suppress monster health
For the time being at least, take out "uninjured/barely wounded/
slightly wounded/wounded/heavily wounded/nearly dead" description
on monsters examined with ';' or '//' or '/m' and on final tombstone
and logfile entry if hero gets directly killed by a monster.
Pasi Kallinen [Sun, 9 May 2021 09:15:48 +0000 (12:15 +0300)]
Accept "waiting" on special level des.monster() specifications
Allow specifying "waiting" for monsters created via lua level scripts.
This sets the monster strategy to make it wait for the hero
to be in visual range before allowing the monster to move.
Also makes the monster inside the Mausoleum themed room use this feature,
to prevent out of depth liches bothering the player unprovoked.
PatR [Sun, 9 May 2021 01:02:00 +0000 (18:02 -0700)]
fix github issue #507 - filename buffer overflow
when compressing or uncompressing a save file. Defining
VAR_PLAYGROUND forces PREFIXES_IN_USE to be defined, and the latter
causes docompress_file() to be called with save file name containing
a full path instead of just save/xyzzy.Z relative to the playground.
Depending on the value of VAR_PLAYGROUND, that could be too long for
the buffer used to make a copy of the name with ".Z"/".gz"/".bz2"
appended.
Probably only applies to Unix/linux/OSX configurations.
PatR [Fri, 7 May 2021 18:58:58 +0000 (11:58 -0700)]
fix pull request #505 - undead turning
zapped at corpse flagged as "no revive". A fairly recent change
made undead turning override no-revive if it hit someone carrying
a corpse flagged that way (corpse of a troll killed by Trollsbane
or stuffed in an ice box or explicitly cancelled) but neglected to
do so for corpses zapped while on the floor. This fixes that, for
undead turning zapped by monsters as well as by the hero.
PatR [Fri, 7 May 2021 00:52:30 +0000 (17:52 -0700)]
fix pull request #504 - partly eaten food
that has no nutritional value. Prevent applying the partly eaten
attribute to wished for food if the full nutrition isn't at least 2.
The problem case was 0 nutrition wraith corpse, yielding "partly
eaten food (1) more nutritious than untouched food (0)" when setting
the corpse's weight. That one was possible in 3.6.x, unlike corpse
that was actually partly eaten and then revived as a zombie (which
was just fixed for triggering the same warning).
Wishing really ought to ignore "partly eaten" for anything that is
normally eaten in one bite but I'm not sure how to handle that.