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

Function throwit_mon_hit

src/dothrow.c:1481–1506  ·  view source on GitHub ↗

thrown object hits a monster. mon may be NULL. returns TRUE if shopkeeper caught the object. may delete object, clearing gt.thrownobj */

Source from the content-addressed store, hash-verified

1479 returns TRUE if shopkeeper caught the object.
1480 may delete object, clearing gt.thrownobj */
1481boolean
1482throwit_mon_hit(struct obj *obj, struct monst *mon)
1483{
1484 if (mon) {
1485 boolean obj_gone;
1486
1487 if (mon->isshk && obj->where == OBJ_MINVENT && obj->ocarry == mon) {
1488 return TRUE;
1489 }
1490 (void) snuff_candle(obj);
1491 gn.notonhead = (gb.bhitpos.x != mon->mx || gb.bhitpos.y != mon->my);
1492 obj_gone = thitmonst(mon, obj);
1493 /* Monster may have been tamed; this frees old mon [obsolete] */
1494 mon = m_at(gb.bhitpos.x, gb.bhitpos.y);
1495
1496 /* [perhaps this should be moved into thitmonst or hmon] */
1497 if (mon && mon->isshk
1498 && (!inside_shop(u.ux, u.uy)
1499 || !strchr(in_rooms(mon->mx, mon->my, SHOPBASE), *u.ushops)))
1500 hot_pursuit(mon);
1501
1502 if (obj_gone)
1503 gt.thrownobj = (struct obj *) 0;
1504 }
1505 return FALSE;
1506}
1507
1508/* throw an object, NB: obj may be consumed in the process */
1509void

Callers 2

throwitFunction · 0.85
boomhitFunction · 0.85

Calls 5

snuff_candleFunction · 0.85
thitmonstFunction · 0.85
inside_shopFunction · 0.85
in_roomsFunction · 0.85
hot_pursuitFunction · 0.85

Tested by

no test coverage detected