Commit Graph

10471 Commits

Author SHA1 Message Date
PatR
b857899afc issue #1449 - fake explorer corpses on land mines
Issue reported by AndrioCelos:  the corpse of an early-level fake
explorer supposedly killed by a trap would leave land mines intact.

Change land mines with a fake explorer's corpse into discovered pits.

Fixes #1449
2025-09-25 11:39:08 -07:00
PatR
edd11009e9 issue #1447 - physical damage when polymorphed
Isssue reported by Tomsod:  hero-as-target section of mhitm_ad_phys()
was not handling hero's Half_physical_damage attribute.

The issue was about cloning a pet from hero who is poly'd into a
pudding but it was more general than that.  Half_physical_damage was
ignored for any hit by a monster-wielded weapon against poly'd hero.

It took a while to convince myself that Half_physical_damage wasn't
aleady being applied elsewhere but it doesn't seem to be.

Fixes #1447
2025-09-25 09:59:15 -07:00
PatR
d0b79912ed support 'nethack --nethackrc=~/File'
Substitute $HOME/File if command line specifies --nethackrc=~/File
to avoid "Access to ~/File denied (2)".

Only implemented for opening run-time config file on Unix.  Works for
NETHACKOPTIONS=@~/File too; the normally optional at-sign is required
since the tilde won't match a slash to distinguish file versus options.

Only supports "~/" file path prefix, not "~user/".
2025-09-22 14:47:54 -07:00
nhmall
349fbe93b1 less verbose compiler command lines during build
If using hints file sys/unix/hints/linux.370 or sys/unix/hints/macOS.370
allow the majority of the boilerplate compile switches to reside in a
compiler response file, instead of on the command line.

Include one of the following on your make command line:

make response=1
  or
make resp=1

It can be combined with other make command line options. See
sys/unix/README-hints for further information about those.

The response files that it uses are:
    CC   (clang or gcc)    src/nethack_cc.rsp
    CXx  (clang++ or g++)  src/nethack_cxx.rsp

Note: I think the reduced clutter should actually become the default,
and the override should be noresponse=1 to NOT use it, but I'm
not sure how others feel, so for now, it requires
    make resp=1
Feedback on whether that should become the default or not
is welcome.

Tested on Linux with gcc-15 and on Linux with clang-20.

I haven't had a chance to test it on macOS yet.
2025-09-07 12:50:54 -04:00
nhmall
e8e1868b70 part3 of 3 for GitHub issue #1441
> Perhaps related: when a wand of sleep hits a disguised already-sleeping
> mimic (about which it is a separate question if they should go into
> disguise when sleeping, is it supposed to be automagic or conscious
> effort for them? but I digress), the mimic is not revealed (should it?)
> but the message says "hits a mimic".

Adjust restrap() so that a revealed mimic won't disguise itself while
sleeping. This seems to be in keeping with mimic lore.

Also, normal shop sounds (chime of register etc.) will wake a
mimic up from indeterminate sleep.

Closes #1441
2025-09-05 12:37:40 -04:00
nhmall
602678aa5a follow-up: function name 2025-09-05 09:26:00 -04:00
nhmall
d3db5ce4f1 yet_another: !mimic_disguised_as_mon(mtmp)
would be true for a non-mimic

(mimic_disguised_as_non_mon(mtmp) would also have
worked okay)
2025-09-04 23:01:29 -04:00
nhmall
774129df11 another #1441 follow-up bit 2025-09-04 22:52:36 -04:00
nhmall
88eb33f198 more #1441
Address the second part of the GitHub issue:
"Finally, when a wand of striking (or a shift+F melee attack for that
matter, but the latter gives no tactical advantage compared to just
bumping them) misses a disguised mimic, it is revealed. I don't know
what to make of it"
2025-09-04 22:38:49 -04:00
nhmall
fe357a6f04 avoid telling hero they missed a monster they aren't aware of
Resolves #1441
2025-09-04 22:13:07 -04:00
PatR
e4f0d1a3e2 fix #4341 - jousting while trapped 2025-09-01 13:35:05 -07:00
nhmall
e880b08be3 offmap initial setting 2025-09-01 10:49:17 -04:00
nhmall
6fade4b184 don't split pudding that got jousted into a hole 2025-09-01 10:34:38 -04:00
nhmall
475134cfa5 comment update 2025-09-01 09:53:20 -04:00
nhmall
137c028200 bug diagnostic comment 2025-09-01 09:47:03 -04:00
nhmall
7e44aad627 address a static analyzer complaint
mthrowu.c: In function ‘hit_bars’:
  mthrowu.c:1419:25: warning: ‘maybe_unused’ attribute ignored [-Wattributes]
  1419 |            static enum sound_effect_entries se[] SOUNDLIBONLY = {
  mthrowu.c:1419:46: warning: unused variable ‘se’ [-Wunused-variable]
  1419 |            static enum sound_effect_entries se[] SOUNDLIBONLY = {
2025-08-31 10:30:23 -04:00
PatR
6f5aba00cd fix issue #1440 - spurious sanity check warning
Issue reported by NullCGT:  if the spot in front of a drawbridge held
water and got frozen, sanity checking for ice-melt timer would issue
complaints about melt timer for non-ice whenever the bridge was open.

Ice in front of closed bridge was handled ok, but ice beneath an open
bridge issued a spurious warning each turn if the sanity_check option
(wizard mode-only) was on.

Fixes #1440
2025-08-29 14:20:49 -07:00
PatR
bfff247462 suppress a static analyzer complaint for o_init.c
This should fix one of the three new complaints.  It compiles but has
not actually been through the analyzer.
2025-08-29 11:14:01 -07:00
nhmall
506e9cdd8f follow-up build bit for OpenVMS 2025-08-28 12:13:12 -04:00
nhmall
f110db02fc updates for build on OpenVMS 2025-08-28 11:43:47 -04:00
nhmall
6c3e70ad77 remove stray tabs from *.c files and config.h 2025-08-19 08:35:39 -04:00
nhmall
070730d845 Qt6 wasn't exiting as expected after saving the game
Reported by email to devteam on Feb 1, 2025.
2025-08-17 01:33:24 -04:00
Alex Smith
8f4c0f2215 You can throw objects at mimics if you know there's a monster there
Part of the reasoning behind thrown objects not hitting mimics is
that a character who doesn't know there's a mimic there wouldn't
aim at it. But if you know there's a monster there (e.g. via
telepathy or monster detection), you would aim at it. Pushing a
boulder at it and hearing a monster works too (which is important
in cases where a mimic is trapped behind a boulder in the Sokoban
corridors).
2025-08-16 01:24:58 +01:00
PatR
351ed094b4 fix? github issue #1431 - init_role_redist()
Issue reported by vultur-cadens:  3.7's revised handling for initial
characteristic allocation included an unintended change from 3.6's.

I don't pretend to understand how characteristic allocation really
works.  This should restore handling for values which are too low.

Fixes #1431
2025-08-11 15:28:11 -07:00
PatR
407a2e0ea8 fix issue #1436 - object_from_map() vs Hallu
Issue reported by janne-hmp:  examining an object on the map while
halluicinating might operate on an object whose name is Null since the
random object could be one that holds an extra description for item
shuffling at game start.  Attempting to format the object led to a
crash.

I wasn't able to reproduce the crash, possibly because MacOS produces
the string "(null)" for sprintf("%s",NULL) instead of dereferencing
the Null pointer.

Perhaps random object selection for display should reject the extra
description objects in some classes.  This susbstitutes a different
object if examining the map encounters one of those.

Fixes #1436
2025-08-10 12:45:29 -07:00
nhmall
b876381b72 add support for [[maybe_unused]] if available 2025-08-07 21:47:40 -04:00
PatR
2d6f0d74f2 fix pull request #1433 - silver mace
Pull request from Umbire:  starting gear for angelic beings should
use recently added silver mace instead of old ordinary mace.

It's simpler to just type in the change than to merge the commit.

Fixes #1433
2025-08-06 15:33:57 -07:00
nhmall
a0275e2696 consolidate some duplication into sfmacros.h
:  #include "sfmacros.h"
:  from sfstruct.c and sfbase.c
2025-08-06 12:56:07 -04:00
PatR
695c6ef3ac fix issue #1434 - engulfed gas spore explosion
Issue reported by Umbire:  a gas spore that got swallowed and killed
didn't die but exploded anyway, with the explosion affecting the map
instead of being contained in the swallower.

There was code to handle that but it wasn't being executed.  This fix
feels unclean but seems to work.

I couldn't reproduce the survival of the gas spore but since that
isn't wanted I won't worry about it.

Fixes #1434
2025-08-05 13:30:17 -07:00
PatR
5fe746a0d6 fix issue #1435 - vampire leaders as wolves
Issue reported by by vultur-cadens:  a vampire lord or lady might change
to wolf form while flying over water or lava, ending flight and dropping
into that water or lava.  It would then drown or burn up, revert to
vampire leader form and resume flying, then be teleported since it was
past the check for being in flight.

The fix is pretty staightforward.  It is still possible to force wolf
form with the monpolycontrol option, leaving the wolf standing on water
(didn't test for lava) and then drowning on its next move, where it will
revert to vampire form but no longer teleport away.  There's no need for
a wizard mode hack to behave more stringently.

Fixes #1435
2025-08-04 19:56:51 -07:00
PatR
c08f79b26e more photographing monsters
Don't record hallucinated monsters as having been seen up close or as
photographed.

Treat a tourist's starting pet has having been photographed prior to
bringing the camera and dog or cat into the dungeon.

No extra points to tourist when first long worm tail is photographed.

EDITLEVEL is incremented again, for extra context to track starting
pet.
2025-07-29 15:45:11 -07:00
nhmall
f145cc02f4 photograph experience gains often counted only prior to first move
More details in https://github.com/NetHack/NetHack/issues/1430

track photographed monsters using a distinct bit

also adds a pair of new context fields to track the total number of monsters seen up close,
and the total number of monsters photographed.

So, if somebody wants to add unique end-of-game disclosure statements for tourists that relate to
those, the groundwork should be there.

NOTE: This increments EDITLEVEL, so existing save and bones files will become outdated.

Fixes #1430
2025-07-26 11:03:20 -04:00
PatR
58d377e81e uhitm.c warning fix
From "Monsters trapped in pits cannot kick" two weeks ago.  Avoid
uhitm.c:5505:9: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]

Recent clang wants C23's [[fallthrough]] attribute rather than just
the lint '/*FALLTHRU*/' comment.
2025-07-17 16:29:27 -07:00
nhmall
0db013c08e adjust levitation wand engraving wording slightly 2025-07-13 21:37:35 -04:00
Pasi Kallinen
e240efa10b Restoring a game can return to the wishing prompt
In TTY or curses, if the terminal goes away while you're in the wishing
prompt, return to the prompt when the game is restored.

Breaks saves.
2025-07-12 18:21:12 +03:00
Pasi Kallinen
8570421449 Create familiar spell can create harder creatures 2025-07-11 13:04:25 +03:00
Pasi Kallinen
3440193a5a Tutorial: spellcasting
Add some basic spellcasting stuff to the tutorial: read a spellbook,
cast a spell.  If the hero doesn't have enough energy, just adds
a note saying so.

Remove/restore the known spells when entering/leaving the tutorial.
2025-07-09 18:30:58 +03:00
Pasi Kallinen
079dca27f2 Tutorial: clear user-given obj type names 2025-07-07 13:08:07 +03:00
Pasi Kallinen
0da45c1e74 Fix Snickersnee attack
Adding the extra attack to Snickersnee made the weapon always
attack from range, even when it was used in melee.
2025-07-05 19:59:26 +03:00
Pasi Kallinen
e2b80cd886 Monsters trapped in pits cannot kick 2025-07-04 17:39:08 +03:00
Pasi Kallinen
a0d9c94ece Dwarves can sense buried items under their feet 2025-07-04 17:04:46 +03:00
Pasi Kallinen
b8664198da Alchemy smock reduces chances of dipped potions exploding 2025-07-03 21:07:05 +03:00
Pasi Kallinen
04e651ca34 Allow kelp in walls of water 2025-07-02 17:24:15 +03:00
Pasi Kallinen
20b03ec0c5 Fix wrong key code in binding keys 2025-06-30 17:59:38 +03:00
nhmall
b8aa0a507c warning in cfgfiles.c while building sfctool
../src/cfgfiles.c:457:9: warning: variable 'nsep' set but not used [-Wunused-but-set-variable]
  457 |     int nsep = 1;
      |         ^
1 warning generated.
2025-06-04 05:51:03 -04:00
PatR
45f751989a fix #K4331 - sticking from distance
Stop attacking if target isn't there anymore.  Already handled for
two-weapon in normal form, not for multi-attacks in poly'd form and
for multi-attack monster vs hero or monster vs other monster.

I didn't attempt to reproduce the reported problem.  This fix is
based on code inspection.

Also prevent monsters that have hug or engulf attacks from knocking
target back with other attacks since that prohibits the grab/engulf
from being able to hit.
2025-06-03 22:13:22 -07:00
nhmall
28af1d6410 whitespace cleanup in sfbase.c 2025-06-03 20:45:08 -04:00
nhmall
356f451b1b prevent a double free() 2025-06-03 07:35:34 -04:00
nhmall
6c6d8afb8f fix a warning during sfctool build 2025-06-02 22:37:48 -04:00
PatR
1aafd7dfcd monster weapon sanity check
In the context of sanity checking, an extra pass though the inventory
of every monster wielding a weapon is completely negligible, but it
is trivial to avoid so take it out.
2025-06-02 13:20:55 -07:00