thrown object hits a monster. mon may be NULL. returns TRUE if shopkeeper caught the object. may delete object, clearing gt.thrownobj */
| 1479 | returns TRUE if shopkeeper caught the object. |
| 1480 | may delete object, clearing gt.thrownobj */ |
| 1481 | boolean |
| 1482 | throwit_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 */ |
| 1509 | void |
no test coverage detected