Commit Graph
100 Commits
Author SHA1 Message Date
Pasi Kallinen 229930e505 Fixes and sanity checks for monster undetected and trapped states
Adds sanity checks for mtrapped and mundetected states.

Fixes cases where those were left in wrong state.

1. Trapped monster (eg. a nymph) teleported out of a trap
2. Monster was hiding under ball or chain, which then got removed
3. While restoring a level, a zombie corpse revived while monster
   was hiding under it
4. A general case where the only object was deleted off floor and
   a monster was hiding under it

Monsters hiding under ball or chain will now get revealed when
the b or c are moved.
2020-11-24 19:37:43 +02:00
Pasi Kallinen e100d1a137 More unpolyable unifying
... and fix the potion dipping case.
2020-11-17 18:00:43 +02:00
Pasi Kallinen d81e1672aa Unify unpolyable objects to single define 2020-11-16 18:42:12 +02:00
Pasi Kallinen ccb5bc4b55 Avoid hard-coded bit twiddling 2020-11-15 19:56:35 +02:00
Pasi Kallinen d6384f4061 Use enums instead of magic values 2020-11-15 19:32:21 +02:00
Pasi Kallinen 0dc44ad210 Update comment about xchar 2020-11-15 14:25:45 +02:00
Pasi Kallinen deb730d9b5 More hypothetical type mismatches 2020-11-15 13:51:47 +02:00
Pasi Kallinen 7cfc5a7142 Fix buffer underrun in curses 2020-11-15 13:22:45 +02:00
Pasi Kallinen 289c8d654d Futureproofing hypothetical type mismatches
If we ever want huge maps with COLNO or ROWNO larger than signed char,
this will at least allow the game to compile and start when typedef'ing
xchar to int. Trying to use huge maps exposes more bugs.
2020-11-14 13:53:09 +02:00
Pasi Kallinen 6ec55a3624 Rework stairs structure
Use a linked list to store stair and ladder information, instead
of having fixed up/down stairs/ladders and a single "special" (branch)
stair.

Breaks saves and bones.

Adds information to migrating objects and monsters for the dungeon
and level where they are migrating from.
2020-11-13 20:27:17 +02:00
Pasi Kallinen c9ac5bc48a Increase EDITLEVEL post Zombie Apocalypse
I forgot to increase EDITLEVEL, as the Zombie Apocalypse added a timeout
routine, messing up saves and bones.
2020-11-04 11:36:52 +02:00
Pasi Kallinen 05263bc276 Fix memory leak when adding basic color menucolors 2020-10-30 23:04:22 +02:00
Pasi Kallinen 91c46ab54b Restful sleep regenerates hp
When sleeping due to wearing an amulet of restful sleep,
hit points will regenerate, one point faster than with normal regeneration.
2020-10-29 19:14:32 +02:00
Pasi Kallinen 22ca1ae4da Fix monster hiding under hatching egg staying hidden 2020-10-24 18:32:08 +03:00
Pasi Kallinen aeb0ea65e3 Mild Zombie Apocalypse
When a zombie (or lich) kills a monster in melee without a weapon,
the monster can rise few turns later as a zombie.

The only creatures that can be zombified are ones that actually have
a zombie counterpart monster. A zombie cannot turn a jackal into
a zombie, for instance. But it could turn a shopkeeper into a human
zombie, or a dwarf king into a dwarf zombie.

Zombies will fight with monsters that can be turned into zombies.

Originally this was a SliceHack feature, but this is based on xNetHack
version of it, with some modifications.
2020-10-23 19:47:10 +03:00
Pasi Kallinen 566dde8683 Match object description via single function
making the code more readable.

Instead of doing strcmp(OBJ_DESCR(objects[otyp]), "foo"),
just call objdescr_is(obj, "foo")

(via xNetHack)
2020-10-20 19:19:57 +03:00
Pasi Kallinen 3a31587ca9 Prevent ghosts from being renamed
(via xNetHack)
2020-10-18 20:28:32 +03:00
Pasi Kallinen f38cb63714 Spitting monsters try to stay away from melee range 2020-10-18 19:18:38 +03:00
Pasi Kallinen fc6b491303 Fix thinko in reset travel dest condition 2020-10-17 16:48:07 +03:00
Pasi Kallinen 5ddafa5c81 Only reset if we actually went to travel destination 2020-10-17 12:13:17 +03:00
Pasi Kallinen a9e4904131 Reset travel destination if reached via teleport 2020-10-17 12:08:51 +03:00
Pasi Kallinen b6125b8f78 Pre-populate teleport destination prompt with travel destination
This has been implemented in multiple variants, and seems like
a small but useful quality of life improvement.
2020-10-16 19:14:01 +03:00
Pasi Kallinen 3d6551a70e Lua: Allow matching any wall
A 'w' in a map fragment will match any wall (IS_WALL macro):

   des.replace_terrain({ mapfragment = "w", toterrain = "F" });
2020-10-10 11:31:16 +03:00
Pasi Kallinen 37339abebd Fix dropping const from params 2020-10-05 17:17:07 +03:00
Pasi Kallinen 40648503b2 Increment EDITLEVEL due to safe_wait 2020-10-02 19:11:15 +03:00
Pasi Kallinen fac154d364 Fix some Guidebook.tex errors 2020-10-02 19:00:40 +03:00
Pasi Kallinen 396b819988 Add safe_wait to toggle search and wait prevention 2020-10-02 19:00:40 +03:00
Pasi Kallinen 6a35a84c56 Fire sources can ignite candles, lamps, and potions of oil
... on the floor, in monster inventory, and in hero's inventory.

Items in your inventory being ignited produce a message even if you're
blind - you can see the lit-state by viewing inventory anyway, so just
give player the message.

(via xNetHack)
2020-09-30 19:49:10 +03:00
Pasi Kallinen fb7b578af1 Make piranhas faster and more bitey
Piranhas are pretty bland, so make them faster and give them
an extra bite attack.

(via xNetHack)
2020-09-30 19:05:02 +03:00
Pasi Kallinen 476990b303 Fixes and lua doc 2020-09-29 17:35:16 +03:00
Pasi Kallinen 6348a53bd8 Fixes doc 2020-09-28 18:28:19 +03:00
Pasi Kallinen 441bb345d7 Fixes doc of the recent pull requests 2020-09-27 22:26:39 +03:00
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