| 1525 | } |
| 1526 | |
| 1527 | staticfn void |
| 1528 | consume_tin(const char *mesg) |
| 1529 | { |
| 1530 | const char *what; |
| 1531 | int which, mnum, r, nutamt; |
| 1532 | /* if you've eaten tin itself, chance to not eat contents gets bypassed */ |
| 1533 | boolean always_eat = metallivorous(gy.youmonst.data); |
| 1534 | struct obj *tin = svc.context.tin.tin; |
| 1535 | |
| 1536 | r = tin_variety(tin, FALSE); |
| 1537 | if (tin->otrapped || (tin->cursed && r != HOMEMADE_TIN && !rn2(8))) { |
| 1538 | b_trapped("tin", NO_PART); |
| 1539 | tin = costly_tin(COST_DSTROY); |
| 1540 | use_up_tin(tin); |
| 1541 | return; |
| 1542 | } |
| 1543 | |
| 1544 | pline1(mesg); /* "You succeed in opening the tin." */ |
| 1545 | |
| 1546 | if (r != SPINACH_TIN) { |
| 1547 | mnum = tin->corpsenm; |
| 1548 | if (mnum == NON_PM) { |
| 1549 | if (Hallucination) |
| 1550 | pline("It's full of %s.", |
| 1551 | rn2(2) ? "air elemental souffle" |
| 1552 | : "dehydrated water"); |
| 1553 | else |
| 1554 | pline("It turns out to be empty."); |
| 1555 | observe_object(tin); |
| 1556 | tin->known = 1; |
| 1557 | tin = costly_tin(COST_OPEN); |
| 1558 | use_up_tin(tin); |
| 1559 | if (always_eat) |
| 1560 | lesshungry(5); /* metallivorous hero ate the tin itself */ |
| 1561 | return; |
| 1562 | } |
| 1563 | |
| 1564 | which = 0; /* 0=>plural, 1=>as-is, 2=>"the" prefix */ |
| 1565 | if ((mnum == PM_COCKATRICE || mnum == PM_CHICKATRICE) |
| 1566 | && (Stone_resistance || Hallucination)) { |
| 1567 | what = "chicken"; |
| 1568 | which = 1; /* suppress pluralization */ |
| 1569 | } else if (Hallucination) { |
| 1570 | what = rndmonnam(NULL); |
| 1571 | } else { |
| 1572 | what = mons[mnum].pmnames[NEUTRAL]; |
| 1573 | if (the_unique_pm(&mons[mnum])) |
| 1574 | which = 2; |
| 1575 | else if (type_is_pname(&mons[mnum])) |
| 1576 | which = 1; |
| 1577 | } |
| 1578 | if (which == 0) |
| 1579 | what = makeplural(what); |
| 1580 | else if (which == 2) |
| 1581 | what = the(what); |
| 1582 | |
| 1583 | if (!always_eat) { |
| 1584 | pline("It smells like %s.", what); |
no test coverage detected