Commit Graph
100 Commits
Author SHA1 Message Date
Pasi Kallinen 07451ca32c Update lua api docs 2022-01-04 21:29:06 +02:00
Pasi Kallinen f065cf01c1 Mark extended commands accepting m-prefix in the command flags 2022-01-04 19:29:18 +02:00
Pasi Kallinen c54c857372 Reuse code to limit look region 2022-01-04 13:10:33 +02:00
Pasi Kallinen 711a12afc3 Add a false rumor 2022-01-04 11:14:12 +02:00
Pasi Kallinen 03b55a6fa0 Make the adventurer ghost asleep 2022-01-04 10:55:09 +02:00
Pasi Kallinen dbd1f7a33b Improve wizmode-only command unavailability reporting 2022-01-03 18:06:11 +02:00
Pasi Kallinen 76381815f3 Add theme room: Ghost of an Adventurer 2022-01-02 19:51:32 +02:00
Pasi Kallinen f405d3bfbc Add few hallu colors 2022-01-02 15:10:32 +02:00
Pasi Kallinen 3e620e06eb Define extra sanity checks if not a release 2022-01-02 01:14:16 +02:00
Pasi Kallinen 1cc31f3cba Init variable just in case 2022-01-01 16:58:34 +02:00
Pasi Kallinen 0f132470c7 Allow tipping container directly into another 2022-01-01 16:15:29 +02:00
Pasi Kallinen 8db18275a6 Define engulfing_u, making clearer code 2021-12-31 21:12:21 +02:00
Pasi Kallinen 2591a21cf0 Leprechauns bury their gold after teleporting 2021-12-31 18:48:44 +02:00
Pasi Kallinen d53cd28d46 Make extended commands return defined flags
Instead of returning 0 or 1, we'll now use ECMD_OK or ECMD_TURN.
These have the same meaning as the hardcoded numbers; ECMD_TURN
means the command uses a turn.

In future, could add eg. a flag denoting "user cancelled command"
or "command failed", and should clear eg. the cmdq.

Mostly this was simply replacing return values with the defines
in the extended commands, so hopefully I didn't break anything.
2021-12-30 19:16:33 +02:00
Pasi Kallinen fa41d5fe66 Apply a wielded polearm with fire-command
Wield a polearm and use 'f'ire to automatically hit with it,
if there's a single valid target.
With fireassist-option, will swapweapon to a polearm.
This only applies if quiver is empty and autoquiver is off.
2021-12-29 19:40:26 +02:00
Pasi Kallinen ea0c488178 Split leprechaun avoidance into separate function 2021-12-28 19:11:30 +02:00
Pasi Kallinen 4b525374d0 Make vrocks emit a poison cloud when they flee 2021-12-25 10:51:20 +02:00
Pasi Kallinen b1ed92abad Apply runmode to multiturn actions 2021-12-21 17:37:48 +02:00
Pasi Kallinen 8f366c725e Minor linewrap and comment fix 2021-12-21 16:25:21 +02:00
Pasi Kallinen 54bba21dd9 Give message for genod shifter changing shape
For accessibility, give a message when a monster changes shape
due to the previous shape being genocided.
2021-12-21 13:10:07 +02:00
Pasi Kallinen 81a7157d7d Vampire in a genocided shape
When you genocided a monster a vampire was shapeshifted into,
the vampire might've stayed in the genocided form.
Always revert back to vampire form if we tried to pick a genocided form.
2021-12-21 11:18:48 +02:00
Pasi Kallinen ef1eeed755 Give dragon armor extra effects
Dragon scales and dragon scale mails will provide some extra effects
when worn:

 - blue:   very fast speed
 - black:  level-drain resistance
 - green:  sickness resistance
 - gold:   hallucination resistance
 - orange: free action
 - red:    infravision
 - white:  slow digestion
 - yellow: stoning resistance

gray and silver don't have extra effects - those two are already the
best ones, so don't need any.
2021-12-20 23:30:27 +02:00
Pasi Kallinen e251bb6a82 Decouple mon state adjustment from find_roll_to_hit
If you have a function named like that, and it goes and
changes the monster state, that's just wrong.

Move waking up the monster from the hit into separate function.
2021-12-15 22:11:22 +02:00
Pasi Kallinen f6b7be49f4 Accessibility: give a message when teleporting a monster
Teleporting a monster only updated the map. Give a message
so blind players can get the same information.
Making a monster invisible gives the same message, if you
cannot detect invisible.
Several other places where monsters teleported themselves
now also give the same message.
2021-12-12 16:50:49 +02:00
Pasi Kallinen 176d5b8463 Bones piles can be ransacked by adjacent monsters
If a bones file is created, any object-liking monster next to
where hero died has a chance of grabbing objects from hero's
inventory.

This comes from xNetHack by copperwater <aosdict@gmail.com>.
2021-09-19 21:20:32 +03:00
Pasi Kallinen 5d3e237ffc Izchak occasionally stocks wands/scrolls/spellbooks of light
This comes from xNetHack by copperwater <aosdict@gmail.com>
2021-09-19 20:52:19 +03:00
Pasi Kallinen b23ff20c6a Gas clouds expand around terrain rather than being rhomboid
The gas will expand from its chosen center point via breadth-first
search instead of hardcoding a diagonal shape. The search is performed
with a randomized list of directions, and has 50% chance of not spreading
to a space it otherwise would have spread to. This has the effect of fuzzing
the cloud edges in open areas, helping the clouds on, for instance,
the Plane of Fire not be big rhombuses.

Also some other code refactoring related to stinking clouds in read.c

This comes from xNetHack by copperwater <aosdict@gmail.com>
2021-09-19 13:57:47 +03:00
Pasi Kallinen 12800bf84b Walking near buried zombifying corpses wakes them up
Moving without stealth will reduce the zombifying timeout
of buried corpses under and around hero's location.
2021-09-18 21:24:52 +03:00
Pasi Kallinen 2dce29e965 Move Pw regen into separate routine 2021-09-18 20:23:20 +03:00
Pasi Kallinen b30061b5ad Allow dropping just picked up items
When using a menu to drop or put in items into a container,
allow putting in the item (or items) you picked up previously,
by selecting the 'P' entry from the item class menu

Inspired by the itemcat patch by Stanislav Traykov.

Invalidates saves and bones.
2021-09-17 21:00:06 +03:00
Pasi Kallinen 408aa4b3cb remove sp_lev execute bits 2021-09-12 22:34:19 +03:00
Pasi Kallinen e3a2dd7f40 Reveal the monster your strike moved
When you hit a small hidden monster (by eg. force-fighting)
that got moved by the strike, the monster stayed hidden, possibly
causing a sanity checking error.

Reveal the monster before hurtling it.
2021-09-12 19:44:39 +03:00
Pasi Kallinen e7e7bca2a3 fixes entry 2021-09-06 21:02:48 +03:00
Pasi Kallinen 9942b65df7 Resistances gained from worn or wielded items also protect inventory 2021-09-06 20:24:44 +03:00
Pasi Kallinen e813cf5b05 Move sanity checking to start of main loop
... just after clearing the object bypasses, as some
of the monster movement code may use object bypass flags.
2021-09-05 10:14:16 +03:00
Pasi Kallinen e61d149171 Fix eel hiding in dry land
When an eel was hiding in a pool and a rolling boulder trap
launched a boulder on top of the pool, and the boulder then
filled the pool, the eel ended up hiding on the dry land.

As a stopgap measure, kill off any monster that is in the
pool location when the boulder hits the pool. This should
probably be expanded to handle flying monsters differently.
2021-09-03 13:27:40 +03:00
Pasi Kallinen c0dc72b3d2 Test for replace_terrain coordinates 2021-09-03 08:27:17 +03:00
Pasi Kallinen cf44cb3382 Handle buried zombifying corpses
When a zombifying corpse is buried, allow it to zombify and
dig itself out of the ground.

Also allow wishing for zombifying corpses.
2021-09-02 20:54:36 +03:00
Pasi Kallinen b76a213caf Fixes entry 2021-08-28 17:07:56 +03:00
Pasi Kallinen 2aaee76c5c Fix ball bypass sanity complaint
Be punished, get swallowed, drop the ball inside the monster
via the 'D' drop, kill the swallower - this issued a sanity
check complaint about the ball bypass flag.

In this case, the ball was "floating", not on any object chain,
when dropped inside the monster, so clear_bypasses didn't
clear the flag.
2021-08-26 18:46:25 +03:00
Pasi Kallinen 2f94ad489f Reindent main loop
No code change, just reindenting the main loop, as it wasn't
reindented when the inner part was split into separate function.
2021-08-26 14:19:39 +03:00
Pasi Kallinen 70b953db44 Clear bypasses at beginning of main loop
Object bypass flag is used to check if an object was already
handled in an iteration loop, in cases where the linked list order
may change during iteration. The flags should never stay set
past a turn, if any were used.

Reset the bypass flags at the beginning of the main loop, without
checking g.context.move -flag; that flag gets reset if hero lifesaved.
2021-08-26 14:12:00 +03:00
Pasi Kallinen a1b927a278 Use enum value, not hardcoded number 2021-08-24 11:34:28 +03:00
Pasi Kallinen 6dc99f69b7 Prevent impossible trying to find a door position
When random dungeon level generation looks for room walls
to place doors at (for joining corridors or creating niches),
it complained about impossible, if the shaped theme room
doesn't have a valid place for a door.

Make the position routine return FALSE and let the
caller deal with it...

Observed this with the small circular themeroom which had
all 4 valid positions already joined with corridors, and
the niche function tried to add a niche to the room.
2021-08-22 18:44:20 +03:00
Pasi Kallinen 67b485601a sanity checking: bypassed billed object destroyed 2021-08-21 18:50:13 +03:00
Pasi Kallinen f43bfc3f71 Lua: diagonals for selection floodfill 2021-08-15 13:50:28 +03:00
Pasi Kallinen 98ec66e00c Qt: deprecation warnings, again
Check Qt version for the QFontMetrics::width vs horizontalAdvance.
Of course can't just #define horizontalAdvance to width, that would
be too easy ...
2021-08-15 10:58:42 +03:00
Pasi Kallinen 6554500593 Qt: Fix Qt5 deprecation warnings
Mostly the warnings were about QString::sprintf and QFontMetrics::width.
sprintf replacement is asprintf, which annoyingly behaves differently
from sprintf - it seems to append to the string.

Not thoroughly tested, but seems to work.
2021-08-14 21:08:12 +03:00
Pasi Kallinen 0bf4bea6ec Fix eels hiding when a pool boiled off
Sanity check caught an eel hiding on floor; this was caused by
an exploding flaming sphere boiling off the pool the eel was
hiding in. The freezing water case was already handled, so
add the same, rather lackluster handling, to the fire case.
2021-08-14 13:43:04 +03:00
Pasi Kallinen 2748ac746e lookaround comments
trying to figure this out
2021-08-12 19:38:29 +03:00
Pasi Kallinen 7a9dd64cb5 Use mon_visible 2021-08-09 19:16:36 +03:00
Pasi Kallinen 1c401960aa Move movement tests
Rushing will go along a snaking corridor.
2021-08-09 16:13:12 +03:00
Pasi Kallinen f5b617eaca More movement tests
Rush behaves different in ROOM vs CORR; in corridors, it'll
turn 90 degrees, but will not go in the opposite direction
from when it started.
2021-08-08 19:30:59 +03:00
Pasi Kallinen c9d075910e Slightly better stone tile
Replacing the placeholder stone tile with something that has
similar color scheme to the dungeon walls.
2021-08-04 13:58:54 +03:00
Pasi Kallinen de73a32d7d Implement wishing for walls in wizmode 2021-07-30 20:52:46 +03:00
Pasi Kallinen d463a9e258 Reveal branch stairs only after traversing them 2021-07-30 19:40:54 +03:00
Pasi Kallinen 4f594659dc More movement tests 2021-07-30 18:40:57 +03:00
Pasi Kallinen 78854aeda6 More movement tests 2021-07-30 18:09:28 +03:00
Pasi Kallinen b080ea12c2 Debug flag allowing overwriting stairs
And using it in the movement tests, so running doesn't stop
at stairs.
2021-07-30 16:35:36 +03:00
Pasi Kallinen 5580cd6286 Remove unused params 2021-07-30 15:35:00 +03:00
Pasi Kallinen c0c617c413 Try fixing interrupted travel oddities
My earlier commit (433f0cc) changed traveling, and caused some
strange problems when travel was interrupted. This seems to
fix those problems.
2021-07-29 21:21:28 +03:00
Pasi Kallinen 4007640882 Allow meta-keys in getloc
Fix altmeta again, to (re)allow meta-keys in getloc, for example
fast-moving the cursor with altmeta and number_pad.
2021-07-29 14:43:46 +03:00
Pasi Kallinen 7bfbe0fba9 Lua: Allow setting debug_flags 2021-07-29 07:36:08 +03:00
Pasi Kallinen 19599fa751 Add more movement tests 2021-07-28 20:47:12 +03:00
Pasi Kallinen 65b320de39 Start of movement tests
Adds the following lua functions:

- nh.pushkey("x")
    Pushes a key into the command queue. Support is spotty,
    currently only the keys handled in rhack.
- nh.doturn()
    Runs one turn of main loop, or if optional boolean param
    is true, until g.multi == 0
- nh.monster_generation(false)
    Disable monster generation, and kill off all monsters.

Adds a testmove.lua script to test hero movement. Currently
covers only hjklyubn and HJKLYUBN.
2021-07-28 19:19:40 +03:00
Pasi Kallinen b16c3732cb Add branch stairs to symbols 2021-07-28 07:57:16 +03:00
Pasi Kallinen 2775a07e5b Explicitly set the altlabels array size
This will allow the compiler to complain after you add new glyphs.
2021-07-28 07:45:25 +03:00
Pasi Kallinen d332720336 Increment editlevel
Added the new branch stairs glyphs, forgot to increment editlevel.
2021-07-27 18:56:50 +03:00
Pasi Kallinen 267ac5add2 Add colored branch stairs
Different color for stairs that go to another dungeon branch.

Adds four new glyphs, S_br{up,dn}{stair,ladder}, which use the
same character as normal stairs/ladders, but yellow color.
In tiles, the up/down arrow is yellow-green instead of while-blue.

This feature has been around a lot and is in several different
variants, but this is implemented from scratch so tiles work too.
2021-07-27 17:21:01 +03:00
Pasi Kallinen 141a7915d6 Bugle playing should not scare some monsters
Make awaken_soldiers match awaken_monsters in what monsters
it can scare.
2021-07-26 21:40:23 +03:00
Pasi Kallinen 83c2eb5645 Add more shop tests 2021-07-25 22:52:42 +03:00
Pasi Kallinen c88bdb0a32 Hide internal commands from key list 2021-07-25 11:57:09 +03:00
Pasi Kallinen 120a8c0173 Add shop creation test script 2021-07-24 20:29:15 +03:00
Pasi Kallinen e2c6cbe347 Fix missing Izchak shop
My recent commit broke Izchak's shop in minetn-6.
Fix it as per the suggestion from entrez.
Fixes #555
2021-07-24 20:18:44 +03:00
Pasi Kallinen 7f39d53ad3 Lua: improve level testing
Add des.finalize_level() used for testing in conjunction with
des.reset_level().
Add nhc.DLB to return 0 or 1 if DLB was defined at compile-time.
Change the test_lev.lua to give more informative messages instead of
just lua error when required file doesn't exist.
Add bigrm-11 to the level tests.
2021-07-24 10:49:06 +03:00
Pasi Kallinen 93b66ff8da Prevent segfault on nonexistent mapseen
Cannot happen on normal play, but with some lua trickery ...
2021-07-23 21:09:39 +03:00
Pasi Kallinen f07829045a Prevent impossible with secret doors in sokoban
Doesn't currently happen as no Soko levels use secret doors,
but handle them anyway gracefully.

Secret doors have their doormask set, but it's overloaded wall_info.
The display routines aren't happy with D_CLOSED in wall_info.
2021-07-23 20:58:45 +03:00
Pasi Kallinen 043cd7e108 Lua: lit="random" is not allowed anymore
Random is the default lit state, so leave it out.
2021-07-22 19:38:04 +03:00
Pasi Kallinen dbac44596e Lua: Allow boolean params in level_init 2021-07-22 18:02:58 +03:00
Pasi Kallinen b566bbda38 Split calculating your movement speed out of moveloop 2021-07-22 12:28:15 +03:00
Pasi Kallinen 5cf0bb1de9 Split moveloop into preamble and core 2021-07-22 12:01:26 +03:00
Pasi Kallinen 932b6d03c9 Lua: Make des.monster use boolean params 2021-07-22 11:05:40 +03:00
Pasi Kallinen 893a14e2bd Remove special doinv key
The same thing can be done in config file with BIND=0:inventory
2021-07-21 16:33:10 +03:00
Pasi Kallinen a5e5435619 Make mouselook use internal extended command
... instead of faking a key press
2021-07-21 12:23:25 +03:00
Pasi Kallinen bfe8727c59 Add retravel to Guidebook.tex 2021-07-21 11:03:36 +03:00
Pasi Kallinen 433f0cc15f Add new command: #retravel
Retravel travels to the previously selected destination.

Also changes the travel-via-mouse to execute the extended command
instead of faking a special key.
2021-07-21 10:59:08 +03:00
Pasi Kallinen 76bb205367 Add some plural/an tests 2021-07-17 23:29:30 +03:00
Pasi Kallinen 8ff2badf51 Use define for wand wresting chance 2021-07-17 20:59:40 +03:00
Pasi Kallinen 2261f998a6 Fix des.room doors
Fix special level des.room shop doors broken by my recent commit.
Mark the shopdoor error as impossible, so the fuzzer stops there.
2021-07-09 20:32:00 +03:00
Pasi Kallinen 50b22449d1 Keep swamp within the room boundaries
If a swamp special room was generated in an irregular room, it could
go outside the boundaries of that room.

Fixes #546
2021-07-09 18:34:46 +03:00
Pasi Kallinen 29a8153170 Add a new bigroom variant "boulder maze" 2021-07-09 18:18:31 +03:00
Pasi Kallinen 4050ec1670 Improve special level shop and door linking
When creating a shop via des.region, allow creating the shop door
either with a map character in a des.map, or with des.door
before or after the shop region.

Also allow a shop door to open directly into another shop.
2021-07-09 13:58:49 +03:00
Pasi Kallinen 491adc6a69 Mark some extended commands as no-fuzzer
... instead of checking the fuzzer being on in the commands themselves.
2021-07-08 11:35:43 +03:00
Pasi Kallinen 57cfcd9ed0 Fix error marking scroll as used up
Forgot to change this when reorganizing the scroll effects
into separate functions.
2021-07-08 10:22:13 +03:00
Pasi Kallinen 5abf948116 Fix movecmd always returning a direction
My recent commit broke the 'm' (menu request) -prefix, because
a thinko in movecmd made it always return a direction.
2021-07-08 07:52:45 +03:00
Pasi Kallinen 2f1b3a34ad Split can-engrave checks out of engraving function 2021-07-07 16:41:58 +03:00
Pasi Kallinen caee59b131 Split potion effects into separate functions 2021-07-07 12:54:35 +03:00
Pasi Kallinen 4b54f4f18a Split scroll effects into separate functions 2021-07-07 12:02:59 +03:00
Pasi Kallinen 581f12797f Allow using rush/run prefix to fastmove in getloc 2021-07-03 18:22:24 +03:00
Pasi Kallinen db68395d69 Movement key reworking
Put the rush and run movement keys into g.Cmd instead of bit twiddling
the normal walk keys in multiple places to get the run and rush keys.

Allow meta keys in getpos. Use the normal running keys to fast-move
in getpos, instead of explicit HJKL - I polled couple places online,
and number_pad users did not use the HJKL keys in getpos.

Make meta keys work even after a prefix key.
2021-07-03 18:20:24 +03:00