MCPcopy Index your code
hub / github.com/NetHack/NetHack / has_magic_key

Function has_magic_key

src/artifact.c:2789–2803  ·  view source on GitHub ↗

figure out whether 'mon' (usually youmonst) is carrying the magic key */

Source from the content-addressed store, hash-verified

2787
2788/* figure out whether 'mon' (usually youmonst) is carrying the magic key */
2789struct obj *
2790has_magic_key(struct monst *mon) /* if null, hero assumed */
2791{
2792 struct obj *o;
2793 short key = artilist[ART_MASTER_KEY_OF_THIEVERY].otyp;
2794
2795 if (!mon)
2796 mon = &gy.youmonst;
2797 for (o = ((mon == &gy.youmonst) ? gi.invent : mon->minvent); o;
2798 o = nxtobj(o, key, FALSE)) {
2799 if (is_magic_key(mon, o))
2800 return o;
2801 }
2802 return (struct obj *) 0;
2803}
2804
2805/* #define is_art(o,art) ((o) && (o)->oartifact == (art)) */
2806

Callers 2

untrapFunction · 0.85
postmovFunction · 0.85

Calls 2

nxtobjFunction · 0.85
is_magic_keyFunction · 0.85

Tested by

no test coverage detected