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

Function cause_known

src/insight.c:266–283  ·  view source on GitHub ↗

check whether hero is wearing something that player definitely knows confers the target property; item must have been seen and its type discovered but it doesn't necessarily have to be fully identified */

Source from the content-addressed store, hash-verified

264 confers the target property; item must have been seen and its type
265 discovered but it doesn't necessarily have to be fully identified */
266staticfn boolean
267cause_known(
268 int propindx) /* index of a property which can be conveyed by worn item */
269{
270 struct obj *o;
271 long mask = W_ARMOR | W_AMUL | W_RING | W_TOOL;
272
273 /* simpler than from_what()/what_gives(); we don't attempt to
274 handle artifacts and we deliberately ignore wielded items */
275 for (o = gi.invent; o; o = o->nobj) {
276 if (!(o->owornmask & mask))
277 continue;
278 if ((int) objects[o->otyp].oc_oprop == propindx
279 && objects[o->otyp].oc_name_known && o->dknown)
280 return TRUE;
281 }
282 return FALSE;
283}
284
285/* format a characteristic value, accommodating Strength's strangeness */
286staticfn char *

Callers 1

status_enlightenmentFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected