Commit Graph

2678 Commits

Author SHA1 Message Date
PatR
43e2f7d0ae some livelog cleanup
The gamelog structure's type/flags field is 'long' but the
corresponding livelog event type field and the argument passed to
gamelog's logging were 'unsigned'.  They take the same values and
those values mean the same things so change them all to long.

The actual livelog logging assumed that time_t is a long number of
seconds, and was also using a boolean as an array index.  Perform
proper type conversions.

sysconf parsing used 'int' to hold strtol() value; change to long.
Also it was using raw_printf() instead of config_error_add() to
complain about any problems.  Clearly the livelog patch was not
updated to the current code base before being incorporated.
2022-03-02 13:09:42 -08:00
PatR
2bef05bb77 livelog level entry events
Fix up the level descriptions used when logging an "entered new level"
event.  Most of the change is for adding an extra argument to calls
to describe_level().  The curses portion is in a big chunk of old code
suppressed by #if 0.

I didn't notice that the level entry events are classified as LL_DEBUG
until all the work was done.  This promotes the entry events for the
four Plane of <Element> levels from debug events to major ones instead.
It doesn't do that for the Astral Plane because the entered-the-Astral-
Plane achievement already produces a major event for that.  Most other
key level entry events are in a similar situation--or will become that
way once another set of achievements eventually gets added--so there
aren't any other event classification promotions.
2022-03-01 13:53:57 -08:00
PatR
77bd50fd77 fix github issue #687 - logging of major events
Reported by k21971, the dumplog section labeled "major events" showed
all logged events rather than just the ones classified as major.
Filter out the non-major ones when writing dumplog.

At the moment only a couple of ones other than achievements are major.
Probably various other types should be too.

The #chronicle command still lists all logged events unless they're
flagged as 'spoiler'.  So far the mines' end luckstone is the only
one flagged that way.  Unfortunately a player with access to live
logging could still learn whether or not the gray stone that has just
been picked up on the last mines level is the target luckstone by
viewing the log from outside of the game.

The #chronicle command would be more useful if it gathered all the
categories of events present and put up a menu allowing the player to
choose which ones to view.  I haven't attempted to implement that.

Closes #687
2022-03-01 04:15:55 -08:00
Pasi Kallinen
b172957831 Use macro for spell pw cost per spell level 2022-02-28 22:21:37 +02:00
nhkeni
3cf1b87914 cmdcount_t
Add a type to force g.{command_count,last_command_count,multi} to have the
same type (because cmd.c: g.multi = g.command_count;) and some resulting
cleanup.
2022-02-27 20:01:49 -05:00
PatR
a3b52bf6a3 new achievement: drawbridge tune
Use up the last available bit for achievements:
"You learned the tune to open and close the castle's drawbridge."
(More can still be added but xlogfile will need another field to
track a second set of 31 in order to keep its achievement bitmask(s)
within portable size.)

As achievements go, it's not very exciting, but players who normally
destroy the drawbridge have to choose whether to earn an achievement
first since once it's gone, there's no way to find out the tune
(either via prayer reward or successful Mastermind).  I'm guessing
that most will probably decide to ignore this achievement since it
has no effect on the outcome of the game.  However, that might not
be true for future tournament play.

There's no need to bump EDITLEVEL for this; room for recording one
additional achievement is already allocated.
2022-02-27 01:55:25 -08:00
Pasi Kallinen
7523623d95 Make m_move return defines instead of magic numbers 2022-02-26 17:40:17 +02:00
PatR
ca97f4f3dd more thrown object cleanup
Handle thrown or kicked object that's in transit for hangup save and
panic save in addition to normal end of game.  Affects ball and chain
placement too, if they've been temporarily taken off the map.
2022-02-25 07:10:30 -08:00
PatR
ab2bcf4dac trap followup
Make the flags argument to dotrap() and mintrap() and the constants
passed to them all have consistent type: unsigned int.
2022-02-24 12:17:21 -08:00
Pasi Kallinen
0c20bf116c Moving a monster with telekinesis hurles it through the air
... and at the end of the flight, it can't avoid a trap, if it
lands on one.
2022-02-24 19:27:59 +02:00
Pasi Kallinen
2777f45bd5 Get rid of force_mintrap, allow passing flags to mintrap
It uses the same flags as dotrap, so simulate force_mintrap
by passing FORCETRAP flag.
2022-02-24 17:13:23 +02:00
Pasi Kallinen
9716f22851 Make trap return values more consistent
Instead of returning monster's mtrapped-state, return specific
trap return values.
Add one extra trap return value, for when a monster was
moved by the trap.
2022-02-24 16:24:02 +02:00
Michael Meyer
1e951db9bc Fix: monster hurtling and liquid
A monster hurtling over liquid would drown immediately the instant it
touched the first square of water, even if normally it would have kept
moving (e.g. hurtling over a short moat).  Additionally, its placement
on liquid would not take into consideration other monsters, so it could
overwrite an existing monster on that spot and lead to an impossible,
and/or two monsters occupying a single position.

Fix these issues, so that liquid effects like drowning only happen if
the monster ends up in liquid at the end of the hurtle, and so that
other monsters in the way will stop it early even if they're floating
over or swimming on a pool/water/lava square.

Also use canspotmon instead of canseemon for the wiztelekinesis debug
command.
2022-02-24 14:53:48 +02:00
Pasi Kallinen
8e91320d2f Use u_at macro 2022-02-23 20:28:55 +02:00
Pasi Kallinen
5786ddadbb Use IS_WATERWALL and is_waterwall 2022-02-23 12:53:09 +02:00
Pasi Kallinen
e0a83630e1 Some spell code reorg
Keep the internal spell array index inside spell.c,
and refer to spells outside of it with the otyp id.
2022-02-23 10:52:10 +02:00
Kestrel Gregorich-Trevor
355ed43a29 pull request #660 from NullCGT - sleeping monsters
Indicate to players that monsters are sleeping.

Closes #660
2022-02-22 11:36:40 -08:00
Pasi Kallinen
268022e5de Add #wiztelekinesis for testing purposes
For testing mhurtle, which is used for jousting or
bare-handed combat.

Improve mhurtle_step to handle bumping into another monster,
and when the monster gets killed or stuck in a trap.
2022-02-22 16:00:05 +02:00
Pasi Kallinen
4866182a02 Change kitchen sink glyph and color
The default sink glyph is already used for many other things:
iron bars, trees, corridors, drawbridges, and clouds.

Change the glyph to {, and change the color to white.
The glyph is only used for fountains, so it makes "safe"
water-related glyphs match.
2022-02-22 14:41:20 +02:00
Pasi Kallinen
33556788c3 Start with a level 1 spell and enough power
Ensure the first spell - if any - given to the hero in initial
inventory is level 1 - otherwise you can end up with a situation
where the hero knows level 3 spells, but won't have enough power
to cast them.

If the hero starts out with a spell, ensure enough power (5)
to cast that level 1 spell.
2022-02-22 12:26:06 +02:00
Pasi Kallinen
d452242af4 Adjust sleep spell, and monk starting spell
Tone down sleep level to 3 (hitting a monster does tend to wake
it up), and replace the random monk starting sleep spell with
confuse monster, which fits nicely with monk's bare-handed
fighting style.
2022-02-22 09:13:32 +02:00
Pasi Kallinen
c73595cc96 Adjust enchantment spell levels
The enchantment spells were skewed towards lower spell levels,
and didn't seem to correspond with the spell effectiveness or
power.  Adjust the spell levels:

- Confuse monster is probably the least powerful enchantment, and
  also requires touch to work, so make it the new level 1 spell.

- Sleep is quite powerful, and ray, bump it to level 4.

- Charm monster is even more powerful so make it level 5.
  (Considering that create familiar is level 6)

                 old   new
sleep             1     4
confuse monster   2     1
slow monster      2     2
cause fear        3     3
charm monster     3     5

Also swap sleep and confuse monster generation probability.
2022-02-21 19:49:04 +02:00
Pasi Kallinen
4a61602436 Illiterate hero will learn spells directly from deity
... instead of receiving a spellbook.
2022-02-20 22:05:33 +02:00
Pasi Kallinen
038ae7f984 Clean up some spell-related code
Add two helper functions and use those outside of spell.c,
instead of iterating through all the spells.
2022-02-20 21:12:26 +02:00
Michael Meyer
dc21b3d657 Make ravens oviparous
Ravens are birds, so they should be able to lay eggs.
2022-02-19 17:31:34 -08:00
Pasi Kallinen
26ea5824c1 Reading a magic marker shows the specific red ink color 2022-02-19 13:11:24 +02:00
Pasi Kallinen
c434236f1e Allow creating unhidden traps in special levels
des.trap({ type = "rust", seen = true });
2022-02-19 12:38:28 +02:00
Pasi Kallinen
04756b5d34 Towels should weigh more than blindfolds
There's more cloth in a towel than in a blindfold.
2022-02-19 10:32:57 +02:00
Pasi Kallinen
41ae240cad Candy bars are bright blue in text mode
There's lots of brown comestibles, but no bright blue.
2022-02-19 10:28:06 +02:00
Pasi Kallinen
953a534cc5 Fix fire auto-swapweaponing to polearm
When you have a polearm as secondary weapon, have a fireassist on,
and press 'f' to fire, the code tries to swapweapon to the polearm.
This failed badly and got stuck in a loop if you were also wearing
a shield - as polearms are two-handed and shield prevents wielding
those.

Add a new "command failed" result, and clear the command queue
in that case. Also make swapweapon and wield actually return
the ECMD flags back to the rhack loop.
2022-02-17 09:12:07 +02:00
Pasi Kallinen
b25138e6d9 Zombies groan 2022-02-16 23:04:02 +02:00
Pasi Kallinen
122634ec9e Hallucinatory rays
When hallucinating, use nonsensical names for the rays
(wands, spells, and breath weapons), and random ray glyphs.

Original code from xNetHack by copperwater <aosdict@gmail.com>,
inspired by a YANI by Kahran042.
2022-02-16 21:09:23 +02:00
PatR
f588a707bb groundwork for nethackrc name on command line
I've implemented 'nethack -nethackrc=filename' as an alternative to
'NETHACKOPTIONS='@filename' nethack' but at the moment it doesn't
work because the command line parsing comes after the run-time config
file has already been processed.  But this part should work, or maybe
have problems spotted and fixed if it doesn't.  The RC file part of
initoptions_finish() has been rewritten so that it won't need extra
replication of
|  set_error_handling()
|  process_file()
|  reset_error_handling()
|  if (NETHACKOPTIONS) {
|    set_error_handling()
|    process_options()
|    reset_error_handling()
|  }
I've tried to test all the combinations mentioned in the comment but
am not sure that I covered everything, particulary for repeating
earlier tests after making incremental changes.
2022-02-16 00:36:26 -08:00
Pasi Kallinen
d958d032a0 Looting will fall through to force
If you have autounlock on, and don't have unlocking tool, but
are wielding a weapon usable for forcing the lock.
2022-02-16 08:49:16 +02:00
nhmall
a68cf63a05 another obsolete function reference 2022-02-15 08:16:21 -05:00
nhmall
c0a4b38bf6 remove obsolete function and references 2022-02-15 08:13:27 -05:00
Pasi Kallinen
73dbd39d98 Use proper locomotion when avoiding water or lava 2022-02-13 10:56:40 +02:00
Pasi Kallinen
03c715f179 Add paranoid:swim to prevent typoing into water or lava
In the name of accessibility: Prevent moving into dangerous liquids.

Now with themed rooms, water and lava are more common, and it's
unreasonable to expect blind players to check every step for those.
With paranoid:swim, just prevent normal walking into those liquids,
unless you prefix the movement with 'm', or if the liquid would not
harm you.

Doesn't completely prevent an accidental dunking - for example
if the hero is impaired or couldn't see the liquid.

This comes from xNetHack by copperwater <aosdict@gmail.com>
with some changes to the code.
2022-02-12 17:29:32 +02:00
Pasi Kallinen
91e2d3633e Use macro for a location next to hero 2022-02-12 11:05:10 +02:00
PatR
3ea4b00879 memory management
MONITOR_HEAP+heaputil pointed out some unreleased memory.  The livelog
stuff wasn't being freed.  Not surpringly the data used for collecting
and formatting build-options that just got changed from strdup() to
dupstr() wasn't being freed.  And a couple of date/version bits.
2022-02-10 12:14:27 -08:00
PatR
96ba3c04d1 logging experience level changes again
The livelog message for losing a level had an off-by-1 error, showing
the level the hero ended up at rather than the level that was lost.

There was a message for regaining a previously lost level when rank
title stayed the same but no such message if the title changed (the
achievement of gaining a particular title only occurs once).

Say "regained" rather than "gained" when gaining a previously lost
level.  (Blessed potions of full healing regain levels but can also
reduce u.ulevelmax so a different way to remember peak experience
level has been added.)

Report level change due to polymorphing into new man/woman/elf/&c.
I hadn't realized that that hasn't been recording achievement for new
rank when applicable and decided to leave things that way.

Report gender change when putting on an amulet of change or becoming
a new man/&c unless hero is polymorphed at the time or experience
level is also changing.
2022-02-10 05:45:07 -08:00
Pasi Kallinen
1e90f89203 Chronicle of major events, and livelog
Log game events, such as entering a new dungeon level, breaking
a conduct, or killing a unique monster, in a new "Major events"
chronicle. The entries record the turn when the event happened.
The log can be viewed with #chronicle -command, and the entries
also show up in the end-of-game dump, if that is available.

This feature is on by default, but can be disabled by
defining NO_CHRONICLE compile-time option.

This also contains "live logging", writing the events as they
happen into a single livelog-file. This is mostly useful for
public servers. The livelog is off by default, and must be
compiled in with LIVELOG, and then turned on in sysconf.

Mostly this a version of livelogging from the Hardfought server,
with some changes.
2022-02-09 22:49:25 +02:00
nhmall
2c7fa4a704 trap magic number follow-up 2022-02-08 19:29:27 -05:00
nhmall
947d80ec6f replace some trap function result magic numbers 2022-02-08 19:16:42 -05:00
PatR
a0100dd300 using prefixes via their extended command names
Trying to use #reqmenu/#rush/#run/#fight prefixes by their extended
command names didn't work because rhack()'s post-processing was stuck
dealing with the entry for the '#' key after using doextcmd() to run
any command.  Use a static variable (actually a global one since I put
it into struct g) to notify rhack() of the command that ultimately got
executed.
2022-02-07 16:53:56 -08:00
PatR
50d8463b71 <Mon> suddenly appears! vs ^G
For ^G, throttle the monster creation feedback.  Don't say "suddenly"
and don't exclaim the message, just say "<Mon> appears."  Also, use
Norep() so creating lots of similar monsters at once only gives a few
messages (just one unless varied by "next to you" vs "nearby" vs no
qualifier for farther away).  And for mimics created as objects or
furniture, report the sudden appearance of new object or furniture.
2022-02-07 15:55:04 -08:00
PatR
deec94e533 disallow g/G/F prefix with rush/run commands
Reject an attempt to specify a conflicting or redundant prefix with
a Ctrl+<move> or Shift+<move> (not numpad) or Alt+<move> (numpad).
'm' prefix is accepted.
2022-02-07 14:22:41 -08:00
nhmall
5ac860bdc7 there was some left-over k&r code in win/chain 2022-02-07 14:58:16 -05:00
PatR
b3c5d68399 fix movement prefixes
My earlier change resulted in rejecting all commands entered after
a movement prefix key, rather than just ones that aren't supposed to
take any prefix.

This fixes that and also restores the ability to use 'm>' or 'm<' on
stairs to change levels without auto-pickup at the destination.
2022-02-06 17:46:31 -08:00
PatR
f233f1d18c water description
The wall of water goaded me into updating waterbody_name().  It's
mostly the same, aside from being moved from mkmaze.c to pager.c and
adding "{wall of|limitless} water" instead of plain "water" for WATER
terrain.  I'm not very happy with "limitless" for the Plane of Water
because limits imposed by air bubbles are all over the place.  "Wall
of water" might work ok for that level.

Water on Medusa's level is now described as "shallow sea" rather than
lame "water".  The two unusual pools on the Samurai home level are
described as "pond" rather than previous "water" which replaced 3.6's
ridiculous "moat".  When lava is hallucinated, it is described as
"molten <substance>" (yielding silly things like "molten yoghurt"),
rather than just "<substance>" to distinguish it from hallucinated
water.  'autodescribe' doesn't use waterbody_name() though.
2022-02-06 13:20:15 -08:00