Commit Graph

8859 Commits

Author SHA1 Message Date
PatR
6553fbb6f5 3.7 monst->mtemplit 2019-06-08 07:38:13 -07:00
nhmall
d0210d9c90 Merge branch 'NetHack-3.6' 2019-06-08 09:38:27 -04:00
PatR
7ea69225e9 fix github issue #198 - mon wielding cursed weapon
Fixes #198

Watching a monster try to switch from a cursed weapon to some other
weapon (of any bless/curse state) reported that the old weapon was
welded to the monster's hand and wouldn't switch to the new one.
But watching a monster try to wield a cursed weapon didn't say that
it was becoming welded at the time.  Report correctly pointed out
that the weld-to-hand check wouldn't work unless the weapon was
already flagged as wielded, and the code in question was deferring
wielding so that the message wouldn't include "(weapon in hand)" in
the formatted object description.  There was also another problem:
it was erroneously testing the monster's old weapon (if any, after
unwielding it), instead of the new one being wielded.

Also, Sunsword starting to emit light when first wielded by a monster
only reported that it was shining if hero could see the monster.
Give an alternate message if hero sees the location instead.  (Just
the monster's/Sunsword's location rather than any newly lit spot
within Sunsword's radius.)
2019-06-08 05:58:42 -07:00
PatR
c741d6c7c9 missile light sources
Throwing or kicking a lit lamp, lit candle, or lit potion of oil
wasn't giving off any light as it travelled to its destination.
Now it does, and dungeon features, objects, or monsters that are
temporarily seen as it moves from square to square till appear on
the map.  In the monster case, they go away as soon as the light
moves beyond range, but when it finishes moving the "remembered,
unseen monster" glyph will be drawn at their location.  I think that
part has some room for improvement, but mapping temporarily seen
terrain features is the primary impetus for this change.

Also, any message delivery while the "lit missile" travelled still
showed its light around the hero.  Noticeable for lamps or stacks
of sufficient candles if hero has no other light source.

This cannibalizes the monst->mburied bit for temporarily seeing a
monster.  It has been present but unused for ages.  I needed to
replace a couple of vision macros to make sure they didn't examine
it any more so that overloading for transient lighting doesn't
introduce any vision oddities.  For version $NEXT, monst->mtemplit
can be given its own bit.  It is only set during bhit() execution
and cleared by the time that returns, so has no effect on save files.
2019-06-08 04:50:40 -07:00
nhmall
aa2fb2932f Merge branch 'NetHack-3.6' 2019-06-06 21:49:54 -04:00
PatR
a27ca52b03 vampshifting by poly'd hero
Hero polymorphed into a vampire or v.lord can use #monster to switch
to vampire bat or fog cloud [or wolf for lord] but it was a one shot
polymorph.  Remember when current form is a shape-shifted vampire and
allow #monster in shifted form to pick another shifted form or the
vampire form.

Genocide of the alternate shape forces back to base vampire.  Genocide
of base vampire does too, then reverts to human (or dwarf, &c) as
vampires go away.  Being killed while shafe-shifted reverts all the
way to human rather than to vampire.  [Just realized:  interaction
with Unchanging wasn't taken into consideration so hasn't been tested.]

Since 'youmonst' isn't saved and restored, I had to add a field to 'u'
to hold youmonst.cham during save/restore.

Tested with 3.6.2+ and seemed to be working (except saving while
shape-shifted restored as ordinary bat/cloud/wolf because new u.mcham
wasn't there to hold youmonst.cham yet).  Builds with 3.7.0- but not
execution tested yet (I didn't want to clobber my current playground).
2019-06-06 16:51:43 -07:00
PatR
eebbac1c65 3.7.x saves not compatible with 3.6.x 2019-06-06 15:59:27 -07:00
PatR
fabfe276fe \#turn comment
Remove a potential 'TODO' since it turned out [pun intended] to be a
no-op.
2019-06-06 13:30:43 -07:00
PatR
c46d6c0572 \#turn mechanics
This part got left out of yesterday's #turn update.
2019-06-06 13:12:39 -07:00
nhmall
d8df7ed733 merge bit 2019-06-06 08:14:11 -04:00
nhmall
8a1945f09c Merge branch 'NetHack-3.6' 2019-06-06 08:09:18 -04:00
PatR
f4353a3c15 \#turn mechanics
When looking at something else I stumbled across this.  Using #turn
is described as chanting a formula but was allowed even if hero wasn't
able to speak due to strangulation or speechless polymorph form.
Also, the check for whether a potential target monster was in range
used 'cansee(mx,my)' which required the hero to be able to see but
not necessarily to be able to see the target.  I've changed that to
'couldsee(mx,my)' on the assumption that it was intended to prevent
\#turn from operating through walls.

Also, the comment about the effective range was wrong.  I changed the
comment to match the code rather than vice versa.
2019-06-05 18:36:55 -07:00
nhmall
bfc4445537 Merge branch 'NetHack-3.6' 2019-06-05 08:08:32 -04:00
PatR
b982e6c526 location viability on Plane of Water
While testing, I noticed that I could completely fill the Water level
with air elementals.

Hero can't fly or levitate or water walk into/onto water locations
on Water level without drowning/crawling out the water, and monsters
shouldn't have been able to but could, then they were hit by drowning
since minliquid used different criteria than movement.  But goodpos(),
used for teleport destination and new monster creation among other
things, consided water locations acceptable on that level for
non-aquadic creatures with Fly/Lev/Wwalk ability.

It explains why so many dragons and other 'nasty' monsters have been
ending up on the vanquished monsters list when hero uses level
teleport to go directly there from level 1.  They've either been
getting created in water and then they drown when it's their turn to
move or moving into it to approach the hero and drowning (not sure
whether that case is immediate or on next move).  There's no message
since hero doesn't see it, and air elementals didn't drown since thy
don't breathe.
2019-06-05 04:16:34 -07:00
nhmall
43ae30443d fixes whitespace bit 2019-06-04 21:58:44 -04:00
nhmall
02898009a6 remove some trailing spaces from data.base 2019-06-04 21:49:20 -04:00
nhmall
cd86242502 make sure end.c can place the bc 2019-06-04 21:46:08 -04:00
nhmall
a65682f58e allow a parent function to restrict use of placebc
placebc was triggering an impossible sometimes on the plane of
water

It turned out to be because movebubbles issued an
unplacebc(), but a downstream function called
placebc(), so when movebubbles() issued its own
placebc() there was a problem.

The downstream function that beat movebubbles to the placebc()
turned out to be unstuck(). There could be others.
2019-06-04 21:18:46 -04:00
PatR
05a0d10097 plug montraits() memory leek
If a corpse with a revive timer included obj->oextra->omonst for
remembering the original monster (I think all corpses do these days)
and makemon() failed to create a new monster when the timer expired,
the copy of the original wasn't freed.  makemon() will fail if there
is no room for the monster.
2019-06-04 14:54:58 -07:00
PatR
25f1cc38e9 confused blessed scroll of remove curse on itself
Noticed when testing the set_bknown patch earlier: something updated
the persistent inventory window while scroll processing was in the
midst of traversing invent and it showed the scroll I'd just read
change from known blessed to bless/curse state not known.  The scroll
should really be removed from inventory because player is told that it
has disappeared, but unlike charging (which does do that so that it is
gone when selecting an item to charge), remove curse isn't auto-IDed
and the code to ask the player to call an unIDed item something only
kicks in when it's still in inventory.  Preventing the scroll in use
from having its bknown flag cleared should be good enough; it won't
have disappeared yet but at least it won't be visibly changing.
2019-06-04 13:18:21 -07:00
PatR
093e7c31e4 container->{cknown,lknown) vs perm_invent
Carried containers could have their contents-known state and/or
lock-known state changed without persistent inventory window being
updated to show the new information.

This also changes the behavior when player has hero zap self with
wand of locking or wizard lock spell.  If it doesn't trigger a
holding trap then the effect will hit inventory, similar to how
opening/knock operates (releasing hero from holding trap or hiting
inventory when that doesn't happen).
2019-06-04 12:13:46 -07:00
PatR
43afa91ff8 fix #H8850 - bless/curse state in perm_invent
Changing an inventory item's bknown flag wasn't followed by a call to
update_inventory() in many circumstances, so information which should
have appeared wasn't showing up until some other event triggered an
update.
2019-06-04 10:50:24 -07:00
PatR
ac79fedf60 fix github issue #196 - green slime feedback
Fixes #196

If you didn't die from turning into green slime but then died because
green slimes had been genocided, the message given assumed that you
had just seen "OK, you don't die" from answering No to "Really die?".
Its wording didn't make sense if the reason you didn't die was an
amulet of life-saving.  Give a different message for that case.

Also, if you survive turning into slime (via either method) and either
green slimes are still around or you answer No to "Really die?" when
they've been genocided, give a message after "You survived that attempt
on your life" pointing out that you have done so in green slime form.
Useful since prior to 3.6.2 you would have reverted to original form--
despite the Slimed countdown saying you had turned into green slime.
2019-06-04 09:16:00 -07:00
nhmall
4519e21a21 disabled code bit 2019-06-03 18:45:02 -04:00
nhmall
fd585a58c2 add some debugging BREADCRUMBS to identify caller of some functions
Only takes effect if a developer uncomments BREADCRUMBS in config.h
2019-06-03 18:37:45 -04:00
nhmall
cccdeb6b01 data.base update 2019-06-03 18:00:19 -04:00
nhmall
bf5878076f more precautions for monster obliteration during overcrowding 2019-06-03 17:11:54 -04:00
PatR
689e7490ec extended ball&chain sanity check
Verify that the locations of ball and chain are consistent.
If chain is on floor then ball is on floor or in hero's inventory
else if chain is free then ball is free or in hero's inventory.
When chain is on floor it is under hero or one step away from hero
and when ball is on floor it is on chain or one step away from chain.
2019-06-03 02:36:44 -07:00
nhmall
0b74f2adeb makedefs: add enum support when generating pm.h
Only changes pm.h content if ENUM_PM is defined when compiling
util/makedefs.c

While NON_PM and LOW_PM could be included, it would require
for the makedefs.c compile, as well as an
around their macro definitions in permonst.h so for now those
particular lines are commented out in makedefs.c
2019-06-02 17:21:35 -04:00
nhmall
6dd7dfa66c Merge branch 'NetHack-3.6' 2019-06-02 16:19:53 -04:00
nhmall
7d38435a9b don't clear mtmp->mx, mtmp->my even when obliterating 2019-06-02 10:34:38 -04:00
nhmall
5c30cc5890 elemental_clog() should not destroy the very monster trying to be placed 2019-06-02 08:15:41 -04:00
PatR
4e119f4f00 place_object(obj,0,0) debugging
Got a hit (on Plane of Water) pretty quickly.
2019-06-02 05:02:08 -07:00
nhmall
e84fb24ede Merge branch 'NetHack-3.6' 2019-06-01 18:05:42 -04:00
nhmall
852995bbeb remove a couple of debugging lines in mon.c 2019-06-01 17:36:54 -04:00
nhmall
4eeebe5e20 fix gcc warning on linux 2019-06-01 17:26:15 -04:00
nhmall
5ee78c5204 improve full level handling in the endgame
Even though a goodpos failure in mnearto() would return 0 to
the caller and trigger proper overcrowding handling for mtmp,
the 'othermon' would be left with its mx,my set to 0,0 under
that circumstance and then trigger a mon_sanity_check()
failure and accompanying impossible() message a short while
afterwards.

This also includes the addition of some flags that proved useful
for troubleshooting the mystery sanity_check failure and helping
to understand some of the code paths the struct monst data had
been through. They are only used for inspection when issues are
reported or when debugging, they don't presently control the
code flow.  Their setting and use is done in an overloaded way
that should not intrude on the existing use of mspare1 for
MIGR_LEFTOVERS. mon->mstate is just a pseudonym for mon->mspare1
and does not alter save file content.
2019-06-01 16:51:10 -04:00
PatR
6f7089de10 whatdoes ('&') for movement commands
The key binding overhaul broke '&' reporting for movement commands.
This is somewhat clumsy but seems to be working as intended.

(M-0 with 'number_pad' set to 2 (or 4) appears to be broken.  It's
supposed to be a synonym for 'I' but brings full inventory ('i')
for me.  I have to set 'altmeta' On and type ESC followed by 0, but
that sequence does work to get M-0.)
2019-06-01 02:52:32 -07:00
PatR
c9e6e44590 help bits
Fix a typo (count example "20s." shouldn't have the period).

Also expand the text for several gotchas that tend to hit newbies.
2019-05-31 18:41:37 -07:00
nhmall
e786098572 Merge branch 'NetHack-3.6' 2019-05-31 17:59:11 -04:00
PatR
cdb4a9e8b3 fix github issue #193 - curses: menu search
Fixes #193

Under curses interface, make characters which are both entry selectors
and menu commands function as a selector.  Needed to support using ':'
to look inside a container when applying/looting it via menu, instead
of performing a menu search operation.  (There was another case like
this but I can't remember what the circumstances are.  The fix is
general enough to cover it, whatever it is.)

For menus which don't have ':' as a choice, make sure search prompt
doesn't offer garbage default input when built with EDIT_GETLIN.

Bug?  If player has 'popup_dialog' option On, EDIT_GETLIN is ignored.
Plain curses I/O doesn't seem to offer a way to implement it.
2019-05-31 10:11:45 -07:00
PatR
a09973851e edge of map feedback
When testing Planes of Air and Water, I found it odd that trying to
move off the edge of a level uses a turn but provides no feedback.
If 'mention_walls' is On, report that you can't go any farther in
whichever direction you're trying to move.  Moving diagonally is
only blocked in one of the two combined directions unless you're in
the very corner, so if you try to move southwest while in the middle
of the bottom row, for instance, it says you can't go farther south
rather than southwest.
2019-05-31 07:35:37 -07:00
PatR
48cd573e32 Planes of Water and Air
Make the Plane of Water be water all the way to edge instead of having
stone on left, top, and right.  The Plane of Air already has air all
the way to edge (including unused/unuseable column #0) but does so via
code rather than the level description file so Water does that now too.

The edges of the Plane of Air were cloudless (3 columns on the left,
2 rows on the top, and 2 columns on the right; don't recall about the
bottom) and that looked pretty strange.  Those rows and columns are
beyond the range of bubble/cloud movement so just make some of those
spots randomly be sight-blocking cloud terrain instead of all open air.
It isn't integrated with the moving clouds but looks fairly good when
the hero moves along the edge of the level.

Using wizard mode to leave Water or Air and later return resulted in
no clouds on the Air level and bubbles as usual on the Water level.
I still don't understand why, but on return to those levels run the
bubble creation routine as if the old discarded bubbles or clouds were
being restored.
2019-05-31 03:42:06 -07:00
nhmall
7437b0b6e6 Merge branch 'NetHack-3.6' 2019-05-30 18:10:41 -04:00
PatR
791b87833b mnearto/mnexto/enexto
This doesn't solve the <0,0> problem but it does prevent mnexto()
from using uninitialized coordinates if enexto() fails.  It also adds
several debugging messages.

enexto() was ignoring map row #0 (unlike column #0, row #0 contains
valid map locations).  Fixing that doesn't matter for Plane of Water
though since that row is stone there--that's probably a bug.  It was
also repeatedly re-testing the top+1 and bottom rows and left and
right columns after they had already failed to be acceptable.  It
still does some of that, but less.
2019-05-30 07:50:38 -07:00
PatR
1a35c15588 sortloot memory leak
Unfreed memory noticed after interrupting the fuzzer and quitting.
query_objlist() has an early return--for touching a cockatrice
corpse--that was skipping release of sortloot info (an array with
one element per object from whichever object list was being used).

Some formatting that's been sitting around for a while got mixed in
and I decided not to take that back out.
2019-05-29 04:40:54 -07:00
Bart House
3427d1ce85 Deleting test file which was just checked-in. 2019-05-28 20:30:10 -07:00
Bart House
9dea6c77d8 Merge branch 'NetHack-3.6' of https://rodney.nethack.org:20040/git/NHsource into NetHack-3.6 2019-05-28 20:19:33 -07:00
Bart House
7492b1da6c Testing ability to cause chaos. 2019-05-28 20:18:27 -07:00
nhmall
57b5498238 Merge branch 'NetHack-3.6' 2019-05-28 21:36:52 -04:00