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

Function can_touch_safely

src/mon.c:1957–1974  ·  view source on GitHub ↗

can monster touch object safely? */

Source from the content-addressed store, hash-verified

1955
1956/* can monster touch object safely? */
1957boolean
1958can_touch_safely(struct monst *mtmp, struct obj *otmp)
1959{
1960 int otyp = otmp->otyp;
1961 struct permonst *mdat = mtmp->data;
1962
1963 if (otyp == CORPSE && touch_petrifies(&mons[otmp->corpsenm])
1964 && !(mtmp->misc_worn_check & W_ARMG) && !resists_ston(mtmp))
1965 return FALSE;
1966 if (otyp == CORPSE && is_rider(&mons[otmp->corpsenm]))
1967 return FALSE;
1968 if (objects[otyp].oc_material == SILVER && mon_hates_silver(mtmp)
1969 && (otyp != BELL_OF_OPENING || !is_covetous(mdat)))
1970 return FALSE;
1971 if (!touch_artifact(otmp, mtmp))
1972 return FALSE;
1973 return TRUE;
1974}
1975
1976/* for restricting monsters' object-pickup.
1977 *

Callers 4

oselectFunction · 0.85
mpickstuffFunction · 0.85
can_carryFunction · 0.85
m_search_itemsFunction · 0.85

Calls 2

mon_hates_silverFunction · 0.85
touch_artifactFunction · 0.85

Tested by

no test coverage detected