Commit Graph

5217 Commits

Author SHA1 Message Date
Pasi Kallinen
6c874267b8 Correct petattr doc in Guidebook 2024-02-06 08:54:32 +02:00
PatR
061c2ab1b1 fix #K4098 - lava burns up item being stolen
Three months ago to prevent an "object lost" panic situation when
stealing an item that let hero survive water (several candidates)
would result in drowning, remove_worn_item() was changed to flag the
item being removed as in_use and emergency_disrobe() was changed to
avoid dropping in_use items while drowning.  That seemed to work ok.
But for lava instead of water, in_use is a flag to destroy the item
(set in advance, before issuing messages that can give the player a
chance to trigger a hangup save).  So instead of keeping the item
around for theft to finish, it was deallocating it.  steal() would
format the freed object and then access some of its fields, leading
to havoc.

This adds a hack to allow one item already flagged as in_use to be
treated differently by lava_effects() from the ones it flags for
destruction.  This also seems to work ok, but we may need to start
putting freed items on a deferred deallocation list similar to how
dead monsters are kept around for the rest of the current move.

The fix/hack has revealed two more bugs that this doesn't address.
An item being stolen is removed without any message, then if that
removal doesn't kill the hero a theft message is given.  The message
sequencing is wrong.  Flying hero who loses amulet of flying just
gets affected by lava; player is only told why after life saving.

The other issue is that life-saving from lava can teleport the hero
to where the thief can no longer be seen, yielding "It steals <item>"
even though "It" was visible when the theft started.
2024-02-04 15:40:00 -08:00
PatR
73feb80a00 fix #K4097 - ^C during DECgraphics on tty
For tty, if ^C interrupt occurred while the terminal was displaying
VT line drawing characters, it wouldn't finish updating the map and
switch back to regular characters, so the "Really quit?" prompt was
illegible.

Rather than muck about with the signal handler, just add a fixup to
tty_putstr() since prompting ultimately uses putstr(WIN_MESSAGE).
Reproducing the situation isn't straightforward; I didn't even try.
2024-02-03 16:22:45 -08:00
nhmall
4d09009fff Guidebook follow-up 2024-01-29 10:56:16 -05:00
Pasi Kallinen
41edcdf6d9 Mention italic for status hilites in Guidebook 2024-01-29 16:48:31 +02:00
nhmall
0dfe92ac61 more italic support
There might be some follow-ups to this.
2024-01-29 08:40:05 -05:00
Pasi Kallinen
5829863be2 petattr also accepts italic 2024-01-28 19:03:45 +02:00
Pasi Kallinen
fd8b2b58d1 petattr: Change accepted parameters, add support for tty 2024-01-28 10:05:42 +02:00
PatR
9993fa97ec vision vs gas cloud dissipation
Reported directly to dev-team:  vapor cloud dissipation didn't always
update vision properly.

Region removal affecting visibility needs to make two passes, the
first unblocking all no longer blocked spots, then the second deciding
whether spots are visible.

Attempting to do that in one pass was doing
| unblock <x1,y1>
| if cansee <x1,y1> whatever
| unblock <x2,y2>
| if cansee <x2,y2> whatever
and the cansee <x1,y1> test wasn't accurate if <x2,y2> blocked it and
hadn't been unblocked yet.

Testing with steam didn't seem to trigger the problem but with poison
vapor trail from green dragon breath did.  The order of evaporation
mattered too; sometimes the single pass unblocking plus vision-testing
worked ok by coincidence.
2024-01-26 13:40:34 -08:00
PatR
4512e85e58 fix hero Strength
The recent acurr() changes introduced a bug that caused Str less
than 25 to be limited to 18/07.  25 was treated correctly as a
special case but 18/01 through 18/100 and 19 through 24 were not.
The cap of 25 imposed on the other characteristics is the same as
encoded Str 18/07.
2024-01-25 13:17:23 -08:00
PatR
90d515b6ab fix #K4091 - losexp() assert(u.ulevel < 30) fail
Previously reported via github pull request #1188 as an out of bounds
access to u.uhpinc[], followed by issue #1189 when it was closed, the
backtrace accompanying new assertion failure provided more information
that led to figuring out the problem.

Only mattered for the debug fuzzer; wouldn't happen in regular play.

When the hero dies during fuzzing, the fuzzer sometimes restores lost
levels via blessed potion of restore ability.  If that happened to a
hero who died by being life-drained while at level 1 then losexp()'s
assumption that life-saved hero was still level 1 got violated.  If
levels had been lost all the way down from a peak of 30, restoration
to u.ulevel==30 resulted in invalid array indexing into u.uhpinc[],
then failure of 'assert(u.ulevel >= 0 && u.ulevel < MAXULEV)' which
was added to avoid that.

Pull request #1188 and issue #1189 are already closed, but they hadn't
actually been solved yet.

Fixes #1188
Fixes #1189
2024-01-24 14:31:26 -08:00
PatR
576dd10bdd fix #K4088 and #K4089 - ring formatting
+/-N for charged rings with known enchantment was clobbering the
BUC formatting that had occurred earlier.  #K4088 thought it was a
problem with the implicit_cursed option; followup #K4089 from same
user correctly pointed out that the problem was present for any BUC
state.

This is the same line of code that inadvertently omitted the space
between +/-N and "ring of <type>".  That was fixed by commit
1a2b2a8cae a couple of days ago.

While in doname(), fix a potential issue calling corpse_xname().
That assigns a new value to gx.xnamep, clobbering the value that
doname() relied on when it was first called (but doesn't look at
again, so doesn't matter now but could conceivably in the future).
2024-01-24 00:37:09 -08:00
PatR
267daeaa0f supply chest fixes for "odd encumbrance behavior"
Changing the quantity to 2 (50:50 chance) when creating a potion of
healing (also 50:50 chance for each attempt) to place inside a supply
chest wasn't updating the potion stack's weight, resulting in the odd
encumbrance behavior that was reported last December.

Taking the stack out of the container doesn't fix the weight but
drinking one of the potions splits the stack of 2 into two stacks
of 1 and does update the weight for both.  That gives the hero higher
encumbrance when the formerly weightless one has its proper weight.
Finishing drinking the potion uses it up, removing second potion's
weight again.  When below an encumbrance threshold by the weight of
one potion or less, player will see encumbrance increase and then
decrease, with healing message given before both due to sequencing.

Supply chests weren't having their own weight updated when they were
populated, so would behave as if empty if hero carried them around.
Removing something, breaking something by kicking the chest, or adding
something would update its weight to match its contents.

I also noticed a refutation (or should that be rebuttable?) to my own
remarks in this:

| commit cd91d0630b
| Author: PatR <rankin@nethack.org>
| Date:   Sat Dec 30 17:10:39 2023 -0800
|
| github issue #1180 - humans and murder
|
| Issue reported by Umbire:  reviving a human corpse into a human
| monster and then killing it entails murder penalty even when it is
| hostile.
|
| This is probably a non-issue.  Human monsters tend to not leave
| human corpses, they leave shopkeeper corpses or sergeant corpses
[...]

Dead fake hero corpses placed at trap locations on early levels are
leaving plain human|dwarf|elf|gnome|orc corpses rather than fake
player monster ones (which are always human but resurrect as player
monsters rather than as plain humans), so there are more plain human
corpses now than there were in 3.6.x or early to-be-3.7.  I've added
a comment about the situation.
2024-01-23 15:42:19 -08:00
PatR
fabc9033aa loadstone bit
If your inventory is full and you aren't already carrying a loadstone,
you can pick one up into the overflow slot.  But if you are already
carrying one and the one you're trying to pick up won't merge with it
(only criterium that matters would be BUC state, I think), you can't
pick it up and get a message saying so.  If loadstone isn't known
yet, the message always referred to it as "gray stone" rather than
"stone called <whatever-you-called-it>".
2024-01-22 13:25:32 -08:00
PatR
593a93d254 obj->how_lost fix
PR #1140 added checking the thrown, stolen, and dropped flags of an
item when testing whether it would merge (at my suggestion...) with
a stack in the target list (hero's invent).  That interferred with
picking it back up--whether via autopickup or explicit pickup--while
inventory was full even when the item would otherwise be mergable.

There was some trial and error involved when trying to figure where
to put the fix but things seem to be working.

This replaces a static analyzer workaround and could possibly bring
its unwarranted complaint back.
2024-01-21 01:17:18 -08:00
PatR
b6bc3ef698 more Guidebook for containers
"blue potion" wasn't a very good example for an item in a container;
plain "blue" isn't a potion description.

Add an extra sentence to make the association between a container's
"item count" that's really a stack count and the fact that inventory
slots are for stacks rather than for individual items too.

Style/usage bit: avoid using "another" twice in the same sentence.

Fix a typo in the spelling of "contents".
2024-01-19 10:44:39 -08:00
Pasi Kallinen
2212cf27ec Lua: Allow creating gas clouds
Use the gas clouds in the Clouds themeroom.
Use the existing visible_region_at() in the vision code.
2024-01-19 17:59:43 +02:00
nhmall
da4bf5a87e updated Guidebook.txt 2024-01-19 09:31:29 -05:00
nhmall
5ab9904b8f fix Guidebook.tex processing 2024-01-19 08:36:12 -05:00
PatR
b156912c46 Guidebook tweaks for "containers" sub-section 2024-01-18 23:58:53 -08:00
PatR
8111a7aff2 covetous monster tactics on completely full level
If a covetous monster tried to teleport adjacent to the hero but the
level was too full to move it from its current spot, it would be
sent off level to wait for the hero to leave and return instead just
staying put.
2024-01-15 14:25:06 -08:00
PatR
40e919dbf9 github issue #1200 - erronenous engraving feedback
Issue reported by chappg:  if a monster or object covered an engraving,
examining that monster or object with farlook would include the text
of the engraving even though it wasn't the thing being examined.

The report was for a bones level but that only mattered because it was
a ghost on top of a grave (and the engraving on its headstone) that was
being examined; bones data itself wasn't pertinent.  It would happen
with any engraving once the spot was mapped as an engraving or a grave
provided that something else was currently displayed at the location.

Bug was introduced by commit 389f03e90e
two months ago.  Mea culpa.

Closes #1200
2024-01-15 02:56:26 -08:00
Pasi Kallinen
9745121137 fixes entry for the accessibility options 2024-01-15 11:00:21 +02:00
Pasi Kallinen
3160112ece Accessibility: Show a message when monster is spotted
Adds a new boolean option, spot_monsters.  If on, every time
the hero notices a monster which was out of sight before,
a message is given.  Combine with accessiblemsg to get the
monster location:

(3north): You see a newt.

Breaks saves and bones.
2024-01-14 13:33:02 +02:00
nhmall
213302d973 check def_monsyms[], def_oc_syms[] index
Resolves #1179
2024-01-11 20:13:02 -05:00
PatR
02c675078b PR #1150 - rework erinyes into avenging Furies
Pull request from entrez:  change erinyes from lame devils named
after the Furies of Greek myth into those Furies.

Bumps EDITLEVEL because of changes to saved data.  I augmented the
new data.base entry.

Closes #1150
2024-01-10 23:22:56 -08:00
nhmall
52940a4620 inappropriate null sobj check - pull request 1173 2024-01-08 23:59:41 -05:00
PatR
83bdf71932 pull request #1175 - obj->corpsenm fixes
Pull request by mkuoppal:  some objects which use the corpsenm field
to access the mons[] array can have a corpsenm value of NON_PM (-1)
and weren't avoiding array access in those cases.

In addition to a fixes entry for it, this makes some revisions to the
commited code, handling a few of the cases differently.

Closes #1175
2024-01-06 15:13:31 -08:00
PatR
21068b05c5 fix github issue #1192 - engulfers vs iron bars
Issue reported by Umbire:  an engulfing monster capable of passing
through iron bars (vortices and air elemental) could do so while
carrying the hero.

Prevent an engulfer from doing that unless the hero happens to be
polymorphed into a subset of the types of monsters that can move to
iron bar locations.

Fixes #1192
2024-01-05 16:15:30 -08:00
PatR
c6897bf331 fix github issue #1191 - obj->age of oil potions
Issue reported by AmyBSOD:  several actions change the object type of
a potion rather than force creation of a replacement one, and if/when
the type was changed to oil, the age wasn't converted from absolute
to relative.  Relative age is the amount available and/or the number
of turns it will burn if applied.  The later in a game a potion got
converted into oil, the longer it would burn.  Not mentioned:  reverse
situation was also the case, although that didn't have any noticeable
effect since incorrect absolute age of former oil doesn't matter.

Not thoroughly tested.  I got a potion of oil from a horn of plenty
and it burned for 400 turns, but it might have been created directly
rather than be a rejected magic potion that was converted into oil.

Closes #1191
2024-01-03 13:29:15 -08:00
nhmall
6db79b9f18 Guidebook update 2024-01-02 12:34:05 -05:00
Pasi Kallinen
dc8d9d6cd0 Accessibility: Add location info to messages
Adds a new boolean option, accessiblemsg.  If on, some game messages
are prefixed with direction or location information, for example:

   (west): The newt bites!
   (northwest): You find a hidden door.

I added the info to the most common messages, but several are
still missing it.
2024-01-02 18:59:25 +02:00
Pasi Kallinen
780d30eca9 Wielded quarterstaff gives a small spellcasting bonus
From NetHack Fourk.
2023-12-31 17:53:03 +02:00
Pasi Kallinen
42a6a5df66 Cursed welded quarterstaff doesn't prevent spellcasting 2023-12-31 17:41:04 +02:00
PatR
0e70fc5844 unfix unnaming types of objects
The prior commit makes the code clearer so I'm not reverting it,
but the old code was not accessing freed memory so I am removing the
fixes entry.  The static analyzer's complaint is bogus.  Freeing the
memory that held a user-assigned type name did not affect whether
that pointer could be tested for being Null.  Its stale value wasn't
being dereferenced.
2023-12-27 05:48:28 -08:00
PatR
97272d3627 fix unnaming types of objects
docall() would access freed memory if the player used space(s) as
a fake object type name in order to remove an existing name without
giving any new one.

3.4.3 had this bug too; I didn't go farther back.
2023-12-27 04:59:44 -08:00
PatR
036d2a929f Fumbling while riding
Being stuck on a cursed saddle overrides Fumbling if hero would have
fallen off steed.
2023-12-24 00:54:48 -08:00
PatR
05cf948007 fix github issue #1186 - eating Medusa's corpse
and having temporary stoning resistance timeout before finishing.

Issue reported by Umbire:  hero was able to finish eating Medusa's
corpse safely after getting the message about no longer being
protected against stoning that is given when temporary resistance
times out.

The eating code was extending temporary resistance--when eating
something protected by such--to avoid just that.  I thought this
was probably a message sequencing situation but it turns out that
the code was using touch_petrifies() to test the meal.  It should
use flesh_petrifies() instead; Medusa doesn't pass touch_petrifies().

I didn't figure that out until after rewriting how the duration is
extended.  The old way probably would have worked as desired with
the revised petrify test but I'm checking in the new version anyway.

Fixes #1186
2023-12-23 17:38:05 -08:00
PatR
35eb289cc3 "partly used candle" fix
If you wished for "lit candle" you'd get an unused candle that
is pre-lit but the feedback as it's added to inventory would be
"partly used candle (lit)".  If snuffed out immediately, it reverts
to "candle" (ie, not partly used).

This fixes the first aspect:  you will get "candle (lit)" added to
inventory.  On the next turn it changes to partly used as expected.
The second aspect, reverting to not-used-yet after being lit during
the wish is left as-is.
2023-12-23 16:15:38 -08:00
Pasi Kallinen
5b5e547791 Restful sleep gives a warning message 2023-12-21 09:41:47 +02:00
Pasi Kallinen
3c94b276a2 Amulet of unchanging cannot be polymorphed 2023-12-19 17:13:52 +02:00
Pasi Kallinen
c0fdb2e8c4 Level temperature affects monster generation
Hot levels generate more fire-resistant monsters, cold
levels cold-resistant ones.
2023-12-18 13:43:41 +02:00
Pasi Kallinen
3c421da746 Previous hero rising as undead in bones retains intrinsics 2023-12-15 16:03:26 +02:00
PatR
9d3710163e fix #K4063 - "back on ground" given at odd time
Moving over at item that's resting on ice gives a message about there
being ice present and then about the item, whether mention_decor is On
or Off.  With it On, you'll get a message about being back on solid
ground as soon as you leave the ice.  With it Off you wouldn't get
that at all if not levitating; that's the basic no-mention_decor
behavior for ice.  However, if you were levitating, you would get a
delayed "back on solid ground" message when moving over some other
object, which might occur quite a bit later.  Autopickup handling is
calling describe_decor() when the hero is levitating and some of that
wasn't appropriate for no-mention_decor.

This issue has been present since I first implemented mention_decor,
not introduced by recent back_on_ground() changes.
2023-12-13 13:15:18 -08:00
PatR
a7db78f7d6 fix #K4060 - "you walk quietly" while riding
Donning elven boots while riding and not already stealthy, you'd get
the message "you walk quietly" when not walking at all.  Instead of
just changing the message, make riding a non-flying steed block
stealth.  Riding a flying steed (or one you take aloft with an amulet
of flying) does not.  It would have been quite a bit simpler to have
made riding anything block stealth, but the hard part is done.
2023-12-10 22:09:26 -08:00
Alex Smith
f3408b87ba A new HP regeneration formula
The new formula is: (xlevel + Con)% chance of regenerating 1 hp
each turn.

This formula has been extensively playtested throughout the whole
game (including two ascensions). The intention is to make late-
game combat more interesting: early game the HP regeneration rate
is potentially slightly faster but not significantly changed, but
in the midgame and lategame is substantially slower because there
is no longer a big regeneration boost once the character's xlevel
is in the double digits.

With the new formula, I'm finding that my characters have to heal
with potions (rather than by waiting) in places that they never
had to before (e.g. lower Dungeons, and upper Gehennom), which in
turn means that fighting efficiently is now more important than it
was before. (In fact, in one of the games I wished for potions of
full healing on Astral for safety, although I think I would still
have won without.) It's also generally the case that you can no
longer regenerate "mid-fight": you need to disengage in order to
heal up. This made the game more fun as it meant that escape items
became more relevant, and I was using a greater range of items
throughout the game than I normally would.

The ring of regeneration has also been slightly buffed: it now
heals an extra 1hp per turn unconditionally (rather than becoming
less effective as the character levels). In both my test
ascensions, I found a ring of regeneration, but intentionally
refrained from using it in order to ensure that the new HP
regeneration rate would be tolerable even without one.
2023-12-11 03:11:23 +00:00
Pasi Kallinen
c2802dba2d Demons cannot be frightened by showing them their reflection
From xnethack by copperwater <aosdict@gmail.com>.
2023-12-10 20:11:29 +02:00
nhmall
e0f591bc49 fixes3-7-0.txt entry for pull request 1155 2023-12-10 10:42:01 -05:00
PatR
31717fe227 fix github issue #1170 - trapped without a trap
Issue reported by mkuoppal:  drum of earthquake triggers a sanity
check warning which the fuzzer escalated to panic.

Analysis by entrez.  If a pit gets created next to a pool or moat or
lava, liquid might flow there and replace the pit.  But the drum of
earthquake code assumed that the pit was still there.  If there was a
monster there and it wasn't levitating or flying and it wasn't killed
by the liquid, it got marked as trapped even though the pit was gone.
'sanity_check' noticed.

With difficulty I was able to reproduce the impossible warning before
the fix, but the are a bunch of random factors at play.  After the
fix I can't reproduce it again, but that's not a guarantee that it's
actually fixed.  The analysis seems correct though and the fix is
based on dealing with that.

Closes #1170
2023-12-10 03:21:52 -08:00
Pasi Kallinen
252e661b72 Prioritize paying shopkeeper next to you even if multiple are detected 2023-12-09 13:24:50 +02:00