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

Function activate_statue_trap

src/trap.c:907–936  ·  view source on GitHub ↗

* You've either stepped onto a statue trap's location or you've triggered a * statue trap by searching next to it or by trying to break it with a wand * or pick-axe. */

Source from the content-addressed store, hash-verified

905 * or pick-axe.
906 */
907struct monst *
908activate_statue_trap(
909 struct trap *trap,
910 coordxy x,
911 coordxy y,
912 boolean shatter)
913{
914 struct monst *mtmp = (struct monst *) 0;
915 struct obj *otmp = sobj_at(STATUE, x, y);
916 int fail_reason;
917
918 /*
919 * Try to animate the first valid statue. Stop the loop when we
920 * actually create something or the failure cause is not because
921 * the mon was unique.
922 */
923 deltrap(trap);
924 while (otmp) {
925 mtmp = animate_statue(otmp, x, y,
926 shatter ? ANIMATE_SHATTER : ANIMATE_NORMAL,
927 &fail_reason);
928 if (mtmp || fail_reason != AS_MON_IS_UNIQUE)
929 break;
930
931 otmp = nxtobj(otmp, STATUE, TRUE);
932 }
933
934 feel_newsym(x, y);
935 return mtmp;
936}
937
938staticfn boolean
939keep_saddle_with_steedcorpse(

Callers 6

dosearch0Function · 0.85
trapeffect_statue_trapFunction · 0.85
bhitpileFunction · 0.85
break_statueFunction · 0.85
really_kick_objectFunction · 0.85
use_poleFunction · 0.85

Calls 5

sobj_atFunction · 0.85
deltrapFunction · 0.85
animate_statueFunction · 0.85
nxtobjFunction · 0.85
feel_newsymFunction · 0.85

Tested by

no test coverage detected