Commit Graph

4874 Commits

Author SHA1 Message Date
PatR
a995929168 fix #H9118 - stoning a sandestin
causes "dmonsfree: N removed doesn't match N+1 pending" warning.  The
sandestin monster definition flags it as MR_STONE, immune to being
turned to stone.  If the hero hit it with a cockatrice while it was
shape-changed into something which isn't MR_STONE, it had its mon->mhp
set to 0, so died, and its form (mon->data) was set back to sandestin.
known_hitum() decided that it didn't turn to stone because of MR_STONE
for that form so proceeded to kill it off due to lack of hit points,
causing it to die twice.

I started to change that so that it didn't kill off the critter a
second time, bit it really shouldn't be able to kill it by stoning in
the first place.  So sandestin how shares some vampire code to revert
to innate form and not turn to stone when "killed" by stoning.  It
only yields the normal visible polymorph message:  "the <foo> turns
into a <bar>" without any attempt to explain why.  Once in sandestin
form, smacking it with a cockatrice corpse doesn't do anything special
(due to MR_STONE now being unambiguously in effect).  It will soon
shape-change to some other form and then become subject to being
forced back to innate shape by stoning again.
2019-08-14 18:49:16 -07:00
PatR
c814ca8e04 fix #H9117 - bookeeping for fatal status condition
When Stoned, Slimed, Strangled, Sick (TermIll or FoodPois or both)
counts down to 0 without being cured, keep it listed as an active
condition while killing off the hero.  It will show in the status
section when disclosing final attributes and in both that section
and map's status lines when producing a dumplog.
2019-08-11 18:56:43 -07:00
PatR
a2a257a512 fix github issue #211 - wrong parentheses
Fixes #211

dopickup() was getting the wrong value from pickup_checks() due
to misplaced closing parenthesis.  But it didn't actually impact
play; picking things up from engulfer's minvent while swallowed
worked even though the special check for that was failing.  The
code which was accidentally being skipped can probably go away but
I haven't gone that far.
2019-08-08 11:25:36 -07:00
PatR
cc3d97d9b3 fix github issue #209 - typo in end_of_input()
Fixes #209

Fix typo:  program_statue should be program_state.  Apparently
NOSAVEONHANGUP+INSURANCE isn't used by anyone since it wouldn't
compile.
2019-08-08 11:01:56 -07:00
PatR
508af05e42 fix #H9084 - teleported boulder left stale screen
Report was for Sokoban but it applied anywhere:  if a teleported
boulder landed in a pit or trap door or hole and flooreffects() used
it up (so returned True), rloco() didn't update the location it was
teleported from and it appeared not to have moved.  (Line of sight was
updated to reflect its absence but map spot wasn't redrawn without it.)
2019-08-02 11:51:26 -07:00
PatR
55e166ba08 fix #H9082 - post-3.6.2 monster throwing crash
Changing
  if (ammo_and_launcher(otmp, uwep) && mwep->otyp == ELVEN_BOW)
(with 'uwep' typo) to
  if (mwep->otyp == ELVEN_BOW && ammo_and_launcher(otmp, mwep))
(with fixed 'mwep') moved ammo_and_launcher()'s hidden non-null
test to after 'mwep->otyp'.  If mwep was Null (so monster must be
throwing non-ammo such as darts or daggers rather than shooting
with a launcher), a crash occurred.  (Throwing such things while
the monster is wielding any weapon doesn't have this problem.)

I don't think 3.6.2 can crash here.  If hero's uwep is a bow, otmp
must be arrows to get past pre-3.6.3's incorrect ammo_and_launcher()
check.  And a monster won't shoot arrows unless wielding a bow, so
monster's mwep would be non-Null regardless of what uwep is.

I tested a kobold with darts and an elven bow.  But I also gave it
one elven arrow to provoke it into wielding the bow and my test
didn't throw darts with nothing wielded....
2019-08-02 10:42:26 -07:00
PatR
31c8038344 bad weapon check for monster multi-shot shooting
A typo caused the bow and arrow check when a monster was wielding an
elven box to test the hero's weapon with monster's ammo.  [I looked
at the old slash'em code where I think this came from and it doesn't
have the typo but does have a different bug.  A monster could get a
multi-shot volley by wielding an elven bow when throwing darts or
spears.  The extra bow and arrow check is intended to prevent that.
The typo was probably by me but I have no memory of that code....]

Elves with bows (or other monsters who manage to pick up and wield an
elven bow) will shoot bigger volleys after this fix.  That will make
them more dangerous but also cause them to run out of arrows more
quickly.
2019-07-31 14:22:09 -07:00
PatR
6dffe52a27 Glory of Arioch vs spellbook
From the newsgroup (reported for slash'em but applies to nethack too):
a chaotic monk was crowned and told he or she had been "chosen to
steal souls for My Glory!" while being given a spellbook of restore
ability which has nothing whatever to do with soul stealing.  There's
alternate wording for when Stormbringer can't be given because it
already exists; also use that for when it's not going to be given
because the character is discouraged against wielding weapons.
2019-07-30 17:24:33 -07:00
PatR
ed18ebc545 timer validations
Add the contributed code that checks for attempting to start a
duplicate timer.  It's based on a comment which must have been there
at least 25 years and doesn't solve any known problems, but it is
conceptually similar to the large amount of sanity checking which has
gone into 3.6.x.

It didn't work as is because it was comparing two unions with '=='.
I don't know offhand whether C++ supports that but C doesn't (through
C11 at least; don't know about C17).  The union ('anything') is simple
enough that two instances can be compared without jumping through hoops.

I've also added another check for timer 'kind' (level, object, monster,
or global).
2019-07-27 16:12:24 -07:00
Bart House
a607ea2b7f Revert "When fuzzing, use the number of moves as a proxy for the hour."
This reverts commit f75deae0bc.
2019-07-14 21:29:41 -07:00
Bart House
5870cb6a92 Revert "Added experimental feature NEW_KEYBOARD_HIT."
This reverts commit bc65112ce0.
2019-07-14 21:28:55 -07:00
Bart House
fe9fc4cac1 Revert "Added nhassert to core."
This reverts commit 0ca299acb3.
2019-07-14 21:15:54 -07:00
Bart House
a90f9d4365 Revert "Fixed sign/unsigned comparisions."
This reverts commit 0e8e5aac93.
2019-07-14 21:15:31 -07:00
Bart House
177bd39646 Revert "Tweaks to nhassert implementation. Change to warnings on MSC build."
This reverts commit 2f3da35c68.
2019-07-14 21:15:01 -07:00
Bart House
ec05e1ec70 Revert "Fix compiler warnings."
This reverts commit 90f5aa91b7.
2019-07-14 21:13:43 -07:00
Bart House
f7c956c35a Revert "Adding ptr_array data structure."
This reverts commit e665d3b850.
2019-07-14 21:12:59 -07:00
Bart House
4c1c247028 Revert "Fuzzer improvements."
This reverts commit 435f1c4626.
2019-07-14 21:10:39 -07:00
Bart House
5d2181ced3 Revert "Fix build issue on linux."
This reverts commit d33160d069.
2019-07-14 21:10:27 -07:00
Bart House
3adaa79858 Revert "Revert type change of lit which would break code."
This reverts commit cc1219b5a8.
2019-07-14 21:09:38 -07:00
Bart House
a66fed3d5a Revert "Move fuzzer_start, fuzzer_stop and fuzzer_log to pline.c"
This reverts commit d9da488c35.
2019-07-14 21:09:29 -07:00
Bart House
a4317b738a Revert "Fix typo in formatting string."
This reverts commit fa5c499268.
2019-07-14 21:09:07 -07:00
Bart House
fa5c499268 Fix typo in formatting string. 2019-07-14 14:31:30 -07:00
Bart House
d9da488c35 Move fuzzer_start, fuzzer_stop and fuzzer_log to pline.c 2019-07-14 14:30:38 -07:00
Bart House
cc1219b5a8 Revert type change of lit which would break code.
Cast lit (which will be 1) to unsigned int to remove warning.
2019-07-14 14:02:05 -07:00
Bart House
d33160d069 Fix build issue on linux. 2019-07-14 02:00:21 -07:00
Bart House
435f1c4626 Fuzzer improvements.
phase_of_moon and friday_13th determined using rn2() instead of local
time if fuzzing.  Don't reseed using init_random() if fuzzing.  Allow
set_random to be called outside of hacklib.  rn2_on_display_rng uses
rn2 if fuzzing so that we have a single source of random that we can
ensure is reproducible.  Implement rul() that returns a random unsigned
long.  Fix bug in fuzzer handling of ntposkey which would cause us to use
unitialized values for x and y.  Added command line arguments to allow
auto starting and stopping of fuzzer.  Add a logging facility for the
fuzzer to use to record activity.  Added some scripts used to automate
fuzzer testing on windows.
2019-07-14 00:20:09 -07:00
Bart House
e665d3b850 Adding ptr_array data structure. 2019-07-13 16:08:08 -07:00
Bart House
90f5aa91b7 Fix compiler warnings. 2019-07-13 09:53:42 -07:00
nhmall
638d9f9363 if prototype is declared static make function static to match
Today, a compiler was encountered that considered it an error
to have the prototype declared static and the function body
not
2019-07-13 00:17:23 -04:00
Bart House
2f3da35c68 Tweaks to nhassert implementation. Change to warnings on MSC build. 2019-07-12 18:40:34 -07:00
Bart House
0e8e5aac93 Fixed sign/unsigned comparisions. 2019-07-12 18:37:33 -07:00
Bart House
0ca299acb3 Added nhassert to core. 2019-07-11 22:01:39 -07:00
PatR
524f5642d5 poly'd hero theft fix
I moved some stuff around after testing the changes in
58583cacf8 before committing it.  It
accidentally ended up with 'gold' always being Null at the first
place it gets used (to vary the feedback when stealing everything
except gold).
2019-07-11 13:29:33 -07:00
PatR
bfbe4e71ce make #panic honor paranoid_confirmatin:quit
If 'paranoid_confirmation:quit' is set, require "yes" instead of 'y'
to execute the wizard mode #panic command.
2019-07-11 02:54:02 -07:00
PatR
58583cacf8 hero-as-nymph: steal items vs steal gold
Nymphs won't steal gold from the hero (so that their steal-item damage
isn't a superset of lerprechaun's steal-gold damage; straightforward
back when gold wasn't kept in inventory), but hero poly'd into a nymph
would steal gold from monsters.
2019-07-10 17:56:33 -07:00
PatR
094a9d8161 fix github issue #204 - theft while in nymph form
Fixes #204

3.6.2's attempts to fix turning off SEDUCE in 'sysconf' introduced
an unintentional change in behavior for hero poly'd into nymph form:
theft attack always angered the target.  The actual change was
intentional but its ramifications were unexpected.
2019-07-10 16:15:11 -07:00
Bart House
bc65112ce0 Added experimental feature NEW_KEYBOARD_HIT. 2019-07-09 22:30:34 -07:00
PatR
9eefeef5d2 fix github issue #200 - docs for 'strange object'
Fixes #200

The Guidebook claims that there's no symbol for 'S_strange_object'
which is literally true, but there is one for S_strange_obj.  It has
been in place longer than the paragraph claiming that there's no way
to customize that symbol.  I'm not sure why variant spelling was used.

Also, files.c doesn't use loadsyms[], it calls a routine which returns
a pointer to a specific element in that array.
2019-07-09 17:42:32 -07:00
PatR
77aa61a59b looking at a trapped monster
would describe it as trapped if you could see its location, but if
the trap was unseen that trap would remain unseen, at least in some
circumstances.  Mark the trap as seen.
2019-07-08 17:38:00 -07:00
PatR
cfca15d02c finding hidden monsters
Wizard mode ^E and any mode spell of detect unseen or wand of secret
door detection failed to find mon->mundetected monsters if they were
hiding under objects, and failed to find those or other hiders or
mimics when the hidden monster was at a trap location.  The fix for
the latter initially only worked if the trap was known, so took two
tries when a monster hid at the location of an unseen trap.  So this
makes the additional change to find both things at the same time; it
isn't manual searching that stops as soon as something is found.
2019-07-08 16:57:52 -07:00
PatR
ceb2d51426 ^X/disclosure of night, moon, Friday 13th
For ^X and final disclosure, report external issues that affect game
play:  midnight, other night, new or full moon, and Friday the 13th.

The 'new feature' entry in the fixes file rambles a bit but if it
heads off even one spurious bug report, it'll have been worth it.
2019-07-07 13:52:24 -07:00
PatR
bac3a75174 fix #H8164 - kicking altar: injury vs wrath
When kicking an altar, trigger divine wrath (minor: luck or alignment
loss) before deciding whether hero has hurt himself in the process.

Add some variation to the wrath penalty so that it can't be used to
precisely control Luck.
2019-07-06 18:14:30 -07:00
PatR
bf672f7f47 Xstairs_room followup
Add a comment to explain why upstairs_room, dnstairs_room, and
sstiars_room aren't handled the same way has other level data.
2019-07-06 16:18:23 -07:00
Bart House
7e72bc0944 mklev() set xxstairs_room pointers back to NULL upon completion.
When mklev() is called multiple times, previous state stored in the
xxstairs_room pointers can be mistakenly used when making decisions about
the new level being constructed.  This caused non-deterministic level
creation behavior when replaying from a snapshot.
2019-07-06 14:18:02 -07:00
Bart House
f75deae0bc When fuzzing, use the number of moves as a proxy for the hour.
Every 1000 moves simulates one hour.
2019-07-04 18:06:56 -07:00
PatR
79ff4cd9c3 fix github issue #202 - worn items inside engulfer
Fixes #202

When swallowed, you can take things from the engulfer's inventory, if
there are any, via pickup.  Items might be worn by the engulfer and
when "picked up" those weren't being unworn before being added to
hero's inventory.  Then they would be formatted as "(being worn)" and
could trigger warnings or worse.

Conceptually they should be worn on the outside and not be accessible
from the inside, so I've made attempts to pick up worn items fail
rather than fix up the unwearing.

Using ':' when swallowed to look at the engulfer's inventory describes
that inventory as "contents of <mon>'s stomach".  That's weird for any
worn items, but the situation is so rare I haven't made any attempt to
deal with it.
2019-07-03 18:30:55 -07:00
PatR
4a74968a58 shk doname for containers
Rescue some old code from bit rot.  It may be useful if the shop
side of things ever gets fixed.  (Itemized billing reveals container
contents.  I'm sure that it's in the bugzilla list but can't find it.)
2019-07-03 13:43:24 -07:00
Bart House
25ea6c8f3c Fix crash that can occur in decode_mixed.
If a player names an object with a name that ends in '\\', drops
that object on the floor nearby and does a look at nearby objects,
then the game will crash.  This is caused by stack corruption when
the decode loop skips over the decode string terminator.
2019-07-02 19:08:50 -07:00
PatR
1e7fb839a3 status_hilite for Xp and Exp by percent rules
Extend support for highlight rules that specify percentages from HP
and spell power to experience level and experience points.  For both
of those, the percentage is based on progress from the start of the
current Xp level to the start of the next Xp level.  100% isn't
possible so is used to enable highlighting a special case:  1 point
shy of next level, most likely to occur after losing a level.

This is something I had in mind a long time ago and then forgot all
about until fiddling with the final disclosure of experience points
recently.  It turned out to be trickier than expected because it needs
to check whether Xp should have a status update when it hasn't changed
but Exp has gone up.  The latter might hit a percentage threshold that
switches to another highlight rule.  Fortunately changes to Exp, at
least that aren't part of level gain or loss (which always trigger
status updating), are all funnelled through a single place (I hope).
2019-07-02 17:39:23 -07:00
Bart House
1b0d47911f When restoring game we should not need to invoke rnd to test for hiding. 2019-06-30 16:41:24 -07:00