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

Function protects

src/artifact.c:697–709  ·  view source on GitHub ↗

determine whether an item confers Protection */

Source from the content-addressed store, hash-verified

695
696/* determine whether an item confers Protection */
697boolean
698protects(struct obj *otmp, boolean being_worn)
699{
700 const struct artifact *arti;
701
702 if (being_worn && objects[otmp->otyp].oc_oprop == PROTECTION)
703 return TRUE;
704 arti = get_artifact(otmp);
705 if (arti == &artilist[ART_NONARTIFACT])
706 return FALSE;
707 return (boolean) ((arti->cspfx & SPFX_PROTECT) != 0
708 || (being_worn && (arti->spfx & SPFX_PROTECT) != 0));
709}
710
711/*
712 * a potential artifact has just been worn/wielded/picked-up or

Callers 1

magic_negationFunction · 0.85

Calls 1

get_artifactFunction · 0.85

Tested by

no test coverage detected