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

Function able_to_loot

src/pickup.c:2040–2069  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2038}
2039
2040staticfn boolean
2041able_to_loot(
2042 coordxy x, coordxy y,
2043 boolean looting) /* loot vs tip */
2044{
2045 const char *verb = looting ? "loot" : "tip";
2046 struct trap *t = t_at(x, y);
2047
2048 if (!can_reach_floor(t && is_pit(t->ttyp))) {
2049 if (u.usteed && P_SKILL(P_RIDING) < P_BASIC)
2050 rider_cant_reach(); /* not skilled enough to reach */
2051 else
2052 cant_reach_floor(x, y, FALSE, TRUE, FALSE);
2053 return FALSE;
2054 } else if ((is_pool(x, y) && (looting || !Underwater)) || is_lava(x, y)) {
2055 /* at present, can't loot in water even when Underwater;
2056 can tip underwater, but not when over--or stuck in--lava */
2057 You("cannot %s things that are deep in the %s.", verb,
2058 hliquid(is_lava(x, y) ? "lava" : "water"));
2059 return FALSE;
2060 } else if (nolimbs(gy.youmonst.data)) {
2061 pline("Without limbs, you cannot %s anything.", verb);
2062 return FALSE;
2063 } else if (looting && !freehand()) {
2064 pline("Without a free %s, you cannot loot anything.",
2065 body_part(HAND));
2066 return FALSE;
2067 }
2068 return TRUE;
2069}
2070
2071staticfn boolean
2072mon_beside(coordxy x, coordxy y)

Callers 2

doloot_coreFunction · 0.85
dotipFunction · 0.85

Calls 11

t_atFunction · 0.85
can_reach_floorFunction · 0.85
rider_cant_reachFunction · 0.85
cant_reach_floorFunction · 0.85
is_poolFunction · 0.85
is_lavaFunction · 0.85
YouFunction · 0.85
hliquidFunction · 0.85
freehandFunction · 0.85
body_partFunction · 0.85
plineFunction · 0.70

Tested by

no test coverage detected