Commit Graph

209 Commits

Author SHA1 Message Date
PatR
cb7f873733 goodtype() reversal
Reverse an erroneous part of the vault guard commit.
2019-02-03 14:08:29 -08:00
PatR
7cc718ea0e fix #H7173 / github #101 - vault exit
Fixes #101

If you tell the vault guard your name, drop carried gold, wait one
turn, then pick up the gold again, the guard will move a step away
during the wait.  If you teleport away, the guard will seal vault
walls and then park himself on the one-square (so far) temporary
corridor adjacent to the vault wall.  Periodically he'll say "Move
along!" and the hero will hear it, regardless of location on the
level.  Unless you dig a corridor to rescue him, or one or more of
the vault's walls get breached again, he will never move.

The report emphasized that you could use this to steal the vault's
gold, but it relies on being able to teleport beyond the gaurd's
reach and if you can do that, you might as well do so before the
guard comes.  The stranded guard, and him saying "Move along!" when
no longer leading hero out of the vault, are more significant bugs.

Bonus fix:  if the game ends and the guard seals up the vault while
the hero is in a spot that gets fixed up (vault wall or temporary
corridor) don't give the "You are encased in the rock" message if
game end was due to death rather than quit.
2019-02-02 17:37:06 -08: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
nhmall
55fdfb9200 domove_core() out of domove(); assess domove_core() results
new domove_core() assessment results

potentially smudge engravings

Proceed to wipe engraving after domove_core() now, but only under
all of the following conditions:
    - you can reach the floor
    - preceding domove_core() move attempt was marked as
      having succeeded in domove_core()
    - there is actually an engraving there to impact at
      your original spot, or your new spot, or both
2019-01-27 11:55:23 -05:00
PatR
c0cce3110e src formatting
Remove a couple of tabs, and for the affected files, put 'goto' labels
in column 2 where they're easier to spot.
2019-01-04 18:47:00 -08:00
PatR
0eb11aa718 fix github issue #155 - encumbrance vs water
Fixes #155

When drowning, you need to be unencumbered in order to crawl out of
water.  When not drowing, you don't, but put a limit on how much can
be carried.  If polymorphed into a swimming creature, allow stressed
or less; otherwise (magical breathing), burdened or less.  (Doesn't
apply on the Plane of Water since there's no climb from water to land
involved.)
2018-12-22 18:09:44 -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
36c2aec2ff fix #H7667 - maybe_reset_pick(), other bad context
When deciding whether to discard interrupted lock/unlock context while
changing levels, maybe_reset_pick() checks whether xlock.box is being
carried.  But it was doing so after the old level had been saved and
memory for non-carried container there had been freed.

That led to a couple of other issues.  context.travelcc was using -1
for 'no cached value', but the fields of travelcc have type 'xchar' and
shouldn't be given negative values.  0 should be fine for 'no cache'.

Failed partial restore which occurred after old game's context had been
loaded would begin a new game with old game's stale context.  Restoring
goes out of its way to avoid that for 'flags' but didn't for 'context'.
2018-12-04 17:10:15 -08:00
nhmall
0fb263ea88 fix broken build cause by missing semicolon 2018-11-05 15:33:02 -05:00
Pasi Kallinen
e8eadac3c8 Feedback on trying to pick up stairs or altar 2018-11-05 18:35:20 +02:00
PatR
2986a807de fix #7470 - Sting vs webs
When trapped in a web, trying to move while wielding Sting gives the
message "Sting cuts through the web."  In 3.6.1 and earler, that
also released you from the trap, but with 3.6.2-beta nothing happens.

It had nothing to do with the recent web spinning patch.  My change
to have being trapped block levitating and flying included replacing
a lot of direct manipulations of u.utrap with set_utrap() and
reset_utrap() in order to keep the lev/fly blocking and unblocking
localized.  Unfortunately, the old 'u.utrap = 0' when wielding Sting
while stuck in web was deleted in error at that time.
2018-10-26 15:09:48 -07:00
PatR
053880c149 untrap downwards while over trap
Force trap to activate during failed untrap attempt if done while
already at the trap's location, to match the recent change in
behavior when failed attempt occurs while adjacent to the trap.

Most noticeable while flying over bear traps, but affects all
failed untrap attempts.
2018-09-30 16:37:32 -07:00
PatR
3e19858edd fix #H6925 - being trapped vs Levitation/Flying
Make being trapped in/on/over floor block Levitation and Flying, the
way that being inside solid rock already does, and the way levitating
blocks flight.

Blocked levitation still provides enhanced carrying capacity since
magic is attempting to make the hero's body be bouyant.  I think that
that is appropriate but am not completely convinced.

One thing that almost certainly needs fixing is digging a hole when
trapped in the floor or tethered to a buried iron ball, where the
first part of digactualhole() releases the hero from being trapped.
If being released re-enables blocked levitation, the further stages
of digging might not make sense in some circumstances.

I recently realized that being held by a grabbing monster is similar
to being trapped so should also interfere with levitation and flying.
Nothing here attempts to address that.

Save files change, but in a compatible fashion unless trapped at the
time of saving.  If someone saves while trapped prior to this patch,
then applies it and restores, the game will behave as if the patch
wasn't in place--until escape from trap is achieved.  (Not verified.)
2018-09-30 01:06:59 -07:00
PatR
21db5a3ae6 alternate bear trap fix
Fix the situation of Flying hero failing to untrap a bear trap that
was resulting in the trap becoming hidden.  Previous fix prevented
hero from moving onto the trap's location so that the reason for
hiding it didn't occur.  This moves the hero and forces the trap,
so it will become unhidden again before there's any chance to notice
that it had been hidden.

Status 'Flying' conflicts with being trapped at floor level, but that
is a separate, known issue.  I'll have to resurrect my unfinished fix
for that sooner rather than later.
2018-09-27 18:42:12 -07:00
PatR
e0b7d2f5a9 monpolycontrol, wizdebug_*
Demote #monpolycontrol and #wizdebug_traveldisplay from commands to
simple boolean options.  The former has the same name, the latter
is called travel_debug.  Rename #wizdebug_bury to #wizbury; it
shouldn't matter that it goes away when compiled without DEBUG.

There are now five wizard-mode boolean options:  monpolycontrol,
sanity_check, and wizweight are documented in the Guidebook;
menu_tab_sep and travel_debug are commented out there.

Guidebook.mn has been tested; Guidebook.tex has not.
2018-09-26 18:40:13 -07:00
PatR
3a62075070 fix #H7136 - iron bars vs non-diggable walls
Iron bars can be destroyed in some circumstances (hit by yellow
dragon breath or thrown potion of acid, being eaten by rust monser
or black pudding, or by poly'd hero in those forms) and should act
like walls for diggable/non-diggable purposes.  But they aren't
walls, so the non-diggable flag was not being set for them by the
special level loader.  Even once that was changed, they weren't
being handled consistently.  Some places checked for non-diggable
directly (zap_over_floor of acid breath, potion of acid hitting bars)
and started working as intended, others used may_dig() to check
non-diggable (poly'd hero attempting to eat iron bars) but it doesn't
handle iron bars, and still others didn't check at all (bars-eating
monster who moved onto bars location in expectation of eating those
next).
2018-09-25 16:43:06 -07:00
Pasi Kallinen
adf070eb04 Use is_pit macro to check for (spiked) pit 2018-09-15 17:19:26 +03:00
nhmall
b77f559d58 quiet a new visual studio compiler complaint from recent code change
..\src\hack.c(2553): warning C4113: 'int (__cdecl *)()' differs in parameter lists from 'int (__cdecl *)(void)'
2018-09-01 15:07:19 -04:00
Pasi Kallinen
27d7f216c7 Split pickup checks out of dopickup 2018-09-01 20:45:51 +03:00
Pasi Kallinen
9e35a94097 Fix pickup awful hack
If pickup has been bound to some other key than ',', the awful hack
did not work correctly. Testing, I couldn't notice the difference,
but probably just not doing the right thing...
2018-09-01 20:15:19 +03:00
keni
d8c49ec9d1 Add updated copyright lines, part 1. 2018-04-25 15:00:13 -04:00
Pasi Kallinen
d5a0d846bf Mention boulder blocking path when traveling
...if mention_walls is on
2018-04-23 19:49:34 +03:00
PatR
544b9015ff comment formatting
Fix a few mis-indented comments I stumbled across.
2018-02-17 01:58:14 -08:00
PatR
3f9522041c fix #6598 - monster briefly rendered as hero
When swapping places with a pet, the hero's coordinates are changed
before some tests which might disallow the swap, and if the pet was
a hidden mimic or was trapped and became untame, the attempt to draw
the revised pet or former pet would actually draw the hero and have
that mistake be visible during the message about not swapping.  That
last bit only occurred when the pet couldn't move diagonally (due to
being a grid bug or to being unable to squeeze through a tight space).
Also, spoteffects for arriving at a new location took place even
though the hero hadn't changed position.
2017-12-08 14:12:35 -08:00
PatR
08a3297f64 boulder pickup: contradictory message sequence
Poly'd into a giant with a full inventory that already contains at
least one boulder, moving onto a boulder (that can't be pushed due
to a wall or other obstacle) yielded

 You try to move the boulder, but in vain.
 However, you can easily pick it up.
 You are carrying too much stuff to pick up another boulder.
 You see here a boulder.

The second and third statements contradict each other.  Make the
code that dishes out the second message smarter.  If autopickup is
set for it and you will pick up the boulder:
 However, you easily pick it up.
If autopickup is not set for it but would have worked if it was:
 However, you could easily pick it up.
If your inventory is full and you have a boulder (or are in Sokoban)
 However, you easily push it aside.

That last one is instead of "however, you can squeeze yourself into
a small opening" that you'd get if not a giant and not carrying much.
2017-10-20 18:31:07 -07:00
Pasi Kallinen
4b7aea0eac Fold invisible glyph unmapping into single function 2017-10-07 16:24:49 +03:00
Pasi Kallinen
1027eacbca Give feedback when released from a bear trap 2017-09-28 22:38:08 +03:00
Pasi Kallinen
db23363d3f Fix mention_walls reporting secret doors as solid stone 2017-09-22 16:33:20 +03:00
Pasi Kallinen
f8bd77ae03 Use symbolic names for shop repair costs
...and add costs to two places where the door you touched
blew up (picking the lock and opening the door).
2017-09-14 21:07:18 +03:00
PatR
c377b584fc m_monnam() usage
m_monnam() overrides hallucination, which is appropriate in some
situations but not others.  This fixes one instance where it was
being misused:  discovering a hidden monster when another monster
attacks it was calling either m_monnam() or a_monnam(); one ignores
hallucination and the other doesn't, so accurate or inaccurate
monster type depended on the condition tested.

Figurine activation and egg hatching are using m_monnam(), which
seems suspect, but I left them as is.
2017-06-04 16:32:17 -07:00
PatR
f6b32bf03c fix #H5245 - levitation boots message sequencing
Report was for
  You finish taking off your boots.
  You float gently to the altar.  [destination was a red herring]
  [take some action to run through moveloop() for next turn]
  Your movements are slowed slightly because of your load.

Having float_down() do the next encumbrance check instead of
waiting for moveloop() to do so was straightforward.  However,
while testing I noticed the reverse situation (not due to the fix
for the above) when putting on levitation boots
  Your movements are now unencumbered.
  You finish your dressing maneuver.
  You start to float in the air!

Having float_up() do the encumbrance check isn't adequate to fix
this, because it takes multiple turns to put on boots but the
properties they confer are enabled immediately, so moveloop() runs
while hero is already levitating even though the game hasn't told
the player about it yet.  Fix is a hack to defer the effect of
levitation on encumbrance until the boots are fully worn, which
might lead to strangeness somewhere.  It's also boot-specific so
will need to be updated if some other multi-turn armor that confers
levitation ever gets added.
2017-05-06 14:47:28 -07:00
Pasi Kallinen
f82205c232 For travel target location, report if no known travel path
Yet another accessibility feature.  When asked for a location
to travel, and autodescribe is on, the location description
has "(no travel path)" appended, if there is no known path
to that location.
2016-08-31 22:08:15 +03:00
Pasi Kallinen
2710106661 Accessibility messages when run or travel is interrupted
These were inspired by the blind accessibility changes by
Alexei Pepers.
2016-08-29 20:47:40 +03:00
PatR
b47a456630 feedback for failed movement attempts
When underwater and an attempt to move onto adjacent land fails
because the destination is a wall or solid rock or closed door,
report that there's an obstacle instead of just silently failing
to make the move.

If the user has 'mention_walls' option set, give feedback for
failing to move diagonally into or out of a doorway instead of
just silently not moving.

Having 'mention_walls' set could yield "you cannot pass through
the bars" when travel was testing (not moving) for a path past
iron bars, and when it happened it tended to be delivered a whole
bunch of times.
2016-06-13 17:46:34 -07:00
Pasi Kallinen
3502cfcc5a Hallucinatory liquids for water, lava, and acid 2016-06-07 20:57:50 +03:00
Pasi Kallinen
e138a4b069 Fix travel occasionally walking you into pools
This was a bug introduced post-3.6.0 in commit 9a2eb370e7
2016-05-31 20:41:39 +03:00
PatR
ea9a95d463 travel comment formatting 2016-05-28 18:39:11 -07:00
Pasi Kallinen
332780763e Merge branch 'infinite-travel-fix' of https://github.com/tung/NetHack into tung-infinite-travel-fix 2016-05-28 09:50:20 +03:00
PatR
70ff2c2b3e cursed potion of levitation
Reported directly to devteam 7-Jan-2016, two issues with cursed
potion of levitation:
1) the go-up-stairs effect for cursed potion still let you choose
not to escape the dungeon if it occurred on level 1 stairs.  I've
left that as-is; perhaps there's a gate across the entrance.
2) both the go-up-stairs and bonk-head-on-ceiling effects were
skipped if the hero was already levitating.  I don't know whether
that was intentional but there was no comment explaining why, so
I've changed it to happen regardless of whether already levitating.

In the process, I changed the head-bonk case to do more damage when
a helmet is worn:
 old: no helmet 1..10 hp, any helmet 1 hp damage;
 new: no helmet 1..10 hp, soft hat 1..6 hp, hard helmet 1..3 hp.

Also, not in the report:  when you aren't already levitating you
get the "you float up" message, but for cursed potion there was
never any corresponding "you float down" message because you ended
up not levitating.  Now you'll levitate for 1 turn and float down
on the next, landing in a trap if one is present.
2016-05-07 17:26:01 -07:00
PatR
995404f6ad hack.c formatting
Triggered by a couple of mis-formatted block comments in spoteffects.
Much of the diff is adding braces to the 'if' portion of things like
  if (test)
statement;
  else {
block-of-statements;
  }
2016-05-07 16:32:25 -07:00
PatR
e8e8c14b34 more fixes for revised 'sortloot'
After some permutation of commands which displayed items, the 'd'
command presented a prompt with the list of letters scrambled (in
loot order or pack order rather than invlet order), so explicitly
sort when getobj operates.  Done for ggetobj too.

For menustyle:Traditional, ',' followed by 'm' presented a pickup
list in pile order even when sortloot was 'l' or 'f'.  That was an
unintentional change during the 'revamp'.
2016-03-22 01:19:27 -07:00
Tung Nguyen
3ed1aedeb7 Fix travel moving player back and forth infinitely
This fixes a bug where hundreds of turns are wasted by the travel system
moving the player back and forth when the player targets an unreachable
space and sight-blocking obstacles occur in certain formations
in-between.  The player will only be stopped if they're interrupted
externally, e.g. growing hungry or being hit by a monster.  See the
comment in the code for full details.

Based on DynaHack commit 02da53e (Fix travel moving player back and
forth repeatedly) by me.
2016-03-11 00:24:40 +11:00
Pasi Kallinen
17a4fc4492 Minor formatting fix 2016-01-15 13:02:42 +02:00
Pasi Kallinen
237c4a2787 Allow dissolving iron bars with potion of acid
Force-fight iron bars with wielded potion of acid to dissolve them

This change comes via UnNetHack by Patric Mueller.
2016-01-06 15:49:06 +02:00
Pasi Kallinen
a049cd070b Never route a travel path through boulders in Sokoban
Change via Dynahack by Tung Nguyen
2016-01-06 01:05:22 +02:00
Pasi Kallinen
715fd7e3d9 Displace a pet rather than stop travel
... and stop travel if you take damage from any source.

Original patch via Acehack by Alex Smith
2015-12-21 19:13:45 +02:00
Pasi Kallinen
4b876b1aec Fix findtravelpath buffer overflow
Test case: Bigroom, full of boulders, with a single
path from travel start to travel end. Boulders (and
doors) are added to the travelstep[xy] arrays multiple
times, and will overflow the arrays.

Original patch via Acehack by Alex Smith
2015-12-21 18:18:40 +02:00
Pasi Kallinen
9a2eb370e7 Make travel consider traps like closed doors
Test case: U-shaped corridor, with a known trap in it.
Before this change, travel would try to move straight at
the target, bumping the wall or walking into a dead-end.
After this, travel will go along the corridor and then stop
right before the trap.

Original patch via AceHack by Alex Smith.
2015-12-21 17:36:14 +02:00
Pasi Kallinen
943cc6057c More tiny formatting fixes, move function names to start of line 2015-11-25 10:15:41 +02:00
Pasi Kallinen
7063488621 Pacify some clang compile warnings 2015-11-21 23:40:06 +02:00