Commit Graph

10060 Commits

Author SHA1 Message Date
PatR
74981d9ff2 wand of secret door detection discovery
Since wand of secret door detection now gives feedback even when it
fails to find anything, always discover it.

Some of the other zapnodir() wands had suspect discoveries.
2024-09-05 01:54:17 -07:00
PatR
cd19f84721 boulder pushing comment
Replace wondering whether something is possible with a description of
how it can happen.
2024-09-05 01:14:20 -07:00
PatR
6da05e1508 kicking door as a giant
Another byproduct of testing boulder pushing.  If you kick a closed
door while polymorphed into a giant, always succeed in breaking the
door instead of maybe getting the Wham! or Thwack! failure result.
2024-09-04 13:34:21 -07:00
PatR
447da0948f shopkeeper vs boulder
Noticed when testing boulder pushing into/out of shops yesterday:
a shopkeeper can "mutter incantations" and fracture a boulder in the
shop, transforming it to rocks.  If hero owed shk for the boulder
(happens when it has been further inside the shop and then gets pushed
to the shop's free spot), it would disappear from the shop's bill and
hero would then owe for the resulting rocks (which cost more than the
boulder!).  That seemed confusing, especially since neither Iu nor Ix
would show the rocks (which are on the floor rather than in invent;
the $ command reported the amount owed, but not what the item was).

When such fracturing happens move the boulder from the unpaid section
of the shop bill to the used-up section before creating the rocks,
which are no longer interesting.
2024-09-04 13:22:14 -07:00
PatR
bd10bf36ec address #K4246 - pushing shop boulder out of shop
The report is for 3.6.7:  pushing a boulder into a general store adds
it to shop's inventory, but pushing it back out lets player remove it
for free.  3.7 has already fixed this; update its comments though.
2024-09-04 03:00:57 -07:00
SHIRAKATA Kentaro
7bb1d4a827 unify moverock() to "early return" style
... to prepare further refactorings.
2024-09-03 23:46:21 -07:00
PatR
ceec9fda44 fix github issue #1278 - spellbook discovery
Issue reported by ars3niy:  having a pauper wizard #enhance bare-handed
fighting to basic caused the hero to learn all level 1 spellbooks.

Spellbook discovery for wizards when advancing skills is intentional,
to replace the old Luck-based chance of writing unknown books with
magic markers.  (The Luck bias for wizards still applies for scrolls.)

Discovering spellbooks when advancing non-spell skills does feel wrong.
Change it to only happen when advancing spell skills.

This isn't pauper-specific, it's just a lot more noticeable in that
state.

There may be better ways to cope with this, but for the time being I'm
marking the issue 'fixed'.

Fixes #1278
2024-09-03 00:05:29 -07:00
Doktor L
52346c8248 Add swallow and explosion glyphs to glyph_to_cmap
This makes custom S_sw_tc etc. from Enhanced1 symset actually work,
yielding nice smooth outlines for swallowers and explosions. Or so I
think, I have only tested the former because when playing locally,
explosions disappear so fast I cannot see them.

While looking at where else glyph_to_swallow was used, I noticed that
parse_id subtracted S_sw_tl from glyph_to_swallow, even though it
returns 0 to 7. This looks like it would cause out-of-bounds access and
perhaps a segfault when trying to customise glyphs for individual
monster swallow glyphs (or whatever it is parse_id is used for), but
I haven't tried to confirm nor change this because who would ever do
such thing?
2024-09-02 01:04:31 +02:00
Doktor L
ede71dd1ac Convert glyph_to_cmap from macro to function
Even if nethack is meant to support compilers that do not know about
inline functions, this one was frankly too long to be a macro already,
and I'm about to make it longer still.
2024-09-02 00:39:00 +02:00
PatR
96787441e9 pauper tweaks
For 'pauper', most roles start without any skills.  However, strong
fighter types were starting with basic bare-handed combat/marital arts,
giving them a big advantage.  Knights were starting with basic riding,
which is probably useless now that they have to acquire a saddle to
use it (see below).  Take those initial skills away, producing an even
playing field.

Non-paupers get their initial skills without needing to spend any skill
credits (aka slots) on those.  Give paupers 2 starting credits that
they'll be able to use once they acquire suitable weapons or spells
and train them up, so that once they're reasonably developed they won't
lag in skills compared to non-paupers.

Pauper knights were still starting with a saddled pony.  Suppress the
saddle when the knight is a pauper.

Wizards start knowing a lot of spellbooks.  Pauper wizards shouldn't.

Give most roles advance knowledge of one low level spell or other item.
It won't benefit them unless/until they find the corresponding item.
2024-09-01 15:11:28 -07:00
PatR
4415fc2154 revise a couple of recently added comments 2024-08-31 20:30:04 -07:00
PatR
0ce2439e82 github issue #1275: curses init vs pauper
Reported by ars3niy, the curses interface could behave strangely on
the first turn if the 'pauper' option/conduct was specified.

There isn't any definitive flag indicating whether or not the game
has started.  Since 'moves' has traditionally been initialized to 1
rather than to 0, there were several instances of
|  if (moves <= 1 && invent != NULL)
being used to determine the starting state on the assumption that
once hero has inventory, the game has begun.  Introduction of the
'pauper' option made the test for non-Null invent become unreliable.
For paupers, the program would behave as if the game hadn't started
yet until the player finally made a time-consuming move.

This changes compile-time initialization of 'moves' from 1 to 0,
then sets it to 1 when initial inventory would be bestowed (even
when 'pauper' inhibits that).  That's probably not the best place
for it, but testing for 'moves==0' now should produce an identical
effect as 'moves<=1 && invent!=NULL' used to accomplish.

It would have been much simpler just to give paupers 1 gold piece,
or perhaps one rock, in place of usual starting gear so that their
initial inventory wouldn't be empty, but the moves+invent way of
checking for start-of-play has always bothered me.

Should 'pauper' be preventing 'nethack -X' from giving its starting
wand of wishing?  Conducts and explore mode don't really overlap so
maybe it doesn't matter.

Fixes #1275
2024-08-31 14:08:04 -07:00
klorpa
02c4147893 Typos 2024-08-31 15:28:42 -05:00
PatR
1fd943e860 trap/secret door detection enhancement
The old secret door detection just redisplayed locations with
discoveries (secret doors and traps, mostly).  Somewhere along the
line it was augmented to find hidden monsters and to deliver one or
two messages reporting how many things had been discovered.  Now it
has been augmented again, to find trapped doors and chests, and to
supply a message when the detection attempt fails to find anything.

More substantially, it highlights the relevant locations as they're
found, before the feedback message(s).

Initially I was using tmp_at() to mark all significant locations,
but that required --More-- and for player to acknowledge it when
detection was done.  That would probably be ok for wand of secret
door detection and spell of detect unseen, but it would be a hassle
for ^E.  It's been revised to use flash_glyph_at() [previously only
used when ^G creates unseen monsters, I think].

The new behavior seems to be working reasonably well.  For curses,
the 'timed_delay' option must be set.  flash_glyph_at() calls
flush_screen() between its output and nap in each cycle of multiple
flashes, but that evidently isn't sufficient for curses.  Maybe
curses init should just force on 'timed_delay'.

I've left the tmp_at() stuff in.  We might want to modify things to
use it instead of flash_glyph_at() when the accessibility flag is
set.  Its current compile-time selection won't be adequate though.
2024-08-29 14:08:23 -07:00
nhmall
0dff31a745 suppress display.c warning introduced by 4fb7dd2c
src/display.c(997): warning C4127: conditional expression is constant
2024-08-29 14:04:40 -04:00
Pasi Kallinen
e645c0b4bb Allow starting game as pauper, without any inventory
And also without spells, skills, or preidentified items.
This also implies nudist.

Breaks saves and bones.
2024-08-29 20:51:13 +03:00
PatR
1595b682cf do_clear_area() vs map column 0
do_clear_area() runs a callback over each point in a square around
a center point.  When executed near the edge of the map, it clips
the square to avoid going over that edge.  But on the left side,
it was clipping to column 0 rather than 1, so running the callback
routine on column 0 even though that isn't part of the level.  This
bug doesn't seem to have caused any problems though.
2024-08-29 07:02:40 -07:00
PatR
8085d03898 some miscellaneous formatting and comments
Clear out some miscellaneous changes that have been sitting around
for a while.
2024-08-27 13:59:57 -07:00
PatR
0ce02a7224 old comment thinko 2024-08-27 12:54:00 -07:00
PatR
9b79e0be8d fix the 'fix obscure secret corridor bug' commit
The fix to prevent finding secert corridors via secret door detection
from forgetting objects broke magic mapping.
2024-08-26 21:27:54 -07:00
PatR
a5700805c6 fix obscure secret corridor bug
magic_map_background() would overwrite remembered objects and traps.
That meant discovery of secret corridors by secret door detection
or ^E would forget embedded objects at their locations.
2024-08-26 14:37:46 -07:00
PatR
83b85d4be9 add a FIXME comment to secret door detection
^E and wand of secret door detection used to just update the map
without any other feedback, but were changed post-3.6 to issue a
message about what things are being discovered.  But the message is
misleading if [some of] the things revealed are obscured by objects
or by monsters.  Presumeably by regions too.
2024-08-25 13:11:05 -07:00
PatR
9365789b6d revise #wizbury feedback
Simplify the code added in April.
2024-08-25 12:15:17 -07:00
PatR
a298052095 fix a FIXME for 'm #vanquished'
If player uses the 'm' prefix before the #vanquished command when
the vanquished monsters list has fewer than two types so far,
select the preferred sort for #vanquished even though it won't be
applicable yet.

Also, when prompting about vanquished monsters during end of game
disclosure, where an 'a' response is given special meaning, use
"[ynq]" instead of "[ynaq]" if there is only one type of monster
vanquished.  It's skipped altogether when the list has zero types
and there's no point in picking sort order when there is just one
type.  The player can still answer with 'a' when [ynq] doesn't show
that (for tty and curses at least, probably X11); 'a' will end up
behaving as 'y' in that case.
2024-08-24 19:04:41 -07:00
PatR
0afa5bd564 Riders when sorting vanquished monsters by class
Explicitly sort and label Riders before major demons when displaying
vanquished monsters with sort-by-class.  They're lumped in with '&'
but they aren't really demons.
2024-08-23 22:01:08 -07:00
PatR
65b5f2cff1 farlook & probing feedback for monsters in regions
When looking at a monster that's inside a gas cloud, include that
fact in the output for farlook and for probing.  When the monster
being examined is sensed rather than seen, you'll sense the presense
of the cloud as well as the monster even if the cloud can't be seen.

Do likewise for self when using look-here (':').  Bonus fix: zapping
wand of probing at self while engulfed reported that you were just
held by the engulfer.

Also fix an old comment typo/thinko.
2024-08-19 13:10:28 -07:00
PatR
9d1234b87d gas cloud dissipation
If hero was in a cloud spot when it expired, the feedback would be
|The gas cloud around you dissipates.
|You see a gas cloud dissipate.
2024-08-19 11:59:00 -07:00
PatR
f8c399bf50 \#timeout for regions
Support tab separation for the region portion of #timeout output.

This works ok under Qt.  However, the output from #timeout uses a
fixed-width font so tab separation isn't necessary.

No idea how well it will work for mswin.
2024-08-19 10:06:29 -07:00
PatR
158e3b12dc comment thinko
Some_Monnam() returns "Someone" or "Something", not "Someone" or "It".

Removing the redundant '&& uchain != NULL' test shouldn't produce any
change in behavior.
2024-08-18 11:29:04 -07:00
PatR
9bc6e1bee1 speed monster vs peacefuls
Testing the shopkeeper speed change, I noticed that zapping the shk
with speed monster made her angry.  Since being hasted is beneficial
for the target, don't become angry.
2024-08-17 19:07:44 -07:00
SHIRAKATA Kentaro
01910d2998 split "moverock_done" into a separate function 2024-08-17 18:13:35 -07:00
SHIRAKATA Kentaro
39665ba017 split "getcad" into a separate function 2024-08-17 18:07:51 -07:00
SHIRAKATA Kentaro
94eef3c3db split "poof" in potion_dip() into a separate function 2024-08-17 18:02:03 -07:00
PatR
23532b012b farlook of "`"
Allow farlook/quicklook to step through all engravings--corridor
ones as well as room ones--with repeated '`' when picking location
with getpos(), similar to how repeated '^' goes through all traps
no matter what display character they use.

It isn't possible to look at corridor engravings by using their
default symbol '#'.  It is possible by using 'a' for "anything of
interest" but that matches lots of other stuff.

This tries to add an NHDT tags line to sym.h.  That was followed by
'git nhadd' which did stage it for commit, but date/branch/revision
tag expansion isn't working.  I did something similar to defsym.h
about 5 weeks ago; that one worked and I don't recall having needed
to do anything special.
2024-08-17 11:19:45 -07:00
PatR
45690624e5 fix pyrolisk egg panic when eating from floor
From a change made about two and half months ago:  eating a pyrolisk
egg tried to use it up from inventory even when it was on the floor.
That would trigger an object lost panic.
2024-08-17 11:02:28 -07:00
PatR
d441d6159b zillionth+1 and +2 comment typo fixes 2024-08-16 22:18:46 -07:00
PatR
5617f32eb4 region bit
When hero was swallowed and a temporary region at swallower's spot
expired, hero was told "the gas cloud around you dissipates".  This
just suppresses the message rather than changing it into "the gas
cloud around <engulfer> dissipates".
2024-08-16 12:26:17 -07:00
PatR
4fb7dd2cd0 more monster display vs gas clouds
Various bits tried while flailing about with map display of monsters
in visible regions.  The newsym()/mon_overrides_region() part is
definitely an improvement because the logic about whether to show a
monster in a region or just the region wasn't easy to comprehend and
was even harder to extend.

I'm not sure whether the _map_location() part is necessary.
2024-08-16 11:59:38 -07:00
PatR
061f564928 monster display vs gas cloud regions
This fixes the bug where a monster displayed instead of a gas cloud
because the hero was next to it didn't revert to gas cloud when hero
moved and was no longer next to the monster.
2024-08-16 11:40:12 -07:00
PatR
c63b493904 tweak paranoid_confirm:trap vs regions
It is possible to have a known trap be at the same location as a gas
cloud region.  When paranoid_confirm:trap is set, ask for confirmation
about entering the region before confirmation about entering the trap
since the map will be showing the region rather than the trap.

Dual confirmations will be annoying but not new.  Before this change,
it would ask about entering the trap, and if the answer was yes, it
would ask about entering the region.  The situation seems to be too
rare to warrant implementing a single combined confirmation, and the
code to accomplish that would likely be messy.
2024-08-13 13:53:41 -07:00
PatR
fd57c9ca83 wizard mode #timeout command vs gas regions
Show visible regions among the other timed events.  Turn number is
relative rather than absolute.  Location is the internal bounding box
which tends to cover more area than just the gas cloud spots.

When multiple regions are present (common on Plane of Fire), they're
listed in arbitrary order.  It would be better to order them by
timeout or by location or both, but the extra effort to do that seems
unjustified.
2024-08-13 13:28:24 -07:00
PatR
0eb8896301 paranoid_confirm:Trap vs vapor+gas cloud regions
Extend paranoid_confirm:trap to also ask for confirmation when
attempting to enter a gas cloud region (scroll of stinking cloud,
breath from green dragons or iron golems, steam clouds from boiling
water, vapor left by fog cloud movement, no doubt several others).

Like with traps, can be overridden for a given move by using the
'm' prefix.  Unlike traps, doesn't try to guess whether moving into
a region will be harmless.

Doesn't affect movement into cloud terrain (Plane of Air).

Update the Guidebook to describe the revised behavior of
paranoid_confirm:trap and to mention how #terrain deals with regions.

'any_visible_region()' got mixed in with this but isn't used yet.
Affects extern.h and region.c.
2024-08-11 14:59:57 -07:00
PatR
3ed2110757 monsters in regions vs #terrain
While trying to track down a display problem with regions
    [when a monster is shown over a region because the hero is
    adjacent, it doesn't revert to the region's cloud glyph when
    hero moves farther away; that's not resolved yet],
I discovered a different display problem for the same thing.  If
you pick a #terrain choice that keeps traps it is supposed to show
region spots too, but that didn't work when there was a monster at
the same spot.  It removed the monster but showed background there.
2024-08-10 16:24:51 -07:00
PatR
9e4237f6f7 couple of weapon.c bits
Some trivial stuff I've had sitting around for a while.
2024-08-10 12:38:56 -07:00
PatR
e550436755 shapechanger crash fix
A recent change was setting mon->data prior to canspotmon(mon) but
that triggered a crash if the temporary mon->data was Null.  All the
testing was done with vampshifers and this affects non-vampshifers.

Push even more shapechange messaging into newcham() by not trying to
determine whether requesting a message from it will oblige.
2024-07-30 11:52:34 -07:00
PatR
2d68ee8f9f fix #K4210 - vampshifter fog clouds
Messaging for vampires changing into fog clouds was inconsistent
in 3.6.x but already fixed in to-be-3.7.

However, maintaining an extra set of shape change messages (one
in newcham(), the other in vamp_shift() which turns out to only be
used when a vampshifter turns into a fog cloud in order to pass
under a closed door) was a nuisance.  Redo vamp_shift() to use
newcham() feedback.  Update that feedback to be accessibility-aware
and also to use "Your <mon>" instead of "The <mon>" when appropriate.

While in there, remove a couple of trailing spaces and eliminate
use of one dynamically constructed format string that necessitated
warning manipulation.
2024-07-27 14:49:17 -07:00
PatR
5adabc07a3 missing comment: YMonnam() variant of x_monnam()
YMonnam() was added three weeks ago but the comment preceding
x_monnam() didn't get updated to list it.
2024-07-26 14:53:33 -07:00
PatR
d963c6dd6f github issue #1263 - lich attacks
Issue reported by loggersviii:  monsters killed by liches can
produce corpses which auto-revive as zombies, but liches aren't
able to harm zombies and get stuck in an endless slap fight when
those revive.

Liches have a touch attack for cold damage and they have a spell
casting attack.  They don't use their spell attack in monster vs
monster combat, so cold resistant foes don't receive any damage.
Prevent them from becoming harmless by changing the cold damage to
physical damage if the target resists cold.

Fixes #1263
2024-07-24 11:01:23 -07:00
nhmall
faca234055 follow-up for dig_check changes
Use the is_hole() macro to cover off holes and trapdoors.
2024-07-23 16:22:30 -04:00
PatR
b08fb9fb93 github issue #1262 - #terrain vs gas regions
Issue reported by elunna:  none of the display choices for #terrain
offered a way to show the terrain beneath temporary gas/cloud
regions (except "full map" in wizard mode or explore mode).  That
prevented the command from being used to find stairs and portals
which had been mapped before becoming covered up.

Adding extra menu choices to deal with visible regions would result
in #terrain becoming a mess.  Instead, treat regions as if they were
traps.  Picking a choice that includes traps will show region spots
which are in view as cloud or poison cloud, picking one that excludes
traps will show the underlying terrain.  Region spots which aren't
within view are handled the same as before:  whatever the hero
remembers at their location gets displayed.

The default menu choice excludes traps so will display stairs that are
covered by gas cloud regions, but not portals, same as when no regions
are present.  When showing traps and one is covered by a gas cloud,
the trap will be shown rather than the gas cloud, making it possible
to see known portals.

At the moment the new "#terrain handles regions like traps" feature
hasn't been documented anywhere.  That might get rectified someday.

I'm not sure whether trap detection ought to also detect regions now.
This doesn't attempt to tackle that and I think that I'll pretend
that the idea never occurred to me.

'parnoid_confirm:traps' definitely ought to prompt for confirmation
when entering a visible harmful region.  This doesn't add that.

Bonus fix:  it's possible for a visible region to cover up a not yet
explored location.  Searching next to such a spot wasn't changing the
spot to be marked as explored (unless hero was blind).  Now it will.

Fixes #1262
2024-07-23 10:40:28 -07:00