shop merchandise has been taken; pay for it with any credit available; return false if the debt is fully covered by credit, true otherwise */
| 684 | /* shop merchandise has been taken; pay for it with any credit available; |
| 685 | return false if the debt is fully covered by credit, true otherwise */ |
| 686 | staticfn boolean |
| 687 | rob_shop(struct monst *shkp) |
| 688 | { |
| 689 | struct eshk *eshkp; |
| 690 | long total; |
| 691 | |
| 692 | eshkp = ESHK(shkp); |
| 693 | rouse_shk(shkp, TRUE); |
| 694 | total = (addupbill(shkp) + eshkp->debit); |
| 695 | if (eshkp->credit >= total) { |
| 696 | Your("credit of %ld %s is used to cover your shopping bill.", |
| 697 | eshkp->credit, currency(eshkp->credit)); |
| 698 | total = 0L; /* credit gets cleared by setpaid() */ |
| 699 | } else { |
| 700 | You("escaped the shop without paying!"); |
| 701 | total -= eshkp->credit; |
| 702 | } |
| 703 | setpaid(shkp); |
| 704 | if (!total) |
| 705 | return FALSE; |
| 706 | |
| 707 | /* by this point, we know an actual robbery has taken place */ |
| 708 | eshkp->robbed += total; |
| 709 | You("stole %ld %s worth of merchandise.", total, currency(total)); |
| 710 | livelog_printf(LL_ACHIEVE, "stole %ld %s worth of merchandise from %s %s", |
| 711 | total, currency(total), s_suffix(shkname(shkp)), |
| 712 | shtypes[eshkp->shoptype - SHOPBASE].name); |
| 713 | |
| 714 | if (!Role_if(PM_ROGUE)) /* stealing is unlawful */ |
| 715 | adjalign(-sgn(u.ualign.type)); |
| 716 | |
| 717 | hot_pursuit(shkp); |
| 718 | return TRUE; |
| 719 | } |
| 720 | |
| 721 | /* give a message when entering an untended shop (caller has verified that) */ |
| 722 | staticfn void |
no test coverage detected