Commit Graph
100 Commits
Author SHA1 Message Date
Pasi Kallinen 10a47c0713 Remove unused curses define 2026-04-13 16:54:44 +03:00
Pasi Kallinen 8d6ab2f9ab Allow m-prefixing #annotate
This is the same as m-prefixing #overview
2026-04-12 19:55:12 +03:00
Pasi Kallinen 635dca05d5 Shapeshifters change shape less
Non-vampire shapeshifters were changing shape a lot; often you
could have a chameleon turning into a different monster each turn.

Now monster shape changing is actually their "special" power,
and it takes 3-12 turns until they can do it again.
2026-04-12 19:01:20 +03:00
Pasi Kallinen 26453eaea0 Allow polearming a monster in unlit space
... as long as you can see the monster, eg. via infravision
2026-04-12 15:54:18 +03:00
Pasi Kallinen 8cf6c62862 Don't put non-m-prefix command msg into history 2026-04-11 23:05:41 +03:00
Pasi Kallinen 9d27cfe8b8 Prevent selecting all options in #optionsfull menu
No-one ever intentionally selected all entries in the options
menu.  Prevent it from happening by accident.
2026-04-11 18:37:56 +03:00
Pasi Kallinen 9172b7eb09 Add tutorial and tips to Windows nethackrc template 2026-04-10 16:39:16 +03:00
Pasi Kallinen 190cbfa2b7 Fix segfault when binding keys in-game 2026-04-06 11:50:22 +03:00
Pasi Kallinen 9c8c17b70c Tweak the blessed potion of see invisible
Blessed potion guarantees the intrinsic, if you're
invisible and can see invisible before quaffing.
2026-04-04 17:58:30 +03:00
Pasi Kallinen 87b3549134 Blessed potion of see invisible
Blessed potion of see invisible was guaranteed to give see invisible
intrinsic, making it far too easy to acquire.  It now has 1/10 chance
of giving it permanently, somewhat similarly to potion of invisibility.
2026-04-04 17:01:58 +03:00
Pasi Kallinen c5efbf6cf7 Split level rnd mon generation into separate function 2026-04-04 16:08:58 +03:00
Pasi Kallinen 5f1163c11a Change the tips internal data struct
Previously adding any new tips invalidated saves; now you can have
up to the number of bits in a long without change in savefile.

Invalidates saves.
2026-04-04 15:39:46 +03:00
Pasi Kallinen 8c55e7df1c Code style nit 2026-04-03 12:59:09 +03:00
Pasi Kallinen b2a80ab87a Prevent phaseable monster hiding deep in undiggable walls
The outer edge of a random dungeon level can have undiggable
walls.  Phaseable monsters, such as earth elementals, could
hide deep inside that boundary.  Turn the walls beyond the
first layer of non-diggable walls also non-phaseable.
2026-04-02 15:43:13 +03:00
Pasi Kallinen fc6c7d70be Give spellcast attack to monster priest and wizard
Acolytes grow up to priests, apprentices to wizards, but they
did not cast spells after they grew up.  Give the monster priests
and wizards the same spellcasting attack as all the other
priest and wizard -type monsters.

This lack of magical ability goes back at least to 3.3.1;
I didn't bother checking back further.
2026-04-02 12:28:00 +03:00
Pasi Kallinen 542d1db5f4 Another fix for #K4317 - monster grudge
Undead monsters created by the level creation routine do not grudge
other (zombifiable) monsters created during the level creation.

This of course doesn't prevent the grudge happening with monsters
created during gameplay.

Invalidates saves and bones.
2026-04-01 19:24:43 +03:00
Pasi Kallinen 3917f5493d More mcastu code reorg
Instead of using two separate functions with switch-cases for
wizard and clerical spell lists, define the spell lists
as arrays and use a single function to pick a spell
from the lists.

Adds levels to the monster spells, using the switch-case values,
with some minor fudging.
2026-04-01 13:17:09 +03:00
Pasi Kallinen 9bf90ee07f Replace magic number with define 2026-03-30 19:07:18 +03:00
Pasi Kallinen f68f15e3b5 Simplify some special level lua
These were generated by a script that converted the des-file
format to lua.
2026-03-30 18:27:10 +03:00
Pasi Kallinen f4173adc88 Use define for player name length in botl
This defines the cut-off how many characters of the player's name
is shown in the bottom status line.
Also increase the limit from 10 characters to 16.
2026-03-30 16:41:37 +03:00
Pasi Kallinen 9fba4af323 Status hilite menu retry limit
Fuzzer got stuck here for a very long time, so bail out
from the status hilite menu after few failed tries.
2026-03-30 13:29:12 +03:00
Pasi Kallinen e3e01267aa Debug panic when level has too many (sub)rooms 2026-03-29 18:47:55 +03:00
Pasi Kallinen f8bd79354c Add a history menu for wizwish
Use the 'm' Prefix to make wizwish show the history menu.
Also entries wished via WIZKIT are added to the history.

While debugging, I often need to wish the same thing multiple
times, and typing or pasting it with mouse is annoying...
2026-03-25 13:46:07 +02:00
Pasi Kallinen 41b2087436 Hero has a small chance of catching items thrown at them 2026-03-25 09:35:39 +02:00
Pasi Kallinen d78af5cec7 Add monster spell header file mcastu.h
Move the monster spell definitions there, and use hackery
(similar to objects.h) to generate enum and data from
the header file.

I have not tested Windows, VMS, or Amiga builds.
2026-03-24 17:26:24 +02:00
Pasi Kallinen d80e194735 Split mcast_spell into separate functions 2026-03-23 14:51:48 +02:00
Pasi Kallinen c0f5d2dd92 Allow monster level adjustments in special levels
Add a new parameter to des.monster, m_lev_adj, which is a level
adjustment for the monster.  This only applies to the monster's
level, so basically only affects the spellcasting, it does not
change the monster's hit die or inventory.

Change one of the shamans in Orctown to be 3 levels higher.
2026-03-23 12:51:50 +02:00
Pasi Kallinen d6cbaca654 Reorganize mcastu code
Merge the two different enums, so all monster spells are in one
list.  This should have no functional difference, but cleans up
the code a bit.
2026-03-23 11:42:54 +02:00
Pasi Kallinen 8e4c7f9fb5 Change some command keys
Change 'v' from #versionshort to #chronicle.
Change 'V' from #history to #versionshort.
History can still be accessed either directly with the extended command,
or via the help menu.
Versionshort now accepts the m-prefix, and then shows the longer version.
2026-03-21 17:56:37 +02:00
Pasi Kallinen 9fc1514253 Amulet of magical breathing increases energy regen
Normally energy regen is 1d2 or 1d3, so wearing the amulet increases
that to 1d4 or 1d5.  The only way to get energy regeneration is via
The Eye of the Aethiopica, so you cannot have both at the same time.
2026-03-21 13:20:14 +02:00
Pasi Kallinen 63a78edcfa Add toggle extended command
Allows the user to configure a key binding to toggle any boolean
option, for example:

BIND=':toggle(price_quotes)
BIND=v:toggle(autodig)

The option must be settable in-game.
2026-03-21 12:17:37 +02:00
Pasi Kallinen f85b5b1c9d Fix segfaults from the key binds change
Should've checked rest_on_space behaviour ...
2026-03-20 22:49:29 +02:00
Pasi Kallinen c595f241e6 Change key binds from array to linked list
Key bindings were stored as a fixed-size array, indexed by the input
character, pointing to the extended commands.  This changes that into
a linked list of an intermediary struct Cmd_bind, storing the input key
and the pointer to the command.

This is just code cleanup for future enhancements, and should have
no effect on gameplay.
2026-03-20 19:57:44 +02:00
Pasi Kallinen 9877e52025 Ring of stealth prevents hero from leaving tracks 2026-03-18 18:04:33 +02:00
Pasi Kallinen 18cb293766 Replace magic number with define 2026-03-18 17:12:01 +02:00
Pasi Kallinen 1c5cf5382b Hellfill variance 2026-03-17 17:29:43 +02:00
Pasi Kallinen 66e7123678 Categorize more commands as general commands
"general commands" tend to be ones which take no game time,
or are non-diegetic.
2026-03-17 13:38:12 +02:00
Pasi Kallinen 13e7d21b93 Replace magic number with define 2026-03-16 15:36:23 +02:00
Pasi Kallinen 619de1ec0e Make monster destroy armor -spell erode armor first
Instead of outright destroying the armor, the spell will instead
first erode the armor.  The spell hits 2-4 times, so if it hits
the same armor 4 times, it will get destroyed.  This does not
hit erodeproof armor.

Also change the scroll of destroy armor, so that blessed one will
destroy a cursed armor, if hero is only wearing that.
2026-03-16 11:24:19 +02:00
Pasi Kallinen 226157004b Make migratemons ignore debug_mongen
Same as wizgenesis, migratemons should create monsters even
when random monster generation is disabled.
2026-03-11 17:35:23 +02:00
Pasi Kallinen fe7b3ce09d Empty tin hallu msg 2026-02-15 17:01:49 +02:00
Pasi Kallinen 78217c3ebd Allow rogues to backstab sleeping or paralyzed monsters 2026-02-13 12:53:21 +02:00
Pasi Kallinen bbc3eea066 Make sure negatively enchanted boomerang hits anything 2026-02-12 14:32:58 +02:00
Pasi Kallinen db36ee35de Fix the healer knife bonus
dmgval is also used for monster attacks; move the healer knife
bonus to actual hero-specific code, and make sure it only
applies to hand-to-hand combat.
2026-02-11 08:22:02 +02:00
Pasi Kallinen 4b30e3fab8 Healers may get tiny damage increase with knives
Styled as anatomy knowledge, a healer attacking a monster in melee
with a knife gets +1 damage per 6 dead monsters of that type,
capped at +3 damage.

Handwaving away the fact we're not keeping track who actually
killed the monsters...

Idea from aosdict.
2026-02-08 18:11:06 +02:00
Pasi Kallinen 3877e142e7 Add more bustle to bustling town 2026-02-08 17:19:53 +02:00
Pasi Kallinen 63dd80f5ec More code style nits 2026-02-07 17:03:54 +02:00
Pasi Kallinen 74390fb690 Split ray bouncing dir into separate function 2026-02-07 14:51:03 +02:00
Pasi Kallinen 79c688cc6b Code style nit 2026-02-06 17:26:54 +02:00
Pasi Kallinen 37168ab188 Boomerangs can hit multiple monsters
The number of monsters it can hit depends on the enchantment.
2026-02-04 22:35:22 +02:00
Pasi Kallinen 27adb7c71d Light-spell is clerical, if playing a priest
Ideally the spell adjustment should be in o_init, but by that time
hero's role has not yet been set.
2026-02-03 12:07:12 +02:00
Pasi Kallinen b34b7e08a4 Fix lua reset_level
The lua des.reset_level() call did not reset the special level
coder, so some values were kept and couldn't be changed.
Adjust the movement tests for this change.
2026-01-28 10:06:58 +02:00
Pasi Kallinen 060c3de8eb Lua tests: code coverage for applying some items
Add a new debug flag prevent_pline, which prevents all messages
from going out to the UI. This prevents the tests from stopping
for -more-.
Add rudimentary tests for applying whistles, camera, and stethoscope.
2026-01-27 17:33:08 +02:00
Pasi Kallinen 11bed1f55b Lua tests: generation of each object
Test generation of every object, both via des.object and obj.new.
Expose FIRST_OBJECT and LAST_OBJECT numbers to lua.
Add lua nh.int_to_objname, a function to convert integer value to
object base name and class.
Allow creating new nethack lua object by specifying id and class.
2026-01-26 18:00:33 +02:00
Pasi Kallinen 2dc95dae42 Actually use the lua argc 2026-01-25 18:38:52 +02:00
Pasi Kallinen 92a8d1dab3 Lua tests: monster creation coverage
Expose constants NUMMONS, LOW_PM, and HIGH_PM to lua.
Allow converting an int to monster type name.
Create one of each type of monster in the lua tests.
2026-01-25 18:32:46 +02:00
Pasi Kallinen f73d9ee704 Expose selection size description to lua 2026-01-25 15:18:51 +02:00
Pasi Kallinen 4bf1fb5c68 Lua tests: more special level code coverage 2026-01-25 14:50:02 +02:00
Pasi Kallinen 8ae3d0f6bc Lua tests: code coverage for selection room and gradient 2026-01-25 14:18:01 +02:00
Pasi Kallinen 68ba3955fd Lua tests: more code coverage for rooms 2026-01-25 13:49:10 +02:00
Pasi Kallinen b5dd0eb894 Lua tests: more code coverage for traps 2026-01-23 18:24:28 +02:00
Pasi Kallinen 3b4ce60df4 Lua tests: more code coverage 2026-01-23 17:43:54 +02:00
Pasi Kallinen c8712fa288 Free the cmdq in getlin 2026-01-22 18:42:11 +02:00
Pasi Kallinen 49a87bd09c Lua pushkey and getlin
Allow lua nh.pushkey to push multiple keys,
make getlin return the keys in the command queue.
2026-01-22 18:16:55 +02:00
Pasi Kallinen b9f8f845fc Test for drawbridge 2026-01-21 20:21:12 +02:00
Pasi Kallinen c5dc08d23a Tests for gas_cloud, exclusion, levregion 2026-01-21 20:15:14 +02:00
Pasi Kallinen e9f57281f8 Expose flip_level to lua 2026-01-20 17:50:27 +02:00
Pasi Kallinen ae452e04b9 Don't discover generic objects
Potion of object detection and then looking at a generic object glyph
on the map would try to "discover" the generic object, and the loop
in discover_object would go too far, overwriting the exclusion_zones
pointer.

Take the easy route and just prevent discovery of generic objects;
there are probably other places where the generic objects should
be handled too, but the fuzzer hasn't hit them.
2026-01-16 21:17:19 +02:00
Pasi Kallinen eed952a095 Add more death drops to leather golems
In addition to the leather armor, leather golems can now drop
leather cloaks and saddles.
2026-01-15 19:02:44 +02:00
Pasi Kallinen a4e032762f Rope golems may death drop grappling hooks 2026-01-15 18:44:46 +02:00
Pasi Kallinen d0b9846367 Move item actions into separate src file
Haven't tested compilation on Windows and VMS ...
2026-01-11 14:46:25 +02:00
Pasi Kallinen 96394394b8 Fix comment typo 2026-01-11 11:42:16 +02:00
Pasi Kallinen 40b39c1026 Bigroom 13: Add few more pillar arrangements 2026-01-10 17:47:34 +02:00
Pasi Kallinen e93f0dedbf Make lyncanthropy less crippling
Now, the were-creature instincts will keep the hero from
unintentionally changing shape while next to hostile creatures.
2026-01-10 14:05:06 +02:00
Pasi Kallinen e504d44de2 Add "snake wall" to bigroom variant 1
Also increase the chances of having walls in bigrm-1 from 75% to 80%
2026-01-10 11:19:52 +02:00
Pasi Kallinen 99b893c786 Add a new bigroom variant "pillars"
Some variants have a bigroom variant called "Mines of Moria";
this one is very much that, but has several different arrangements
of the pillars.
2026-01-09 19:39:45 +02:00
Pasi Kallinen b19db444c5 No wish resuming for the fuzzer 2026-01-09 16:13:30 +02:00
Pasi Kallinen 8d87886458 Fix vision when vampire changes form on a door 2026-01-07 13:07:07 +02:00
Pasi Kallinen b9d781e0b2 Fix segfault when carried box explodes
Opening a trapped box in inventory, if the box exploded and was
not destroyed, then temporary variable otmp was pointing to null.
2026-01-06 21:00:33 +02:00
Pasi Kallinen f2cd27551d Just pass a mfndposdata pointer to should_displace 2026-01-04 16:34:28 +02:00
Pasi Kallinen 37df18b59c Use struct to pass data out of mfndpos
Instead of passing two array pointers to mfndpos, fold the data
into a specific struct.
2026-01-04 14:00:43 +02:00
Pasi Kallinen 01928276d5 Monsters use wand of teleportation more 2026-01-03 11:04:13 +02:00
Pasi Kallinen 5b22feb795 Reduce the effect of luck on to-hit
Luck has a massive effect on the to-hit chance; maximum luck alone
(which almost everyone has past the midpoint of the game) gives
10 points to to-hit, so accounts for 50% chance alone, excluding all
other effects.

Multiple variants do something similar to this, so it is well tested.
This version comes from xNetHack by copperwater <aosdict@gmail.com>,
and allows the +1 or -1 luck adjustments of early game, such as full moon,
to have an effect.
2025-12-31 12:47:20 +02:00
Pasi Kallinen 0dac2b5fa0 TTY: add support for the palette config option
For now, terminal colors are not reset back when exiting NetHack.
Depends on CHANGE_COLOR compile-time option.
2025-12-30 19:26:07 +02:00
Pasi Kallinen 6707d3bfba Safe armor enchantment limits
The safe armor enchantment limit is lowered by one, if the armor
is innately magical.  This takes off 3-7 points of AC from
a typical ascension kit, but should not really have any effect
for early game.

Also clean up the relevant code a bit.
2025-12-27 18:24:26 +02:00
Pasi Kallinen 91cc3e3f12 Replace a weight magic number 2025-12-14 20:23:22 +02:00
Pasi Kallinen 758528f094 Grimtooth and Sunsword invoke can be paid with magic power
If the invoke timeout hasn't run out, the effect will take 25 pw,
the same as a lvl 5 spell.
If hero doesn't have that much, then the invoke fails.
2025-12-14 12:00:30 +02:00
Pasi Kallinen b92cccbbcd A line added, a space removed 2025-12-12 17:57:58 +02:00
Pasi Kallinen e68c5826d3 Remove extra space 2025-12-12 17:44:59 +02:00
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