Commit Graph
100 Commits
Author SHA1 Message Date
Pasi Kallinen e240efa10b Restoring a game can return to the wishing prompt
In TTY or curses, if the terminal goes away while you're in the wishing
prompt, return to the prompt when the game is restored.

Breaks saves.
2025-07-12 18:21:12 +03:00
Pasi Kallinen 8570421449 Create familiar spell can create harder creatures 2025-07-11 13:04:25 +03:00
Pasi Kallinen e5bd185ab5 Tutorial: untrapping traps 2025-07-10 13:48:16 +03:00
Pasi Kallinen 588dc6b73f Tutorial: quaffing potions 2025-07-10 13:40:04 +03:00
Pasi Kallinen 06ab2ce604 Tutorial: Knight jumping 2025-07-10 11:07:45 +03:00
Pasi Kallinen 44b9ffe245 Tutorial: tip containers 2025-07-10 11:01:30 +03:00
Pasi Kallinen 3440193a5a Tutorial: spellcasting
Add some basic spellcasting stuff to the tutorial: read a spellbook,
cast a spell.  If the hero doesn't have enough energy, just adds
a note saying so.

Remove/restore the known spells when entering/leaving the tutorial.
2025-07-09 18:30:58 +03:00
Pasi Kallinen 079dca27f2 Tutorial: clear user-given obj type names 2025-07-07 13:08:07 +03:00
Pasi Kallinen 0da45c1e74 Fix Snickersnee attack
Adding the extra attack to Snickersnee made the weapon always
attack from range, even when it was used in melee.
2025-07-05 19:59:26 +03:00
Pasi Kallinen e2b80cd886 Monsters trapped in pits cannot kick 2025-07-04 17:39:08 +03:00
Pasi Kallinen a0d9c94ece Dwarves can sense buried items under their feet 2025-07-04 17:04:46 +03:00
Pasi Kallinen b8664198da Alchemy smock reduces chances of dipped potions exploding 2025-07-03 21:07:05 +03:00
Pasi Kallinen 76de716d2d Tutorial: squeezing through small gaps 2025-07-03 10:09:51 +03:00
Pasi Kallinen 04e651ca34 Allow kelp in walls of water 2025-07-02 17:24:15 +03:00
Pasi Kallinen 79bbd33675 Add a false rumor
... but is it false?
2025-07-01 21:04:45 +03:00
Pasi Kallinen 47e95a126e Tutorial: wrong secret door
Some first time players have gotten stuck here. Give them a hint.
2025-07-01 16:19:01 +03:00
Pasi Kallinen 751b296e3b Tutorial: boulders and a trapdoor 2025-06-30 18:00:08 +03:00
Pasi Kallinen 20b03ec0c5 Fix wrong key code in binding keys 2025-06-30 17:59:38 +03:00
Pasi Kallinen 2b0530a5ed Tutorial: iron bars to show hidden stairs
Seems like several new players did not find the "hidden" stairs.
Add iron bars to show a glimpse of them - the hero still needs
to find the secret door in to the room.
2025-06-30 12:41:20 +03:00
Pasi Kallinen a89d6b3bae Tutorial: fix non-alt keys shown as alt-combos
Lua doesn't have regexes, and "-" has special meaning in match;
escape the minus with "%", so it actually matches a minus sign.
2025-06-30 12:34:47 +03:00
Pasi Kallinen 8d8867007f Typofix 2025-06-27 00:28:27 +03:00
Pasi Kallinen 7122c0cb0a Add a literary reference to genetic engineer database entry 2025-06-19 12:01:00 +03:00
Pasi Kallinen 15ced6f1ff Fix pet apport value
Fuzzer encountered a case where a pet apport ended up being zero:
the reviving tame troll already had edog structure, so it was not reset.
2025-05-23 17:21:27 +03:00
Pasi Kallinen a4b971c744 Allow monsters to use Snickersnee like a polearm 2025-05-20 20:06:28 +03:00
Pasi Kallinen ab4f70b448 Monsters were bashing with Snickersnee
Side effect of allowing Snickersnee to attack like a polearm,
monsters were bashing with it in melee.
2025-05-20 19:59:28 +03:00
Pasi Kallinen 68ef0b49c1 Split arti_invoke code into smaller functions 2025-05-14 18:30:55 +03:00
Pasi Kallinen 035cd4377f Snickersnee can hit at a distance once per turn for free
Once per turn, Snickersnee can be used to hit at a distance,
similar to a polearm, without taking any time.

Breaks saves.
2025-05-12 20:26:53 +03:00
Pasi Kallinen c90cc53ab3 Ogresmasher gives a higher chance of knockback 2025-05-12 10:24:36 +03:00
Pasi Kallinen bd98dda8c1 Unpolyed hero can knockback too
Noticed a strange oversight in knockback: Hero hitting a monster
did not cause knockback, unless polymorphed into a monster.
Add knockback chance if we're using a weapon, not twoweaponing,
and dealing some damage.
2025-05-11 21:23:43 +03:00
Pasi Kallinen 6d374f9306 No knockback with flimsy or non-blunt weapon
Weapons that can do knockback are lucern hammer, bec de corbin,
dwarvish mattock, (silver) mace, morning star, war hammer,
club, quarterstaff, aklys, flail, pick-axe, and grappling hook.
2025-05-11 20:32:29 +03:00
Pasi Kallinen af6c53ac7c m_respond code reorg and splitting 2025-05-10 18:42:42 +03:00
Pasi Kallinen 31e03f1c68 Fix vision on plane of air
We can't just unconditionally unblock vision when the cloud moves,
as there could be a temporary poison cloud at that location.
2025-04-26 20:38:50 +03:00
Pasi Kallinen 079566cad9 Fix memory leak in lua selection iterate
Iterating over a large set of locations in a selection caused a memory leak.
Lua couldn't do garbage collection in the middle of the iterator function,
so it eventually ran out of space, and just quietly dropped stuff.
2025-04-20 20:19:05 +03:00
Pasi Kallinen 3d5b7f1f51 Killing quest leader angers the guardians 2025-04-18 14:40:10 +03:00
Pasi Kallinen f12108c5c5 Fix memory leak when setting autocompletions 2025-04-18 11:40:48 +03:00
Pasi Kallinen 178bd3a988 Wielding Trollsbane grants hungerless regeneration 2025-04-17 17:28:07 +03:00
Pasi Kallinen 86bfb3e2f9 Avoid map accessibility notices when map isn't updated 2025-04-16 18:08:33 +03:00
Pasi Kallinen af3e601ff7 Remove melting ice timer when breaking digging wand 2025-04-15 14:45:51 +03:00
Pasi Kallinen d6dd5c743c Reinstate some of the mind flayer amnesia
When I reworked amnesia to not forget levels or objects, I removed
the forgetting from the mind flayer attacks.  I intended to add
something to replace it, but forgot ...
2025-04-13 20:16:00 +03:00
Pasi Kallinen a185c270bb Expose trap once-field to lua 2025-04-13 17:32:14 +03:00
Pasi Kallinen 85de51a69a Add invocation effect to Fire and Frost Brand
Casts fireball or cone of cold at expert level
2025-04-13 13:13:54 +03:00
Pasi Kallinen 652f8576c0 Cursed magic whistle can teleport you to your pet 2025-04-13 12:48:21 +03:00
Pasi Kallinen 8f7258dc35 Buff Grimtooth with poison
Grimtooth is now permanently poisoned, protects the wielder from
poison, and can be invoked to throw poison.

Permapoison code comes from xNetHack by copperwater <aosdict@gmail.com>.
2025-04-12 19:24:36 +03:00
Pasi Kallinen 7138af00ba Praying on an altar with pet statue on it can revive the pet 2025-04-10 23:38:44 +03:00
Pasi Kallinen 197e6af78c Increment EDITLEVEL for silver maces 2025-04-09 21:26:22 +03:00
Pasi Kallinen fa229439d4 Fixes entry for silver mace
Fixes #1405
2025-04-09 21:05:59 +03:00
Pasi Kallinen 2065d2d392 Avoid premapping outside Sokoban map to prevent showing stone glyphs
If user has changed the stone glyph to something other than a space
(or uses a tileset), Sokoban levels showed the unreachable stone outside
the map area.  Prevent marking those areas as seen, so the stone
glyphs aren't shown.
2025-04-09 18:41:00 +03:00
Pasi Kallinen a64796e64d Flip monster goal when flipping the level 2025-03-17 14:33:01 +02:00
Pasi Kallinen 7c43654580 Lua: allow functions for some optional strings
Those places that use get_table_str_opt() to get an optional string
value can instead use a function that returns a string.
This can be used for example in quest data lua table, or some table
fields in the lua api bindings, or the dungeon definition.

For example, in quest.lua

text = "You again sense %l pleading for help.",

could be replaced with

text = function() return "You again sense %l pleading for help."; end,

which of course allows using lua to build the string.
2025-03-16 20:29:28 +02:00
Pasi Kallinen b2c071bc66 Fix rare door in corner of room bug
There were couple reports of doors being generated in a corner
of a room.  This happened for randomly generated irregular rooms,
because the code that was deciding if a corridor starting or
ending location was good did not handle irregular rooms at all.

This changes the corridor code so it can now generate start and
end points properly for any valid position in irregular rooms,
instead of only on the edges.  This means the corridor sometimes
meanders a bit more than before, because it tries to find
the end point away from the edge of the room rectangle.

Also added is sanity checking for the randomly generated rooms
and corridors level, testing for door placement and room connectivity.

And another fix for a rare special case where dig_corridor
created a zero-tile long corridor; the entrance door was placed,
but there was nothing behind it.

Fixes github #1269 and #1385
2025-03-16 09:46:53 +02:00
Pasi Kallinen 488011571a Fix vision when vault guard corridor vanishes 2025-03-15 22:20:59 +02:00
Pasi Kallinen 495a7e7898 Silence a suggested parenthesis warning 2025-02-16 10:50:04 +02:00
Pasi Kallinen 3cb7819c81 Split monster goal coordinate out of mstrategy field
Instead of packing a coordinate into unsigned long, store the goal in
a coord struct, making the code a bit cleaner.  Monster struct is
of course slightly bigger, but that should not really matter.
No change in monster behaviour.

Breaks saves and bones.
2025-02-16 10:46:21 +02:00
Pasi Kallinen 027bf78f28 Sort monsters for mkclass
An assumption of monster generating code is that monsters within a class
appear in increasing order of difficulty.  This wasn't the case with
some monsters, but swapping the monsters around is rather intrusive,
and doesn't really lend to changing monster difficulties when needed.

As a result, for example ghouls would not randomly generate when they
should have at certain level difficulties (where a ghoul is weak enough
to generate but an ettin zombie would be too strong).

Keep a separate array of monster indexes sorted correctly, generate it
when required by mkclass()

Description of this bug via copperwater <aosdict@gmail.com>
2025-02-13 17:17:00 +02:00
Pasi Kallinen d1f0cfce92 No hangup save while in tutorial
Tutorial code doesn't handle saving and reloading the game gracefully,
and manually saving has been disabled in there already.
Also disable automatic saving in the tutorial when the terminal goes away.
2025-02-10 17:48:01 +02:00
Pasi Kallinen 3ffbfc724c Fix another impossible no_charge object
Tame earth elemental picked up a no_charge object from a shop and moved
it out of the shop, causing "no_charge obj not inside tended shop"
impossible.  Non-tame monsters picking up no_charge items cleared that
bit, so make the same happen for pets.
2025-01-28 21:26:10 +02:00
Pasi Kallinen c9abc92dd7 Fix lua.adoc 2025-01-24 19:04:17 +02:00
Pasi Kallinen 991a1dbe43 Fix exploding landmine and boulders next to lava
Same issue as with breaking a wand of digging in commit 7ce0751a
2025-01-20 19:26:12 +02:00
Pasi Kallinen 0c18792916 Fix vision when vault guard clears corridor 2025-01-20 19:24:09 +02:00
Pasi Kallinen 663ab8aa89 Fix wall spines outside map bounds 2025-01-19 21:16:27 +02:00
Pasi Kallinen 7ce0751a6c Fix breaking wand of digging and boulders next to lava
If one or more boulders were next to lava and hero broke a wand of digging
next to that location, the boulder(s) stayed over the lava causing a sanity
checking error.
2025-01-19 19:34:58 +02:00
Pasi Kallinen 7f36a5db3c Fix vision when guard moves a monster 2025-01-18 19:30:10 +02:00
Pasi Kallinen 6df83cb677 Fix pet data being reset when charm monster was cast
Casting charm monster with pets nearby could reset the edog struct.
If the pet ate a mimic corpse and was pretending to be something else
when that edog reset happened, the sanity checking would issue an impossible.
The error happened because meating was reset, but the pet appearance was not,
but the edog struct reset is the part being wrong.  Lets not do that.

To reproduce, turn on sanity checking, create a tame dog, give it a mimic corpse
to eat, #wizcast charm monster next to it.
2025-01-17 17:07:07 +02:00
Pasi Kallinen f0a0a74dcc Hero polyed into slithy monster and sitting 2025-01-12 16:42:33 +02:00
Pasi Kallinen aa12620376 Fix vision with temporary clouds over pools
Vision wasn't cleared correctly when a temporary [poison] cloud
was over a pool and hero was under water while the cloud disappeared.
2025-01-10 15:49:20 +02:00
Pasi Kallinen 0e04988fec Fix another no_charge in untended shop
This time the no_charge object was being carried by a pet.

To trigger, drop an object into shop, decline to sell it,
pick up an object belonging to shopkeeper, decline to buy it,
wait for your pet to pick up the no_charge object you dropped,
teleport out of the shop, wait for shopkeeper to walk out of
the shop.
2025-01-10 15:46:09 +02:00
Pasi Kallinen de38ce2c90 Fix vision: force bolt breaking door with temp cloud 2025-01-09 19:44:21 +02:00
Pasi Kallinen 843b02ec1d Add vision sanity checking, fix more vision
- Add a vision sanity checking routine

- Recalc block point when digging a door for temporary clouds

- Add recalc_block_point after cvt_sdoor_to_door, because doorways
  on the Rogue level have no doors, and otherwise the sanity checking
  would complain.  This doesn't actually change how the Rogue level
  vision works, as it uses a different vision system

- Monster using a trap in a secret corridor revealed the corridor,
  but didn't unblock the vision unless you saw the location
2025-01-09 17:28:24 +02:00
Pasi Kallinen c956e3e215 Fix vision when applying a wand of digging 2025-01-08 13:59:50 +02:00
Pasi Kallinen 256b820fe3 Fix impossible no_charge obj in untended shop
Sanity checking was complaining about a no_charge obj in untended shop.

Angry shopkeeper was accepting thrown items as no_charge objects:
To reproduce the impossible, kick down the shop door angering
the shopkeeper. While the shopkeeper is still in their shop,
throw an item they don't want into the shop. Wait for the shopkeeper
to get out of the shop.

Move the anger checking before the sell auto-accept code,
so the shopkeeper will charge for the object.
2025-01-08 12:59:08 +02:00
Pasi Kallinen ae1a86d7be Fix vision when door is destroyed by ray effect
A door was destroyed and vision unblocked without considering
temporary (poison) clouds.
2025-01-07 17:39:46 +02:00
Pasi Kallinen b27c9102f6 Fix vision when opening a door
If a monster or hero opened a door with a temporary (poison) cloud
on it, the location could be seen through even with the cloud.
2025-01-07 15:14:27 +02:00
Pasi Kallinen 108d975694 Fix vision in guard created corridor
... when hero angers the guard, the guard's previous location
didn't get the vision blocking fixed.
2025-01-07 10:52:01 +02:00
Pasi Kallinen f4cd5ed065 Fix vision with pushing a boulder and temp clouds
remove_object cleared the vision when the last boulder was removed
from a location, without considering temporary [poison] clouds.
This particular case happened when pushing a boulder.
2025-01-06 20:22:56 +02:00
Pasi Kallinen 274b15cd77 Fix vision when xorn digs down on a wall
A xorn inside a wall using a wand of digging to dig down, the vision
was still blocked at that location.
2025-01-06 20:11:35 +02:00
Pasi Kallinen 4392f5fa4e Fix vision in some cases with boulder falling into pool
We can't just unconditionally unblock vision for a location when a boulder
falls into a pool, because the location may also have a (poison) cloud on it.
2025-01-06 19:46:38 +02:00
Pasi Kallinen 57bf003c26 Fix rolling boulder not unblocking sight at wall of water
A rolling boulder that destroys a wall of water did not unblock
the vision at that point.
2025-01-05 13:35:21 +02:00
Pasi Kallinen 1ef3167ca0 Steed #monster breath feedback
Using #monster to make the steed use the breath weapon often
failed because the steed did not want to breathe at weak or
too strong monsters.
Make #monster force the steed use the breath, and if there is
no targets available, make the steed make some noise as feedback.
2025-01-04 16:37:14 +02:00
Pasi Kallinen 2ebe8915f6 Prevent melting ice destroying necessary traps
A magic portal ended up on a melting ice.
2025-01-04 16:05:07 +02:00
Pasi Kallinen 9313fb7747 Clear tin-eating struct when object goes away
The tin-eating context was pointing to a non-existent object,
causing an error when the fuzzer somehow managed to continue eating
the freed tin object.
Clear the pointer when the tin leaves inventory or the object
is deleted.
2025-01-03 22:21:14 +02:00
Pasi Kallinen ba731a346b Fix shop steal when teleporting your swallower
Picking up a shop item and not paying it, getting swallowed
by a monster, and then teleporting the monster out of the shop
with you in it, the shopkeeper didn't notice the theft.
But the object was not marked as paid either.

Also prevent giving a message of the swallower disappearing
and appearing when it was teleported.  (Although now there's
no message given, so something should be added ...)
2025-01-03 20:58:26 +02:00
Pasi Kallinen 114f99867e Fix unicorn movement special handling
My commit 82f0b1e8ea to make monsters which had nowhere
to move would panic attack the hero if possible, broke the
special unicorn handling; they avoid being in-line with hero,
so often had nowhere to move...

Fixes #1344
2025-01-01 23:43:15 +02:00
Pasi Kallinen 0a58b7a540 Tweak tourist xp gain from new monsters
Remove the XP gain for tourist seeing a new type of monster
nearby, as it apparently made tourists a bit harder by forcing
early level gains.

Monsters next to hero are still marked as seen close-up, but
fix the code so it doesn't count undetected monsters.

Tourists still gain XP from "taking photos" of new types of monsters,
but only if they haven't seen the monster close up before.
(No actual photos are taken.)
2025-01-01 21:43:31 +02:00
Pasi Kallinen 1282863f5c Fix breaking wand of digging not touching boulders
Applying a wand of digging skipped all the affected locations
with any boulders on them.
2024-12-29 18:17:57 +02:00
Pasi Kallinen 6c895ab6f6 Boulder-over-pit sanity when breaking wand of digging 2024-12-28 20:54:36 +02:00
Pasi Kallinen 5f95831526 Creating a pit in a wall message tweak
"A pit appears in the wall" sounds a bit silly, so change it to
"The wall crumbles into a pit"
2024-12-28 20:52:39 +02:00
Pasi Kallinen 767a20e21f Hacky fix for pline recursion outputting raw_print
When glyph updates are on, pline can be called recursively
when the vision is being fully recalculated.  This caused
the recursively called pline to output raw_pline text.

Not sure if this is the correct way to fix it, but can't really
turn off or block the glyph update notices either ...
2024-12-28 20:41:43 +02:00
Pasi Kallinen 454978fadd Avoid boulder-over-pit sanity when filling empty maze
This shouldn't happen unless doing special level commands in
strange order, but handle it anyway...
2024-12-28 20:33:18 +02:00
Pasi Kallinen 72fb06a40a Unhide monster moving over to teleport trap 2024-12-28 20:31:45 +02:00
Pasi Kallinen d11747899e Fix boulder-over-pit sanity after landmine blows up 2024-12-28 20:30:11 +02:00
Pasi Kallinen 66d0307e95 Impossible timer after vault guard entered
Fuzzer encountered impossible "timer sanity: melt timer on non-ice",
when vault guard entered the vault, changing the vault wall unconditionally
into room floor; in this case the vault wall was ice with a melting timer
attached.

Delete any melting ice timers on that location when turning it into floor.
2024-12-28 19:43:14 +02:00
Pasi Kallinen 6530951fd5 Impossible timer after dipping a lit potion of oil
Dipping a lit potion of oil into another potion could
turn the potion of oil into another potion; this resulted
in "burn_object: unexpected obj" impossible after the lit timer
ran out.

Just make an explosion if trying to dip a lit potion of oil.
2024-12-28 19:39:02 +02:00
Pasi Kallinen 8b11bda6cb Open cavern -style Gehennom filler level 2024-12-22 18:14:12 +02:00
Pasi Kallinen 0079bf87bb fixes update 2024-12-21 18:19:42 +02:00
Pasi Kallinen 6b0e21dc1a Wish alias "tripe" for tripe ration 2024-12-21 14:11:00 +02:00
Pasi Kallinen f7e86aa150 Add a new bigroom variant "two hexagons" 2024-12-21 12:19:26 +02:00
Pasi Kallinen e7a714849e luahelper doc nit 2024-12-21 12:06:20 +02:00
Pasi Kallinen cc31017265 Use NO_MATERIAL instead of a magic number 2024-12-20 19:39:16 +02:00
Pasi Kallinen 5de7f986a0 Forget obj trap known in bones file 2024-12-19 15:29:29 +02:00
Pasi Kallinen 87694e1a95 Hero remembers trapped boxes
After finding a trap on a chest or a large box, remember it
as trapped: "You see here a trapped large box."
Randomly generated chests and boxes can be obviously trapped.
Allow defining obviously trapped containers via lua.

Invalidates saves and bones.
2024-12-19 13:11:25 +02:00