Commit Graph

2500 Commits

Author SHA1 Message Date
Pasi Kallinen
7bfbe0fba9 Lua: Allow setting debug_flags 2021-07-29 07:36:08 +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
PatR
31d6b27481 altmeta revisited
Put the flag that parse() uses to tell readchar() that the next
keystroke is a command into the program_state structure instead of
having it be a static variable in cmd.c.  Conceivably an interface
could make use of it, and even if none do, it is program state....

More #558
2021-07-27 11:03:20 -07: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
nhmall
227ef401df change NetHack's MACOSX references to MACOS 2021-07-24 17:52:47 -04: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
PatR
5a09a01a13 gold dragon and scales
Add two new monsters and two new objects:
 gold dragon
 baby gold dragon
 gold dragon scale mail
 set of gold dragon scales

A couple of variants seem to have added these already, but this came
off my ancient list of monsters to add and was done from scratch.
It's a clone of silver dragon, but instead of having reflection and
breathing cold, a gold dragon emits light and breathes fire; because
of the latter it can be seen with infravision like a red dragon.
Adult gold dragons are lawful as in the AD&D Monster Manual rather
than chaotic as the wiki pages show for the variant versions.

Worn gold dragon scales operate similar to wielded Sunsword:  when
blessed, radius is 3 (same as a lamp), if uncursed, radius is 2, and
if cursed, radius is 1 (but functions as 2 when worn by the hero,
otherwise there would be no tangible effect).  Gold dragon scale mail
gets an extra +1, making blessed gold DSM have a bigger radius than
lamps.  Embedded scales have radius 1 regardless of BUC state; light
for that case comes from the gold dragon monster form the hero is in.
When not worn, gold scales and scale-mail don't emit any light.

The tiles use a mix of yellow (for gold) and red.  The two object
tiles seem reasonable variations of the corresponding silver dragon
ones.  The two monster tiles definitely need work since the silver
ones were mostly cyan and changing that to red did not produce very
good result; subsequent attempt at a mixture was haphazard at best.
2021-07-23 10:41:57 -07: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
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
8ff2badf51 Use define for wand wresting chance 2021-07-17 20:59:40 +03:00
Michael Meyer
d8dc16e393 Add 'readable' Hawaiian shirt designs
Functionally similar to reading a T-shirt or apron, but rather than
actual text printed on the shirt being displayed, the design of the
Hawaiian shirt is described: for example, "hula dancers on an orange
background" or "tropical fish on an abstract background".  Much like
T-shirts have their text included in the game-end inventory list ('a
blessed +2 T-shirt with text "foo"'), Hawaiian shirts now have a brief
description of their design appended to their item name under the same
circumstances.

Because 'reading' a Hawaiian shirt doesn't actually involve reading
text, using the 'r' command in this way doesn't break illiterate
conduct.
2021-07-16 18:05:21 +02:00
nhmall
ed9647310a deal with gold leaving shop via scatter()
fixes #538
2021-07-10 19:41:55 -04: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
nhmall
216c26aaef do vs2017 warnings.h a little differently than vs2019
fixes #545
2021-07-07 09:05:22 -04: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
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
f25a6e26ee Use enums and defines for directions 2021-06-27 15:46:56 +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
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
PatR
a9134fd8b9 more "<mon> appears in a cloud of smoke"
Now that the appear message isn't limited to summoning by demon,
seeing "the Angel of <foo> appears in a cloud of smoke" seems
strange.  Angels weren't covered by the vapor/dust/&c change for
elementals.  Make angels appear in a flash of light.
2021-06-21 17:47:51 -07:00
PatR
fa7980c585 monster name formatting
While testing monster summoning by using a debugger to force the
outcome, I saw "the renegade Angel of <foo> appears in a cloud of
smoke" as if only one such creature existed.  Trying to change
that to "a renegate Angel" pointed out some problems:  type names
like Angel, Green-elf, and Uruk-hai fool an() into using "the"
because of their capital letter.  Fixing that was a bit of a hack
and worked for Green-elf and Uruk-hai but not for Angel because
it has the eminion extension so uses priestname() instead of the
guts of x_monnam().  Fixing that involved more hackery and now I
feel unclean, but it seems to be working.

It wasn't as noticeable as it might have been because most of the
time that "the Angel of <foo>" or "the priest of <bar>" was shown,
the caller is requesting "the" rather than "a/an".
2021-06-21 17:44:35 -07:00
PatR
0bb77f455d "<foo> appears in cloud of smoke."
Have water demons appear in a cloud of vapor rather than a cloud of
smoke.  This adds a few other alternatives but they'll never happen.
Elementals could only be summoned by Angels but Angels never call
msummon() as far as I can tell.  Vortices aren't summoned at all
but the smoke/vapor/&c routine has provisions for them.

The cloud of smoke message used to be given only when the summoner
is a demon.  Now it will be given if the last--or only--summoned
creature can be seen to arrive, no matter whether summoned by a
demon, a non-demon (which I think isn't possible), or post-Wizard
harassment.
2021-06-20 16:45:42 -07:00
PatR
0b5a112b0c gender for figurines
Use (obj->spe & CORPSTAT_GENDER) for figurines as well as for
statues and corpses.

Support wishing for
 "{female,male,neuter} {corpse,statue,figurine} [of <monster>]".
and
 "{female,male,neuter} <monster> {corpse,statue,figurine}".
Also
 "{corpse,statue,figurine} of {female,male,neuter} <monster>"
where the qualifier might be in the middle instead of a prefix.
2021-06-17 16:03:45 -07: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
PatR
57e970b227 mon_pmname(), obj_pmname()
Revive some code from 5 or so years ago that's been sitting in a
defunct local git branch.  There are a couple of references to
figurines having gender; the old, unfinished code did already have
support for that, the current code doesn't.  It probably won't take
much effort to add it in but I want to get this first part out of
the way.

Replace some of the
pmname(mon->data, Mgender[mon]) calls with simpler
mon_pmname(mon) and some
pmname(&mons[statue->corpsenm],
   (statue->spe & CORPSTAT_GENDER) == ... ? ... : ...) with simpler
obj_pmname(obj).  There are other instances of them which haven't
been changed but could be.
2021-06-12 03:07:30 -07:00
PatR
04a8ddcce1 fix github issue #531 - genderless corpses
Dead monsters that had traits saved with the corpse would revive as
the same gender, but ordinary corpses revived with random gender so
could be different from before they got killed.

Since corpses of monsters lacked gender, those for monsters with
gender-specific names were described by the neuter name.

This is a fairly big change for a fairly minor problem and needs a
lot more testing.

Fixes #531
2021-06-08 03:43:46 -07: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
PatR
41eecdf6b3 curses menu: support backspace/delete for counts
Have curses call the core get_count() routine instead rolling its
own so that backspace and delete are supported.  That part was
trivial to accomplish.  Unfortunately it brought the disappearing
menu phenomenon back so it became more complicated overall.
2021-06-06 05:54:53 -07:00
nhmall
91ab71f0f9 windows and visual studio follow-up bit 2021-06-03 23:43:32 -04:00
nhmall
0a10bd632d change references from winnt to windows
rename sys/winnt to sys/windows
move vs (visual studio) folder out of win/win32 and into sys/windows
rename include/ntconf.h to include/windconf.h
rename winnt.c to windsys.c
place visual studio projects into individual subfolders.

This will hopefully resolve GitHub issue #484 as well.
2021-06-03 23:26:00 -04:00
PatR
0fda8504bb sp_lev.c reformatting
Mostly reformatting but fixes a bug in mapfrag_free(); would matter
if the same map fragment gets freed a second time.
2021-05-30 01:01:01 -07: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
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
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
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
PatR
dae25564bc more object->dknown handling
Fix a couple of places that set obj->dknown to 0 to deal with some
special cases where it should be left at 1.  (Other places do that
but deal with potions where hardcoded 0 remains appropriate.)
2021-05-13 09:38:53 -07:00
PatR
b630d5e038 fix issue #509 - shop 'glob' pricing segfault
A recent change made it possible for a glob to have its dknown flag
cleared and that exposed globby_bill_fixup() passing Null shopkeeper
to get_cost(), triggering a crash.

Make the routine that clears dknown/known/bknown/&c also be the
routine used to initialize those flags for a new object so that it
is the place that handles various special cases.  That hides the
shop bug again.

But also fix the shop bug even though it won't be triggered.

Fixes #509
2021-05-12 16:13:40 -07: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
PatR
cecda13ab2 fix pull request #504 - partly eaten food
that has no nutritional value.  Prevent applying the partly eaten
attribute to wished for food if the full nutrition isn't at least 2.
The problem case was 0 nutrition wraith corpse, yielding "partly
eaten food (1) more nutritious than untouched food (0)" when setting
the corpse's weight.  That one was possible in 3.6.x, unlike corpse
that was actually partly eaten and then revived as a zombie (which
was just fixed for triggering the same warning).

Wishing really ought to ignore "partly eaten" for anything that is
normally eaten in one bite but I'm not sure how to handle that.

Fixes #504
2021-05-06 17:52:30 -07:00
PatR
ad7f2afef9 fix github issue #493 - hero item knowledge
Issue was about being asked what to call a previously seen potion
which has been picked up and thrown by an unseen monster.  Hero
shouldn't remember what the item description was.  This is a much
more general change than just fixing that.  Any item picked up by
an unseen non-tame monster will have all its *known flags cleared
since the hero can't see what that monster does to it.  Same if an
item is picked up while seen but then used when unseen.

Unseen pets are excluded from the pick up case--but not the use
case--because they pick up and drop stuff continually and players
would just slaughter them if they caused item information to be
forgotten.

Fixes #493
2021-05-06 12:36:32 -07:00
PatR
b4ae19ed0c fix "Killed by foo, while paralyzed by a monster"
If the killer and the paralyzer are the same monster, truncate
that to "Killed by a foo, while paralyzed".  When not the same,
spell out the paralyzer's monster type instead of using generic
"monster".  "Killed by a fox, while paralyzed by a ghoul", or
"Killed by a ghoul, while paralyzed by a ghoul" *if* they were
two different ghouls.
2021-04-22 16:13:41 -07:00
PatR
221d82f899 fix pull request #488 - regressions for 'a'pply
Restore some old behavior for the apply command that was changed
by the "getobj refactor" patch.  You couldn't attempt to apply
potions to determine whether they were oil, couldn't apply gray
stones once touchstone was discovered, and attempting to apply
arbitrary items gave "that is a silly thing to apply" rather
than "sorry, I don't know how to use that."
2021-04-18 17:02:11 -07:00