Commit Graph

9153 Commits

Author SHA1 Message Date
nhmall
7f97d86b40 Merge branch 'fix-zap' of https://github.com/argrath/NetHack into NetHack-3.7 2023-12-04 11:27:58 -05:00
nhmall
d8909ec3d0 comment 1st dereference of otmp in bhitm() 2023-12-04 11:26:50 -05:00
Pasi Kallinen
d8421aa219 Save and restore hero tracks
The tracks left by hero were cleared when player saved and
restored the game, or changed levels.  Now the tracks are
saved in the dungeon level, so changing levels keeps the tracks
left by hero in that level.

Also increased the length of tracks from 50 to 100, and
simplify the tracking function.

Thing not done: fade out old tracks when returning to a level.

Breaks saves and bones.
2023-12-04 17:50:48 +02:00
SHIRAKATA Kentaro
b36d792334 remove unnecessary null-check on bhitm()
`otmp` here is always non-null, otherwise it leads segv at earlier code.
2023-12-04 22:14:37 +09:00
PatR
2713853f28 another uhandedness bit
For the accessories section of '*' and perminv_mode=InUse, show the
ring on main hand first (after amulet) and the one on off hand after
(before blindfold).  Main hand ring is more significant due to the
potential of a one-handed weapon becoming cursed, preventing it from
being removed.
2023-12-04 00:54:42 -08:00
PatR
6e785f4d8c uhandedness: include handedness in ^X feedback 2023-12-04 00:17:57 -08:00
PatR
2be47f1d93 options bit: wizweight
Persistent inventory window wasn't being updated right away if the
'wizweight' option was toggled via 'm O'.
2023-12-03 18:22:29 -08:00
PatR
ed6b78e227 fix #K4054 - spellbook weight bug
Report was that converting a novel into a blank spellbook via water
damage resulted in a spellbook of blank paper that increased weight
when put into a bag of holding.

Spellbooks weigh 50 units but novels were defined with a weight of 0;
when one was created, a non-zero weight of 1 got assigned.  Blanking
it didn't update the weight; that stayed at 1.  Putting it into a
container reset the weight to match the new type: spellbook of blank
paper, so its weight increased.

Do that when blanking rather than wait until a container might fix it
up.  If it is already in a [possibly nested] container, update that
container's weight too along with any outer ones.

This also changes the base weight of novel from 0 to 10, so it still
gets magically heavier when turned into a spellbook of blank paper.
(The alternative seems to be to destroy it instead.)

The Book of the Dead weighed only 20 units which seemed odd to be so
much less than a spellbook.  This changes that to 50 to match those.
2023-12-03 18:03:16 -08:00
nhmall
3230babae0 uhandedness follow-up
avoid (wielded in right hands)
2023-12-03 20:27:01 -05:00
Alex Smith
495a1a9b07 Tweak to Wizard spellbook knowledge
Wizards now start out recognising all level 1 spellbooks, making
it possible to write a low-level spellbook in order to start
training a spell skill of choice.
2023-12-03 16:16:19 +00:00
nhmall
713eafc8c8 reduce flashing w/options simple menu iterations 2023-12-03 01:15:04 -05:00
nhmall
7d22a2c7b9 uhandedness follow-up
boomerang trajectory
bones
2023-12-02 20:25:37 -05:00
Alex Smith
fe2d8faed9 Fix for use-after-free in supply chest generation 2023-12-03 00:50:28 +00:00
PatR
6c38bfeba2 fix #K4042 - visible but unreachable teleport trap
If a monster fled from the hero by intentionally jumping into a vault
teleporter located in a niche which was still hidden and the hero
saw it happen, the trap would be mapped but the niche would remain as
a secret corridor spot.  The hero couldn't move onto the trap until
searching or wall kicking or other map disclosing activity converted
the spot into regular corridor.

Trap doors in hidden niches did already change the secret corridor
into normal corridor to unhide the trap's spot, but only if the hero
saw it happen.  Now the terrain change occurs even if hero doesn't
see it; only mapping the trap depends on that.

While testing the fix, I noticed that a monster jumping onto a vault
teleporter was teleporting randomly rather than being sent to the
vault, unlike when triggering such a trap by accident.  The code has
changed for 3.7 but this bug was already present in earlier versions.
2023-12-02 15:05:45 -08:00
nhmall
0c03b9bea6 follow-up: Soundeffect does its own Deaf check
Simplify previous fix, as Soundeffect does its own Deaf checks,
so doesn't need to follow an if-test.
2023-12-02 14:40:18 -05:00
nhmall
e8ebad8db9 fix warnings when no soundlib is included in build
monmove.c: In function ‘postmov’:
monmove.c:1391:65: warning: suggest braces around empty body in an ‘if’ statement [-Wempty-body]
 1391 |                         Soundeffect(se_door_unlock_and_open, 50);
      |                                                                 ^
monmove.c:1410:55: warning: suggest braces around empty body in an ‘if’ statement [-Wempty-body]
 1410 |                         Soundeffect(se_door_open, 100);
      |                                                       ^
monmove.c:1435:60: warning: suggest braces around empty body in an ‘if’ statement [-Wempty-body]
 1435 |                         Soundeffect(se_door_crash_open, 50);
2023-12-02 14:33:47 -05:00
nhmall
e4e8eea4e8 track the handedness of the hero
Don't make either LEFT_HANDED or RIGHT_HANDED be an advantage
or a disadvantage.

use suggested macros
2023-12-02 11:23:43 -05:00
nhmall
8ee8d89814 optlist.h
Currently, options.c is the only file that #includes "optlist.h".

In theory, if a source file did want to include optlist.h (perhaps
for the struct allopt_t declaration so they could deal with a
pointer to such a struct), they wouldn't be able to include it
because of a static function prototype that it contains.

Add some protection to only include that static function
prototype when optlist.h is included from options.c.
2023-12-02 11:09:41 -05:00
Alex Smith
4a00b66b30 TDTTOE: oil has a higher boiling point and flashpoint than water
As such, it shouldn't be affected by the heat of the ground in
Gehennom (which is hot enough to boil but not to burn). The oil
still heats but won't break its bottle.
2023-12-02 14:25:09 +00:00
Alex Smith
6acf5a7784 Potions are often destroyed when dropped onto very hot ground
In Gehennom and on the Plane of Fire, the ground is hot enough to
boil potions (although not hot enough to, e.g., burn scrolls).
The potions sometimes survive this (almost always if it's your
potion, it's blessed, and you have maxed Luck), but often don't.

In addition to making a lot of flavour sense, this serves a
gameplay purpose in that it reduces the number of potions that
are deathdropped by monsters in the late game. In Gehennom,
monsters often generate with potions to use defensively, but then
get killed before they have a chance to use them: this produces a
surfeit of potions that players tend to convert into holy water or
potions of full healing (and in general it doesn't make much sense
that the basic potion of healing primarily generates in Gehennom).
This commit approximately halves the number of useful potion
deathdrops, whilst still allowing monsters access to their
potions; when the monster dies, it drops the potion and this has a
chance of destroying it.
2023-12-02 08:18:01 +00:00
Alex Smith
39a7dc1c52 Most monsters no longer deathdrop comestibles other than their corpse
Playtesting has shown that there is too much permafood in the game
at present: in the late-game the only food-related problem is how
much to carry in order to avoid burdening yourself. In the early
game, food could previously have been a problem prior to
Minetown/Sokoban (thus the recent commit to add a guaranteed ration
in the upper dungeons), but past that point, there is easily enough
food generated on the ground. Additionally, the recent commits to
make healing sources more available in the early game reduce the
amount of time that needs to be spent waiting to heal, thus
further reducing food requirements.

The main purposes of food as a mechanic are to given an incentive
to press onwards and to discourage grinding. However, if monsters
are deathdropping non-corpse permafood, then beyond the very
early game, grinding actually generates more food than it uses up,
so the nutrition mechanic doesn't do its job properly.

Playtesting (including a full ascension!) has shown that there is
still plenty of food available even without deathdrops available
(my test game had 8 spare non-deathdrop food rations upon reaching
the Castle, at which point nutrition is no longer an issue due to
the Castle food stores and the huge numbers of C- and K-rations
dropped by the soldiers). I will address the potential problems
this causes for vegetarian Monks in a future commit.
2023-12-02 08:18:01 +00:00
Alex Smith
e8ca614e5c Reduce yields for multi-step alchemy recipes
With potions of healing becoming much more common, the multi-step
alchemy recipe from potion of healing to potion of extra healing to
potion of full healing is likely to become even more overpowered
(and it was somewhat unbalancing even beforehand).

This change restricts alchemy involving diluted dipped potions to
alchemize only two potions at a time. This means that potions of
healing can stil be alchemized into potions of extra healing as
efficiently as before this commit, and so can potions of extra
healing into potions of full healing; but the multi-step recipe
is now limited by requiring a lot of potions of gain level or gain
energy. As such, this is intended to make potions of healing into
an item primarily useful in the early game, and discourage hoarding
them for the late game.
2023-12-02 08:18:01 +00:00
Alex Smith
ae3e5d281f Add bonus items to some early-game Dungeons levels
These are primarily in chests (apart from one guaranteed good food
item on the Mines branch level), and are quite likely to be potions
of healing, although other items that are useful for early-game
survivability are also possibilities.

This is part of a series of commits that aim to make the early game
less about waiting to heal up and more about pressing forwards. In
particular, this means that characters need likely access to
healing sources other than waiting/backtracking/hiding in closets.
In a future commit, I plan to make permafood generate primarily
through exploration (rather than drops from monsters) in order to
deter waiting around or grinding; the early guaranteed food drop is
present to give the more nutrition-intensive characters (e.g. orc
wizard or vegetarian Monk) a fair chance to reach the more abundant
food sources in Minetown or Sokoban.
2023-12-02 08:18:01 +00:00
PatR
ea57b9d8ca bones fix - clear monst->seen_resistance
When saving bones, forget observations of current hero's resistances
because they'll be stale when the bones are used in a future game.
2023-12-01 23:05:11 -08:00
PatR
a0008f7376 --windowtype:foo on command line
There's no need to process windowtype a second time after options
parsing.  The sequence set windowtype, process options, set
windowtype again was intended to deal with the options setting it
to some other value, but there's a flag available to disable that
from happening.
2023-12-01 22:58:53 -08:00
Alex Smith
9d910773d0 Make starting inventory magic markers more likely, but fewer charges
In particular, Wizards now get a magic marker guaranteed (but with
fewer charges than magic markers naturally generate with). This is
intended to improve the game in two ways: it reduces the incentive
for startscumming, and it gives Wizards a method to gain an
additional low-level spell early if they wish (but the marker does
not have enough charges to get higher-level spells quickly using
this method).
2023-12-02 03:59:29 +00:00
Alex Smith
319dfbdaa3 Wizards learn about spellbooks as they enhance their spell skills
Previously, Wizards got a boost to the chance of writing unknown
spellbooks based purely on being a Wizard (with the chance still
luck-based), leading to a very large power spike when the Wizard
gained access to a luckstone and the ability to max out luck.
This had two main issues: this power spike came *after* the major
early-game difficulty spike, often leaving Wizards forced to deal
with it without having appropriate spells; and it promotes
grinding (for Luck and for Magicbane) at an early point in the
game, meaning that the Wizard early game effectively followed a
sequence of extreme difficulty -> grinding -> minimal difficulty,
which isn't very good balance-wise.

With this commit, Wizards lose their advantage to writing unknown
spellbooks by guessing, and instead learn spellbook IDs based on
their spell skills (advancing a skill gives knowledge of higher-
level spellbooks). This means that writing unknown spellbooks
becomes guaranteed with sufficient skill, but has no advantage
over non-Wizards in schools where the Wixard does not have
sufficient skill.

Due to Wizards' skill caps, there are two spells which they can't
ever write guaranteed: create familiar and charm monster. Create
familiar is a fairly niche spell (that doesn't match the Wizard
playstyle that well) and being unable to write it is not a major
problem. The inability to easily write charm monster is
intentional.
2023-12-02 03:46:55 +00:00
Pasi Kallinen
a30a205c45 Fix sanity error with migrating monster 2023-12-01 22:15:10 +02:00
Pasi Kallinen
e6ea551150 Fix segfault when trying to create tame lights 2023-12-01 22:13:46 +02:00
PatR
eb212c1676 refine PR #1139 - m_move() and postmov()
Remove a stale comment and update one or two others.
Remove several trailing spaces.
Change the data type of a couple of variables from schar to int and a
couple others from int to coordxy.
Redo a nested 'if' sequence to un-nest; results in a bloated diff due
to reducing indentation for a big chunk of code.
Change monster movement to use u_on_newpos() when swallowed hero's
location moves along with engulfer so that a clipped map will be kept
up to date.
2023-12-01 04:53:20 -08:00
PatR
f3bcec6c53 generic objects bit
u_on_newpos() bit:  player can't see the map while swallowed so hero
can't see objects on the map, hence shouldn't gain more info about
any generic objects if engulfer moves closer to some.

At the moment engulfer movement is manipulating <u.ux,u.uy> directly
rather than going through u_on_newpos(), but that's about to change.
Otherwise a clipped map doesn't get updated properly until the hero
is eventually expelled.
2023-12-01 04:52:21 -08:00
SHIRAKATA Kentaro
fffb1d53ff split 'postmov' of m_move() into separate function 2023-12-01 03:37:47 -08:00
Michael Meyer
03801773a8 Allow #dipping bare hands from pickinv menu
This wasn't being provided as an option because apparently all actions
which allow hands needed to be explicitly added to the list in getobj().
Add a fallback default 'hands' entry for any action which permits hands,
which both allows #dipping your hands and means that future additions of
hands as a target to other actions will work with OPTIONS=force_invmenu
without needing to remember this.

I made it so that hands will only be presented in the pickinv menu if
they are actually one of the suggested/likely items, which was a little
tricky because pickinv was only looking at actual inventory to determine
whether some items were excluded and the "show everything" option should
be presented.  I had to add a parameter to inform it that hands are
allowed so it would know to display that option if they were allowed but
no 'hands' entry was passed in xtra_choice.  Not sure if there was a
better way to let it figure that out...
2023-11-30 18:36:09 -08:00
Michael Meyer
abafc849e9 Rust gauntlets when washing hands even if Glib
Make it so that washing your gloved hands in a fountain, pool, or sink
can still rust your gauntlets even if it successfully removes the grease
from your fingers.  There wasn't much logic behind the two effects being
mutually exclusive, since the oily fingers of the Glib effect don't
normally protect against water damage like the item being 'greased'
does, and this introduces a possible tradeoff that could make whether or
not to clear Glib by washing your hands a more interesting tactical
decision.
2023-11-30 18:36:08 -08:00
Michael Meyer
fe8710532e Fix: latent bug with finish_meating on catchup
Some players of 3.6 recently noticed that sometimes, mimics in shops
seemed to have moved around even before the player had entered the shop
or done anything to uncloak them.  I found that this was because
finish_meating was being called for all non-eating monsters when
restoring a level (monsters that weren't eating anything would have
meating == 0 so always pass the 'imv > meating' check).  This would
uncloak mimics -- but not all the time, because the 'mappearance != 0'
test meant mimics disguised as strange objects weren't uncloaked.  I
think that was meant to be an additional check to confirm the monster
really did have a disguise, but in reality it meant that M_AP_OBJECT
"strange object", M_AP_MONSTER "giant ant", etc disguises wouldn't be
removed by finish_meating.

As it turns out, this was mostly fixed by coincidence in 221e4a7, which
fixed the "exclude actual mimics" check in finish_meating.  So at this
point in 3.7 it's largely a latent bug, but it still had the potential
to improperly uncloak non-mimics who can disguise themselves (like the
Wizard of Yendor, maybe?), and could cause other problems if
finish_meating were updated to have additional effects, or if some
monster types were made to disguise themselves as a strange object when
eating a mimic.
2023-11-30 18:05:34 -08:00
PatR
97238fc01a github issue #1157 - wand of striking
Issue reported by elunna:  hero witnessing a wand of striking being
zapped by a monster didn't have that type of wand become discovered.
Monsters observing hero resisting--or failing to resist--the effect
on hero didn't learn about target's current resistance capability.

Barely tested.

Fixes #1157
2023-11-30 16:37:07 -08:00
nhmall
14bdbc8a04 Merge branch 'do-play-instrument' of https://github.com/argrath/NetHack into NetHack-3.7 2023-11-30 13:50:28 -05:00
nhmall
a6772da65d pull request 1156 follow-up bit 2023-11-30 12:19:16 -05:00
nhmall
182d7d27b8 Merge branch 'fix-mkobj' of https://github.com/argrath/NetHack into NetHack-3.7 2023-11-30 12:16:46 -05:00
SHIRAKATA Kentaro
3ab0d92ac9 remove unnecessary condition on save_mtraits()
`mtmp->data` here is always non-null, otherwise it leads segv at earlier code.
2023-12-01 02:05:38 +09:00
nhmall
d7fef5f194 avoid another magic number
Some of the hardcoded +1 scattered about are likely
invlet_gold or invlet_overflow, but I didn't hunt those down.
2023-11-30 11:15:32 -05:00
PatR
9847fcb5b1 improve the menu for setting pickup_types option
For
|Autopickup what?
| a - amulets
 ...
| A - all classes
prevent invert all and set all from setting the 'A - all classes'
entry.  For invert, toggling it is wrong.  For set, suppressing it
from being set is academic since all other entries get set.

Simplify the notes about what happens when no classes are selected,
and when autopickup is On about how to not autopickup anything at all.
Add one when it's Off, about how to make the chosen classes matter.
2023-11-29 21:37:40 -08:00
Michael Meyer
4e008bb52f Reword feedback for repeated confuse monster use
I didn't like "your hands begin to glow red even more" very much (the
hero's hands aren't really 'beginning' to glow if they already have an
active confuse monster effect, and "glow red even more" was an awkward
turn of phrase on top of that).  Rephrase it to "The red glow of your
hands intensifies."
2023-11-29 12:11:43 -08:00
Michael Meyer
392f300fa6 Blame hero for broken digging wand shop damage 2023-11-29 11:36:57 -08:00
Michael Meyer
e49c488f18 Streamline digactualhole messaging
Merge some nearly-duplicate code for the two trap types.  Also include
alignment name when referring to an altar's destruction, since it
provides some context for the immediate follow-up by its god.
2023-11-29 11:36:57 -08:00
Michael Meyer
0473fff5b5 Make destruction of altar incite its god's wrath
This is for completely destroying an altar with extra-powerful magical
digging -- the normal altar_wrath() punishment didn't seem sufficient
for such an outrage to me, so skip straight to slinging the lightning
bolts.  Destroying an altar is unlikely to happen by accident (though
it's possible with poorly timed usage of a drum of earthquake).
2023-11-29 11:36:56 -08:00
Michael Meyer
5cbc16a3bd Improve digging vs furniture messaging
When a wand of digging explosion overwrites furniture, describe it
appropriately.  "A pit appears in the altar" doesn't sound right.
2023-11-29 11:36:56 -08:00
Michael Meyer
06ef415c4f Remove unneeded furniture vs earthquake hack
This is no longer needed after ab37888b36.
2023-11-29 11:36:55 -08:00
SHIRAKATA Kentaro
5f6535728d remove unnecessary condition on use_offensive()
`otmp` here is always non-null, otherwise it leads segv at earlier code.
2023-11-29 11:27:20 -08:00
PatR
585e6373b5 drop_uswapwep()
drop_uswapwep() avoided calling makeplural() in a pline which also
had a call to Yobjname2(), with a comment about the possibility of
clobbering its static return buffer.  uswapwep might be a stack that
results in Yobjname2 indirectly calling makeplural to produce a
plural description.  But makeplural() has used xname's pool of obufs
since before uswapwep became a thing, so the code was evidently
cloned from some other out of date usage.

I was going to just move the makeplural() call into pline() but it
dawned on me that uswapwep must be one handed, so don't pluralize
hands at all.  And since uswapwep might have the same description as
uwep, explicitly mention "left hand" to distinguish.
2023-11-29 11:23:25 -08:00