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

Function water_turbulence

src/hack.c:2364–2393  ·  view source on GitHub ↗

does water disturb the movement? */

Source from the content-addressed store, hash-verified

2362
2363/* does water disturb the movement? */
2364staticfn boolean
2365water_turbulence(coordxy *x, coordxy *y)
2366{
2367 if (u.uinwater) {
2368 int wtcap;
2369 int wtmod = (Swimming ? MOD_ENCUMBER : SLT_ENCUMBER);
2370
2371 water_friction();
2372 if (!u.dx && !u.dy) {
2373 nomul(0);
2374 return TRUE;
2375 }
2376 *x = u.ux + u.dx;
2377 *y = u.uy + u.dy;
2378
2379 /* are we trying to move out of water while carrying too much? */
2380 if (isok(*x, *y) && !is_pool(*x, *y) && !Is_waterlevel(&u.uz)
2381 && (wtcap = near_capacity()) > wtmod) {
2382 /* when escaping from drowning you need to be unencumbered
2383 in order to crawl out of water, but when not drowning,
2384 doing so while encumbered is feasible; if in an aquatic
2385 form, stressed or less is allowed; otherwise (magical
2386 breathing), only burdened is allowed */
2387 You("are carrying too much to climb out of the water.");
2388 nomul(0);
2389 return TRUE;
2390 }
2391 }
2392 return FALSE;
2393}
2394
2395staticfn void
2396slippery_ice_fumbling(void)

Callers 1

domove_coreFunction · 0.85

Calls 6

water_frictionFunction · 0.85
nomulFunction · 0.85
isokFunction · 0.85
is_poolFunction · 0.85
near_capacityFunction · 0.85
YouFunction · 0.85

Tested by

no test coverage detected