Commit Graph

14283 Commits

Author SHA1 Message Date
PatR
37bfc4b522 more PR #897 - autounlock
For the 'autounlock option', "none" is gone from the set of choices
so case 'n' can't happen anymore.
2022-10-13 11:54:11 -07:00
PatR
f2d808995b pull request #897 - setting 'autounlock' option
Pull request from entrez:  simply the 'O' submenu for autounlock by
removing choice 'none'.  Fix error reporting for bad autounlock value
from run-time config file or NETHACKOPTIONS.

Fixes #897
2022-10-12 17:03:11 -07:00
Michael Meyer
883f973f56 Fix: error handling for invalid autounlock value
Because the existing error was the default case in a switch/case
statement only reachable if the option matched one of the expected ones
in the list, it wasn't actually reachable: something totally out of
left-field wouldn't match one of the expected options so never hit the
switch, and something that did match one of the expected options would
by definition have a first character handled by one of the cases in the
switch/case.

Do it a slightly different way that should successfully raise an
unexpected value error for 'OPTIONS=autounlock:foobar'.  I didn't remove
the default case entirely, because it could still catch an error if
some new value is added to unlocktypes[] without a corresponding case
being added to the switch statement.
2022-10-12 17:02:15 -07:00
Michael Meyer
b02e018225 Remove explicit 'none' opt from autounlock handler
The autounlock handler included an explicit 'none' option, a choice that
gave it a different UX from similar existing compound option handlers
(e.g. paranoid_confirm or pickup_types), which set 'none' simply by
deselecting all options.  It didn't make the menu any easier to use (at
least in my experience), since in order to go from some combination of
options to 'none', you'd have to deselect everything anyway (which on
its own was enough to set 'none', so there was no reason to explicitly
select it after doing so).

Make the autounlock handler work like other compound option handlers,
such that deselecting all options is the way to set 'none', and there is
no explicit 'none' option included in the list.
2022-10-12 17:02:14 -07:00
PatR
e5a99e8ad8 github PR #896 - show contained gold for ^X
Pull request from entrez:  the '$' command got changed to show gold
in containers as well as gold in inventory.  Make ^X do the same.

Closes #896
2022-10-12 16:28:13 -07:00
Michael Meyer
9bf9aca4a9 Move stashed gold in #attributes to its own line
The line got a lot longer than most other #attributes lines when the
hero had gold both in open inventory and in stashed containers, so break
it up into two lines (using the same approach as the pantheon info in
the first section).  Maybe this isn't necessary but it does make it
stand out less.
2022-10-12 16:21:44 -07:00
Michael Meyer
2cc85b20dd Make #attributes gold line match #showgold
The #showgold command now mentions (known) gold socked away in
containers in your inventory as of 706b1a9.  Since the gold info in the
attributes display and dumplog matches the output of #showgold
otherwise, update it to do the same thing.  Also refactored doprgold a
bit to be a little more compact, as opposed to enumerating all the
different combinations of gold/no gold in open inventory/containers.
This eliminated some string constants that were broken up into multiple
constants/lines (like "line 1 " "line 2"), which NetHack code style
seems to prefer to avoid.
2022-10-12 16:21:44 -07:00
PatR
c2894a422b monk strength
Add a stack of 2 tins of spinach near the leader on the monk quest
start level and another stack of 2 blessed tins of spinach at a
random spot on the monk quest locate level, to compensate for the
inability to gain strength from giant corpses if they adhere to
vegan or vegetarian conduct.  paxed supplied the 'tinplace' magic.

4 tins of spinach aren't nearly enough to get to 18/100, but by
uncursing the first pair, if necessary, and waiting until strength
is at least 18, they can be eaten to add 4..40 (average 22) points
of exceptional strength.  (Players choosing either of those conducts
for other roles or foodless for any role are on their own as far as
boosting Str goes, same as before.)

The special level loader needed to be modified to handle tins of
spinach.  It now accepts "spinach" as a fake monster type for an
object of type "tin".  Also added support for empty tins since it
involved the same code, and use of fake monster type "empty" with
object type "egg" to be able to create generic (unhatchable) eggs.
(Wishing for "egg" produces those by default but it also accepts
explicit "empty egg" by coincidence.)
2022-10-12 13:47:12 -07:00
nhmall
e157224edc MinGW build update 2022-10-12 12:24:59 -04:00
PatR
6e0fa50d80 couple of reformatting bits
Some reformatting done while working on ATTRMAX().
2022-10-12 02:19:38 -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
PatR
b01fd1b849 PR #862 - try XLII
When strength loss is so big as to cause HP damage, but reduce
strength if the damage causes hero to revert to normal form.  There's
no point in adjusting strength before rehumanization and not fair to
do so afterward.

Also, validate strength and its intended adjustment before doing
anything else.  (Just paranoia; there's no reason to suspect that any
bad data ever gets passed in.)
2022-10-11 14:49:14 -07:00
PatR
e2599c2e99 PR #892 - one more try...
Try again to make losestr() do what's intended.  If it would take
strength below 3, it takes away HP and max HP instead.  If hero is
poly'd, those come from the hero-as-monst values.  If hero was
poly'd but isn't any more, hero-as-monst died and rehumanized as
previous self; leave max HP alone.  If hero wasn't poly'd, take
HP and max HP from their usual values, but don't take max HP below
the threshold of minimum max HP (experience level times 1).  The old
check for max HP going below minimum can't happen anymore, unless
hero was below that threshold already (which shouldn't happen; if it
does somehow, don't punish hero further).

If this still isn't right, I'll throw up my hands and my lunch.
2022-10-10 16:46:33 -07:00
PatR
f7d8bfc0a3 more PR #892 - strength lose due to poison
Refine pull request #802 by entrez.  Applying damage within a loop
could potentially damage the hero multiple times, maybe using up
an amulet of life saving and then killing hero anyway, or causing
rehumanization and taking further HP from normal form, or both,
causing rehumanization and then using up amulet of life saving.

Accumulate the damage in the loop and then apply it as a unit.
2022-10-09 16:57:06 -07:00
nhw_cron
2c5293867b This is cron-daily v1-May-8-2022. 000files updated: Files 2022-10-09 10:42:01 -04:00
nhmall
a8cd11ee8a transcribe dependencies from sys/unix/Makefile.src
Transcribe the dependencies from sys/unix/Makefile.src
to sys/msdos/Makefile.GCC and sys/windows/Makefile.nmake
to bring them up to date.
2022-10-09 10:39:50 -04:00
nhmall
4ab2860718 warning fix in msdos build
../sys/msdos/font.c:24:12: warning: declaration of 'flags' shadows a global declaration [-Wshadow]
   24 |     uint32 flags;
      |            ^~~~~
In file included from ../include/hack.h:285,
                 from ../sys/msdos/font.c:3:
../include/flag.h:422:29: note: shadowed declaration is here
  422 | extern NEARDATA struct flag flags;
      |                             ^~~~~
make[2]: Entering directory '/home/nhmall/git/NHsource/util'
2022-10-09 09:35:24 -04:00
nhmall
9f4b239a6f Merge branch 'pr899' into NetHack-3.7 2022-10-09 09:31:21 -04:00
nhmall
78ac9c767f Merge branch 'dos-tty-unicode' of https://github.com/chasonr/NetHack into pr899 2022-10-09 09:26:08 -04:00
nhmall
e5c4b6f65a potentially uninitialized variable warnings
src/mkroom.c(1068) :
warning C4701: potentially uninitialized local variable 'insidex' used
src/mkroom.c(1070) :
warning C4701: potentially uninitialized local variable 'insidey' used

The warning is because the insidex and insidey variables only get
assigned a value conditionally within a for-loop, but contain random
values if that for-loop is not executed, and they are used unconditionaly
later on in the code.

Initializing them changes that from containing random values to containing
zeros, whether that is appropriate or not.

In this particular case, insidex and insidey look to be riding on the coat
tails of insidect and there is a check for invalid insidect in the code,
so that should catch the situation.
2022-10-09 09:11:56 -04:00
Ray Chason
ea3d322a11 Fix compile when no ENHANCED_SYMBOLS 2022-10-09 09:04:23 -04:00
Ray Chason
613828f5dd Support 24 bit color for Unicode symbols 2022-10-09 08:59:20 -04:00
nhmall
8bc41c10c7 Merge branch 'dos-vesa-crash' of https://github.com/chasonr/NetHack into pr898 2022-10-09 08:29:29 -04:00
Ray Chason
98a145db95 Always compile the Terminus fonts 2022-10-09 02:53:52 -04:00
Ray Chason
e4f921f508 Update the native compile 2022-10-09 02:53:13 -04:00
PatR
6be593526c pull request #888 - latent shop creation bug
Pull request from copperwater:  if a theme room produced a room with
one door that effectively opened on a 'hallway' leading to the core
of that room, it would be considered to be eligible to become a shop.
But if the only spot available for the shopkeeper to move away from
the spot in front of the door was another spot in the hallway, there
would be no possibility to get out of the way, either to let someone
in, or if the hero arrived by teleport or trap, to let hero out.
|     --
|  ---..[rest
|##+12..of the
|  ---..room]
|     --
Shopkeeper would move back and forth between 1 and 2, always blocking
access between the door and the rest of the room.

Currently no rooms get generated with that shape.  I haven't tried to
force one in order to verify the fix.

Fixes #888
2022-10-08 16:54:24 -07:00
copperwater
3eccfa3839 Fix: possible themed room shop where shopkeeper permanently blocks entry
Reported by every for xNetHack. This bug is latent in vanilla, but can
easily start to present itself if themed rooms of a certain shape are
added. Ultimately, it comes from an assumption that shops will always be
rectangles of at least size 2x2, and the shopkeeper will always be able
to step diagonally backwards from their normal position just inside the
door in order to get out of the player's way.

Themed rooms introduce the possibility of shops where the shopkeeper has
only 1 square adjacent to their normal position to move to -
effectively, the shop entrance is a narrow corridor. When this happens,
they have nowhere to go to allow the player to enter or leave the shop,
leaving it permanently blocked unless the hero teleports or falls in or
out.

This fixes that by adjusting the shop algorithm to detect when a shop
candidate room is set up like this, and excludes it from becoming a
shop.
2022-10-08 16:53:53 -07:00
PatR
54ac8cc717 pull request #893 - prevent non-adjacent grabber
Pul request from entrez:  in some circumstances a monster holding the
hero can move away and continue holding.  Check for that sooner and
release hero is warranted.

Fixes #893
2022-10-08 16:44:17 -07:00
Michael Meyer
3653649ed3 Fix: nonadjacent grabber after move
A monster which has grabbed you could move away without becoming unstuck
if it hit the "move and shoot" or "helpless" conditions in the dochug
MMOVE_MOVED case (since those lead to early return or break), leaving
the hero stuck to a monster which is no longer adjacent.  Put the
'grabber moved away -> become unstuck' stuff at the top of the block so
that it will always be evaluated if a grabber has moved.

I would have liked to move the whole "grabber checks" block up, but I
think it'd change behavior to have the u.uswallow attack come before the
early return for a helpless monster, so I split it up instead.
2022-10-08 16:43:45 -07:00
Ray Chason
6400ce073a Support Unicode symbols in 16 color mode 2022-10-08 19:41:22 -04:00
PatR
7baba64fb3 pull request #892 - strength loss effects
Pull request from entrez, with several commits:  monster spell 'weaken'
didn't handle poly'd hero correctly, possibly continuing in poly'd
form with negative hit points.  Make losing strength (which takes away
HP if Str would drop below 3) take care of applying damage too so that
several callers don't need to do that.

Fixes #892
2022-10-08 16:33:43 -07:00
Michael Meyer
b80cf6138c Don't hardcode min Str in losestr
Min Str is typically 3 no matter the hero's race, but could be higher
(at least in theory?).  Using ATTRMIN makes losestr respect the same
minimum as other kinds of attribute loss (I'm operating under the
assumption that this wasn't an intentional move to fix the minimum at 3
regardless of other factors).
2022-10-08 16:29:56 -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
4b32f8b3bd Fix: 'weaken target' spell against poly'd hero...
...could leave hero in creature form with negative u.mh

losestr can subtract HP, but doesn't directly kill its target.  The
caller is responsible for possibly killing the hero if losestr reduces
her HP to 0 or lower; most callers do this by combining losestr with a
losehp call, which can kill off the hero if necessary.

MGC_WEAKEN_YOU calls done_in_by if u.uhp < 1 after losestr, but didn't
handle the Upolyd u.mh case, so could leave a polymorphed hero with
negative health.  Add a rehumanize call in that case.

This could also be done by changing losestr to call losehp itself for
the HP loss it deals out, but this would interfere with
cast_wizard_spell's use of done_in_by to generate the death reason:
either all strength loss is described one way ("terminal frailty" or
something -- not great) or else losestr must be passed a death reason
and is described a different way than other attack spells (because it
wouldn't go through done_in_by).
2022-10-08 16:29:54 -07:00
PatR
3681855f34 fixes entry for PR #883 - digestion attack by hero
Pull request from entrez:  poly'd hero who digests a creature has a
change to gain an intrinsic from it.  I put the fixes entry in the
New Features section.

I was a bit concerned that g.afternmv might be cleared during the
turns the hero is busy digesting, leaving a stale value for
g.corpsenm_digested, but I don't think that that can happen.

Fixes #883
2022-10-08 16:09:19 -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
PatR
769e154546 couple of reformatting bits
Some formatting stuff left out of recent commits.  No change in
behavior.
2022-10-08 15:56:12 -07:00
Ray Chason
fb88488583 Support Unicode symbols in VESA modes 2022-10-08 18:50:38 -04:00
Ray Chason
5b5e217991 Avoid null dereference in VESA initialization
If the VESA mode chooses a mode with 8 bit pixels, but the tile set
has too many colors for that, a null dereference can result when
trying to set up the nonexistent palette. Catch this condition and
refuse to set VESA mode instead.
2022-10-08 15:42:07 -04: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
c4fc5cf9ce gcc warning 2022-10-07 10:36:16 -04:00
nhmall
691ffbe456 be consistent in preprocessor conditional 2022-10-07 10:30:36 -04:00
nhmall
b0029472de during devel make it easy to review mon difficulty 2022-10-07 10:26:40 -04:00
Pasi Kallinen
60252cd28b Remove leftover debug pline 2022-10-07 11:44:03 +03:00
PatR
01dea35a22 fix github issue #894 - guardian nagas can't grab
Issue reported by eakaye:  for a 'hugs' attack to succeed, the
monster must have at least three attacks and the two preceding the
hug attack need to both hit.  Guardian nagas had three attacks but
the first was melee 'bite' and the second was ranged 'spit'.  Those
are mutually exclusive, so they would never both hit and nagas never
grabbed their prey.

Make the spit attack be first, the bite attack be second, insert a
touch attack for 0 damage third, and make the hug be fourth.  Also,
change their hug damage type from 'phys' to 'wrap'.  The first and
2nd+3rd+4th are still mutually exclusive.

The resulting message feedback left something to be desired and has
been tweaked.

The difficulty-level formula used by deprecated 'makedefs -m' now
generates 17 rather than 16 for guardian naga so I changed revised
monster to match.  They are definitely more difficult now that their
constriction attack has a chance to hit.

Fixes #894
2022-10-07 01:07:43 -07:00
nhmall
14ef7b6005 paste error 2022-10-06 21:39:00 -04:00
nhmall
d1755013b4 less specific re version to reduce doc maintenance 2022-10-06 21:36:23 -04:00