Commit Graph

8932 Commits

Author SHA1 Message Date
Pasi Kallinen
93b9467c08 Balrogs prefer bullwhip is hero is wielding something 2023-10-04 19:48:21 +03:00
Pasi Kallinen
3946c5a01d Give barbed devils a sticking attack 2023-10-04 11:09:25 +03:00
Pasi Kallinen
f83a57c5bf Tweak wand of make invisible and potion of invisibility
Wand of make invisible doesn't make you permanently invisible,
just for a short duration.  Potion of invisibility makes you
invisible for much longer period, or if blessed, has a small
chance of giving permanent invisibility.

This makes the wand actually useful, and improves the spell
too.
2023-10-03 21:04:15 +03:00
Pasi Kallinen
2402e6ad4d Decommission Juiblex Express 2023-10-03 10:57:29 +03:00
Pasi Kallinen
f0698e1dca Bone devils summon skeletons
Skeletons are extremely rare, and not generated at random,
and bone devils are basically just a speed bump when they appear.
Make both more interesting.

Idea by copperwater <aosdict@gmail.com>
2023-10-02 20:25:58 +03:00
Pasi Kallinen
9b4eaafe8c Fog clouds maintain any gas clouds 2023-10-02 13:05:15 +03:00
Pasi Kallinen
cf0eb8dfa0 Steam vortices leave steam clouds behind
Code via xnethack by copperwater <aosdict@gmail.com>
2023-10-01 20:30:54 +03:00
Pasi Kallinen
412a996da8 Wand of probing reveals tin contents 2023-10-01 14:49:00 +03:00
Pasi Kallinen
ac9be58970 Sitting on cream pies destroys them 2023-09-30 23:27:47 +03:00
Pasi Kallinen
6e09c980d2 Use #monster to make dragon steed breathe 2023-09-30 22:44:46 +03:00
Pasi Kallinen
b1e3863b43 Stop occupation when timed levitation or choking issues a message 2023-09-30 21:15:20 +03:00
Pasi Kallinen
086f68187f Coughing due to stinking cloud wakes up neighbors 2023-09-29 10:56:17 +03:00
PatR
86811ab266 wildmiss() sanity checking
Suggested by entrez:  have wildmiss() complain about the unexpected
"none of the above" before possibly returning early.
2023-09-28 18:47:06 -07:00
PatR
7c0ece5bd6 fix #H2736 - missing Samurai quest throne
Reported 11 years ago, the level definition for the Samurai quest
home level specifies a throne room and entering it gives the "opulent
throne room" message, but there isn't any throne.

Initially I was going to add a throne but decided that its lack is
probably intentional.  The throne room designation is used to give
periodic atomspheric messages.  That's my guess anyway.

Alter the room entry message there to omit "throne" from "you enter
an opulent throne room".  Add a no-throne comment to Sam-strt level
definition.

While in there, make Lord Sato's katana and splint mail explicitly
rustproof and either blessed or uncursed.  (The mail was already
implicitly rustproof because splint mail created on the Sam quest
home level always is, like for a Samurai's initial inventory.)
2023-09-28 13:25:20 -07:00
Pasi Kallinen
0ecb0547e6 Reset getdir_click when exiting therecmdmenu early
This was causing a really annoying to track down bug where
the fuzzer threw the attached iron ball and it could end up
anywhere on the level, emitting a sanity check error.
2023-09-28 18:19:53 +03:00
Michael Meyer
fa1f1134c8 Disambiguate b_trapped null bodypart value
b_trapped was treating 0 as a null value for its bodypart parameter, but
0 is actually the value of ARM, so b_trapped(..., ARM) would be treated
as intending no A_CON abuse.  Add NO_PART = -1 to the bodypart_types
enum, and use that instead of 0 as the "no body part" value in
b_trapped, so that ARM can be passed to it without any ambiguity.

aosdict identified this issue in xNetHack and handled it differently; he
added NO_PART with a value of 0, incremented the existing bodypart_types
values, and padded the body part arrays so the actual body parts would
start at index 1.  I think using NO_PART = -1 is simpler, but that's an
alternative approach that can be used instead -- it is advantageous in
that it automatically fixes any other places where 0 is assumed to be a
non-body-part value that I may have overlooked.
2023-09-27 10:40:27 +03:00
nhmall
234c0da66f update comment preceding mixed_to_glyph() 2023-09-25 08:42:07 -04:00
PatR
882b4a3436 typo fix 2023-09-24 16:06:24 -07:00
PatR
3962f3710a warning fix for !STATUS_HILITES
Avoid an unused variable complaint if compiling with STATUS_HILITES
disabled.
2023-09-24 14:36:05 -07:00
nhmall
0b472d15f5 relocate mixed_to_glyphinfo to windows.c 2023-09-24 11:13:15 -04:00
Pasi Kallinen
56159742c2 Prevent segfault for non-existent trap
If a buried zombie under stairs revived
2023-09-23 17:25:24 +03:00
nhmall
e4c3d87a4c fix a small memory allocation that was never freed 2023-09-23 10:16:07 -04:00
Michael Meyer
602af21ca3 Have leader keep already-used invocation items
The other suggestion from Pat about potential extensions to bda0b3b.  I
think it's interesting from a story perspective, and hopefully nobody
will run into this by mistake when they hoped to use the Candelabra as a
light source later!  The specific language used by the leader could be
changed if someone has a better idea (as could the code itself, for that
matter).
2023-09-22 21:40:12 -07:00
Michael Meyer
dedf1ade18 Have quest leader ID thrown unknown fake Amulet
If the hero throws an unidentified fake Amulet of Yendor at the quest
leader, the leader will identify it and toss it back, similar to the
behavior for the real Amulet.

This was one of Pat's suggestions for continuing in the same key as
bda0b3b; I think this makes a lot of sense, especially now that people
may be encouraged to throw things called "Amulet of Yendor" at the quest
leader.  Arguable about whether a _known_ fake Amulet should still anger
the leader and quest helpers; as I have it in this commit, it will, but
I'm somewhat ambivalent about what makes more sense.
2023-09-22 21:40:12 -07:00
nhmall
14faa682c4 improve selectsave handling for Windows
If there were outdated savefiles encountered during
startup, each individual one was getting a wait_synch
that required a <return> even though a message window
wasn't being used at that point.

Allow suppression of the individual per-file wait_synch()
calls on Windows, so that a single one can be done once
the selectsave processing is overwith.

This was a little messy because an indicator had to flow
down through validate(), uptodate(), etc.

There shouldn't be any change in how things behave on
any non-Windows platforms.
2023-09-22 15:14:53 -04:00
PatR
c868feb383 impossible "ceiling hider hiding without ceiling"
Reported by a hardfought user, a ceiling_hider monster hid on the
Astral level, triggering a sanity check warning that gets repeated
each move until the hider comes out of hiding.  Normally sanity_check
can only be set in wizard mode, but hardfought must force it on for
to-be-3.7.

I was able to reproduce it before this fix and unable to do so
afterward, but there is a random factor involved hence no guarantees.
I think that lack of ceiling for Astral is recent, but this could
have happened on other levels which lack a ceiling.  I didn't try to
figure out whether it might happen with 3.6.x, just put the fixes
entry in the "exposed by git" (found in code not yet released, that
is) section.
2023-09-21 14:17:01 -07:00
PatR
b6c942d062 inappropriate 'object 0' in makemon() 2023-09-21 13:23:15 -07:00
PatR
14c7b2015d PR #1093 - quest leader vs thrown invocation items
Pull request from entrez:  if hero throws (or kicks) an invocation
item or the Amulet at the quest leader, identify it and give it back
instead of treating the throw (or kicked item) as an attack.

In addition to the fixes entry I've made several tweaks to related
code, mostly to refer to the leader as "Someone" rather than "It" if
unseen.

Closes #1093
2023-09-20 12:10:57 -07:00
Michael Meyer
bda0b3b807 Allow quest leader to catch and return unique item
It's been possible for a while to throw your quest artifact to your
quest leader, completing the quest (he will then throw the object back
to you).  The quest leader will also react to being brought the Amulet
of Yendor (i.e. having it in inventory when you approach or #chat), but
tossing it over like the quest artifact was treated as a hostile act and
would cause the quest leader and guardians to become hostile and attack
the hero.

Make throwing the Amulet of Yendor at the quest leader work like
throwing the quest artifact, and treat the invocation items similarly
just in case people try throwing those (maybe because they are lost,
unsure what to do, and have already seen their quest leader catch and
react to the quest artifact -- regardless of the reason, throwing over
the Book of the Dead is almost certainly not intended to be an attack).
Doing so for invocation items will ID them but not do much more than
that.  The Amulet of Yendor triggers the existing quest pager message.
2023-09-20 11:00:32 -07:00
PatR
e2203ef9a1 stone-to-flesh of wielded rocks
Wielding one or more rocks while other rocks were quivered and casting
stone-to-flesh at self wasn't subject to the "null obj after quiver
merge" panic but it did result in a combined stack of meatballs that
was neither wielded nor quivered.  Keep inventory items that turn into
meat and are wielded/alt-wep/quivered separate and still wielded/&c.
2023-09-19 14:43:17 -07:00
PatR
dd05f5183e addinv_nomerge()
Replace several instances of
 obj->nomerge = 1;
 addinv(obj);
 obj->nomerge = 0;
with new
 addinv_nomerge(obj);
and add various related comments.
2023-09-19 14:40:33 -07:00
PatR
3fdcd5f4e0 fix #K4006 - 'null obj after quiver merge' panic
Using apply to unlight a lit potion of oil makes it unlit, removes
it from inventory, and then re-adds it to try to force it to merge
with other potions of oil.  If it was wielded and the other potions
were quivered, the game would panic.  When merging, they get forced
into the weapon slot in preference to the quiver slot.

Unwearing it before freeinv+addinv would solve this but also leave
the hero with nothing wielded, even if it didn't merge with another
stack.  Instead, don't try to merge if the potion being unlit happens
to be worn.

3.6.x was subject to this too and the fix is small+isolated but the
situation is so uncommon that I haven't bothered backporting it.

Applying a lump of royal jelly and then not picking anything to rub
it on had a similar problem.  It also panicked if the applied lump
was wielded and other lumps were quivered.  The fix is different
because the stack it gets split from during apply is known.  This one
doesn't impact 3.6.x; applying jelly to eggs wasn't implemented yet.
2023-09-19 07:16:00 -07:00
Pasi Kallinen
44a649b0b4 Wand of probing reveals map locations in ray path 2023-09-18 19:20:01 +03:00
PatR
4f2c913925 another paranoid_confirm:Autoall revision
For Autoselect-all confirmation, accept yes|n|q (or yes|no|quit)
rather than just yes|n (or yes|no).  An extra query routine is needed
to support it, but the existing paranoid_query() can just call the
new paranoid_ynq() with an extra argument, keeping things painless.

For menustyle:full plus paranoid_confirmation:Autoall, if you include
'A' in the class filtering choices then you're prompted for whether
you really meant it.  (Same behavior as in the past few weeks.)  Yes
auto-selects items matching all other chosen classes, or from all
classes if 'A' is the only choice.  (Again, same behavior.)  n|no
moves on to menu:full's second menu.  If anything else was chosen
along with 'A', that's what the second menu will offer.  (Same as
past few weeks but revised from initial implementation.)  If 'A' was
the only choice, it will now use 'a' and offer a choice of everything
in the second menu.  (That's a change; it used to cancel if declining
to honor 'A' and nothing else was present.)  Now <return> without
answering or q|quit or ESC skips the second menu, whether or not the
rejected 'A' was the only choice made in the first menu.  (New.)

Other paranoid confirmations still just accept yes and n|no responses,
treating ESC as n|no.
2023-09-18 00:17:33 -07:00
PatR
11bfb09daa fix #4005 - paranoid_confirm:Autoall
When paranoid confirmation for menustyle:full's "Autoselect all" is
enabled, it is handling yes vs no backwards.

The initial implementation had it right, then a negation got dropped
when it was expanded to support yes|no via paranoid_confirm:Confirm.

ESC is being treated as 'n' rather than as cancel.  Fixing that will
take some more work.  This just adds the missing negation to make 'y'
and 'n' behave properly.
2023-09-17 16:43:26 -07:00
PatR
56036ed5c7 status bit: trucated gold count
Gold on status line can be truncated, so testing the display value
might miss up/down/changed highlights.  I don't think that it actually
matters since a hero cannot pick up enough gold to reach the 999999
truncation threshold.

Normal amounts still seem to highlight correctly after this.
2023-09-16 17:48:51 -07:00
nhmall
b25512f7a1 fix broken build as of 2a5f03a3
gcc-9 -g -I../include -DNOTPARMDECL -Wall -Wextra -Wno-missing-field-initializers -Wreturn-type -Wunused -Wformat -Wswitch -Wshadow -Wwrite-strings -pedantic -Wmissing-declarations -Wformat-nonliteral -Wunreachable-code -Wimplicit -Wimplicit-function-declaration -Wimplicit-int -Wmissing-prototypes -Wold-style-definition -Wstrict-prototypes -Wformat-overflow -Wmissing-parameter-type -fPIC -DCURSES_GRAPHICS -D_XOPEN_SOURCE_EXTENDED=1 -DX11_GRAPHICS -DQT_GRAPHICS -DSND_LIB_QTSOUND -DUSER_SOUNDS -DSND_SOUNDEFFECTS_AUTOMAP -DDLB -DHACKDIR=\"/home/vsts/nh/install/games/lib/nethackdir\" -DDEFAULT_WINDOW_SYS=\"tty\" -DSYSCF -DSYSCF_FILE=\"/home/vsts/nh/install/games/lib/nethackdir/sysconf\" -DSECURE -DTIMED_DELAY -DDUMPLOG -DCONFIG_ERROR_SECURE=FALSE -DCOMPRESS=\"/bin/gzip\" -DCOMPRESS_EXTENSION=\".gz\" -DCURSES_UNICODE -DUSE_XPM  -c -o decl.o decl.c
decl.c:223:15: error: incompatible types when initializing type ‘enum statusfields’ using type ‘void *’
  223 |             , UNDEFINED_PTR, UNDEFINED_PTR
      |               ^~~~~~~~~~~~~
decl.c:219:44: warning: missing braces around initializer [-Wmissing-braces]
  219 | const struct instance_globals_b g_init_b = {
      |                                            ^
decl.c:219:44: warning: missing braces around initializer [-Wmissing-braces]
decl.c:219:44: warning: missing braces around initializer [-Wmissing-braces]
decl.c:219:44: warning: missing braces around initializer [-Wmissing-braces]
decl.c:219:44: warning: missing braces around initializer [-Wmissing-braces]
decl.c:219:44: warning: missing braces around initializer [-Wmissing-braces]
make[1]: *** [Makefile:1837: decl.o] Error 1
2023-09-16 20:02:11 -04:00
PatR
2a5f03a3b4 status hilites: Hp and Pw percentages
The hitpoints and power/energy status values (and corresponding
maxima) shown on the screen are capped at 9999 to control status line
width.  The actual values can be bigger than that.  Highlights based
on percentages were doing their calculations on the potentially
truncated values rather than on the actual ones.

Add another field to the blstat[] structure, populate it for BL_HP,
BL_HPMAX, BL_ENE, and BL_EXEMAX and switch to it for their percentage
calculations.

Doesn't seem to break highlighting of 'normal' range values but hasn't
been tested for extreme ones.
2023-09-16 12:42:26 -07:00
PatR
e451966266 botl.c cleanup
Mainly miscellaneous source formatting, plus some expanded comments
and #undef of macros when done with them.
2023-09-16 10:15:05 -07:00
PatR
450efa0dc4 status hilites fix
The options menu for status hilites wouldn't work as intended if the
entries in the initblstats[] array were changed to not be in BL_xyz
order.  (No effect on current behavior since they are in that order.)
2023-09-15 12:35:42 -07:00
PatR
6636db94e7 corridor engravings in black and white
The default engraving-in-corridor character is the same as the default
corridor symbol (and also default lit corridor one), distinguished by
color.  Show it differently (in inverse vidoe, like lava vs water and
sink vs fountain) if color is Off.

It might be better to change the engraving-in-room symbol to be the
same as the room one so that they'll be more consistent with corridors;
color is probably sufficient without resorting to back-tick.  But this
update hasn't done that.
2023-09-12 01:34:47 -07:00
PatR
9016d65df4 another wall of lava fix
Use inverse video for wall of lava if color is disabled, same as is
done for ordinary lava.  The two won't have any visible distinction
from each other but at least wall of lava won't look like water.
2023-09-10 14:25:41 -07:00
PatR
0a7cdeae3c viewing geno'd monsters at "genocide what?" prompt
At either of the genocide prompts,
|What type of monster do you want to genocide?
or
|What class of monsters do you want to genocide?
answering "?<return>" will show the list of monster types that have
already been genocided, then re-prompt.
2023-09-09 16:56:24 -07:00
PatR
1a64ee1c28 github PR #259 - paranoid_confirmation:trap
Fairly old pull request from copperwater:  add new paranoid_confirm
setting 'trap'.

The old commit suffered from bit rot and merging needed too much
fixing up despite there not being many bands of change in the commit's
diffs.  I ultimately redid it from scratch, although the two biggest
chunks of code started with copy+paste of the pull request's commit.

It operates like paranoid:pray.  Setting paranoid:trap adds a new
"Really step into <trap>?" y/n prompt when attempting to move
into/onto a known trap, even if an object covers it on the map.
Setting both 'paranoid:Confirm trap' turns that into a yes/no prompt.
(Adding 'Confirm' affects other paranoid confirmations; in addition
to requiring yes<return> rather than just y to accept, it also forces
no<return> to reject.)

However, moving into a known trap that is considered to be harmless
behaves as if no trap was present.  Some of the trap classification
might be out of date; several types of traps have undergone changes
since implementation of the original pull request, notably anti-magic
field.  When the hero is hallucinating, all known traps are considered
harmful since the map no longer reliably describes them.

Preceding a movement command with the 'm' prefix also behaves as if
no trap was present, bypassing confirmation for that move, similar to
how paranoid:swim currently behaves.  Being stunned or confused also
behaves as if no trap was present, taking priority over hallucination.

This updates the documentation.

Supersedes #259
Closes #259
2023-09-08 15:55:31 -07:00
nhkeni
33d85bfe08 CRASHREPORT cleanup
make deprecation warning suppression unconditional
formatting/whitespace
2023-09-07 20:55:07 -04:00
Michael Meyer
9d7378ec57 Fix: undoing monsters' permablindness by accident
Monsters can become permanently blind (in very narrow circumstances -- I
think limited only to a very short-range camera flash), in which case
they have both mon->mblinded and mon->mcansee set to 0.  Such
permanently blinded monsters can counterintuitively regain their sight
by being blinded a second time from a different source: for example, by
being hit with a cream pie.  That second blinding will increase
mon->mblinded (which functions as a blindness timeout) by some amount,
and when it runs out the monster will regain its sight.  Try to make
sure that doesn't happen by skipping any blinding attacks if the monster
has already been permanently blinded.
2023-09-07 05:59:50 -07:00
Michael Meyer
1dab134fce Fix: rising from the grave as a zombie
When the hero is killed by a zombie, she is supposed to arise from the
grave as a zombie of a type matching her race.  Commit 580c5a6 broke
this inadvertently -- done_in_by was passing gy.youmonst.data to
zombie_form() and relying on the old behavior where it attempted to
include the hero's race in is_elf, is_orc, etc if the permonst matched
the hero's role.  Because this no longer works, zombie_form was only
returning PM_HUMAN_ZOMBIE when passed the role permonst of an
unpolymorphed hero.  Use gu.urace.zombienum instead.  This would have to
be a little more sophisticated (falling back to zombie_form() if Upolyd)
if a polymorphed hero with unchanging could die via done_in_by but
that's not currently possible as far as I can tell.
2023-09-07 05:35:51 -07:00
nhkeni
ee2510eb2f blind attempt to fix Windows build 2023-09-06 13:55:06 -04:00
nhkeni
385d860bef Merge branch 'keni-crashweb3' into NetHack-3.7 2023-09-06 12:39:17 -04:00
nhkeni
8c095b009a Add CRASHREPORT, show contact form on panic/impossible
When calling panic() or impossible(), create the option
of opening a browser window with most of the fields
already populated.  Code for MacOS and linux is included;
other ports are affected by argument change to early_init
which are done but not tested.

To enable, define CRASHREPORT in config.h and set
CRASHREPORTURL in sysconf to (for the moment at least)
http[s]://www.nethack.org/common/contactcr.html

Adds --grep-defined option to makedefs for Makefiles.

Adds "bid" (binary identifier), an MD4 of the main nethack
binary.  This is ONLY for helping (in the future) contact.html
to set the "NetHack from" field automatically for our own
binaries.  This can be faked, but the user can lie so nothing
lost.  There's nothing magic about MD4; other ports can use
anything that prodcues a long apparently random string we can
match against.

- new option --bidshow for us to get the MD4 of a
  released binary so I can add it to the website.
  Only available in wizard mode and not in nethack.6.
- typo macos -> macosx in hints file

No support for packaging builds as I'm not sure what that
would look like.

Adds a javascript helper for MacOS.
Adds a lua helper for linux (and builds and installs
 nhlua).
2023-09-06 12:27:13 -04:00