Commit Graph

5269 Commits

Author SHA1 Message Date
Pasi Kallinen
c71e8ec8d4 Sunsword can be invoked to create a blinding ray 2024-03-31 19:43:33 +03:00
PatR
636432e883 variant spellings of "master lich"
From a reddit thread:  after genociding "arch-lich", player's next
target was "master-lich".  The character was a monk who immediately
died of genocide.

("Master<almost anything>" other than "master mind[ ]flayer" or
"Master Thief" or "Master Assassin" matches level 30 monk rank "Master".)

Rather than muck about with fairly complicated matching code, just add
"master-lich" and "masterlich" as explicit variations.
2024-03-28 03:10:38 -07:00
PatR
c6992777f5 end-of-game attribute disclosure in wizard mode
Disclosing final inventory while wearing an alchemy smock reported
the apron's slogan accurately but then disclosing attributes gave
different text if it was conferring poison resistance and/or acid
resistance.  The extra text was unneeded/unwanted there anyway, so
simply suppress it rather than force it to be accurate.

3.6.x had the same issue but it wasn't detectable there because it
only had extra text for T-shirts and they don't confer attributes.
2024-03-27 23:52:37 -07:00
PatR
18baf188ea fix github issue #1220 - shattering unseen weapon
Reported by NetSysFire:  if hero dealt a weapon-shattering melee
blow to an unseen target, the weapon was accurately described in
the accompanying message
|Its <formatted-weapon-description> is shattered from the force...!

If the hero can't see or sense the monster, report
|Its weapon is shattered from the force of your blow!

If the monster isn't seen but is sensed, then
|<Monster>'s weapon is shattered from the force of your blow!

Fixes #1220
2024-03-26 13:29:29 -07:00
Pasi Kallinen
720c62c340 Ring of aggravate monster increases level difficulty 2024-03-23 12:35:54 +02:00
Pasi Kallinen
9a870b5f06 Option to use a menu to answer yes/no prompts
Add a new boolean option 'query_menu'. If on, game will pop up
a menu for specific yes/no questions, instead of using an input prompt.
2024-03-22 19:19:57 +02:00
PatR
f801863e5c misbehavior by #adjust
Reported directly to devteam:  using '#adjust a a' to collect
invent stacks compatible with the one in slot 'a' all into 'a' gave
feedback of "Merging: a - ..." even though "Collecting: a - ..."
was intended.  Also, if there weren't any such compatible stacks,
so that the whole operation didn't accomplish anything, it reported
"Collecting a - ..." without the intended colon between the action
and the inventory letter.

Test case was trivial:  start with a stack of 2 of something in 'a'
and use '#adjust 1a b' to split into two stacks, then '#adjust a a'
to collect them back again.

While fixing this, I noticed that '#adjust a b' and '#adjust b a'
(from same starting situation) just swapped a and b instead of the
intended behavior of merging them back together.
2024-03-21 22:32:31 -07:00
PatR
a8fbb96f2b 'windowcolors' documentation
The construct "\\'#rrggbb'" seemed strange and while fixing that
I made several other changes.  There's an escape sequence for
apostrophe but "#rrggbb" doesn't actually need any quoting in the
first place (except for "\#" in the TeX version).

There was unwanted indentation after the OPTIONS=windowcolors line
in the 'roff version.  For the TeX version, avoid 'verbatim' since
it contains both literal text and placeholders that are now being
distinguished with italics.

Also, "trueblack" is Windows-specific rather than an ordinary named
color.
2024-03-21 09:59:43 -07:00
PatR
a0bea150e1 rephrase fixes entry about tutorial obj discovery
The fixes entry about object info carrying over when normal play
was resumed could have been mistrued as stating that the objects
themselves were carrying over.
2024-03-21 08:58:48 -07:00
PatR
a79d6d8e63 partly fix issue #1134 - tutorial leaks obj info
Reported by AndrioCelos, a handful of objects in the tutorial can
be discovered via use, and such discoveries were carrying over to
normal play when the tutorial ended.

This causes the hero to forget such discoveries.  The player will
still be able to remember them.  The proper fix would be to discard
the initialized but not-yet-started game when entering the tutorial
and then start a whole new one when exiting so that saving and
restoring game state would become unnecessary.  This doesn't do that.

This also causes monster birth and death statistics to be reset when
exiting the tutorial.  Affects the #vanquished command and potentially
extinctionist play.

Closes #1134
2024-03-21 08:32:58 -07:00
Pasi Kallinen
23d1657dca Add walking on traps to default paranoid_confirm 2024-03-20 19:31:09 +02:00
Pasi Kallinen
55263050df Doc: windowport putmsghistory 2024-03-19 18:59:23 +02:00
Pasi Kallinen
4030ef13a0 Curses: implement the windowcolors option
Allow changing the curses windows foreground and background colors,
for example:

OPTIONS=windowcolor:menu #8000F0/20F080 message grey/blue
2024-03-17 18:41:52 +02:00
Pasi Kallinen
464d0c9269 Curses: swap the grey and no-color initialization
The grey color was initialized as default foreground color,
and no-color as white.
2024-03-15 11:06:44 +02:00
PatR
68312f7feb magic trap uncursing vs scroll of remove curse
Reported directly to devteam:  if a magic trap gave its uncurse
effect, scroll of remove curse could become discovered.

Turns out that it would happen if hero was wielding a stack of
unholy water potions.  It didn't matter whether they were known
as water or known to be cursed or whether hero was carrying any
scrolls of remove curse.
2024-03-13 12:39:50 -07:00
PatR
6ca54852ee perm_invent initialization fix
Using
|OPTIONS=windowtype:Foo
|OPTIONS=perm_invent
or
|NETHACKOPTIONS='perm_invent,windowtype:Foo'
would enable perm_invent if interface "Foo" supported it, but using
|OPTIONS=perm_invent
|OPTIONS=windowtype:Foo
or
|NETHACKOPTIONS='windowtype:Foo,perm_invent'
or combined
|OPTIONS=perm_invent
|NETHACKOPTIONS='windowtype:Foo'
would only enable perm_invent if both "Foo" and the default interface
supported it.

Using '--windowtyp:Foo' on the command line didn't have this issue
because command line interface selection replaces the default one
before configuration file and environment options are processed.
2024-03-12 11:19:35 -07:00
nhw_cron
2d1c1f03cb This is cron-daily v1-Dec-5-2024. 005guidebook updated: doc/Guidebook.txt 2024-03-11 17:31:32 -04:00
nhkeni
e316d962a8 Minor regex naming and doc cleanup. 2024-03-09 13:28:15 -05:00
nhmall
6d22361fca separate function for acid potion damage pr#1195
Also includes a couple of trailing whitespace removals.
2024-03-09 09:25:43 -05:00
PatR
cb50fbb2ce fix for breaking unreachable statue
Reported almost 9 years ago:  if an adjacent statue was in a pit,
you could use a pick-axe to break it even though if you managed to
move to the pit location without falling in, you wouldn't be able
to reach objects there including the statue.

Allow a pick to reach if hero is in a conjoined pit, or if it is a
mattock rather than an ordinary pick-axe.  Otherwise you'll get the
"you swing at thin air" result.  Similarly when hero is in a pit and
and adjacent statue or boulder is on the floor:  mattock will work
but pick-axe now yields "you can't reach".
2024-03-08 13:08:28 -08:00
Pasi Kallinen
8cd8759e04 Walking on ice can make you slide in a random direction 2024-03-07 19:29:09 +02:00
Pasi Kallinen
2de0c8cacb Qt: make all menus modal
This fixes a lot of problems where a menu or a text window was up
and the main window accepted input - for example you could move around,
making another window of the same type pop up ...
2024-03-04 11:39:32 +02:00
PatR
9a866688c5 engravings shown with symset:blank
Noticed when testing the OPTIONS=symset:blank fix, map spots holding
engravings weren't blank.

Are there any other relatively recently added symbols that need to be
added to the blank set?
2024-03-02 06:12:34 -08:00
PatR
5e79f8c425 fix #K4113 - OPTIONS=symset:blank in RC file
Any plain text symbol set specified in .nethackrc or NETHACKOPTIONS
didn't get loaded but did set the symset name.

Faulty 'if' logic excluded loading of symbol sets that used the
default handling type of H_UNK.
2024-03-02 05:50:44 -08:00
nhmall
356875ea20 updates from cron daily 2024-02-29 09:03:00 -05:00
nhmall
258d7b2f56 Guidebook date stamp 2024-02-29 08:00:19 -05:00
nhmall
92f831d53a do not include tmac.n
The terms of use listed in doc/tmac.n ask that it not be modified from
the original.
.
2024-02-29 07:40:19 -05:00
RainRat
a3658f85ac fix typos 2024-02-28 20:15:56 -08:00
PatR
41a5565403 new 'showvers' option
Add options 'showvers' (boolean) and 'versinfo' (numeric mask) to
show nethack's version on the status lines during play.  It won't be
particularly interesting to ordinary players but should be useful
when making screenshots or video to be streamed, or for someone who
switches between git branches or between nethack and variants.

I worked on this several months back but it was combined with
unfinished changes to 'hitpointbar'.  I've separated it out so that
it can be put into use.  When enabled, one or more components of
"<name> <branch> <version>" will be shown right justified after
status conditions.  At present the default is "<branch>" if that is
available and overall status isn't 'released', or "<version>" if
'released' or if branch isn't available.  That might need some
refinement.

It works as intended for tty and curses, although some abbreviation
mechanism would be useful if/when the program resorts to abbreviating
status conditions to make things narrow enough to fit.

For X11, it works ok for fancy_status:True (the default, controlled
via NetHack.ad settings) but is messed up for tty-style status.  The
text is positioned correctly but there are gaps in it, making it
appear garbled, similar to what I saw when I tried and failed to
implement statuslines:3 for X11.  [It might be due to having empty
condition widgets be 1 pixel wide instead of being totally removed
but I don't think the situation is that simple.]

For Qt, if the text needs to be truncated in order to fit, the center
portion of the string will be shown, discarding parts from the left
and right.  That ought to discard from left and retain rightmost
portion instead.

For win32|mswin|Win GUI, no attempt to support it has been included.
Things should be ok when 'showvers' is left as False (the default)
but I don't know what will happen if that gets toggled to True.  At a
minimum, the version info won't be right justified.  The information,
or at least some of it, is displayed in the game window's title bar
so there isn't any pressing need to add it to status, but toggling
the option will need to behave sensibly if it doesn't already.
2024-02-28 11:47:16 -08:00
Pasi Kallinen
25fa293c81 Accessibility: lookaround command, mention_map option
Adds a new extended command #lookaround, which will describe
the map around the hero they can see or remember.

Adds a new boolean option mention_map, which will give a message
when an interesting map location in sight changes.
2024-02-28 20:53:52 +02:00
PatR
1532a052c0 spellbook of blank paper named Making Money
Reported directly to devteam, polymorphing a spellbook could produce
a blank spellbook with a Discworld novel's title attached.
2024-02-27 11:27:02 -08:00
nhmall
334535e7b0 Fix makemon() trying to generate a monster on top of another monster
When makemon was called with all-zero arguments (e.g. for random
monster generation over time), ptr==NULL means "a random monster".
This was being forwarded to mon==NULL in makemon_rnd_goodpos, and
then mtmp==NULL in goodpos, which means "an object, not a monster".
Because objects can be generated under monsters, this meant that an
attempt to create a random monster could end up choosing a location
that already had a monster, which would then cause the monster
generation to fail.

This mostly wasn't noticeable in normal play: it effectively
reduced the monster generation rate depending on how many locations
outside LOS happened to contain a monster. Normally that's a very
small proportion, so the bug had no obvious effects: but when there
are very few locations outside LOS (i.e. the player can see almost
every location on the level), the bug effectively caused monster
generation to stop once those locations became occupied by
non-moving (e.g. hiding) monsters, something that became observable
in games where the player decided to dig out and light almost an
entire level.

This commit fixes the problem by adding a new flag to goodpos that
requests that it not choose a position that already has a monster.

This bug was diagnosed, and this fix committed, by ais523; but
nhmall wrote almost all of the code implementing the fix.
2024-02-27 19:04:35 +00:00
Pasi Kallinen
dd37c5326a Accessibility: showdamage option
Add a new boolean option showdamage, if on, outputs a message
like "[HP -2, 14 left]" - several variants have something similar,
but I chose the message based on how eSpeak said it, while keeping
it short.
2024-02-24 17:38:46 +02:00
nhmall
353838c1a6 follow-up to nethackw.exe vertical menu row adjust
Commit 7e452018a6 resolves #1094
2024-02-23 09:41:53 -05:00
nhmall
7e452018a6 Windows GUI: vertical menu row spacing for tiles
The menus in nethackw.exe were being spaced according to the vertical
tile size of custom tiles, but the tiles were being rendered in menus
at the default size anyway, resulting in unnecessary gaps between menu
rows.

Use the default size of 16 for the vertical spacing calculation.
2024-02-23 09:32:50 -05:00
PatR
cba7e6eb43 umpteenth comment typo fix
plus bonus fix:  change a recent fixes entry to past tense.
2024-02-22 11:01:53 -08:00
Pasi Kallinen
d42efcd04f Slightly randomize the spellbook in vlad's tower
Replace the guaranteed invisibility with a somewhat high-level
spell sort-of thematical to Vlad or vampires in general
2024-02-21 09:47:47 +02:00
Erik Lunna
eb22a81088 Refactor, unify, and nerf item destruction
Note: Original change is from xNetHack by copperwater <aosdict@gmail.com>,
      but this commit comes from HACKEM-MUCHE by Erik Lunna, with
      some minor code formatting.

From xNetHack commit a0a6103bea:

'The original goal: nerf item destruction using a method I initially
 proposed for SpliceHack, in which the number of items subject to
 damage from any single source is limited by the amount of damage the
 effect caused. The intent was to be more fair all around and prevent
 aggravating situations where, for instance, a chest shock trap zaps
 you for 4 damage and immediately ten of your rings and wands blow up.

 Problem 1: no easy way to limit the items destroyed without biasing
 heavily towards the start of the invent chain. The old code was able
 to get away without bias by just indiscriminately destroying
 everything eligible with a 1/3 chance. Here, I had to introduce
 reservoir sampling in a somewhat more complex form than I've applied
 it elsewhere, since there are a pool of potential items.

 Problem 2: destroy_item no longer worked remotely like destroy_mitem,
 which still destroyed 1/3 of items indiscriminately. Commence the
 process of squishing them into one function that handles both the
 player and monsters. (Which required making a lot of adjustments to
 destroy_one_item, now named maybe_destroy_item, on nits such as
 messaging and when to negate damage. An annoying consequence of the
 merge is that in the player case, their HP is deducted and they can
 be killed directly, but for monsters they need to add up the
 destruction damage and return it.)

 Unifying destroy_item and destroy_mitem has some advantages: in
 addition to the obvious code duplication removal, it ensures monsters
 now take the same damage as players for destruction (previously they
 took a piddly 1 damage per destroyed item). Now when you hit
 something with Mjollnir and their coveted wand of death breaks apart
 and explodes, you at least get the satisfaction of knowing they took
 the standard amount of damage from it.  Monsters also now get
 symmetry with players in having extrinsic elemental resistance
 protect them from item destruction, and damage negation from item
 destruction if they were appropriately resistant.

 Problem 3: a lot of callers didn't preserve the "amount of incoming
 damage" that this refactor relies on. E.g. if the defender resisted
 that element, the local dmg variable would be set to 0. So I had to
 do some wrangling with callers to save that original damage
 value. The rule of thumb is: all *incoming* damage counts. So that
 includes the player's spellcasting bonus if applicable, but not
 things like half damage, negation due to resistance, or extra damage
 due to being vulnerable to cold/fire.

 Then I figured, while I'm here let's get rid of all those silly cases
 where destroy_items is called multiple times for various different
 object classes, and cut the object class parameter out of it. This
 has a few minor effects:

 - Places where different object classes previously rolled
   independently for destruction to happen at all now roll
   once. (Which, by my calculation, generally means less incidences of
   destruction - a fire attack now won't have three separate chances
   to hit your scrolls, potions, and spellbooks. On the flip side, a
   lucky roll will no longer save an entire object class in your
   inventory.)

 - Callers can no longer specify different probabilities for
   destroying different object classes. The only place this was really
   used was to call destroy_item with a slightly lower probability on
   SPBOOK_CLASS.  With the nerf in this commit, less of them ought to
   be destroyed anyway.

 - A very edge case of where explosion-vs-monster damage was totted up
   differently for golems, which could result in differences of a hit
   point here or there.

 - All object classes being processed in one go means that less items
   are destroyed than would be if they were still processed
   independently.  This is not really visible compared to the old
   baseline of just destroying 33% of everything, but would be a
   marked difference versus a copy of the game that still called
   destroy_items separately for different object classes. To
   compensate, I adjusted my planned damage-to-destruction-limit
   scaling factor down from 8 to 5.

 Not done: merging in ignite_items(), though that would probably be
 really easy now.'

Notes from porting from xNetHack:

- It might be necessary to reexamine at all the conditional checks for
calling destroy_items. Because item destruction is much more
restrained and uses the actual damage from an effect, we might now
need to check 'if (!rn2(3))' and similar in all the places item
destruction occurs.
2024-02-20 22:03:54 +02:00
nhmall
688ac6ffbe remove register from variable declarations 2024-02-19 16:30:07 -05:00
PatR
9226a5dea6 couple of DECgraphics optimizations
If a termcap entry for ending attributes and color also contains
the code to switch from secondary font back to primary (HE_resets_AS
hack), maybe strip the AS code out of HE (and clear the HE_resets_AS
flag) when setting up DECgraphics.  Affects whether nethack sends
extra AS sequences while rendering a run of VT line-drawing chars.
My HE doesn't reset AS so that aspect hasn't been exercized.

When switching back and forth between normal and line-drawing,
defer the switch away from line-drawing if the character will be
rendered the same in both character sets (uppercase letter, digit,
most punctuation).  That might just defer the AE, but could skip it
and next AS depending on what characters are written.  The cycle
might repeat an arbitrary number of times, avoiding sending many
AS+AE combinations rather than just one.

Both of these optimizations are pretty small but reducing the number
of characters sent from a server to a remote user is worthwhile.
2024-02-18 15:01:21 -08:00
PatR
44de195718 theft against punished hero with empty inventory
If a punished hero's inventory is empty, have a nymph usually take
off the attached chain and indirectly fix punishment.  If hero is
trapped by being chained to a buried iron ball, sometimes take off
the implicit chain and indirectly release hero from the trap.

Monkeys won't do this and nymphs will only do so if there is no
inventory (aside from gold and/or embedded dragon scales which they
aren't allowed to target).

It's a lot simpler than I was expecting when I wrote the TODO about
it recently.
2024-02-18 11:24:21 -08:00
Pasi Kallinen
2952bdab63 No secret doors or corridors on the early levels
New players often get stuck on the first level when they can't
find the secret door or corridor.  Make the first two levels
have no such features.
2024-02-18 11:47:02 +02:00
nhkeni
3d3ce2369c Merge branch 'keni-wincw2' into NetHack-3.7
Lots of manually resolved conflicts.
2024-02-15 16:25:12 -05:00
PatR
bf8a634760 nethack --version:dump
Add the 'dump' argument to the existing '--version' command-line
option to display the magic numbers used when validating save and
bones files for compatibility.

Nothing exciting, just a line of 5 hex values.  I was going to also
list the values for however many save and bones files are specified
on the command line but it seems to need more effort than I care to
expend.  And I hadn't made up my mind whether that should be done by
nethack, recover, or some new standalone program.  [Single line of
relatively raw output is so that they could be compared more easily.]

nethack --version:bad-argument was writing a message to stdout and
then starting play--which immediately overwrites stdout.  Have it
quit instead.  Player wasn't trying to start a game and quitting is
what it does with --version:good-argument.
2024-02-13 15:58:10 -08:00
PatR
c490265e35 Q enhancement
Noticed while testing confused #loot:  when using 'Q' to populate
quiver, or 'f' when quiver is empty, don't bother asking what to
ready/fire if inventory is empty.

And when inventory isn't empty, don't list '-' as a likely candidate
if quiver is already empty.

'w' behaves differently.  '-' is treated as a likely candidate when
already not wielding anything, and even when inventory is completely
empty.
2024-02-09 16:46:22 -08:00
PatR
381851348b fix #K4103 - crash after confused #loot of throne
If gold is moved into throne's coffer chest (or added to exchequer
monster's minvent) while quivered by the hero, it wasn't being unworn
to remove it from quiver slot.  That could lead to a crash.  Example
was segfault during 'f' command.

freeinv() expects caller to unwear item being removed from inventory;
reverse_loot() wasn't doing so.
2024-02-09 15:48:47 -08:00
PatR
fd5526db7c fix for #H9430 and github issue #1207 - gas clouds
Reported yesterday as issue #1207 by elunna and over four years ago
in #H9430:  monsters in gas clouds that should be shown by Warning
aren't.  And in some discussion of #H9430 back then:  monsters
adjacent to the hero while in gas clouds aren't shown on the map,
but combat and other interaction describes them as if they were.
There have been changes since then--to prevent seeing things on the
far side of gas clouds as if there were no clouds in the way--but
the basic problems with warning and adjacency weren't addressed.

This is a band-aid (tm) that probably makes things livable.  Don't
allow gas region display to override monsters that are sensed via
warning or when the hero is next to them.  That part doesn't work
correctly if the hero isn't blind and is inside the cloud while the
monster is adjacent but outside.  I think it will take more than a
band-aid to deal with that sensibly.

Closes #1207
2024-02-08 07:04:15 -08:00
Pasi Kallinen
b37f1408d8 Self-recover for linux
Compile-time option SELF_RECOVER was implemented for Windows;
add it to unix systems too, with it being on by default when
compiling with the linux hints file.
2024-02-08 11:34:59 +02:00
PatR
5212e4b3db fix github issue #1204 - reflected poison gas
Reported by elunna:  a poison gas breath attack that was reflected
by the target still left that target enveloped in a poison gas cloud.

This makes the gas trail not extend to the target if the attack hits
and is reflected.  But if the attack misses then the cloud does reach
the target, which seems weird to me.  However, being in the cloud is
a separate event that isn't deterred by reflection.

Closes #1204
2024-02-07 11:58:12 -08:00
Pasi Kallinen
6b9f411a32 Accessibility: mon_movement
Adds a new boolean option, mon_movement. When hero notices monster
movement, give a message. Use with spot_monsters and accessiblemsg.
2024-02-07 19:50:38 +02:00