MCPcopy Create free account
hub / github.com/NetHack/NetHack / rescued_from_terrain

Function rescued_from_terrain

src/trap.c:5013–5055  ·  view source on GitHub ↗

life-saving or divine rescue has attempted to get the hero out of hostile terrain and put hero in an unexpected spot or failed due to overfull level and just prevented death so "back on solid ground" may be inappropriate */

Source from the content-addressed store, hash-verified

5011 terrain and put hero in an unexpected spot or failed due to overfull level
5012 and just prevented death so "back on solid ground" may be inappropriate */
5013void
5014rescued_from_terrain(int how)
5015{
5016 static const char find_yourself[] = "find yourself";
5017 struct rm *lev = &levl[u.ux][u.uy];
5018 boolean mesggiven = FALSE;
5019
5020 switch (how) {
5021 case DROWNING:
5022 if (is_pool(u.ux, u.uy)) {
5023 You("%s %s of %s.", find_yourself,
5024 (Is_waterlevel(&u.uz) || IS_WATERWALL(lev->typ))
5025 ? "in the midst" : "on top",
5026 hliquid("water"));
5027 mesggiven = TRUE;
5028 } else if (IS_AIR(lev->typ)) {
5029 You("%s in %s.", find_yourself,
5030 Is_waterlevel(&u.uz) ? "an air bubble" : "mid air");
5031 mesggiven = TRUE;
5032 }
5033 break;
5034 case BURNING: /* moved onto lava without fire resistance */
5035 case DISSOLVED: /* sunk into lava while fire resistant */
5036 if (is_pool(u.ux, u.uy)) {
5037 You("%s %s %s.", find_yourself,
5038 u.uinwater ? "in" : "on", hliquid("water"));
5039 mesggiven = TRUE;
5040 } else if (is_lava(u.ux, u.uy)) {
5041 You("%s on top of %s.", find_yourself, hliquid("molten lava"));
5042 mesggiven = TRUE;
5043 }
5044 break;
5045 default:
5046 break;
5047 }
5048 if (!mesggiven)
5049 back_on_ground(TRUE);
5050
5051 iflags.last_msg = PLNMSG_BACK_ON_GROUND; /* for describe_decor() */
5052 /* feedback just disclosed this */
5053 update_lastseentyp(u.ux, u.uy);
5054 iflags.prev_decor = svl.lastseentyp[u.ux][u.uy];
5055}
5056
5057/* return TRUE iff player relocated */
5058boolean

Callers 3

fix_worst_troubleFunction · 0.85
drownFunction · 0.85
lava_effectsFunction · 0.85

Calls 6

is_poolFunction · 0.85
YouFunction · 0.85
hliquidFunction · 0.85
is_lavaFunction · 0.85
back_on_groundFunction · 0.85
update_lastseentypFunction · 0.85

Tested by

no test coverage detected