Commit Graph

5418 Commits

Author SHA1 Message Date
Pasi Kallinen
87694e1a95 Hero remembers trapped boxes
After finding a trap on a chest or a large box, remember it
as trapped: "You see here a trapped large box."
Randomly generated chests and boxes can be obviously trapped.
Allow defining obviously trapped containers via lua.

Invalidates saves and bones.
2024-12-19 13:11:25 +02:00
PatR
65070b7462 fix /e and /E
A fix in Janurary to avoid appending engraving text or headstone
text when examining a map location where a monster or object covers
the engraving or headstone inadvently broke the /e and /E variations
of the '/' command, which is intended to list such text even when
covered.
2024-12-18 02:15:09 -08:00
PatR
bbb4bfa938 fix issue #1337 - 'fireassist' vs 'f'iring aklys
Issue reported by elunna:  if the 'fireassist' option is on and the
quiver contains ammo, 'f' while wielding an aklys switches to the
ammo's launcher instead of throwing the aklys.

Fixes #1337
2024-12-13 12:30:48 -08:00
Alex Smith
c2c797fa35 Artifact and #offer rebalance, part 2: luck from sacrificing
Luck from sacrificing is now limited by the value of the sacrifice.

This fixes two exploits, both of which rely on getting luck up to
maximum as soon as you have an altar, a luckstone, and a few
rations, via altar-camping until you accumulate enough luck. One of
them is to use the resulting luck to throw off the balance of combat
via using it to make hit chance calculations irrelevant. The other
is to use it to get crowned early in the game; in particular,
getting crowned pre-Sokoban is often viable and, especially for
chaotic characters, solves most of the game's difficulty at that
point (because the intrinisics and weapon are enough to carry a
character to the Castle given even mediocre luck with finding armor).

After this commit, becoming crowned very early in the game is more
difficult (likely requiring unicorns and identified gems), and the
hit chance gain from luck becomes a more gradual gain over the
course of the game rather than all happening immediately upon
finding the altar and luckstone.

In addition to making the game more balanced, this also discourages
grinding by reducing the incentive for altar-camping, so it will
hopefully make it more fun as well.
2024-12-12 03:37:02 +00:00
Alex Smith
d87cadaf73 Artifact and #offer rebalance, part 1: sacrifice gifts
In 3.6, artifact gifts are often either a) entirely useless or
b) gamebreaking, neither of which is really ideal from a balance
perspective.

This commit aims to make artifact gifts more useful in the early
game by greatly increasing the chance for situational artifacts to
generate positively enchanted.  However, the most powerful
artifacts will now only be gifted if you offer a high-value corpse,
meaning that they are only likely to be accessible later in the
game.  The selection of which artifact to gift has become more
complicated in order to a) increase the chance that it fits the
character and b) reduce cheese strategies (e.g. it is no longer
possible for elves to force the gifting of Stormbringer as the
first sacrifice gift).
2024-12-12 03:14:47 +00:00
PatR
aedb24d343 partly fix issue #1336 - pets vs floating eyes
Issue reported by ars3niy:  pets with reflection or ranged attacks
would only attack floating eyes when rolling the 10% random chance
that other pets have even though they could have always safely
attacked.

This fixes the situation for melee attacks by pets who have
reflection.

dog_move() is too complicated for my feeble brain to cope with the
ranged attack aspect.  Pets still won't use ranged attacks against
floating eyes.

With the fix for reflection, I discovered that silver dragons
would be subjected to floating eyes' passive paralysis even when
their breath attack was suppressed.  (It wouldn't impact them, due
to reflection, but the message about the floating eye being hit by
its reflected gaze was being delivered without being preceded by
any message since no attack had taken place yet.)  This fixes that.

\#1336 is still open
2024-12-11 12:38:28 -08:00
Pasi Kallinen
dafd854993 Gelatinous cubes eat organic objects inside them 2024-12-08 17:57:59 +02:00
Pasi Kallinen
78289a7f83 Archeologists' fedora is lucky 2024-12-08 16:17:35 +02:00
PatR
13b8725ac2 combine taming of already tame monsters
Merge the recent change in the effect of blessed scroll of taming on
already tame monsters with the earlier change of any taming on already
tame monsters.  Non-blessed has a chance of boosting monst->mtame by 1
when it is less than 10, more likely the lower the current value is.
For blessed, boost by 2 after that, so possibly by 3 if it is very low.

Make spell of charm monster when skilled or expert in enchantment
spells behave the same as blessed scroll of taming.  [I'm not too sure
about this; it may make the spell too powerful.]
2024-12-07 19:38:01 -08:00
Pasi Kallinen
a3f0b54aea Healers gain experience by healing pets 2024-12-07 12:50:59 +02:00
Pasi Kallinen
12228cac49 Tourists gain experience by going to new dungeon levels 2024-12-06 22:10:17 +02:00
Pasi Kallinen
89c4c3a722 Tourists gain experience by seeing new types of creatures up close
Experience equivalent to killing a monster is gained when starting a turn
adjacent to and being able to see the monster.

Breaks saves.

Idea and parts of code via dNetHack
2024-12-06 21:30:23 +02:00
Pasi Kallinen
e23e6ef235 Blessed scroll of destroy armor asks which armor to destroy
via xNetHack with some slight modifications.
2024-12-06 11:09:27 +02:00
Pasi Kallinen
9b4f38eebe Blessed scroll of taming increases tameness of pets 2024-12-05 16:44:05 +02:00
Pasi Kallinen
4b15085bb1 Avoid naming Vlad's entourage if vampires are genocided 2024-12-05 16:16:55 +02:00
Pasi Kallinen
b96c59e9b1 Angry god may remove an intrinsic 2024-12-04 20:54:47 +02:00
Pasi Kallinen
53f43ab00b Qt: show main window normally instead of maximized
Sidenote: The main window size calculations are getting stupid.
It would be better to find out the widget sizes and shift
the splitter up, instead of letting it just take up half of the main window.

Idea and part of the code by Richard Henschel
2024-12-03 19:52:30 +02:00
nhmall
fec6320e68 rename sys/windows/Makefile.mingw32 to GNUmakefile
GNU make looks first for a file called GNUmakefile, ahead of
looking for Makefile and then makefile.

Renaming sys/windows/Makefile.mingw32 to sys/windows/GNUmakefile
allows:

o src/GNUmakefile (for use by GNU make) and src/Makefile (for use
  Microsoft nmake) to both reside in the src folder during build.

o src/GNUmakefile will be used by GNU make, without having to
  explicitly specify "-f GNUmakefile" on the GNU make command line.

o src/Makefile will be used by Microsoft nmake, without having to
  explicitly specify "-f Makefile" on the Microsoft nmake command line.

For the gcc build, the movemement of sys/windows/GNUmakefile needs
to be copied to src/GNUmakefile as part of the build process (see
sys/windows/build-msys2.txt).

For the Microsoft Visual Studio command line build with nmake,
sys/windows/Makefile.nmake needs to be copied to src/Makefile as
part of the build process (see sys/windows/build-nmake.txt).

They are both copied to the src folder from their respective
repository source file names when the nhsetup.bat file is used.
2024-12-02 19:04:08 -05:00
nhmall
211178d084 fixes3-7-0.txt entry: WASM pull request 1331
The pull request was:
    https://github.com/NetHack/NetHack/pull/1331
by @guillaumebrunerie

The text by @guillaumebrunerie that accompanied the pull request was:

I have been working on a browser/mobile port of NetHack 3.7 using
cross-compilation to WebAssembly (it is very playable already, you can
try it at https://guillaumebrunerie.github.io/nethack/).

[screen shot]

The existing code for compiling to WebAssembly was a great help, although
it wasn't fully up to date and was missing a number of things in order
to be able to create a proper window port (for instance there was no way
to set 'iflags.window_inited' to true, 'print_glyph' was not working
properly as its signature changed, and various other things).

This pull request contains various fixes and additions that I found were
needed/helpful.

Changes:

 * export more constants/pointers/globals.
 * fix various types that are incorrect.
 * disable compression of save files, as it uses fork which isn't supported
   in WebAssembly.
 * include 'genl_player_setup' when 'SHIM_GRAPHICS' is defined, in order to
   make it possible to reuse the existing player selection code.
 * move initialization of JavaScript global constants up, as I was running
   in some issue when 'raw_print' was being called before initialization.
 * change various compilation options for Emscripten, in particular it now
   generates an ES6 module (easier to use in a modern Javascript project)
   and exports more methods from Emscripten (for instance to be able to use
   the virtual file system when saving).
 * simplify the implementation of the main loop to avoid 'setTimeout' which
   can be pretty slow in the browser when called many times.
 * change the way pointer arguments are being sent to JavaScript in 'getArg'
   (they were being sent as a pointer to the pointer itself on the stack,
   which doesn't really make sense, now the pointer itself is sent).
2024-11-30 21:06:16 -05:00
PatR
9c0e47785a digging in ice
If the spot in front of a closed drawbridge was ICE, digging there
had issues....
2024-11-27 08:41:55 -08:00
PatR
1c5b295097 tin consumption edge cases
If eating a tin killed the hero (choked, turned to stone, poly'd into
a new man with new Xp too low to survive) and bones were saved, the
tin remained intact in them.

When hero who is poly'd into metallivore form eats a tin, give a
little extra nutrition for the tin itself.  Also, eat it immediately
by skipping the "It smells like <creature>" message and "Eat it? [yn]"
prompt.  (The message while eating it also reports <creature>, so
skipping the 'smells' one doesn't end up hiding anything.)
2024-11-26 18:01:19 -08:00
nhkeni
4f3c463d69 remove some testing junk that escaped 2024-11-16 17:39:40 -05:00
nhkeni
d493d31aec Remove "*.txt NHSUBST" from .gitattributes because it's too general.
Specifically, it was marking Guidebook.txt for substitution, but
it's a derived file, not a source.
2024-11-15 19:00:31 -05:00
Pasi Kallinen
62971c6f09 Qt: add support for the palette config option
Depends on CHANGE_COLOR compile-time option.
2024-11-14 17:25:44 +02:00
nhkeni
91c38355e7 Merge branch 'keni-gitset2' into NetHack-3.7 2024-11-11 11:27:27 -05:00
nhkeni
36e8d9e6fc nhgitset version 4
To update, run "perl DEVEL/nhgitset.pl"

Fixes:
- "nhcommit -a" has been fixed
- NHDT was hardwired in places
- no longer complain about a missing dat directory outside of the
    NetHack source tree
- make update of gitinfo atomic
- Replace some hardwired directory separators with OS-dependent constructs

Backwards Incompatibilities:
- NH_DATESUB's DATE() is now Date() to match the other variables
- MSYS2 requires an additional Perl package - the MSYS2 docs have
    been updated

New Help System:
- git nhhelp
   This command mirrors "git help" for nh* commands.
- See git nhhelp nhsub for general help on substitution variables

New Substitution Variables:
-Brev()
    An aBREViation of $PREFIX-Branch$:$PREFIX-Revision$ - this
    may help get line length under control in file headers.
-Assert(TYPE=VALUE)
    If TYPE does not match VALUE, do not substitute on this line.
    TYPE P checks VALUE against nethack.substprefix
-Project(arg)
    Returns nethack.projectname if there is no arg and an uppercase
    version if arg is uc.

Other New Features:
- Add nethack.projectname
- Documentation updates - see "git nhhelp nhsub"
- On checkout or merge of a branch, check for nhgitset version updates
  and provide an optional message to the user.
- Move NH_DATESUB substitutions here from cron job to keep dates in sync
- PREFIX-* keywords now available in NH_DATESUB templates
- Support use of nhgitset.pl from a different repo; note that update
  checks will be dependent on keeping the original source repo up-to-date
  and in the same location.
2024-11-11 09:15:49 -05:00
Pasi Kallinen
945ccff1ff Allow changing command autocompletions via #optionsfull 2024-10-19 14:46:11 +03:00
Pasi Kallinen
696af89299 Change MSGHANDLER from compile-time to sysconf 2024-10-19 10:47:53 +03:00
Pasi Kallinen
f12635ccd9 Prevent monster generation in the sokoban trap hallway
Makes Sokoban far less tedious when you don't have to worry about
monsters randomly popping up in the trap hallway while you're pushing
the boulder.

Adds a new exclusion zone for monster generation, and the goodpos
routine avoids the zones when GP_AVOID_MONPOS is used.
2024-10-18 13:30:51 +03:00
PatR
1f36b98b8f 'selectsaved' extension
Instead of a menu listing
 a - hero1
 b - hero2
 n - New game
 q - Quit
show
 a - hero1-role1-race1-gend1-algn1
 b - hero2-role2-race2-gend2-algn2
 n - New game
 q - Quit
or
 a - - hero1-role1-race1-gend1-algn1
 b - X hero2-role2-race2-gend2-algn2
 c - D wizard-role3-race3-gend3-algn3
 n - New game
 q - Quit
when any game in the list wasn't saved during normal play.  (Those
are sorted by character name; the playmode is just coincidence.)

The dash for 'normal' doesn't look great but -/X/D are codes used in
entries written to paniclog.  The whole playmode prefix doesn't look
particularly good but I suspect that most players relying on restore
via menu won't see it.

It should work when the character name has dashes in it but that
hasn't been properly tested.

The gender and alignment suffices reflect their value at the time of
save rather than at the start of the game.  That might be considered
a bug but it was easiest.

Increments EDITLEVEL; existing save and bones files are invalidated.
2024-10-10 23:14:25 -07:00
PatR
dcf18b2b69 fix #K4292 - tame hider-under vs cursed object
A pet with the hides-under attribute could hide under cursed objects
if it first moved reluctantly to their location.  Also, the messages
seem contradictory:
| The cobra slithers reluctantly over a scroll labeled DUAM XNAHT.
| You see your cobra slither under a scroll labeled DUAM XNAHT.
First over, then under, but that was actually accurate; the monster
moved, then after it was on the pile it hid underneath.

Change hideunder() to not let pets hide under an object if it is
cursed or any object in its pile is cursed.  Initially I was just
going to check the top item and the item directly beneath it, but
reluctance to move there extends to the whole pile so I made hiding
do so too.

Change the first message to move reluctantly "onto" an object since
"over" suggests that it has continued past the item, unless it is
actually flying or levitating so truly "over" the pile.
2024-10-03 12:50:10 -07:00
PatR
4e2494c859 fix hunger status highlighting text match
Crash triggered by fuzzer.

The Null value for not-hungry between "Satiated" and "Hungry" in the
array of possible hunger states caused a crash if C++ regex handling
was being used.  With posixregex, it would pass benignly for tty but
crash for curses.  I didn't check any other interface.
2024-09-30 12:41:29 -07:00
PatR
7b34edc11a fix fixes3-7-0.txt typo 2024-09-29 17:38:34 -07:00
PatR
0128fcdf6c fix github issue #1289 - odd "unexplored area"
Issue reported by ars3niy:  an arrow trap covered by more than
one stack of arrows was described by farlook as "unexplored area".
Later simplified to any object pile with plain arrows on top; the
trap turned out to be irrelevant aside from producing a pile of
arrow stacks.

This problem turns out to be due to an off by 1 error introduced
into the xxx_is_piletop() macros when generic objects were added in
mid-January of last year, and plain arrow is the first real object
so suffered from the bug.  Misclassifying the glyph at a specific
location also confused the #terrain command but it's the same bug.

Knowing what was wrong (map glyph was UNEXPLORED when it should
have been ARROW) wasn't sufficient to figure out the problem.
Without the simplified way of reproducing the problem, I would
never have managed to use 'git bisect' to find the offending commit
because that would have been too time consuming.

Fixes #1289
2024-09-28 19:28:37 -07:00
PatR
9390a844f0 green dragon/iron golem breath
A poison gas breath attack that hits a wall would leave a 1x1 gas
cloud region at that wall spot.

Not always noticeable due to other spots along the zap path leaving
regions that blocked vision.
2024-09-26 23:29:32 -07:00
PatR
0dad60e485 fix github issue #1291 - water walking vs lava
Issue reported by ars3niy:  non-fireproof water walking boots are
supposed to be destroyed if worn on lava, but a post-3.6 change
made that only happen if the hero died and left bones.

The boots remained intact if hero was fire resistant or survived
6d6 damage.  Staying intact should only happen if they're fireproof.

This seems to work but each time lava_effects() gets modified it
becomes more fragile.  Having deleted objects stick around doesn't
help with this problem, which is to keep an item which is being
stolen--and whose loss causes the hero to drop into lava--from
being burned up before being transferred to the thief's inventory.

Fixes #1291
2024-09-26 08:10:26 -07:00
PatR
dd0d050508 article 'a' for Angel names
The recently revised priestname(), which is also used for angels
since they share the " of <deity>" suffix, included a test for
'!strncmp(,"Angel ",6)', assuming it was looking at the beginning
of "Angel of <deity>".  But the " of <deity>" part doesn't get
appended until later, so the test should be '!strcmp(,"Angel")'
without the trailing space.

Noticed by code inspection; I don't have a test case.  Like priests,
Angels are almost always referred to as "_the_ Angel of <deity>" so
the bad "Angel " check normally wouldn't get reached.

Also, fix an unrelated indentation bit in fixes3-7-0.txt.
2024-09-21 15:55:25 -07:00
nhmall
b4a636d25f update fixes3-7-0.txt
Close #1282
Close #1287
2024-09-21 13:22:20 -04:00
PatR
7787d83f50 article 'a' for priest names
|You hear an priestess of Issek incant PHOL ENDE WODAN.

using "an" instead of "a" wasn't because the deity name started
with a vowel, it was because the wrong argument was being passed to
just_an() and just_an("") always yields "an" (actually "an ").

I eventually gave up trying to reproduce the message but am fairly
sure that this fixes it.
2024-09-20 13:33:52 -07:00
PatR
796497015f tribute fix - Lords and Ladies, passage 6
Omitted word mistake occurred in the transcription, not in the book.
2024-09-19 22:14:49 -07:00
PatR
5e572d3d5f fix part of github issue #1285 - cursed curses
Issue reported by g-branden-robinson:  vertical status panel ended
up with an extra closing paren on the energy line, and sometimes
popups left some text and/or border to the right of the map.

I haven't been able to reproduce the energy anomaly.  It is possible
that it is dependent on the version of curses.

This fixes the leftover popup traces that the base window catches
(and hangs onto) when there is extra space to the right of the map.
Erasing a popup prior to deleting it suffices to make base window
forget it.

I have a more elaborate fix that covers the space to the right of
the map, when there is some, with an extra window and erases that
window when refreshing the map.  It works but adds a bunch of code
that we can get by without.

Issue #1285 is still open.
2024-09-19 01:41:24 -07:00
Pasi Kallinen
d126ae9a42 Reduce crystal plate mail weight 2024-09-18 21:39:55 +03:00
PatR
6b08e7758b fix restore panic: relink_light_sources
Reported directly to devteam:  restoring a save file which was
made while the hero was polymorphed into a light emitting monster
would trigger a panic.

This was caused by an attempt to deal with corrupted save data,
which in turn was caused by attempting to use impossible() in a
situation where the game can't reliably continue.  If bad light
source data was ignored during restore, it would cause trouble
during next save.

Remove the check which was erroneously detecting invalid data
and also change two impossible() calls to panic().
2024-09-17 14:55:01 -07:00
PatR
5bb4adace0 'tips' fix and enhancement
When 'tips' are enabled, the farlook tip displays some text at the
start of getpos().  But it clobbered the initial prompt, leaving
the screen in an ambiguous state (seemingly a normal map display,
but it is actually waiting for player to move the cursor) after
removing the tip's popup window.

Reissue the prompt.  farlook's short but misleading prompt of
"Pick an object" is changed to "Pick a monster, object or location".
I would normally include a comma before "or" but omitting it makes
the longer text seem slightly less cluttered.

The other tips are all one-line, delivered via pline().  Prefix
all of their messages with "Tip:" (which the farlook one already
uses) as a hint for using OPTIONS=!tips to shut them off.
2024-09-14 12:53:48 -07:00
nhw_cron
351a8fa99c This is cron-daily v1-Apr-1-2024. 005guidebook updated: doc/Guidebook.txt 2024-09-14 12:27:55 -04:00
nhmall
2410bd9e8a fix an automatic addition by CVS back in 2002 2024-09-14 11:34:24 -04:00
nhmall
0bf6f1b247 Improve Guidebook *roff formatting and markup
Pull request #1280 from g-branden-robinson

References:
https://github.com/NetHack/NetHack/pull/1280

Closes #1280
2024-09-14 11:26:23 -04:00
nhmall
bf72423fb0 Merge branch 'NetHack-3.7' of https://github.com/g-branden-robinson/NetHack into NetHack-3.7 2024-09-14 11:15:41 -04:00
nhmall
cbb32ac64a glyph_to_cmap() becomes function instead of macro
Also adds swallow and explosion glyphs to glyph_to_cmap()

References:
https://github.com/NetHack/NetHack/pull/1022 by argrath
https://github.com/NetHack/NetHack/pull/1277 by ars3niy

Closes #1277
Closes #1022
2024-09-14 10:12:09 -04:00
nhmall
5091ac3fdd Guidebook.txt update Sept 13, 2024 2024-09-13 13:28:32 -04:00