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

Function oselect

src/weapon.c:475–496  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

473 } while (0)
474
475staticfn struct obj *
476oselect(struct monst *mtmp, int type)
477{
478 struct obj *otmp;
479
480 for (otmp = mtmp->minvent; otmp; otmp = otmp->nobj) {
481 if (otmp->otyp != type)
482 continue;
483
484 /* never select non-cockatrice corpses */
485 if ((type == CORPSE || type == EGG)
486 && (otmp->corpsenm == NON_PM
487 || !touch_petrifies(&mons[otmp->corpsenm])))
488 continue;
489
490 if (!can_touch_safely(mtmp, otmp))
491 continue;
492
493 return otmp;
494 }
495 return (struct obj *) 0;
496}
497
498static NEARDATA const int rwep[] = {
499 DWARVISH_SPEAR, SILVER_SPEAR, ELVEN_SPEAR, SPEAR, ORCISH_SPEAR, JAVELIN,

Callers 1

select_rwepFunction · 0.85

Calls 1

can_touch_safelyFunction · 0.85

Tested by

no test coverage detected