MCPcopy Index your code
hub / github.com/NetHack/NetHack / float_down

Function float_down

src/trap.c:4023–4179  ·  view source on GitHub ↗

stop levitating */

Source from the content-addressed store, hash-verified

4021
4022/* stop levitating */
4023int
4024float_down(
4025 long hmask,
4026 long emask) /* might cancel timeout */
4027{
4028 struct trap *trap = (struct trap *) 0;
4029 d_level current_dungeon_level;
4030 boolean no_msg = FALSE;
4031
4032 HLevitation &= ~hmask;
4033 ELevitation &= ~emask;
4034 if (Levitation)
4035 return 0; /* maybe another ring/potion/boots */
4036 if (BLevitation) {
4037 /* if blocked by terrain, we haven't actually been levitating so
4038 we don't give any end-of-levitation feedback or side-effects,
4039 but if blocking is solely due to being trapped in/on floor,
4040 do give some feedback but skip other float_down() effects */
4041 boolean trapped = (BLevitation == I_SPECIAL);
4042
4043 float_vs_flight();
4044 if (trapped && u.utrap) /* u.utrap => paranoia */
4045 You("are no longer trying to float up from the %s.",
4046 (u.utraptype == TT_BEARTRAP) ? "trap's jaws"
4047 : (u.utraptype == TT_WEB) ? "web"
4048 : (u.utraptype == TT_BURIEDBALL) ? "chain"
4049 : (u.utraptype == TT_LAVA) ? "lava"
4050 : "ground"); /* TT_INFLOOR */
4051 encumber_msg(); /* carrying capacity might have changed */
4052 return 0;
4053 }
4054 disp.botl = TRUE;
4055 nomul(0); /* stop running or resting */
4056 if (BFlying) {
4057 /* controlled flight no longer overridden by levitation */
4058 float_vs_flight(); /* clears BFlying & I_SPECIAL
4059 * unless hero is stuck in floor */
4060 if (Flying) {
4061 You("have stopped levitating and are now flying.");
4062 encumber_msg(); /* carrying capacity might have changed */
4063 return 1;
4064 }
4065 }
4066 if (u.uswallow) {
4067 You("float down, but you are still %s.",
4068 digests(u.ustuck->data) ? "swallowed" : "engulfed");
4069 encumber_msg();
4070 return 1;
4071 }
4072
4073 if (Punished && !carried(uball) && !m_at(uball->ox, uball->oy)
4074 && (is_pool(uball->ox, uball->oy)
4075 || ((trap = t_at(uball->ox, uball->oy))
4076 && (is_pit(trap->ttyp) || is_hole(trap->ttyp))))) {
4077 u.ux0 = u.ux;
4078 u.uy0 = u.uy;
4079 u.ux = uball->ox;
4080 u.uy = uball->oy;

Callers 8

Boots_offFunction · 0.85
Ring_off_or_goneFunction · 0.85
dismount_steedFunction · 0.85
dropFunction · 0.85
dodownFunction · 0.85
arti_invokeFunction · 0.85
spoteffectsFunction · 0.85
nh_timeoutFunction · 0.85

Calls 15

float_vs_flightFunction · 0.85
YouFunction · 0.85
encumber_msgFunction · 0.85
nomulFunction · 0.85
is_poolFunction · 0.85
t_atFunction · 0.85
movobjFunction · 0.85
newsymFunction · 0.85
sticksFunction · 0.85
mon_namFunction · 0.85
set_ustuckFunction · 0.85
drownFunction · 0.85

Tested by

no test coverage detected