Commit Graph

1297 Commits

Author SHA1 Message Date
nhmall
ea4a81901d add an interface for sound libraries
Groundwork for a more versatile interface for using
sound libraries. A lot of sound libraries work across
multiple platforms.

The current NetHack sound stuff is quite limited.

Binaries can have a variety of window ports linked into
them, and it makes sense to have something similar for
sound.

This tries to set things up in a more soundlib-centric way,
rather than inserting things in a platform-centric way.

It establishes a new top-level directory sound (akin to win
for the window interface routines, or "window-port") where
sound-related additions and sndprocs and support files can be
added and used across platforms.

The default interface is nosound and the 'nosound' interface
is in src/sounds.c

The interface for 'windsound', which contains the same minimal
USER_SOUNDS support using built-in routines that has been in the
windows port for a long time is added to
sound/windsound/windsound.c.

For now, the sound interface support for 'qtsound' has been added
to the existing Qt files win/Qt/qt_bind.h and win/Qt/qt_bind.cpp,
and a note has been placed in sound/qtsound/README.md to avoid
confusion.

New header file added: include/sndprocs.h.
2023-01-19 18:51:42 -05:00
Pasi Kallinen
1113373892 Fix vibrating square
The Gehennom changes broke the vibrating square, allowing hero to go
down into the Sanctum via stairs without performing the invocation.

Fix this by making the hellfill lua check for invocation level, and
placing down the vibrating square trap, instead of stairs.
2023-01-19 12:15:46 +02:00
PatR
8952ea9bb5 add Japanese item names to discoveries list
When playing as a Samurai, add things like "osaku" to the discoveries
list even though they don't have separate descriptions to be used
when not yet discovered.  Non-magic ones are pre-discovered and
players can now use the '\' command to figure out what things like
"tanko" mean without resorting to '/?'.

"wooden harp" has been getting changed to "koto (harp)"; make that be
| koto [wooden harp] (koto)
"magic harp" has been staying as "magic harp (harp)"; add it to the
list of Japanese item names.  Since it's magic it isn't pre-discovered.
Once discovered it becomes
| magic koto [magic harp] (koto)

Those two needed special case handling, none of the other items did
aside from forcing them to be discoverable when lacking descriptions.
The discoveries list now has things like
| wakizashi [short sword]
| naginata [glaive] (single-edged polearm)
| gunyoki [food ration]
if--and only if--the hero is a Samurai.
2023-01-18 22:00:57 -08:00
PatR
2e1f52e882 strange object vs generic objects
Try to fix a fuzzer issue.  I wasn't able to reproduce it so am not
sure whether this actually fixes it.  A mimic seemed to be mimicking
object #1 (generic ILLOBJ_CLASS object which shouldn't occur) rather
than #0 (strange object).  Strange object always has dknown==1 and
generic objects should always have dknown==0 but farlook of mystery
object #1 had its dknown flag set.

An earlier fix to force non-Null oc_name when formatting objects in
order to pacify the static analyzer might have been the reason that
the problem couldn't be reproduced.

This includes a few miscellaneous changes made while unsuccessfully
hunting for the problem.
2023-01-15 01:45:14 -08:00
Pasi Kallinen
6abb12aee0 Lua: Persistent variables
Add a way for the lua scripts to set and retrieve variables
that are persistent - saved and restored with the game.

Invalidates saves.
2023-01-15 10:34:45 +02:00
PatR
85c908cb03 displaying generic objects
Add 17 fake objects to objects[], one for each object class.  All
specific color as gray.  They're grouped at the start--actually near
the start since "strange object" is still objects[0]--rather than
being among the objects for each class.  init_object() knows to start
at [MAXOCLASSES] instead of [0]; other code that loops through every
object might need adjusting.

For potions, non-stone gems, and non-novel/non-Book_of_the_Dead
spellbooks that don't have obj->dknown set, display the corresponding
generic object rather the object itself.  Fixes the longstanding bug
of seeing color for not-yet-seen objects whose primary distinguishing
characteristic is their color.  Walking next to a generic object
while able to see its spot will set dknown and redraw as specific.
It's slightly disconcerting to have objects change as you reach them;
I hope it's just a matter of becoming used to that.  (If there is any
code still changing the hero's location manually instead of using
u_on_newpos(), it should be changed to use that routine.)

Most of the new tiles are just a big rendering of punctuation
characters.  The potion, gem, and spellbook ones could be cloned from
a specific object in their class and then have the color removed.  I
started out that way but wasn't happy with the result.  I'm not
artisticly inclined; hopefully someone else will do better.  Each of
them is preceded by a comment beginning with "#_"; the underscore
isn't required, just being used to make the comments stand out a bit.

Invalidates existing save and bones files.
2023-01-10 14:33:21 -08:00
Pasi Kallinen
4af086be73 More interesting Gehennom levels
Instead of just plain old boring mazes, spice up Gehennom by
occasionally adding lava, iron bars, or even mines-style levels
(with lava, of course).

Of the fixed Gehennom levels, only Asmodeus' lair has been changed
to add some random lava pools.

Also some lua fixes and changes:
- Fixed a selection negation bounding box being wrong.
- Fixed a selection negated and ORed returning wrong results.
- des.map now returns a selection of the map grids it touched.
- When using des.map contents-function the commands following the
  map are not relative to it.
2023-01-10 12:20:21 +02:00
nhmall
2fc0d25d45 introduce support for coloring the frame behind a map location
Also includes support by paxed for polearm targeting using the
frame color.

Also renames USE_TILES to TILES_IN_GLYPHMAP which is a more
accurate description.

Not all window interfaces have full support for the color framing
of the background square yet.

MS-DOS needs further work (to bring it to both VESA and VGA, with
and without tiles.

Windows GUI is missing support.

X11 and Qt have been started, but may require further refinement.
2023-01-01 19:55:02 -05:00
Michael Meyer
15274fcca1 Make paralysis intefere with seduction attempts
tinklebear on IRC noticed that a hero paralyzed by a floating eye was
still "charmed" and capable of "removing her armor" as part of a nymph's
theft attack.  The same thing was true of foocubus seduction: a
paralyzed hero was still able to respond to the questions about whether
particular pieces of armor should be removed (and also do whatever else
may be involved in a successful attack...).

I think paralysis should prevent both those things.  Nymph theft will
still work, unless she needs the hero's active cooperation in removing a
bulky piece of armor.  Foocubus attacks will be prevented entirely by
paralysis, making it interfere like unconsciousness already does.

Apply a similar constraint to hero vs monster seduction, as well.
2022-12-31 11:25:53 -08:00
PatR
249e431e46 new 'sortvanquished' option
Allow the preferred sort order for the vanquished monsters list to
be specified in the run-time config file
|OPTIONS=sortvanquished:X
where X is t, d, a, c, n, or z.  It can also be set to 'A' or 'C'
but those aren't documented and aren't offered as choices when
setting the value interactively, which can be done via 'm O' or by
using 'm #vanquished'.

Guidebook.mn has been updated but Guidebook.tex is lagging again.
2022-12-26 14:56:12 -08:00
PatR
91e2ab13b2 last? role/race/&c option values update
Keep track of how a role|race|gender|alignment option got its value
so that role:!Tourist in .nethackrc and role:!Priest in NETHACKOPTIONS
yield 'role:!Priest' rather than merging into 'role:!Priest !Tourist'.
It also doesn't write the value into new config file for #saveoptions
if that value comes from environment or command line (not applicable
since the command line arguments for role,&c don't go through options
handling).  Also, the old config file value takes precedence over
the current game's value file so that 'role:random' doesn't become
'role:Healer' or such in a new config after the random value gets
picked for play.

This only tracks the role, race, gender, and alignment options but the
concept could be extended to all options.  The data would need to be
saved and restored if values set interactively need to be retained in
restore sessions (doesn't apply to role,&c since those don't change
during play).
2022-12-22 15:07:33 -08:00
Pasi Kallinen
d7e90fbae2 Expand safe_wait to deadly status afflictions
Searching or waiting with safe_wait on will now consider
sliming, stoning, or deadly illness to be hazardous and prevent
the command.
2022-12-18 00:40:38 +02:00
PatR
daeec9291c refine PR #946 - named armor
Move the new stuff from PR #946 out of xname() into new routine
armor_simple_name().

Noticed while testing:  tweak 'call object type' so that it doesn't
list instances of pre-discovered armor as likely candidates since
assigning a name to such wasn't showing up in the discoveries list.

Add "silver shield" as wishing synonym for "polished silver shield".
2022-12-14 07:37:04 -08:00
PatR
7096c68492 more interactive role selection
This ended up combining several unrelated changes.

Add missing 'fixes' entry for curses-specific item in New Features.

When answering "Shall I pick ... for you? [ynaq]", accept \m as well
as \n and space for choosing the default of 'y', same as normal
ynaq() would.  Also add '*' to '@' as not-shown potential answers;
they force 'random'.

When tty tore down any of the menus, things were reasonable if they
were short enough for corner windows, but tall ones that switch to
full screen weren't fully erased.  The parts of those outside of the
map window stayed behind when the tall menu was closed and cleared.
Mainly affects picking the "~ - reset filtering" choice but also
affected the role menu on 24 line tty screens.  (Didn't affect curses
because it tracks and refreshes its base window when some overlaying
window goes away.)

The role menu used 25 lines so required a second page for the case
of a 24 line screen on tty.  Dealing with that is a bit ugly but it
wasn't an issue when this form of role selection was tty-only (because
the info about choices made so far was displayed on the base window
rather than in an extra menu line back then) so I added a hack for it.
If the role menu will take one more line than the screen height, the
separator between 'random' (below 'Wizard') and 'pick race first' gets
squeezed out.  If the menu needs two more lines (doesn't happen now,
except by changing screen size to 23 lines for testing), a second line
gets squeezed out.  (Not attempted for curses because it wouldn't
help.  'windowborders' and one or two extra separators it adds make
menus taller.  I doubt if many players use curses on 24-line screens
but if they do, they'll be using something new rather than going from
something that used to fit on one page with 3.6.x.)
2022-12-13 15:59:05 -08:00
PatR
b2fe51490d tty-style role selection for curses
Move the tty role/race/&c selection from wintty.c to role.c and remove
its references to BASE_WINDOW.  Have curses call the same routine now
so that the player has the option to choose role, race, gender, and
alignment in any order and to confirm or override random settings
prior to starting play.  Also if you went through "who are you?" then
final confirmation includes an extra menu choice to rename the hero.

It still has the quirk of sometimes remembering some of the previous
aspects when you re-pick a new value for some aspect which already
been selected.

The menus pop up on top of the copyright screen and that looks a bit
strange.  I don't think core code has any way to erase that base
window without erasing the entire screen so to fix the strangeness
the window ports would need to do that before calling the selection
routine.  I didn't do that because the very first prompt, "Shall I
pick ... for you? [ynaq]" shows up in that window rather than in a
popup over it, and having it be all by itself on an otherwise blank
screen seemed to be even stranger.

X11 and Qt both have more sophisticated selection routines so I
haven't tried to switch either of them to use this.  They both use a
fancy role-selection-specific menu with all the aspects present at
once so this wouldn't fit without more work than I care to tackle.
2022-12-12 16:30:27 -08:00
PatR
cefd9a0c0a 'generic username' checking
Don't require the list of generic usernames in sysconf to need to be
ordered to guard against false substring matches.  If the list was
"nethacker nethack" and the tentative character name was "nethack",
it wouldn't be recognized as generic.  The old code forced the list
to be "nethack nethacker" for the matching to work correctly because
it only checked the first matching substring.  Either order works now.

It also failed to recognize a generic name if the player used
|nethack -u nethack-samurai-human-male-lawful
because it checked for generic names before stripping off the role
aspects.  Now that will at least recognize the name as generic and
prompt with "who are you?", but the role/race/&c info gets discarded.
2022-12-12 14:53:07 -08:00
PatR
0e1f1c653b fix #K3802 - sanity_check: boulder not on top
This should fix the problem of polymorphing or stone-to-fleshing a
pile of multiple boulders and having some underneath ones which get
changed resist and not get changed, producing a pile with one or more
non-boulders above one or more boulders.  If that situation arises,
re-stack the pile so that boulders are moved to the top.

This also revises zapping up or down while hiding under something
(if that is even possible; the types of creatures which can hide
under things can't zap wands or cast spells; maybe there are some
exceptions?).  Zapping up used to hit only the top item, but zapping
down hit the whole stack.  Now up still hits only the top, but down
skips the top and hits the rest.

Caveat: not adquately tested.
2022-12-10 17:48:55 -08:00
PatR
6a1f875b17 some extern.h reformatting
Wrap or re-wrap some wide lines.
2022-12-10 00:48:38 -08:00
nhmall
215808abd1 clear up a few gcc warnings 2022-12-05 23:19:38 -05:00
nhmall
4b04b1e6ac expand support for noreturn declarations
Although gcc specifies support for declaring a function as
noreturn after the function name and parameters, other compilers
do so via an attribute at the start of the declaration. Add some
macro support for the attribute-at-the-beginning method:
  o MS Visual Studio compiler
  o Upcoming C23 standard (untested at this point)
2022-11-24 00:51:42 -05:00
PatR
e49c772f13 unpaid object sanity checking
Handle items in gaps of a wall shared between adjacent shops.

Make handling of shop boundaries more explicit:  walls, the door,
and the "free spot" by the door aren't classified as 'costly' but
obj->unpaid and obj->no_charge are valid there.

Move unpaid/no_charge checking into its own routine to unclutter
objlist_sanity().

Pushing a shop-owned boulder to the free spot or doorway or gap in
wall triggers the sanity check for the time being.
2022-11-23 16:41:12 -08:00
nhmall
937355038d some coordxy and other conversion warnings
When dist2() got changed to use coordxy parameters, a macro that uses
it in its definition was overlooked and it had (int) casts in it.
That caused a warning about possible data loss when the int
then got converted to coordxy for the dist2() call.

Give online2() coordxy parameters instead of int, like its bretheren.

Avoid a couple of implicit conversion warnings where ints were being assigned
to smaller uchar or ints being assigned to smaller short.

A couple of signed vs unsigned warnings on some rumor processing.

Avoid some signed vs unsigned warnings in mdlib/makedefs where a signed int
param eventually got used in an external call that took size_t.
Eliminate all of it by just having the outer NetHack routine also take
a size_t.

Lastly, insert some default C99 alternative time-related code
in mdlib/makedefs since asctime() and ctime() are being flagged as
deprecated in the upcoming C23 standard and will now start to trigger
warnings for anyone using a C23-compliant compiler.
2022-11-23 17:49:55 -05:00
PatR
546930e05e tweak PR #925 - don't expose shop bill details
Avoid use of 'struct bill_x' outside of shk.c.
2022-11-19 00:38:20 -08:00
Michael Meyer
b8472af927 Charge hero for making off with shop-owned boulder
Pushing a shop-owned boulder out of the shop wouldn't charge the hero
anything.  Remedy this (and remove the boulder from the bill if the hero
then pushes it back in).  Also tried to handle a couple other uncharged
boulder "theft" scenarios: pushing a boulder into lava or water, into a
trapdoor or hole, or into a level teleporter (various other traps
already charged for the boulder -- it was pretty inconsistent).

I externified onbill() for this, since relying on otmp->unpaid by itself
impossibles if you push a boulder through a gap in a wall between two
adjoining shops.
2022-11-19 00:13:13 -08:00
PatR
9a7f8418ee 'nethack --usage' and '?' menu
Write up a description of how the command line works on UNIX and put
that in new file dat/usagehlp.  Add support for
|nethack --usage | --help | -? | ?
to display it and exit.

Also add a menu entry for nethack's help command to show it during
play.  That can be suppressed by uncommenting new '#define HIDE_USAGE'
in config.h since it won't be useful on servers that don't give
players access to command lines.

New genl_display_file() just writes to stdout.  opt_usage(), which
calls it, might need some suid/sgid handling to make sure the output
is done as the player rather than as nethack.

doc/nethack.6 is already out of date again.
2022-11-18 16:07:15 -08:00
nhmall
3f93d54b66 some Makefile and hints tinkering
1. remove all window interface bits from compiler.370, and have
   the preceding include files set some variables to control
   the behavior of compiler.370 when it comes to c++.
2. some more common Makefile lines into sys/unix/hints/include/multiw-3.370.
3. make it so you can pass cppregex=1 on the Make command line to build with
   sys/share/cppregex.cpp instead of posixregex.c
4. fix sys/share/cppregex.cpp so that it will build with clang compiler
   (required an additional header include). I don't know if it would have
   worked with g++ without that change. The include can be placed into an #ifdef
   block if there's an issue with the change on other compilers.
5. Anything that needs to compile using c++ (Qt, sys/share/cppregex.cpp) can
   just ensure that CPLUSPLUS_NEEDED Makefile variable is set above the lines
   in compiler.370 to ensure that things get set up for c++. It no longer
   checks specifically for Qt. That is what sys/unix/hints/include/multiw-2.370
   does now.
2022-11-13 22:25:07 -05:00
nhmall
9e92fefdd8 keep propertynames static in timeout.c 2022-11-06 10:02:27 -05:00
nhmall
185322421a relocate mstrength() and supporting function again
Also, purge the code for makedefs -m
2022-11-05 18:40:57 -04:00
nhmall
242c05ccf3 Revert "ranged_attk() - there can be only one"
This reverts commit b399e3f2f5.
2022-11-05 15:26:29 -04:00
nhmall
b399e3f2f5 ranged_attk() - there can be only one
Relocate the newer code for the function to mdlib.c
where makedefs can still use it.
2022-11-05 13:07:10 -04:00
PatR
1572877429 build fix for NODUMPENUMS and more issue #916
I made more things in dump_enums() static and/or const.  In the
process I discovered both compile problems for NODUMPENUMS and when
fixed, link problems for NODUMPENUMS+ENHANCED_SYMBOLS.

The uft8map.c portion has no changes, just reformatting.
2022-10-31 15:43:14 -07:00
PatR
220726f7ba status condition options
Option parsing rejected
|OPTIONS=!cond_X
for all valid X.

Using the menu to unselect all condition options treated that as not
having made any choice and didn't make any changes.  That would be
reasonable if nothing was preselected, but things are so unselecting
all of them is a choice.  (A bizarre one, but still should be viable.)

Mostly this deals with including cond_X options when #saveoptions is
used to write a new RC file.  It now produces something like
|OPTIONS=!cond_barehanded,cond_blind,!cond_busy,cond_conf,!cond_deaf,\
|        cond_iron,cond_fly,cond_foodPois,!cond_glowhands,cond_grab,\
|        cond_hallucinat,!cond_held,!cond_ice,cond_lava,cond_levitate,\
|        !cond_paralyzed,cond_ride,!cond_sleep,cond_slime,!cond_slip,\
|        cond_stone,cond_strngl,cond_stun,!cond_submerged,cond_termIll,\
|        !cond_tethered,!cond_trap,!cond_unconscious,!cond_woundedlegs,\
|        !cond_holding
after the last alphabetical option and before the bound keys, menu
colors, and others which aren't simple OPTIONS=X settings.  This only
happens if there is already one or more OPTIONS=cond_X entries in the
old file when it was read or if 'mO' gets used to make any changes.

Not fixed:  after my RC had something similar to the above and before
I changed status conditions to accept negation, I was getting several
"the cond_ option may not both have a value and be negated" messages
written to stdout instead of the config file error handler.  So they
vanished when the screen was initialized without providing a --More--
prompt to acknowledge that they have been seen.
2022-10-31 00:53:10 -07:00
nhmall
88f6df2d8b some tabs to spaces
cd src
    grep -P -n '\t' *.c | grep -v "1:"
    cd ../include
    grep -P -n '\t' *.h | grep -v "1:"
    cd ..

side note: win/Qt/*.cpp are full of tabs
2022-10-26 14:21:23 -04:00
Michael Meyer
05f004403e Rename update_mon_intrinsics to ...extrinsics
There was a TODO about this; not exactly a great challenge but it feels
like a worthwhile change since the name was misleading.  I also updated
the name of the do_intrinsics parameter of extract_from_minvent(worn.c),
since it was in a similar situation (and directly related, since it
controls whether to call update_mon_{in/ex}trinsics).
2022-10-23 00:21:44 -07:00
PatR
064c9fb52e fix github issue #900 - "Elbereth" engravings
Issue reported by vultur-cadens:  Elbereth used to be effective in
inhibiting monster movement when an object was present on the same
spot, but since 3.6.0 it isn't.  It only functions that way when the
hero--or hero's displaced image--is present these days.  So special
levels that have been using engraved Elbereth to try to protect
objects from monsters haven't been providing any useful protection.

This makes Elbereth that's engraved during level creation work like
it used to in 3.4.3 and earlier:  when there's at least one object
on the engraving's spot, monsters who are affected by Elbereth will
be affected.  [I'm fairly sure that that behavior started out
unintentionally, as a side-effect of an optimization to only check
for scroll of scare monster when there was at least one item present
which is a necessary condition for such a scroll.]

Old-style Elbereth includes Elbereth chosen as a random engraving
during level creation in addition to engravings specified in special
level definitions.  Engravings by the player don't have the required
attribute and player-engraved Elbereth behaves in the 3.6 way.

This ought to be replaced by something more general.  Perhaps a new
engraving type not usable by the player?

Fixes #900
2022-10-15 02:13:39 -07:00
PatR
02cfdfee30 more github issue #679 - orc strength
Handle alternate values for hero poly'd into a 'strongmonst' form
more thoroughly by propagating max values other than 18/100 to the
attribute manipulation routines.

ATTRMAX(A_STR), which used to be a relatively simple expression, now
contains a function call.

Along the way, change the races[] terminator's value for 'mnum' from
0 (giant ant) to NON_PM.
2022-10-12 02:05:32 -07:00
Michael Meyer
02367077bd Use function for combined str/hp loss from poison
Since losestr and losehp calls go together most of the time, this feels
like it probably makes more sense than repeating the killer name/format
twice in a row all over the place.
2022-10-08 16:29:56 -07:00
Michael Meyer
70fe2ce5cd Don't make callers responsible for losestr death
Remove callers' responsibility to deal with possible hero death when
calling losestr.  This is less fragile and error-prone than leaving it
in the caller's hands, but it means that death from the monster spell
'weaken target' no longer goes through done_in_by, and the death reason
is no longer "killed by <monster name>".
2022-10-08 16:29:55 -07:00
Michael Meyer
c0dfa40cd3 Don't use boolean for losehp killer format type
Killer format isn't a boolean, since it has 3 possible values
(KILLED_BY_AN, KILLED_BY, NO_KILLER_PREFIX).  It shouldn't make any
difference behind the scenes, but it's confusing to use 'boolean' for
it.
2022-10-08 16:29:55 -07:00
Michael Meyer
c78e7af013 Digestion attack can grant hero intrinsics
Monster purple worms can now gain intrinsics from swallowing foes whole,
so maybe the hero should be able to do so too.  Intrinsics aren't
granted immediately upon swallowing (that would probably have been
easier), but only once a corpse is created and then entirely digested.

I'm not sure if this is too powerful and was being avoided deliberately
for that reason, since it includes potential level gain from wraith
corpses in addition to other intrinsics.  That's consistent with monster
purple worms but may be a bit too much in the hands of the hero, though
it is limited by needing the corpse creation roll to succeed.
2022-10-08 16:06:50 -07:00
nhmall
334fd76ab4 mstrength prototype and preprocessor 2022-10-07 11:15:10 -04:00
nhmall
26d13f6656 just the one mstrength() for makedefs and game 2022-10-07 11:00:15 -04:00
nhmall
b0029472de during devel make it easy to review mon difficulty 2022-10-07 10:26:40 -04:00
Ray Chason
8b6fe9d205 Support wide Curses on MS-DOS
Also, fix IBMGraphics on Curses
2022-10-02 20:41:02 -04:00
PatR
4885653014 alloc() never returns Null
Mark alloc()--also dupstr() and re_alloc()--for gcc and clang as
always returning non-Null.  This should silence some of the static
analysis complaints.

Almost all the monster and object naming functions (anything that
returns an mbuf or an obuf) should be marked this way too but I'll
leave that for somebody else to deal with.

I didn't attempt to mark alloc() with the 'malloc' attribute because
macro definitions could end up causing trouble.  Specifying its
deallocator would probably be useful but is at even bigger risk of
macro interference.

I'm not sure whether gcc 3 is really the right test for whether the
returns_nonnull attribute setting is available.
2022-09-24 04:39:12 -07:00
Michael Meyer
81285b661e Apply dest. limit to monster trap door usage
To prevent monsters from falling past the bottom level or into the
sanctum early, and to maintain consistency between monster and hero hole
usage.
2022-09-22 11:36:48 +03:00
PatR
2b04cc9f5b fix issue #843 - vampire revival sequencing
Reported by Umbire:
|You kill SpaceMannSpiff!  SpaceMannSpiff puts on a dwarvish cloak.
|SpaceMannSpiff puts on a dwarvish iron helm.
|The seemingly dead SpaceMannSpiff suddenly transforms and rises as
| a Vampire.

This was tough to reproduce but I finally managed it.  The issue
text mentions that it was fixed by copperwater in xNetHack with
commit 8c4af50f0aa3e72522f3eb98df039ff25c2a1ea0 to the repository
for that variant.  My attempt to cherry-pick that failed--I'm not
even sure whether it should have been expected to work--and some of
the code has been impinged upon by changes, so I ended up applying
the contents of that commit manually.

The commit changes how/when monsters put on new armor rather than
anything directly related to vampires.  Circumstances similar to
the example above now yield:
|You kill SpaceMannSpiff!
|The seemingly dead SpaceMannSpiff suddenly transforms and rises as
| a Vampire.
on one turn, then on the next turn the revived vampire produces:
|SpaceMannSpiff puts on a dwarvish cloak.

My test case only had one item of interest; I assume that the second
item of armor gets worn on a subsequent turn rather than at the same
time as the first one.

Fixes #843
2022-09-15 18:02:07 -07:00
Pasi Kallinen
3605f18a8e Split themeroom shape from themeroom contents
Previously, the tetris-shaped rooms were always either
normal rooms, or turned into shops or other special rooms
in NetHack core. Now, the themed room lua code first picks
the themed room (which can be a themed or shaped), and some
of those will then pick a random filling (eg. ice floor,
traps, corpses, 3 altars).

Adds a new lua binding to create a selection picking locations
in current room.

The content-function in special level regions now get passed
the room data as a parameter.
2022-09-15 18:09:40 +03:00
PatR
c2a9343367 horn_of_plenty-to-container #tip
For tipping purposes, a horn of plenty is treated like a container.
But using one as the source container in a container-to-container tip
wasn't supported.  Implement that.

Also, #tip was offering carried bags of tricks as candidate containers
to tip some other carried container into.  Only do that for ones which
aren't known to be bags of tricks (so when type not discovered yet, or
specific bag not seen yet due to blindness).
2022-09-14 15:54:24 -07:00
PatR
7ae4efb07c fix issue #872 - container-to-container #tip
Reported by k2:  tipping one container's contents directly into
another container allowed transferring a wand of cancellation (not
mentioned:  or a bag of holding or a bag of tricks) into a bag of
holding without blowing it up.

That's now fixed.  There are other issues that this doesn't touch:

I think it's odd that you can transfer stuff from one carried
container to another but not from a carried container to a floor
container nor from one floor container to another one at same spot.

I didn't test shop billing so an not sure what happens when #tip
blows up a bag of holding and there are some unpaid items involved.

Using #tip on horn of plenty treats it like a container, but doing
that when it's carried doesn't offer the chance to tip its contents
directly into a carried container.

Tipping a carried container does not require free hands or even
limbs (for playability) but tipping such into another container
should require at least one free hand.

Fixes #872
2022-09-12 14:17:22 -07:00