Commit Graph
100 Commits
Author SHA1 Message Date
Pasi Kallinen 978cf23cc9 Fixes entry 2020-04-25 19:19:36 +03:00
Pasi Kallinen 52a15daaf6 Tests: Wishing for sprig of wolfsbane etc 2020-04-21 20:00:26 +03:00
Pasi Kallinen dc42b0f7a5 Add Pillars themeroom 2020-04-21 19:52:39 +03:00
Pasi Kallinen 907e7dead1 Adjust some themerooms 2020-04-21 18:59:43 +03:00
Pasi Kallinen 54aa84eeea Prevent branch stairs generating in unjoined room 2020-04-21 18:41:08 +03:00
Pasi Kallinen c0cbe21c4e Prevent stairs in Mausoleum themeroom
... by making the mausoleum part into an unjoined subroom
2020-04-21 17:57:49 +03:00
Pasi Kallinen 2d67aaebb8 Clear saved lua_State from dungeons
These will be recreated if necessary in makerooms
2020-04-20 16:48:56 +03:00
Pasi Kallinen 776ebd809e No trying themed rooms if lua init failed 2020-04-20 16:34:22 +03:00
Pasi Kallinen 807638833b lua doc for des.object 2020-04-19 20:23:22 +03:00
Pasi Kallinen 9baa3fc6b2 Add water vault themeroom 2020-04-19 19:54:42 +03:00
Pasi Kallinen 9c51024b6d Fix negating menu_overlay 2020-04-18 22:36:31 +03:00
Pasi Kallinen 9784b5adef Fix heap use after free
In a lua script, if object was created inside a container, it
might've merged with another object.

Also prevent stacking, lighting, and burying contained objects.
2020-04-18 22:13:52 +03:00
Pasi Kallinen 9b74ea0b22 Shaped and themed rooms
Allows creating shaped or themed rooms for the Dungeons of Doom
via lua script.

Invalidates bones and saves.

Makefiles updated for unix/linux by adding themerms.lua, but other
OSes need to have that added.
2020-04-18 19:55:09 +03:00
Pasi Kallinen 2d43c6d62a Fix segfault on teleport while punished due to flooreffects
... deleting the ball & chain, but keeping a boulder in the pit.

Noticed a segfault when fuzzing, teleport while punished caused
a segfault via fill_pit -> flooreffects -> bury_objs -> unpunish,
and then the next line in teleds tried to look up uchain.

Guard against that particular case.

Fix the case of boulder being in a pit, triggered by you being in
a pit and a giant throwing a boulder on top of you.
2020-04-18 18:58:39 +03:00
Pasi Kallinen 9cdcf7b219 Also explode the other bag of holding 2020-04-18 11:31:16 +03:00
Pasi Kallinen 7c44e06ab1 Dehardcode the monk minetown food shop conversion
Instead of trying to figure out in core whether to change a minetown
food shop to health food shop for monks, just figure it out in the
minetown level creation script.
2020-04-16 21:01:37 +03:00
Pasi Kallinen 43d331c4eb Nerf unicorn horn
Unicorn horns are just too good. Nerf it in similar way several
other variants have done: don't let it restore attribute loss.

This makes potion of restore ability more valuable, and the
int loss from the (nerfed) mind flayers matter more.
2020-04-15 22:45:47 +03:00
Pasi Kallinen fe8f18c5d7 Mimic in a health food store could cause a panic
Health food stores use a special "vegetarian class" of items,
which mkobj doesn't understand. Just make the mimic use a random
item class in that case.
2020-04-15 11:10:26 +03:00
Pasi Kallinen 02f222bc0c Add vault guards to undisplaceable monsters 2020-04-15 08:59:35 +03:00
Pasi Kallinen ab4e82d1cf Fixes bit 2020-04-15 08:49:43 +03:00
Pasi Kallinen 7efe7b05df Fix "x" and "a" when choosing map location
Recent(ish) change to split unexplored glyphs from solid wall glyphs
resulted in getloc commands to choose unexplored and interesting
locations not work correctly.

Fixes #323
2020-04-15 07:15:41 +03:00
Pasi Kallinen bddb80f13c Make hostile monsters with launcher and ammo keep away
If a hostile monster is wielding a ranged weapon, and is carrying
appropriate ammo for it, make the monster try to stay away,
outside the melee range.
2020-04-14 15:19:30 +03:00
Pasi Kallinen ffb9540295 Document the map characters used in lua 2020-04-14 11:46:57 +03:00
Pasi Kallinen 71754910db Scatter bag of holding contents instead of deleting them
Losing all of your items in one go is really frustrating.
If you blow up your bag of holding, make the contents scatter around
instead of outright deleting them. This will destroy fragile objects.
2020-04-13 21:49:29 +03:00
Pasi Kallinen 28c3478ae6 Add test for selection.iterate 2020-04-13 20:29:06 +03:00
Pasi Kallinen d78dcdcb9b Allow matching any wall map terrain in lua scripts
When matching a terrain, allow using a "w" placeholder that matches
any solid wall:

For example:
   local s = selection.match([[w.w]]);
would match all floor locations with a wall to the left and right of it.
The walls can be solid stone, horizontal, vertical, etc.

This applies to selection.match(), selection.filter_mapchar(), and
des.replace_terrain()
2020-04-13 20:00:34 +03:00
Pasi Kallinen 9513b73169 Trapped container creates occasionally an actual gas cloud 2020-04-13 13:08:39 +03:00
Pasi Kallinen 6b9c9bb170 In-game doc the extended commands accepting 'm' prefix 2020-04-13 11:10:59 +03:00
Pasi Kallinen ecc1ceb581 Allow random mimics to mimic more furniture
In addition to stairs, allow altar, grave, throne, and sink.
2020-04-12 22:08:06 +03:00
Pasi Kallinen ac94c44b0b Prevent searching or waiting next to a hostile
Generally speaking there's no reason to wait or search next to
a hostile monster, so let's just prevent those actions. You can
still do those commands by prefixing them with the 'm' prefix.
2020-04-12 17:32:29 +03:00
Pasi Kallinen 47fb7e5ee5 Fix double free 2020-04-12 16:55:00 +03:00
Pasi Kallinen 6d1df04eda Remove incorrect comment 2020-04-12 15:45:13 +03:00
Pasi Kallinen c88fab4056 Add missing prototype 2020-04-08 08:22:24 +03:00
Pasi Kallinen 665eacf40c Expose scaled mazes to special level lua
Adds a new level init type which directly creates a maze,
optionally setting corridor width and wall thickness,
and removing dead ends.

des.level_init({ style = "maze", corrwid = 3, wallthick = 1, deadends = false });
2020-04-07 19:20:39 +03:00
Pasi Kallinen 297eb934a7 Fix monster booted into limbo trying to act
There's a chance that a tactics-using monster (eg. arch-lich)
teleporting next to you on a full level would get booted off
into limbo. After that, if the monster tried using an item
in the same action you'd get panic "relmon: mon not in list"

Fix this particular case by checking monster mstate.
Other cases may lurk in other places that eventually call mnexto.
2020-04-07 17:23:23 +03:00
Pasi Kallinen fd89663a0f Add selection gradient doc placeholder 2020-04-06 19:03:28 +03:00
Pasi Kallinen c24b9f0f1a Fix one more prototype warning 2020-04-06 18:24:15 +03:00
Pasi Kallinen 7b1bc9dcbd Prevent segfault when not wielding anything 2020-04-06 18:09:47 +03:00
Pasi Kallinen d087746fd7 And some more warning fixes 2020-04-06 15:41:26 +03:00
Pasi Kallinen e215f09ddb Fix even more warnings 2020-04-06 13:34:07 +03:00
Pasi Kallinen 99519c4e5b Fix more warnings 2020-04-06 10:25:17 +03:00
Pasi Kallinen 9411d24edb Fix more warnings 2020-04-05 21:53:45 +03:00
Pasi Kallinen 01e35397de Fix warnings
Add missing prototypes and rename one shadowed declaration.
2020-04-05 21:36:38 +03:00
Pasi Kallinen 1ba1422eba Confused scroll of light conjures tame cancelled lights
Tame cancelled lights are actually quite interesting and useful: they
are a mobile light source that will follow you around, and because they
are cancelled they won't explode at hostile monsters.

This replaces the existing confused scroll effect of creating an area of
darkness (the cursed scroll of light still produces this effect). If you
are confused *and* the scroll is cursed, it summons black lights instead
of yellow ones.

Original change by copperwater <aosdict@gmail.com>, added with
formatting and some functional changes.
2020-04-05 13:21:54 +03:00
Pasi Kallinen cf1c725148 Purple worm changes
Shriekers only spawn purple worms when they're appropriate difficulty.
Non-tame Purple worms eat corpses off the ground.
Baby purple worms attack shriekers.
Hero polyed into baby purple worm is warned against shriekers.

Original changes by copperwater <aosdict@gmail.com>, added with some
formatting adjustments and consolidation.
2020-04-05 12:44:25 +03:00
Pasi Kallinen e34f123698 Make hezrous stink 2020-04-03 21:05:49 +03:00
Pasi Kallinen 13b8a9912f Flip poison gas clouds 2020-04-03 20:42:27 +03:00
Pasi Kallinen 42fc34691d Check for levl typ STONE explicitly
... instead of expecting 0 to be STONE (or unused space in this case)
2020-04-03 13:10:12 +03:00
Pasi Kallinen 5f9714bf92 Remove workarounds for ancient compilers 2020-04-03 08:21:08 +03:00
Pasi Kallinen 2f64f419ad Unify checking if monster is ok in poison gas 2020-04-02 20:53:08 +03:00
Pasi Kallinen 62538f8e62 Fix iron ball being deallocated when saving
When swallowed by an air elemental, going down into a pit
placed the attached iron ball on the floor. Saving (or
using #wizmakemap) then deallocated the iron ball.

Check being swallowed before trying to go down.
2020-04-01 12:20:18 +03:00
Pasi Kallinen f13ee3c9bc Fix birth statistics for pets after #wizmakemap 2020-03-31 20:19:33 +03:00
Pasi Kallinen ac2b34654f Fix lua selection error
There was a rare selection bug where selection was freed by the gc
but it was still in use. Don't remove the selections from the stack
while we're handling them.
2020-03-31 19:11:49 +03:00
Pasi Kallinen 3776b7d382 Fix monsters overflowing out of rooms in special levels
In a special level, creating more monsters inside room contents
than was space in the room placed monsters outside the room,
possibly inside walls of rooms created afterwards.

Prevent monster creation if inside room contents and there's no
space for the monster.
2020-03-29 11:17:40 +03:00
Pasi Kallinen 87513ad6bf Fix polymorphing monster trying to dig undiggable wall
Not sure if this can actually happen in a non-modified game, but
my fuzz testing stopped here, so deal with it.

If a polymorphing monster turns into an earth elemental or other
wall-phasing monster, it can wander into a non-diggable area, and
then turn into a tunneling monster.
This caused mdig_tunnel to issue an impossible.
2020-03-28 15:43:10 +02:00
Pasi Kallinen b8668da3ea Fix purple worm ending up in solid wall
If you're in a vault, the vault guard enters, and your tame purple worm
swallows and kills the guard, the worm ended up inside the vault wall.
Instead return the attacker to the old location, if the defender's
position isn't good.
2020-03-28 11:40:42 +02:00
Pasi Kallinen e89c193a57 Fix flipping while punished
... if either you, the ball, or the chain are outside the flip area.
Just unplace the b&c and then put it down under the hero.
This can only happen via #wizlevelflip, as normal level flipping
is done when creating the level and b&c are not on the map.
2020-03-27 17:30:23 +02:00
Pasi Kallinen 75a24d2846 Fix teleporting not unhiding polyed hero 2020-03-25 19:57:25 +02:00
Pasi Kallinen eec9c2e209 Expose core random number functions to lua
Expose nh.rn2() and nh.random() to lua.
Add a math.random() compatibility shim to nhlib.lua
2020-03-25 12:24:32 +02:00
Pasi Kallinen c8fb419a2c Try to fix pet location inconsistency again 2020-03-24 21:56:24 +02:00
Pasi Kallinen 596ba4bb8a Fix des tests 2020-03-21 14:03:03 +02:00
Pasi Kallinen 6227bdf438 Prevent setting boulder symbol to a control character 2020-03-20 21:04:16 +02:00
Pasi Kallinen a65fc97b44 Prevent zombies in trees in priest quest start 2020-03-20 18:37:01 +02:00
Pasi Kallinen a142ac8140 Unify special level c code for stairways 2020-03-19 21:23:55 +02:00
Pasi Kallinen 9ab6994eae Make Juiblex resist magical digging from inside
Juiblex should be a little bit harder to beat than zapping a digging
wand once you've gotten swallowed and then whacking him once.

Make his HP halve every time you zap digging instead of setting it
to 1.

Change via UnNetHack.
2020-03-18 09:16:26 +02:00
Pasi Kallinen 750d2fe560 Alias "kirin" for "ki-rin" 2020-03-17 19:06:32 +02:00
Pasi Kallinen a57894cedb Prevent monsters in trees in monk quest start 2020-03-17 18:09:33 +02:00
Pasi Kallinen 15019248ae Fix pet location inconsistency
... if the pet attacked hero or another monster by eg.
swallowing them, the pet's location might've changed
during that attack. Count it as movement, so return
immediately.
2020-03-16 22:17:15 +02:00
Pasi Kallinen 44ba4a9e96 Don't flip column 0 2020-03-16 22:10:37 +02:00
Pasi Kallinen 712f545119 Move, rename, and comment out unused function 2020-03-16 11:46:08 +02:00
Pasi Kallinen 408321b4f7 Use TAINT_AGE for old corpses instead of hardcoded value 2020-03-16 11:28:09 +02:00
Pasi Kallinen abbfabd498 Prevent ogres in trees in barbarian quest start 2020-03-16 08:58:07 +02:00
Pasi Kallinen 04c59fff0a Major amnesia revamp
Instead of forgetting maps and objects, make amnesia forget skills.
Forgetting maps and objects could be circumvented with taking notes,
or by using an external tool to remember the forgotten levels.

Forgetting skills allows the player to optionally go down another
skill path, if they trained the wrong weapon in the early game.

Amnesia still forgets spells.

As a replacement for the deja vu messages when entering a forgotten
level, those messages will now indicate a ghost with your own name
existing on the level, given only when the level is entered for
the first time.

These changes based on fiqhack, with some adjustments.
2020-03-15 11:57:34 +02:00
Pasi Kallinen b0e645a650 Lock castle chest
Just to keep the wand in the chest. Even if the soldiers pick up
the chest, they won't open it, and the wand is better protected.
2020-03-14 21:49:18 +02:00
Pasi Kallinen dc9fe0d8bc Tone down scare monster by excluding humans and uniques
Scroll of scare monster completely shut down most of the actual
challenging monsters, such as uniques. Tone it down, so you can
use it to ignore the smaller threats while dealing with uniques,
or get most of the effect in the early game when you're usually
dealing with normal monsters.
2020-03-14 21:04:08 +02:00
Pasi Kallinen 55bfc8115a Flip timed effects
In wizard mode, freezing some water on the ground, then
flipping the level did not flip the coordinate of the ice
thawing timed effect. This could cause an impossible complaint.
2020-03-14 11:28:32 +02:00
Pasi Kallinen 961b2a11ff Fix vault guard leaving monsters encased in stone
For some reason the vault guard fake corridor code checked
if the hero was outside the corridor before removing monsters.
But the vault end of the corridor usually gets sealed off
even while you're still in the corridor. This left monsters
stuck in solid rock.
2020-03-13 19:32:47 +02:00
Pasi Kallinen 2ff8523481 Fix priest generated inside temple wall
In a rare case, a random room's width can be 2 tiles, and if
that room was converted into a temple, the priest ended up
inside the wall. Try to put the priest on a random valid position
around the altar, or on it.
2020-03-12 19:17:06 +02:00
Pasi Kallinen a6c600fd61 Handle gone portal for migrating monsters
If the quest portal was gone, due to hero expulsion, migrating monsters
caused an impossible.
2020-03-11 19:52:12 +02:00
Pasi Kallinen 9adb11238a Flip locations only if inside the flip area
Objects and hero outside the level area (embedded in undiggable
rock by eg. polying into earth elemental) cannot be flipped.
2020-03-11 19:25:52 +02:00
Pasi Kallinen f664e83070 Handle gone portal when going back in quest 2020-03-10 21:49:38 +02:00
Pasi Kallinen ae471e71b2 Make sure random doors don't open into solid wall
When making a random door into a random wall or random position
in a room, keep trying harder to find a location that doesn't
have solid wall behind it.

Fixes the Wizard tower door.
2020-03-10 18:11:30 +02:00
Pasi Kallinen 67d3cd31f8 Prevent wizmode panic
In wizard mode, if you angered your quest leader and got expelled from
the quest (which removes the quest portal from the dungeon), then used
the wizmode level teleport menu to teleport back to the quest start and
talked with the angry leader, you would get booted back to the dungeon,
and the game panicked because the dungeon end of the portal didn't
exist anymore.
2020-03-10 08:02:12 +02:00
Pasi Kallinen 9ea2fb7422 Fix flipping some monsters
Don't flip the guard waiting to be disposed of.
Don't flip the occasional monster (usually an earth elemental)
outside the level bounds.
2020-03-08 20:01:41 +02:00
Pasi Kallinen f18b5bb59b Make special levels generate objects with genocided monster classes
If a special level explicitly requests eg. a statue with a genocided
monster class, allow generating it.

Rationale is that those objects were generated before the monsters
became extinct. Also fixes a lua error.
2020-03-08 14:08:32 +02:00
Pasi Kallinen aca240c928 Limit wizgenesis to max 255 monsters 2020-03-08 00:15:28 +02:00
Pasi Kallinen fcfa5dc267 Fail fetch-lua in Unix Makefile more gracefully
If missing curl or failing to download the lua tarball,
don't try to untar the nonexistent file.
2020-03-07 22:38:33 +02:00
Pasi Kallinen f5d9324f28 Fix wizmakemap to consider monster birth counts and uniques
Also add a new wizmode command #wizborn to show those.
2020-03-07 21:35:26 +02:00
Pasi Kallinen d89b9c8c1a fixes doc bit
Previous commit should've been:

Fixes #311
2020-03-07 17:18:30 +02:00
Pasi Kallinen 8b6ae1642d Fix flipping non-existent stairs
If the stair or ladder x coord is 0, it doesn't exist.
Flipping it, caused "u_on_newpos: trying to place hero off map <80,0>"
when coming back up from the valley into the castle, and the
castle was flipped.

Fixes #331
2020-03-07 17:07:10 +02:00
Pasi Kallinen 2fc9c02f88 lua special level feature flags
Allow des.feature() to set rm flags for the special features.
2020-03-06 20:30:15 +02:00
Pasi Kallinen 54ca0c2211 Lua tests for map and room contents 2020-03-04 22:07:10 +02:00
Pasi Kallinen a6dfbfca2f Lua: Add contents function to room and map
The function will get the map/room width and height as a parameter.
2020-03-04 20:05:15 +02:00
Pasi Kallinen 00be8be45a Start of lua api docs
... in asciidoc format. Use "asciidoctor -b html5 lua.adoc"
to generate the HTML version.
2020-03-02 18:10:35 +02:00
Pasi Kallinen c9b21e36a7 Add lua selection match method
Also improve the replace_terrain command parameters.
2020-03-02 16:17:53 +02:00
Pasi Kallinen 297863d4bc Fix room tests 2020-03-01 10:28:19 +02:00
Pasi Kallinen ce3b45944b Fix Fort Ludios room type
... and add an impossible when lua tries to create unknown room type.
2020-03-01 10:13:53 +02:00
Pasi Kallinen 22528d31f5 Allow coord in place of x and y in special level lua script 2020-02-28 22:14:36 +02:00
Pasi Kallinen d86b7e8e7c Demon lords and princes suppress teleporting in Gehennom
Instead of having the demon lair levels unconditionally no-teleport,
grant demon lords and princes the ability to suppress teleportation
in Gehennom on the level they are on.
2020-02-26 20:03:00 +02:00
Pasi Kallinen 816079c8dd Lua: accept different params for gold function 2020-02-26 17:57:47 +02:00