Commit Graph

13946 Commits

Author SHA1 Message Date
Pasi Kallinen
d062f4c4d8 Fix repeating untrapping
... or any that use getdir to ask direction.
2022-08-12 12:02:52 +03:00
Pasi Kallinen
db1ef8172e Fix Windows compilation 2022-08-11 17:07:43 +03:00
PatR
dee099968e minor code cleanup
Mostly removing several trailing spaces.
2022-08-11 03:55:17 -07:00
Pasi Kallinen
1952050fae Remove comment 2022-08-11 08:46:20 +03:00
Pasi Kallinen
649fc7f9b3 Monsters "remember" noteleport levels
... using the same hack when zapping themselves: If the level is
no-teleport, the monster will learn of teleport traps, and if
it knows about them, won't try using teleportation again.
2022-08-11 08:43:40 +03:00
Pasi Kallinen
c855b04a57 Fixes entries 2022-08-11 08:28:15 +03:00
Kestrel Gregorich-Trevor
5c313389a1 Document monmove.c and name temp variables.
This commit expands on comments in dochug() and defines names for
the integer passed between it and m_move(). Hopefully increases readability.
2022-08-11 08:26:23 +03:00
Kestrel Gregorich-Trevor
ecc275a450 Pull mind flayer blasts into their own function.
The mind blast code was previously a part of dochug().
This commit pulls that code into its own function, and also
happens to eliminate a goto and label with no change in functionality.
2022-08-11 08:26:09 +03:00
Kestrel Gregorich-Trevor
50adaff549 Piranhas devour corpses. 2022-08-11 08:26:06 +03:00
Kestrel Gregorich-Trevor
a2a79a1250 Clean up set_apparxy()
This commit removes the gotos from set_apparxy, making it easier to read.
It also cuts out at 1-2 variable assignments on certain calls,
so technically it is an efficiency win as well.
2022-08-11 08:25:56 +03:00
Kestrel Gregorich-Trevor
f83eaade32 Allow monsters to zap wands of teleportation at the player.
According to comments in the code, this feature was disabled
because it never triggered, making it useless. I enabled the code
again, and monsters demonstrated a willingness to zap the player
with wands of teleportation. I am not sure of what exactly changed,
but I think this feature could trigger some interesting situations,
and absolutely deserves to make a comeback.
2022-08-11 08:25:33 +03:00
PatR
3dac38eb0f look_here() arguments
Add LOOKHERE_NOFLAGS to use instead of 0 for look_here()'s 2nd arg.
Fix the call to look_here() that passed FALSE.
2022-08-10 18:02:57 -07:00
Michael Meyer
8a549b0a60 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.
2022-08-10 20:02:33 +03:00
Michael Meyer
94e8141c01 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.
2022-08-10 20:01:22 +03:00
Michael Meyer
ce0107aff9 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).
2022-08-10 20:01:22 +03:00
Michael Meyer
9d28a8dc76 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.
2022-08-10 19:59:44 +03:00
Michael Meyer
c2393344b7 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).
2022-08-10 19:59:44 +03:00
copperwater
e0d26c7163 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.
2022-08-10 19:58:43 +03:00
Michael Meyer
ddce73502e 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.
2022-08-10 19:57:48 +03:00
Michael Meyer
beb99c0e72 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.
2022-08-10 19:56:53 +03:00
Michael Meyer
9c9a8ff797 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.
2022-08-10 19:55:42 +03:00
Pasi Kallinen
121d79ab6b Random item artifact chances
The chance that randomly generated item is an artifact will
now depend on the number of already existing artifacts.
2022-08-10 18:18:18 +03:00
Pasi Kallinen
d91915dba3 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.
2022-08-10 11:04:04 +03:00
PatR
e9ec89a903 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.]
2022-08-09 16:22:50 -07:00
Pasi Kallinen
fd9745f9c6 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.
2022-08-09 11:54:45 +03:00
PatR
4e6d3aba4f 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.
2022-08-07 16:02:44 -07:00
Pasi Kallinen
b635160297 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.
2022-08-07 22:33:47 +03:00
Michael Meyer
2b51a22c6c 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.
2022-08-06 16:42:17 +03:00
Michael Meyer
76d9d65884 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.
2022-08-06 16:42:17 +03:00
Pasi Kallinen
83f8ec1c43 Give pyrolisk a bite attack 2022-08-06 10:55:04 +03:00
Pasi Kallinen
3eb2192d75 Make pyrolisk gaze effect match other fire effects 2022-08-06 10:46:27 +03:00
Pasi Kallinen
0a3d02b9d4 Pyrolisk stops gazing if it sees you resist 2022-08-06 10:45:11 +03:00
Pasi Kallinen
6bc796028d 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.
2022-08-06 08:28:39 +03:00
PatR
a84025c36c more abandoned migrations when entering endgame
The earlier commit just removed monsters from migrating_mons and left
them orphaned.  Also it ignored migrating objects.

Actually release the monsters that can no longer arrive at their
migration destinations.  Release their inventories too.

Release objects that can no longer arrive at migration destinations.
2022-08-05 16:55:05 -07:00
PatR
7a3c11ec6b 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.
2022-08-05 15:05:10 -07:00
PatR
dc381d0560 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.
2022-08-05 14:36:11 -07:00
PatR
393283f05c 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'.
2022-08-05 14:22:27 -07:00
Pasi Kallinen
b01d81277e Increase buffer size for saving menucolors
The '"regex"=color&attr' is max BUFSZ, so prefixing with MENUCOLOR=
and adding a newline overflowed the temp buffer when saving the
menucolors.
2022-08-05 18:19:07 +03:00
nhmall
958a8aa297 quiet a warning that appeared today
src/cmd.c(2867) : warning C4701: potentially uninitialized local variable 'win' used
2022-08-05 10:31:54 -04:00
Pasi Kallinen
07184c9640 Don't give fake Demonbanes to angels
Demonbane is a mace now, so trying to generate a long sword made
fake Demonbanes. Just don't give Demonbane at all to random angels.
2022-08-05 13:43:39 +03:00
Pasi Kallinen
fa1b326e31 Save changed key binds to config file 2022-08-05 13:07:26 +03:00
Pasi Kallinen
45613ea771 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.
2022-08-05 10:33:55 +03:00
PatR
e5ddf400c6 '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.
2022-08-04 16:53:31 -07:00
PatR
908a8a132f m_digweapon_check()
Some streamlining that I left out of the recent commit for maybe
avoiding exclamation mark when a monster wields a tool or weapon
to dig or chop.
2022-08-04 14:26:12 -07:00
PatR
672ef846fa 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.
2022-08-04 14:09:19 -07:00
Pasi Kallinen
c8bd39c748 Simple options: guard against boolean being null 2022-08-04 20:08:19 +03:00
Pasi Kallinen
b3822cd94d Fix roguesymset substitution in options 2022-08-04 17:05:26 +03:00
Pasi Kallinen
4ff9537b0d Rudimentary key rebinding in game options
Currently shown only in the full options list, as it's not
quite complete. (For example, it doesn't handle movement commands,
or the getpos keys)
2022-08-04 14:42:45 +03:00
Pasi Kallinen
b5acfc5c3f New options: swap symset to roguesymset on rogue level 2022-08-04 09:48:58 +03:00
Pasi Kallinen
dd28f8b405 Minor tweaks to post-option screen refresh 2022-08-04 09:39:21 +03:00