Commit Graph
100 Commits
Author SHA1 Message Date
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
Pasi Kallinen 552431e966 Split coord truncate-to-map into separate function 2021-07-01 14:29:04 +03:00
Pasi Kallinen 183e31ef14 Fix swapped DIR_UP and DIR_DOWN
I don't think this had any effect on gameplay, but it was still wrong.
2021-06-28 23:34:54 +03:00
Pasi Kallinen efae7c7c47 Missed couple direction enum places 2021-06-28 17:41:04 +03:00
Pasi Kallinen f25a6e26ee Use enums and defines for directions 2021-06-27 15:46:56 +03:00
Pasi Kallinen 5ea652e0c6 Explicitly check for not STONE in corridor join
... instead of relying STONE being 0
2021-06-26 16:59:11 +03:00
Pasi Kallinen c019968997 Clear all room data
Restoring a level cleared residence pointer from those subrooms
which were in the restored level, but if the previous level had
more subrooms, those pointers weren't cleared.
This caused weird problems when a shopkeeper data was looked
up based on the subroom number.

Just to be safe, clear all the room data when freeing the level.
2021-06-26 15:10:43 +03:00
Pasi Kallinen b5dd0f8986 Fix strange object mimic in shop sanity error
Shop population code set the mimic shape to strange object
without checking for protection from shape changers.
Let set_mimic_sym (via makemon) handle it correctly instead.
2021-06-26 13:03:28 +03:00
Pasi Kallinen 075844b4d6 Adjust shopkeeper damage fixing
Allow shopkeeper to remove webs and pits.

Change the damage fix messaging to be more specific when
shopkeeper removes a trap. Before this the message was
"A trap was removed from the floor", which sounds really silly
when it comes to holes.

Change the damage fixing so the shopkeeper will fix one damage spot
at a time (instead of all at once), so it's more like a monster action.

Some code cleanup, splitting into smaller functions.

While doing this, I noticed that shopkeepers don't actually bill
the hero for the damage, but that'll have to be another commit...
2021-06-25 20:02:06 +03:00
Pasi Kallinen 823b770ad9 Fix thinko in the shk litter indexing 2021-06-25 13:39:59 +03:00
Pasi Kallinen ef9e2e36c3 Reorg shopkeeper litter routine
When shopkeeper fixes a wall and there are items on that location,
shopkeeper tries to move those items into their shop. Split
the code dealing with that into separate functions.
2021-06-25 13:22:22 +03:00
Pasi Kallinen 1e7b75eb8b Expose stairway data to lua 2021-06-24 18:55:20 +03:00
Pasi Kallinen 3ddb2a91c7 Allow some makemon flags in lua monster creation
Also document the des.monster hash parameter values.
2021-06-24 14:38:12 +03:00
Pasi Kallinen 8dfe963652 Allow spiders to spin webs
Revisited this feature, and the chance of a spider spinning a web
depends now on the number of webs already present on the level.

For a giant spider to spin a web in the middle of a room with no
supports, the limit of existing webs is 4, next to one support 9,
next to two supports 14, and so on. Cave spider limits are much lower.
2021-06-23 22:50:57 +03:00
Pasi Kallinen f84538aa8c Dehardcode number of glass gems 2021-06-21 10:06:46 +03:00
Pasi Kallinen 26fa915cf3 Silence couple warnings of possibly uninitialized vars 2021-06-16 22:08:04 +03:00
Pasi Kallinen 769bce1199 Minor code reorg: finding longest option name 2021-06-16 14:53:05 +03:00
Pasi Kallinen 76f77ee0cc Add assistance to fire-command
Allows the fire-command to autowield a launcher; it will now
do either swapweapon or wield an appropriate launcher, if you
have ammo quivered.

This assistance can be turned off with the fireassist boolean option.

Adds a rudimentary command queue, which allows the code to add keys
or extended commands into the queue, and they're executed as if
the user did them.  Time passes normally when doing the queue,
and the queue will get cleared if hero is interrupted.
2021-06-16 13:14:32 +03:00
Pasi Kallinen 97e58a4fdc Change autopickup and color default values
Change the default value of autopickup to off. Having it on is
harmful for new players, making them very easily burdened.
We can't expect new players to know how to configure
pickup_types, pickup_burden, and pickup exceptions.

Change the default value of color to on. We can safely assume
new users have a terminal that supports color, and most people
want color.
2021-06-06 19:25:49 +03:00
Pasi Kallinen 8849f66dae Don't bind quit to any key by default
Quit is not a commmand you usually need very often, and generally
don't want to use by accident.

Apparently, on Spanish keyboard layout, n-with-tilde is interpreted
by the Windows NetHack as M-q, and the key is next to l. Loot also
asks for confirmation, just like quit.

Prevent stuff like this by not binding the quit command to any key.
2021-06-04 09:13:30 +03:00
Pasi Kallinen a71482af71 Check genocided zombies before raising the zombified corpse
Fixes #520
2021-05-26 09:02:38 +03:00
Pasi Kallinen 8d2407f1f2 Monsters can gain resistances by eating corpses
This is based on both the EvilHack implementation by
k21971 <keith.simpson1971@gmail.com>, and xNetHack
implementation by copperwater <aosdict@gmail.com>.
2021-05-23 19:03:33 +03:00
Pasi Kallinen 20cbadcf85 Unlock your quest by killing your quest leader
Allow killing your quest leader, just to make games winnable if you
converted before doing the quest.
Boost the quest leaders and give them some equipment. King Arthur
gets Excalibur. Killing quest leader gives really bad luck and
makes your god angry at you, and killing quest guardians gives
smaller penalties.

This is based on both the EvilHack implementation by
k21971 <keith.simpson1971@gmail.com>, and xNetHack
implementation by copperwater <aosdict@gmail.com>.
2021-05-23 11:11:58 +03:00
Pasi Kallinen 6b60618e0e Exploding spheres cause real explosions
Despite active explosion attacks being called explosions in-game,
they only affected a single target, and were handled differently
from actual explosions. Make them do an actual explosion instead.
This should make spheres more interesting and inspire different
tactics handling them.

Because spheres deal more damage on average and can destroy items
in their explosions, their difficulty has been increased slightly.

Polyselfed hero exploding won't cause elemental damage to their
own gear.

Originally from xNetHack by copperwater <aosdict@gmail.com>.
2021-05-22 13:37:39 +03:00
Pasi Kallinen 7f8cfb43d2 More hallu colors 2021-05-22 08:56:54 +03:00
Pasi Kallinen 29868036f1 Lua: nhcore script with function callbacks
Adds possible callbacks for "start_new_game", "restore_old_game",
"moveloop_turn", and "game_exit" which when defined, will be called
from core code at the appropriate time.

Adds lua hooks for dump_fmtstr (only if DUMPLOG), dnum_name, u.moves,
u.uhave_amulet, and u.depth.
2021-05-21 21:24:59 +03:00
Pasi Kallinen 5ad45fc696 Make anti-magic fields drain more energy
... and make them actually deal damage based on the energy
it would've drained, if you have Antimagic.
Also prevent them appearing too early in the dungeon.

Allow drain energy attacks (and anti-magic traps) drain more
than your level of energy.

Make eating magical monsters such as wizards and shamans give
the same tiny buzz bonus as eating a newt.
2021-05-20 21:35:23 +03:00
Pasi Kallinen a1b765936f Boost HP of some golems
Idea from SporkHack by Derek Ray, but values are different.
2021-05-20 19:25:16 +03:00
Pasi Kallinen 2f25556025 Conflict based off of charisma
Higher charisma will make it more likely for monsters to be affected.
Conflict will also now require the monster to see the hero.

Originally from SporkHack by Derek Ray.
2021-05-19 18:35:00 +03:00
Pasi Kallinen 16105ad0d5 Change touch of death from instadeath to maxhp reduction and damage
Touch of death will now do 50 + 8d6 damage, and drain max HP for half
of that. If the drain is equal or greater than your max HP, then it
will kill you instantly.

Change originally from SporkHack by Derek Ray.
2021-05-18 18:58:34 +03:00
Pasi Kallinen f057ef573c Knights get no metal armor penalty for clerical spells
Originally from SporkHack by Derek Ray.
2021-05-18 17:02:28 +03:00
Pasi Kallinen 2288452278 Monsters can see player resistances
If monsters see you resist something, generally elemental or magical
attack, or if they see you reflect an attack, they learn that and
will adjust their attack accordingly.

Originally from SporkHack, but this version comes via EvilHack with
some minor changes.
2021-05-17 20:01:11 +03:00
Pasi Kallinen 1e1d580336 Allow webs to be placed without a giant spider on them
Allow creating webs without spiders in the lua level scripts:

des.trap({ type = "web", spider_on_web = 0 });

Based on xNetHack commit by copperwater <aosdict@gmail.com>.

Also changes the Spider nest themed room to generate without
spiders when the level difficulty is 8 or less.
2021-05-10 17:48:51 +03:00
Pasi Kallinen d2b331abf7 Accept "waiting" on special level des.monster() specifications
Allow specifying "waiting" for monsters created via lua level scripts.
This sets the monster strategy to make it wait for the hero
to be in visual range before allowing the monster to move.

Also makes the monster inside the Mausoleum themed room use this feature,
to prevent out of depth liches bothering the player unprovoked.

For example:

des.monster({ class = "D", waiting = 1 });
2021-05-09 12:24:27 +03:00
Pasi Kallinen 967c7e5b0b Fix compile error on Windows
Fixes #508
2021-05-09 11:43:55 +03:00
Pasi Kallinen 9fa9f00f8a Entering special room, wake up only that room
... instead of doing a level-wide wake-up.

Fixes #429
2021-05-05 20:34:05 +03:00
Pasi Kallinen ce482ba2ba Lua: Fix getmap nodoor flag 2021-04-03 21:44:05 +03:00
Pasi Kallinen 54eb25ad2e Show extended command name in key help
(In the "?f")
2021-03-26 17:57:59 +02:00
Pasi Kallinen f9aff476c4 Increment editlevel
Just in case, even though changing joined to boolean shouldn't cause problems.
2021-02-19 17:28:43 +02:00
Pasi Kallinen 1b7faaf661 Add couple more config tests 2021-02-13 11:51:25 +02:00
Pasi Kallinen b1097df86d Make runmode option complain, add some tests for it 2021-02-12 19:41:46 +02:00
Pasi Kallinen 7f51e59770 Don't complain about unknown option if param is wrong
When a compound option was given an erroneous parameter,
for example "OPTIONS=runmode:foo",
you first got "Unknown runmode parameter 'foo", and
then "Unknown option 'runmode:foo'".

Prevent the Unknown option complaint, if we actually did
find a match.
2021-02-11 18:22:18 +02:00
Pasi Kallinen da92e0349b Fix lua doc copypaste error 2021-02-10 22:06:36 +02:00
Pasi Kallinen cc25f40d69 Add lua tests for config file parsing
Bare-bones for now, more tests needed.
2021-02-10 19:22:16 +02:00
Pasi Kallinen 9576154690 Add in_lua flag
In preparation of making config errors available to lua scripts,
instead outputting them via pline.
2021-02-10 17:06:12 +02:00
Pasi Kallinen d817564a6a Lua: set and get config options
Still needs more work, especially the error handling.
2021-02-06 19:02:25 +02:00
Pasi Kallinen 9e550ccb07 Fix BIND segfault
Recent commit that added terminator entry to default_menu_cmd_info
caused a segfault when trying to BIND keys.
2021-02-05 11:14:14 +02:00
Pasi Kallinen 933c7f215c Move the other options to alphabetical order 2021-01-30 19:07:58 +02:00
Pasi Kallinen 10cd5af500 Move other options into the options array 2021-01-30 18:43:21 +02:00
Pasi Kallinen b502a7d9b2 Remove leftover variables 2021-01-28 12:44:45 +02:00
Pasi Kallinen a3c8dead91 Remove unused function 2021-01-23 15:19:34 +02:00
Pasi Kallinen 0516fa9e35 Fix leftover variables from trap refactor 2021-01-23 11:32:54 +02:00
Pasi Kallinen 0dd6960cb1 Fix article used for steed when stepping on trap
This was caused by the trap code refactor I did a month ago.
2021-01-23 11:25:53 +02:00
Pasi Kallinen 2b525aab02 Fix missing proto 2021-01-23 10:56:56 +02:00
Pasi Kallinen ad0c701127 Fix unused param 2021-01-22 18:16:08 +02:00
Pasi Kallinen 8681aec71b Fix uninitialized variable 2021-01-22 17:58:54 +02:00
Pasi Kallinen 44bb68fe82 Curses: Select menu items via mouse 2021-01-21 12:53:02 +02:00
Pasi Kallinen 57181c5655 Remove Aztec C workaround from core
Aztec C is closed-source and dead for more than 20 years.
2021-01-20 19:19:43 +02:00
Pasi Kallinen e41c029262 Give barrow wights a cold touch
Their attack is described as "the icy touch froze his bones"
in Lord of the Rings
2021-01-13 21:29:07 +02:00
Pasi Kallinen de5da621ac Fix glyph lookup
Seems to have been a mistake in c9673b3d9e
2021-01-07 21:53:56 +02:00
Pasi Kallinen bc8dd92621 Monster ranged attacks and staying away from hero
Move the check for monsters that want to stay away from hero
due to having a ranged attack into a separate function.

Add monsters with polearms and breath attacks to it.
Monsters with breath attacks stay away only if they haven't
used their breath recently, or if they are injured.
2021-01-06 14:38:39 +02:00
Pasi Kallinen 0a60a80f50 Fix zero-damage attacks
Disenchanters dealt 0 damage with their disenchanting attack,
as did monsters with sleeping and slowing attacks.

Fixes #439
2021-01-05 17:51:04 +02:00
Pasi Kallinen a4184c8684 Prevent monsters from picking up locked containers 2020-12-24 22:37:58 +02:00
Pasi Kallinen 957990c14d More futureproofing hypotheticals
If you set COLNO larger than BUFSZ, few places cause a buffer overrun.
Add a new buffer size definition, COLBUFSZ, which is the larger of
COLNO and BUFSZ, used in places that care about a screen-wide string.
2020-12-20 12:32:29 +02:00