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

Function float_up

src/trap.c:3936–4006  ·  view source on GitHub ↗

start levitating */

Source from the content-addressed store, hash-verified

3934
3935/* start levitating */
3936void
3937float_up(void)
3938{
3939 disp.botl = TRUE;
3940 if (u.utrap) {
3941 if (u.utraptype == TT_PIT) {
3942 reset_utrap(FALSE);
3943 You("float up, out of the %s!", trapname(PIT, FALSE));
3944 gv.vision_full_recalc = 1; /* vision limits change */
3945 fill_pit(u.ux, u.uy);
3946 } else if (u.utraptype == TT_LAVA /* molten lava */
3947 || u.utraptype == TT_INFLOOR) { /* solidified lava */
3948 Your("body pulls upward, but your %s are still stuck.",
3949 makeplural(body_part(LEG)));
3950 } else if (u.utraptype == TT_BURIEDBALL) { /* tethered */
3951 coord cc;
3952
3953 cc.x = u.ux, cc.y = u.uy;
3954 /* caveat: this finds the first buried iron ball within
3955 one step of the specified location, not necessarily the
3956 buried [former] uball at the original anchor point */
3957 (void) buried_ball(&cc);
3958 /* being chained to the floor blocks levitation from floating
3959 above that floor but not from enhancing carrying capacity */
3960 You("feel lighter, but your %s is still chained to the %s.",
3961 body_part(LEG),
3962 IS_ROOM(levl[cc.x][cc.y].typ) ? "floor" : "ground");
3963 } else if (u.utraptype == WEB) {
3964 You("float up slightly, but you are still stuck in the %s.",
3965 trapname(WEB, FALSE));
3966 } else { /* bear trap */
3967 You("float up slightly, but your %s is still stuck.",
3968 body_part(LEG));
3969 }
3970 /* when still trapped, float_vs_flight() below will block levitation */
3971#if 0
3972 } else if (Is_waterlevel(&u.uz)) {
3973 pline("It feels as though you've lost some weight.");
3974#endif
3975 } else if (u.uinwater) {
3976 spoteffects(TRUE);
3977 } else if (u.uswallow) {
3978 /* FIXME: this isn't correct for trapper/lurker above */
3979 if (is_animal(u.ustuck->data))
3980 You("float away from the %s.", surface(u.ux, u.uy));
3981 else
3982 You("spiral up into %s.", mon_nam(u.ustuck));
3983 } else if (Hallucination) {
3984 pline("Up, up, and awaaaay! You're walking on air!");
3985 } else if (Is_airlevel(&u.uz)) {
3986 You("gain control over your movements.");
3987 } else {
3988 You("start to float in the air!");
3989 }
3990 if (u.usteed && !is_floater(u.usteed->data)
3991 && !is_flyer(u.usteed->data)) {
3992 if (Lev_at_will) {
3993 pline("%s magically floats up!", Monnam(u.usteed));

Callers 7

peffect_levitationFunction · 0.85
Boots_onFunction · 0.85
Ring_onFunction · 0.85
arti_invokeFunction · 0.85
switch_terrainFunction · 0.85
eataccessoryFunction · 0.85
reset_utrapFunction · 0.85

Calls 15

reset_utrapFunction · 0.85
YouFunction · 0.85
trapnameFunction · 0.85
fill_pitFunction · 0.85
YourFunction · 0.85
makepluralFunction · 0.85
body_partFunction · 0.85
buried_ballFunction · 0.85
spoteffectsFunction · 0.85
surfaceFunction · 0.85
mon_namFunction · 0.85
MonnamFunction · 0.85

Tested by

no test coverage detected