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.
This commit is contained in:
PatR
2017-05-06 14:47:28 -07:00
parent 35d9cd3fd0
commit f6b32bf03c
5 changed files with 46 additions and 13 deletions

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 trap.c $NHDT-Date: 1489745987 2017/03/17 10:19:47 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.277 $ */
/* NetHack 3.6 trap.c $NHDT-Date: 1494107206 2017/05/06 21:46:46 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.278 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -2794,6 +2794,9 @@ float_up()
if (Flying)
You("are no longer able to control your flight.");
BFlying |= I_SPECIAL;
/* levitation gives maximum carrying capacity, so encumbrance
state might be reduced */
(void) encumber_msg();
return;
}
@@ -2837,12 +2840,14 @@ long hmask, emask; /* might cancel timeout */
BFlying &= ~I_SPECIAL;
if (Flying) {
You("have stopped levitating and are now flying.");
(void) encumber_msg(); /* carrying capacity might have changed */
return 1;
}
}
if (u.uswallow) {
You("float down, but you are still %s.",
is_animal(u.ustuck->data) ? "swallowed" : "engulfed");
(void) encumber_msg();
return 1;
}
@@ -2924,6 +2929,11 @@ long hmask, emask; /* might cancel timeout */
}
}
/* levitation gives maximum carrying capacity, so having it end
potentially triggers greater encumbrance; do this after
'come down' messages, before trap activation or autopickup */
(void) encumber_msg();
/* can't rely on u.uz0 for detecting trap door-induced level change;
it gets changed to reflect the new level before we can check it */
assign_level(&current_dungeon_level, &u.uz);