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

Function avoid_running_into_trap_or_liquid

src/hack.c:2494–2509  ·  view source on GitHub ↗

when running/rushing, avoid stepping on a known trap or pool of liquid. returns TRUE if avoided. */

Source from the content-addressed store, hash-verified

2492/* when running/rushing, avoid stepping on a known trap or pool of liquid.
2493 returns TRUE if avoided. */
2494staticfn boolean
2495avoid_running_into_trap_or_liquid(coordxy x, coordxy y)
2496{
2497 boolean would_stop = (svc.context.run >= 2);
2498 if (!svc.context.run)
2499 return FALSE;
2500
2501 if (avoid_moving_on_trap(x,y, would_stop)
2502 || (Blind && avoid_moving_on_liquid(x,y, would_stop))) {
2503 nomul(0);
2504 if (would_stop)
2505 svc.context.move = 0;
2506 return would_stop;
2507 }
2508 return FALSE;
2509}
2510
2511/* if paranoid_confirm:Trap is enabled, check whether the next step forward
2512 needs player confirmation due to visible region or discovered trap;

Callers 1

domove_coreFunction · 0.85

Calls 3

avoid_moving_on_trapFunction · 0.85
avoid_moving_on_liquidFunction · 0.85
nomulFunction · 0.85

Tested by

no test coverage detected