Michael Meyer [Tue, 26 Jul 2022 18:31:34 +0000 (14:31 -0400)]
Shopkeepers hold a grudge against past thieves
When you steal from a shop, its shopkeeper will remember you as a thief
and charge you higher prices in the future (as well as be more curt and
less polite in interactions with you, though not outright hostile) even
if you pacify them, or die on the level and revisit it later as a bones
file. This was an idea aosdict had, and I think it makes sense that a
shopkeeper doesn't forgive and forget, immediately returning to treating
you exactly like anyone else, just because you were terrorized into
paying her back. Paying a shopkeeper off may cause her to stop actively
attacking you, but it feels like she'd have her eye on you as a known
thief going forward (and maybe would hang up a sign with your picture,
saying something like "DO NOT ACCEPT CHECKS FROM THIS HERO").
This surchage already existed, but since it was tied to active anger
(which typically causes a shopkeeper to quickly abandon their shop to
follow you) it was somewhat rare to see it in action.
I did not implement it here, but one possible further tweak might be to
clear the surcharge if the shopkeeper is pacified via taming magic
(which more-or-less magically brainwashes the target to feel positively
towards the hero) but not if you simply pay your debts.
Michael Meyer [Thu, 28 Jul 2022 16:04:34 +0000 (12:04 -0400)]
Fix: lookaround trap detection
Whether a trap exists is independent on the underlying terrain type, so
putting a check for traps in a block structured like
| if (IS_ROCK(levl[x][y].typ) || levl[x][y].typ == ROOM)
| ; /* do nothing */
| else if (levl[x][y].typ == CORR)
| do_corridor();
| else if ((trap = t_at(x, y)))
| avoid_trap(trap);
would mean that the check for traps only happens on terrain other than
normal room and corridor spots. As a result, it wasn't being evaluated
in most places where traps might actually occur.
Move the test for traps outside of the terrain type evaluation if/else
series, so that it happens independent of terrain (and remove the
'continue' so it doesn't preclue evaluation of the terrain).
Once the rule actually started coming into play, it became clear the
avoid_moving_on_trap message was being printed in cases where the hero
didn't actually stop (i.e. shift-dir runmode, the "if you must" case),
so I also modified the value for that parameter so it will match the
situations where the hero stops running.
Michael Meyer [Thu, 28 Jul 2022 15:48:05 +0000 (11:48 -0400)]
Restore old behavior for running onto trap
The refactor of domove made it impossible to run onto a trap (or water,
if blind), even in the shift-dir mode where the hero is meant to stop
only upon "hitting a wall or running into something". I use this
runmode to sprint large distances across the map, and the change to this
behavior meant that it was no longer possible to press shift-dir again
to continue past the trap. This restores the old behavior of allowing
shift-dir running to carry you onto a trap (though the hero will still
stop before hitting a trap in less breakneck runmodes).
Michael Meyer [Fri, 29 Jul 2022 16:52:16 +0000 (12:52 -0400)]
Update lit corridor display if dark_room toggled
The dark_room option determines whether remembered but unseen waslit
corridor spaces are displayed with S_litcorr or not. When it is
disabled, a remembered permanently-lit corridor spot will be shown
as "lit corridor" when out of sight. When it is enabled,
corridors are only shown as lit if they are currently in view.
Toggling this option was not immediately refreshing how corridors on the
map were displayed: an unseen spot shown as a lit corridor because
dark_room was disabled would continue to be shown as a lit corridor
when it was toggled on, until the hero's memory was refreshed by
visiting the spot and then leaving.
Slightly extend the existing function for updating how room spaces are
displayed when dark_room is toggled so that it will update the glyph
used for unseen lit corridors in a similar way.
Michael Meyer [Fri, 29 Jul 2022 16:17:47 +0000 (12:17 -0400)]
Don't show corridors as lit in #terrain
Because back_to_glyph assumes the hero can directly see the spot, when
used for #terrain (e.g. when a spot was covered by a remembered object)
it would display corridors as lit if lit_corridor was enabled. Instead
of trying to suppress back_to_glyph's S_litcorr result only under
circumstances where it would be unusual, just show all corridor spots
with S_corr, so that none of them appear as "lit corridor". This
is consistent with what is already done for room spots for #terrain
(S_darkroom is forced to the basic S_room across the board).
copperwater [Mon, 8 Aug 2022 22:08:38 +0000 (18:08 -0400)]
Refer to non-damaging gas cloud as "steam"
You can create steam clouds that are gray and deal 0 damage when zapping
fire at or over water sources. If you happen to be in the cloud, it
produced the "You are enveloped in a cloud of noxious gas!" line, and
steam isn't noxious.
Other uses of "gas cloud" could have potentially been changed, but I
left them alone.
Michael Meyer [Wed, 10 Aug 2022 00:57:28 +0000 (20:57 -0400)]
Improve feedback for trying to bribe the watch
Members of the watch can never be bribed, no matter how much gold is
thrown at them, but when a bribe was attempted they would say "that's
not enough" (implying incorrectly some higher amount would be enough to
pacify them). Also, an already-peaceful mercenary would take on an
unusually aggressive tone when given any amount of gold, giving the
player the same message to "beat it" as when a bribe succeeds in
pacifying them.
Adjust the mercenary bribery code a bit so that a more friendly message
is given if the monster is already peaceful, and so that unbribeable
monsters don't imply they are just not being given enough gold. I think
the actual effects of bribery shouldn't be affected by this commit, just
the messages/feedback.
Michael Meyer [Wed, 10 Aug 2022 13:09:02 +0000 (09:09 -0400)]
Describe engulf attack by animal as "swallowing"
Suggested by aosdict: instead of describing all gulp attacks as
"engulfing you", say "The <monster> swallows you whole" for purple worms
(or any other animal engulfer) to visibly differentiate between
engulfing and swallowing.
Michael Meyer [Wed, 10 Aug 2022 13:02:57 +0000 (09:02 -0400)]
Fix: m-prefix looting a container
Using #loot with the 'm' prefix would claim there was nothing to loot
even if the hero was standing on a box, as long as there was no adjacent
monster. 'm' prefix is an explicit request to select a direction so
make it work regardless of whether a monster is there. Once I did that
I noticed that it was providing no feedback for using '.' or '>' as the
direction if no container was available, so adjust that to give the
"there is nothing here to loot" feedback.
Pasi Kallinen [Wed, 10 Aug 2022 07:53:43 +0000 (10:53 +0300)]
Migration-safe monster movement iteration
The monster knockback could mess with the monster linked list while
the code was going through it for monster movements. (For example,
a monster knocked back another into a level teleport trap)
Add iter_mons_safe, which first grabs all the monster pointers in
the list into an array, and goes over that array instead of relying
on the "next monster" pointer. This is possible because dead monsters
are not removed from the linked list until after all the monsters
have moved.
Testing is very minimal, and I'm not sure the vault guard check
for migration is correct - it should probably check for more states?
Also the iterator could be improved by not continually allocating
and freeing the monster pointer array.
PatR [Tue, 9 Aug 2022 23:22:50 +0000 (16:22 -0700)]
fix issue #836 - engulfing mounter hero
Reported by copperwater: if an engulfer swallowed a mounted hero,
odd things could happen if the hero dismounted. The steed would be
silently expelled and float-down flooreffects were attempted.
It turns out that if the engulfer is classified as an animal (so
purple worm, lurker above, trapper), the hero got "plucked from
<steed>'s saddle" and was forcibly dismounted prior to completing
the engulf operation, but non-animals (vortices, air elemental,
ocher jelly, Juiblex) swallowed the hero+steed intact. The most
straightforward fix to dismounting-while-engulfed issues is to change
engulfing to always pluck the hero from the saddle even when the
engulfer isn't an animal.
If there's no room on the level to place the former steed, it gets
killed off. I looked at changing that to put the steed into limbo,
waiting to migrate back to the current level if hero leaves and
subsequently returns, but that breaks movemon()'s assumption that
when monsters are in the process of moving, only the currently moving
one can be taken off the fmon list to be placed on migrating_mons.
[The recently added monster knockback code violates that assumption
too when knocking the victim into a level changer trap. It needs to
be fixed in one fashion or another.]
Pasi Kallinen [Mon, 8 Aug 2022 11:02:59 +0000 (14:02 +0300)]
Command repeating by using cmd queues
This replaces the old pushq/saveq arrays (which were used to save
the keys pressed by the user for repeating a previous command)
with a new command queue. This means there's no hard-coded limit
to the saved keys, and it can repeat extended commands which are
not bound to any key.
PatR [Sun, 7 Aug 2022 23:02:44 +0000 (16:02 -0700)]
fix #K3656 - chest in pit
Using #loot while in a pit allows looting containers in that pit.
Using open and specifying the hero's spot when not in a pit allows
looting containers at hero's spot. But using open while in a pit
complained about not being able to reach out of the pit before player
had a chance to give hero's spot at the place of interest, so did not
allow looting any container there.
Get a target spot before rejecting use of 'open' while in a pit.
The alternate prompt might be tty-centric.
Pasi Kallinen [Sun, 7 Aug 2022 19:31:41 +0000 (22:31 +0300)]
Minor ranged attack tweak
Make monsters with magic and gaze attacks avoid hero,
just like spitters and breathers already did.
Some small code cleanup related to the ranged attacks.
Michael Meyer [Thu, 4 Aug 2022 17:53:12 +0000 (13:53 -0400)]
Fix: command counts greater than 2
Entering a count to repeat an action stopped working for counts greater
than 2 after 93db2a8: the unconditional call to reset_cmd_vars at the
top of rhack was resetting many more variables than had previously been
cleared at that point, including g.multi (which in this context tracks
how many more times the requested action should be repeated). As a
result any count would perform the requested action twice at most.
Reduce the list of variables zeroed out at the start of rhack back to
what it was before 93db2a8.
Michael Meyer [Thu, 4 Aug 2022 17:34:06 +0000 (13:34 -0400)]
Fix: get_count and altmeta
M-<key> shortcuts with altmeta enabled weren't working when preceded by
a count (e.g. 2 M-j for "jump twice"): g.program_state.getting_a_command
determined whether <esc> should be read as staring a potential meta key
combination, and was being reset by readchar on the first digit entered
without being reactivated for subsequent input. As a result, by the
time the player entered the actual command to be modified by the count,
readchar wasn't bothering to look for M-<key> sequences.
Pasi Kallinen [Sat, 6 Aug 2022 05:28:36 +0000 (08:28 +0300)]
Make hitting with a wielded potion hit you far less
Hitting a monster with a wielded potion of paralysis or sleep
was practically useless, because it almost always also hit you.
Negate the chance and make it depend on your dex.
PatR [Fri, 5 Aug 2022 22:05:10 +0000 (15:05 -0700)]
more Wizard of Yendor
The earlier attempt to prevent the Wizard from immediately teleporting
(and giving a vanishes and reappears message before the player has had
a chance to see the level) when you arrive on the Plane of Earth ended
up being worse. He just stayed put, so no vanish and reappear but no
other activity either.
PatR [Fri, 5 Aug 2022 21:36:11 +0000 (14:36 -0700)]
discard migrating monsters when entering endgame
When the hero enters the planes branch, all the rest of the dungeon
gets discarded since it can no longer be reached. At the time that
that takes place, throw away any migrating monsters waiting to arrive
on any of those levels.
PatR [Fri, 5 Aug 2022 21:22:27 +0000 (14:22 -0700)]
Wizard of Yendor entering endgame
When entering the Plane of Earth (or level teleporting directly to
another endgame level in wizard mode), if the Wizard came off the
migrating_mons list instead being re-created from scratch, he would
be placed randomly on the level instead of next to the arrival point.
If his mstrategy field still had the STRAT_WAITFORU bit set and you
didn't move to where he could see you, he might never come after you,
at least until some future harassment event chose 'resurrect'.
Pasi Kallinen [Fri, 5 Aug 2022 07:27:43 +0000 (10:27 +0300)]
Experimental #saveoptions command
Add a #saveoptions extended command, to allow saving configuration
settings from within the game. This is still highly experimental,
and gives plenty of warnings before asking to overwrite the file.
Lack of option saving is one of the biggest complaints new players
have, so this should help with it. More experienced players with
highly customized config file should not use this feature, as it
completely rewrites the file, removing all comments and non-config
lines.
PatR [Thu, 4 Aug 2022 23:53:31 +0000 (16:53 -0700)]
'O' tweaks
Reformat most of optlist.h. In the process, fix a couple of
conditionally included items which were mis-classified as set_in_game
when excluded. Add "permablind" as an alias for the "blind" option.
[I don't understand the size value of 70 for #if BACKWARD_COMPAT
{curses,DEC,IBM,Mac}_graphics but didn't alter that.]
Include 'pickup_types' in the behavior section; it's useful from
turn 1 and does get adjusted from time to time during play.
Include 'color' in the map section, but hide it for wc_tiled_map.
Include 'showscore' and 'statuslines=2|3' in the status section.
I didn't rebuild with SCORE_ON_BOTL enabled so the showscore part
hasn't been tested.
PatR [Thu, 4 Aug 2022 21:09:19 +0000 (14:09 -0700)]
condition mask option's menu
Not related to changes to 'O' but noticed because of those. The menu
for selecting which status conditions to include on the status line
starts with a special entry for sorting that shouldn't be selected by
the select all and toggle all actions.
Pasi Kallinen [Wed, 3 Aug 2022 11:07:17 +0000 (14:07 +0300)]
User-friendly options menu
Make the default options menu only show the most important
options, split into categories. The full, traditional menu
can be accessed by using the m-prefix.
Issue reported by schauveau: when the command line specifies the
'--nethackrc=file' option (Unix, including linux and OSX, only) the
value of 'file' was set in pointer g.cmdline_rcfile and the options
parsing made a copy of that pointer rather than of what it pointed
to, then freed g.cmdline_rcfile before using the copy. So it ended
up using a pointer to freed memory.
Stick with copying the pointer but defer freeing the original until
after its copy is no longer needed.
Pasi Kallinen [Mon, 1 Aug 2022 22:11:11 +0000 (01:11 +0300)]
Potions of healing, extra healing, and lifesaved heal amount
Make potions of healing and extra healing more useful in the early
game, by upping the average amount of health restored.
Make amulet of life saving restore between 60 and 170 health,
depending on constitution. Previously life saving was the best way
to heal back up to full, even if you had thousands of hp.
The only effect of a new moon was to make hearing a cockatrice's
hissing (whichs happens with 1 in 3 chance) always start the turn to
stone sequence instead just having a 1 in 10 chance to do so, but
that was negated by carrying a lizard corpse.
Keep the hiss-always-starts-petficiation part and remove the
carrying-a-lizard-corpse-negates-that part. So the effect of a new
moon no longer gets controlled by the contents of hero's inventory.
When you see a dwarf wield a pick-axe,
|The dwarf wields a pick-axe!
avoid the exclamation point if that dwarf just intends to dig.
|The dwarf wields a pick-axe.
Pull request from entrez: nothing happened--except spending a wand
charge--if a monster zapped a wand of digging down at a spot where
holes can't be dug. If a pit can be dug there, dig one and then trap
the monster in it. No-op if a pit or other trap is already present.
Michael Meyer [Thu, 9 Jun 2022 16:48:41 +0000 (12:48 -0400)]
Let fleeing monsters dig pits in undiggable floor
When the hero zaps a wand of digging down in an undiggable level, it
creates a pit. When a fleeing monster did the same thing, it had no
effect. Bring this closer to the behavior experienced by the hero: if a
monster tries to use a wand of digging to create a hole in an undiggable
floor, a pit will be made (and the monster will fall into it, if not a
flyer).
hero is invisible without being able to see invisible
Issue reported by EndHack: you could see your hands glow red when
reading a scroll of confuse monster or casting the spell of confuse
monster even if you were unable to see yourself.
Switch to the blind feedback (tingling instead of glowing red) if
invisible without see invisible.
Also, have uncursed scroll or low skilled spell confer 1..2 turns
of glowing hands instead of always just 1. (Blessed/highly skilled
stays at 2..9 turns.)
If the first monster on the migrating_mons list couldn't arrive and
was put back on the list to try again later, 'later' would happen
immediately and the program looped forever trying and failing to
bring that monster to the level.
Defer repeat attempts at migration until losedogs() has been through
the whole migrating_mons list. mon_arrive() now populates a new
list called failed_arrivals and losedog() moves its contents, if any,
to migrating_mons prior to returning.
Extend the wizard mode #migratemons command. Instead of just asking
for how many random new monsters to be sent to the next level, first
describe how many migrating monsters there already are, then if that's
non-zero ask whether to show them. Choices are 'c' for ones scheduled
to arrive at the current level if hero leaves and returns, 'n' for
ones aimed at the next level, 'o' for ones that aren't in either of
those two categories, 'a' for all migrating monsters, and 'q' to skip.
After that, ask how many to make for the next level. The default for
that is still zero.
For the 'o' and 'a' cases, they're displayed in the reverse order of
when they went onto migrating_mons, not sorted by destination level.
Pasi Kallinen [Tue, 26 Jul 2022 20:17:54 +0000 (23:17 +0300)]
Fix knockbacked monster migrating or killed
Fix a case where a monster knocked back another monster into a trap,
and the trap either killed or migrated the monster, then the actual
damage dealing later could try to detach the already detached monster.
If the monster migrated, the monster is gone before the damage from
the hit is dealt to the monster.
Pull request from Kufat: combine a pair of single item skills into
one skill by changing scimitar to use saber skill and removing no
longer used scimitar skill.
I don't think skill values end up in save files but decided to
increment EDITLEVEL to be safe.
Deleted scimitar skill, changed scimitar to use saber skill.
Adjusted Barbarian's max saber mastery basic->skilled for consistency
with former scimitar skill.
Pull request from entrez: typing map symbols during a getpos
operation was using incorrect values and might end up moving the
cursor to walls or other terrain that it classifies as uninteresting
and intends to ignore.
Michael Meyer [Sat, 16 Jul 2022 16:21:40 +0000 (12:21 -0400)]
getpos cmap vs glyph followup
This is a bit more efficient, since everything up to S_hcdoor is
skipped anyway, but it's a little harder to understand so needs more
comments. Not sure if it's worth it or not...
Michael Meyer [Fri, 15 Jul 2022 23:53:47 +0000 (19:53 -0400)]
Fix: getpos cmap vs typ/glyph confusion
When some parts of getpos were rearranged in 7404597, tests of terrain
types and glyphs were moved to a loop which iterated through the defsyms
array without being updated to handle cmap values instead. Consequently
they weren't excluding certain terrain types from being 'jumped to' as
intended. (Though it seems as though they actually worked by chance to
some extent, just because there's some overlap between terrain types and
defsyms in terms of where the 'walls/doors' blocks start and end.)
I also noticed that cmap_to_type was missing S_darkroom (it fell through
to the default case so that the function returned STONE), so I added it.
Pull request from entrez: don't allow an amorphous engulfer who
has swallowed the hero to move to a closed door location. If some
hypothetical amorphous holder existed, it could move to such a spot
while holding the hero adjacent.
Michael Meyer [Fri, 15 Jul 2022 02:40:41 +0000 (22:40 -0400)]
Prevent amorphous mon from carrying hero into door
An amorphous engulfer like a fog cloud could engulf the hero, then carry
him into a closed door. If it was killed or decided to spit out the
hero, he would be left occupying the same spot as a closed/locked door.
Make an amorphous monster unable to move into a door if currently
engulfing the hero.
Something more complicated could be done along the lines of allowing the
move if the hero is himself in an amorphous polyform, but that verges on
being a little too silly, maybe.
I also included fixes to a couple miscellaneous, unrelated formatting
issues that I noticed recently.
Extend findgd() to bring a migrating guard back 'early' if there is
one and an active guard is wanted but none is present on the level.
It the level is full then the found guard is likely to be sent into
limbo (scheduled to migrate back), so one can end up moving back and
forth. Unlikely to occur during normal play.
Also, when a guard is needed and there's a dead one parked at <0,0>,
revive it. The dead guard has temporary corridor info in its
mon->mextra->egd that a new one won't have. (This might introduce
unexpected changes in vault behavior but if so, the old behavior was
probably buggy.)
When the hero is in a vault, don't find a guard unless u.uinvault is
ready to bring it into play. It was finding one every turn and then
ignoring the result for 29 turns out of 30.
Change guard appearance timing: the first appearance is still after
30 turns, but if it goes away, bring it back after 15 more turns
rather than another 30 and repeat as needed.
Add a couple of non-timer, non-(property & TIMEOUT) timeout values
for the wizard-mode #timeout command: uswldtim and uinvault. The
swallowed counter goes down and explusion or total digestion occurs
when it hits zero. The in-vault counter goes up when you're in a
vault or the temporary corridor. If you make it out of the vault-
and-corridor it gets reset to zero.
Pasi Kallinen [Wed, 20 Jul 2022 06:42:24 +0000 (09:42 +0300)]
Adjust Demonbane invoke ability
Demon lords and princes have a chance to resist the effect.
Demons in quest when nemesis is alive have a very high chance
of resisting.
When invoked in Gehennom, teleports the demons within the same
level.
Pasi Kallinen [Tue, 19 Jul 2022 12:14:40 +0000 (15:14 +0300)]
Buzz macros and related stuff
Add macros to convert AD_foo, WAN_foo, and SPE_foo to relative values
for passing to BZ_U_foo and BZ_M_foo macros.
Change some return values in monster spellcasting function from
magic numbers to MM_MISS or MM_HIT.
Make buzzmu consider hero resistances - previously the
monster with innate zapping ray (Angels and Asmodeus) would
just keep doing that attack, but they will now just curse if
it saw the hero resist the attack.