From 3086f1638643dfde1df893c6f7d1d3862ba647cc Mon Sep 17 00:00:00 2001 From: Pasi Kallinen Date: Sat, 13 Apr 2024 15:10:15 +0300 Subject: [PATCH] Shopkeepers bill you for using their bear trap or land mine --- doc/fixes3-7-0.txt | 1 + include/extern.h | 1 + src/apply.c | 1 + src/shk.c | 17 +++++++++++++++++ 4 files changed, 20 insertions(+) diff --git a/doc/fixes3-7-0.txt b/doc/fixes3-7-0.txt index 39e1b9329..159ba317b 100644 --- a/doc/fixes3-7-0.txt +++ b/doc/fixes3-7-0.txt @@ -1399,6 +1399,7 @@ gold thrown or kicked at a sleeping monster with the 'greedy' attribute gets neglected to report that target monster was awakened in the process hero movement affects the water bubble movement direction pets and peacefuls avoid a location hero just kicked +shopkeepers bill you for using their bear trap or land mine Fixes to 3.7.0-x General Problems Exposed Via git Repository diff --git a/include/extern.h b/include/extern.h index 85ec516c2..113984202 100644 --- a/include/extern.h +++ b/include/extern.h @@ -2847,6 +2847,7 @@ extern void globby_bill_fixup(struct obj *, struct obj *) NONNULLARG12; /*extern void globby_donation(struct obj *, struct obj *); */ extern void credit_report(struct monst *shkp, int idx, boolean silent) NONNULLARG1; +extern void use_unpaid_trapobj(struct obj *, coordxy, coordxy) NONNULLARG1; /* ### shknam.c ### */ diff --git a/src/apply.c b/src/apply.c index 709807ffc..6c18cb039 100644 --- a/src/apply.c +++ b/src/apply.c @@ -2880,6 +2880,7 @@ use_trap(struct obj *otmp) } } You("begin setting %s%s.", shk_your(buf, otmp), trapname(ttyp, FALSE)); + use_unpaid_trapobj(otmp, u.ux, u.uy); set_occupation(set_trap, occutext, 0); return; } diff --git a/src/shk.c b/src/shk.c index 25fd6ebf4..e0b638ce0 100644 --- a/src/shk.c +++ b/src/shk.c @@ -5523,4 +5523,21 @@ globby_bill_fixup(struct obj *obj_absorber, struct obj *obj_absorbed) return; } +/* Shopkeeper bills for use of a land mine or bear trap they own */ +void +use_unpaid_trapobj(struct obj *otmp, coordxy x, coordxy y) +{ + if (otmp->unpaid) { + if (!Deaf) { + struct monst *shkp = find_objowner(otmp, x, y); + + if (shkp && !muteshk(shkp)) { + SetVoice(shkp, 0, 80, 0); + verbalize("You set it, you buy it!"); + } + } + bill_dummy_object(otmp); + } +} + /*shk.c*/