Commit Graph

179 Commits

Author SHA1 Message Date
nhmall
6c97b0f9a1 Merge branch 'NetHack-3.6' 2019-11-14 19:48:57 -05:00
PatR
f3a923d647 fix #H1554, #H1736, github issue #240 - silver )
Fixes #240

Monster versus monster (melee and throwing) didn't handle shades
(need silver or blessed weapon to take damage) or silver feedback
(extra info when silver-haters are hit).

I did a lot of test, revise, re-test but didn't always re-test
everything that had previously been tested, so bugs that I thought
were quashed might have crept in.

Now if a missile weapon "passes harmlessly through the shade" it
will continue on and maybe hit something else.  (Regular misses
still stop at the missed target.)

A couple of minor ball&chain changes accidentally got included.
2019-11-13 15:47:46 -08:00
nhmall
79db36b455 Merge branch 'NetHack-3.6' 2019-10-23 08:46:39 -04:00
nhmall
15d5942b2a fix recent bypass of obj placement 2019-10-22 09:40:10 -04:00
nhmall
3ccc6e5308 Merge branch 'NetHack-3.6' 2019-10-17 20:52:10 -04:00
Pasi Kallinen
02b9368dba Fix fired iron ball sanity error
When hero was punished and swallowed, and fired the attached
iron ball from a quiver, thrownobj was not cleared.
2019-10-11 20:02:06 +03:00
nhmall
7ab824eb40 Merge branch 'NetHack-3.6' 2019-09-23 20:46:38 -04:00
PatR
348f968132 fix add_to_minv panic when aklys kills enfulger
Reported directly to devteam rather than via the web contact form:
throwing wielded aklys while swallowed would hit the engulfer and
return to the hero's hand but leave a stale 'thrownobj' pointer if
the monster survived.  Under usual circumstances, throwing anything
else or throwing the aklys again when not engulfed would clear that
pointer, putting things back to normal.  However, killing any engulfer
with the same weapon would try to add it to engulfer's inventory to
be dropped as it died.  If the killing blow was via melee rather than
another throw, the object in question would still be in hero's
inventory instead of free, hence panic.

The initial returning-aklys implementation shared Mjollnir's code
which doesn't have this issue.  This reverts from having attached
aklys always returning successfully when thrown while swallowed to
Mjollnir's 99% chance of return and 99% to be caught when it does
come back.  (That was already the case if the engulfer was killed by
the throw, where hero wasn't swallowed anymore after the damage was
inflicted.)
2019-09-23 15:16:39 -07:00
nhmall
0d34f43830 remove STATIC_DCL, STATIC_OVL, STATIC_VAR, STATIC_PTR from core 2019-07-14 17:24:58 -04:00
nhmall
6d93eb7cdd Merge branch 'NetHack-3.6.2' 2019-04-26 19:52:16 -04:00
PatR
75db8e004d fix #H8612 - splashes of venom might stay intact
If a poly'd hero spits venom and it lands at a 'soft' spot such as
water, it would remain as an intact venom object.  (Venom spat by
monsters seems to always be used up regardless of where it lands.)
2019-04-25 07:11:42 -07:00
nhmall
d15496ba31 Merge branch 'NetHack-3.6.2' 2019-04-22 14:36:58 -04:00
nhmall
dcf4da2150 preserve dknown field between fakeobj instances
Preserve temporary fake object's previous dknown value by storing it
as a flag value within the m_ap_type field of the posing monster, and
recalling it when it is needed.

This is intended to help eliminate observable differences in price display
between real objects and mimics posing as objects.

98% of this is just switching the code to utilize macro M_AP_TYPE(mon)
everywhere to ensure that the flag bits are stripped off when needed.
2019-04-22 14:17:18 -04:00
nhmall
42e7f6fcba Merge branch 'NetHack-3.6.2' 2019-02-23 12:16:13 -05:00
PatR
e0db41572a more bz 1604 - re-do vs autoquiver
Take another crack at describing yesterday's do-again fix.  Having
'autoquiver' enabled wasn't necessary to encounter the problem.
Also, 'in_doagain' is an int rather than a boolean.
2019-02-22 12:54:39 -08:00
nhmall
453a2a041d merge NetHack-3.6.2 part 2 2019-02-22 08:53:18 -05:00
nhmall
b92df3f2cb Merge branch 'NetHack-3.6.2' 2019-02-22 08:47:37 -05:00
PatR
9c4a6afe46 fix bz 1604 - re-do vs autoquiver
One-line fix is much shorter than attempting to describe the problem.
^A could misuse previous input if 'f'<direction> needed to fill the
quiver and there was nothing suitable, so that the sequence became
'f'<what to throw>.  If previous <direction> was an inventory letter
that was occupied, and the item it that slot wasn't already worn in
some other slot, it would be put in quiver slot.  Then player would
be asked for direction rather than immediately throwing it since the
what-to-throw prompt had just used up the last of the ^A queue.

Miscellaneous formatting included....
2019-02-21 13:28:18 -08:00
nhmall
fd410148c5 Merge branch 'NetHack-3.6.2' 2019-01-29 07:27:56 -05:00
Alex Smith
ce5184c3da Don't advance the main RNG during hallucination
This is based on the multiple-RNGs code fron NetHack4, but using
only the parts relevant to the display RNG (and with substantial
changes, both because of post-3.4.3 changes, and because Nethack4's
display code is based on Slash'EM's rather than NetHack's).
2019-01-28 04:45:26 +00:00
Bart House
1c65e6afe0 context to g.context 2018-12-25 07:29:38 -08:00
Bart House
8c1a4d9a97 invent, youmonst, hackdir moved to g. 2018-12-24 21:04:15 -08:00
Bart House
90547edb83 moves, monstermoves, wailmsg, migrating_objs and billobjs moved to g. 2018-12-24 20:22:33 -08:00
Bart House
be5cdcf77a killer, level and rooms move to instance globals. 2018-12-24 19:50:08 -08:00
Bart House
572ee347b9 Another round of instance globals changes. 2018-12-24 16:43:50 -08:00
Bart House
62e1a45b60 Merge branch 'win-wip3.7' into win-wip3.7-bart
Conflicts:
	src/end.c
2018-12-24 12:09:42 -08:00
nhmall
a229a8a56d Merge branch 'NetHack-3.6.2' 2018-12-24 06:44:27 -05:00
PatR
7bc36ddef4 fix #H6942 - dropx vs hold_another_object
Dropping an existing fragile item while levitating will usually
break it.  Getting a new wished-for fragile item and dropping it
because of fumbling or overfull inventory never would.

Some callers of hold_another_object() held on to its return value,
others discarded that.  That return value was unsafe if the item
was dropped and fell down a hole (or broke [after this change]).
Return Null if we can't be sure of the value, and make sure all
callers are prepared to deal with Null.
2018-12-23 12:37:26 -08:00
Bart House
74edf42f1c Moved decl.c globals into instance globals. 2018-12-22 18:44:22 -08:00
Bart House
576eece500 More globals moved to instance_globals. 2018-12-19 21:26:35 -08:00
Bart House
912886a73f First set of changes to move globals to instance_globals. 2018-12-19 20:00:35 -08:00
PatR
942961e3e2 throwing recoil inside shop
Another bug from seven years ago, sent directly to devteam so no #H
number.  Report stated that throwing recoil could move a levitating
hero diagonally through a shop's doorway to exit it.  If the thrown
item was unpaid, it remained unpaid after landing on shop's floor
and was an unlisted item on shop's bill.  Moving diagonally out the
door seems to have been fixed, but the same effect still occurred
if you were far enough from the door to have the shopkeeper vacate
his door-blocking spot and throwing recoil took hero to that spot.
The thrown unpaid item remained unpaid, and walking out the door was
treated as shop robbery.
2018-12-17 03:05:10 -08:00
PatR
b40868a74f fix #H7708 - change in terrain not noticed
Jumping or teleporting while levitating in xorn form wouldn't toggle
blocking of levitation when moving from open spots to wall/stone and
unblocking of same when moving the opposite way.

This handles those cases but there are no doubt others.  The only
other one I checked was when failed #untrap moves hero onto trap.
That case works correctly--at least after this fix is in place.

Noticed while working on it:  change of terrain didn't always update
the status line.  When levitation became blocked, it still said Lev
and when unblocked, didn't say that.  Next status update got status
condition back in sync.
2018-12-09 16:22:27 -08:00
PatR
285023acf6 fix #H7659 - accessing freed memory by cutworm()
hmon() can destroy the weapon being used, and known_hitum() would
still pass the pointer to the freed object to cutworm().  Remember the
relevant weapon attribute before using and maybe freeing the object,
then pass that attribute instead of the whole weapon.  Also pass
'more-likely-to-cut' for axes in addition to blades.

thimonst() behaved similarly, although due to much different code
paths none of the objects that might get to hmon() were then passed to
cutworm(), so it wasn't vulnerable.  But pass 'more-likely-to-cut'
for axes instead of for blades when thrown.
2018-12-03 18:57:01 -08:00
PatR
27fe555bc1 src/ formatting
Clean up quite a bit of minor things found with simple grep patterns:
operator at end of continued line instead of beginning of continuation
(and a few comments which produced false matches, so that they won't
do so next time), trailing spaces (only one or two of those), tabs (a
dozen or so of those), several casts which didn't have a space between
the type and the expression (I wasn't systematic about finding these).

I think the only code change was in the function for the help command.
2018-11-17 16:40:53 -08:00
nhmall
c6a5ec1ab6 ensure tmp_at() structures are initialized for all code paths when swallowed 2018-10-04 22:02:28 -04:00
nhmall
8ce1f88f53 Revert "ensure tmp_at() structures are initialized for all code paths when swallowed"
This reverts commit 39074d29fc.

Bad commit of do_throw
2018-10-04 22:00:51 -04:00
nhmall
67c80b2e4b Revert "fix up a bad commit"
This reverts commit 2eb8436db2.
2018-10-04 22:00:08 -04:00
nhmall
2eb8436db2 fix up a bad commit 2018-10-04 21:55:01 -04:00
nhmall
39074d29fc ensure tmp_at() structures are initialized for all code paths when swallowed 2018-10-04 21:49:16 -04:00
PatR
14bef9a02d formatting cleanup src/*.c
Remove trailing spaces, and remove tabs from the files that had
trailing spaces.

Also, rndorcname() was using a random value to terminate a loop
and was recalculating a new one each iteration.
2018-10-02 16:53:22 -07:00
PatR
8ce81a27ef fix #H7397 - pronoun for unseen shopkeeper
Most shop messages accurately identify the shopkeeper even when he
or she can't be seen, but some also include a pronoun reference that
ended up as "it" or "its" when not seen.  Extend pronoun selection
so that visibility can be ignored:  noit_mhe(mon), noit_mhim(mon),
and noit_mhis(mon).  Note that despite being called noit_foo(),
those will still return "it" if mon is neuter.

"Accurately identify shopkeeper" is misleading if the hero is
hallucinating; a random shopkeeper name is used then.  noit_foo()
yields the pronoun applicable to the actual shopkeeper and might
not match the gender of a hallucinatory name.  That could be fixed
in a couple of ways (add shk_mhe()/shk_mhim()/shk_mhis() and either
pass them the randomly chosen name so that they can figure out the
appropriate gender, or just have them use a random gender whenever
hallucinating) but I don't think that's worth bothering with.

A bunch of shop messages needed noit_foo(); only a couple of those
have actually been tested.  A bunch more were using shkname() at
the beginning of a sentence where Shknam() should be used instead.
(All the existing shk names are already capitalized so there's no
noticeable difference.)

The three places outside shk.c and vault.c which directly use
pronoun_gender() have been successfully tested.
2018-09-24 15:15:04 -07:00
Pasi Kallinen
e031800880 Use is_hole macro to check for trapdoors and holes 2018-09-15 17:57:57 +03:00
Pasi Kallinen
adf070eb04 Use is_pit macro to check for (spiked) pit 2018-09-15 17:19:26 +03:00
PatR
37f8d0edb3 fix #H7385 - double trap activation when jumping
Jumping performs the placement of the last step after using hurtle()
to move to the destination, so if hurtle() triggered a trap then it
would happen twice.  Report was for a Sokoban pit but it would happen
for fire traps too.  Other traps would yield "you pass over <trap>"
while hurtling and then trigger the trap when landing.  Have
hurtle_step() ignore a trap for the last step of a jump, leaving it
to the jump's landing to handle.

Also, give feedback when hurtling over water or lava, similar to what
happens when passing over a previously seen trap which doesn't
activate.
2018-09-13 17:10:25 -07:00
nhmall
cc1d43fad4 integrate aklys feature introduced in 3.6.1 into display
(cherry picked from commit 3fe8325f14)
2018-05-15 06:29:40 -04:00
keni
d8c49ec9d1 Add updated copyright lines, part 1. 2018-04-25 15:00:13 -04:00
PatR
a6b7438c51 fix an out of date fire/auto-quiver comment
When the fire command prompts for missile, it autoquivers the chosen
item.  Originally that was only done when the chosen item was a stack
but that got changed (back in 2007...) and the relevant comment was
not updated at the time.
2018-04-05 15:28:50 -07:00
Pasi Kallinen
2548d68dd3 Fix some warnings
Remove an unused variable, add missing FALLTHRUs, and use the same
FALLTHRU wording where it wasn't recognized by gcc
2018-03-30 19:42:50 +03:00
PatR
6bd8efe510 aklys tweaks
It turns out that Mjollnir before the recent aklys enhancement and
aklys since then would end up both wielded and quivered if it returned
to thrower's hand while quiver was empty.  Remove it from quiver before
restoring it to hand.

Limit the throwing range of an aklys if it is expected to return (ie,
thrown while wielded as primary) since it is a "thonged club" which is
supposedly attached by a cord to the thrower's wrist or hand.  I have
no idea how long a real cord like that might be.  I set the range limit
to BOLT_LIM/2.  Shorter makes throw-and-return uninteresting for an
item that needs to be wielded to throw--so would probably be swapped
back and forth with a stronger melee weapon or longer range missile
weapon--and longer seems absurd.
2018-03-03 10:54:43 -08:00