From 447da0948f0ca1a2a8d24df82e61ed12a1510885 Mon Sep 17 00:00:00 2001 From: PatR Date: Wed, 4 Sep 2024 13:22:14 -0700 Subject: [PATCH] shopkeeper vs boulder Noticed when testing boulder pushing into/out of shops yesterday: a shopkeeper can "mutter incantations" and fracture a boulder in the shop, transforming it to rocks. If hero owed shk for the boulder (happens when it has been further inside the shop and then gets pushed to the shop's free spot), it would disappear from the shop's bill and hero would then owe for the resulting rocks (which cost more than the boulder!). That seemed confusing, especially since neither Iu nor Ix would show the rocks (which are on the floor rather than in invent; the $ command reported the amount owed, but not what the item was). When such fracturing happens move the boulder from the unpaid section of the shop bill to the used-up section before creating the rocks, which are no longer interesting. --- doc/fixes3-7-0.txt | 2 ++ src/monmove.c | 9 +++++++++ src/zap.c | 2 +- 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/doc/fixes3-7-0.txt b/doc/fixes3-7-0.txt index b2f4651bb..803596e42 100644 --- a/doc/fixes3-7-0.txt +++ b/doc/fixes3-7-0.txt @@ -1162,6 +1162,8 @@ prevent hug attacks and touch or engulf attacks for wrap, stick-to, and vortices, a few others) or against worm tails wand of speed gives temporary speed, potion gives intrinsic some monsters (riders, shopkeepers, priests, quest leader) can break boulders +if hero owes shop for a boulder and shopkeeper breaks it, continue to bill hero + for the boulder rather than switching to the resulting rocks corpse-eating monsters will go out of their way to eat corpses on the floor warnings via impossible() would be unseen if message suppression via ESC at --More-- prompt was in effect diff --git a/src/monmove.c b/src/monmove.c index 5822d5fc9..19d2e70a7 100644 --- a/src/monmove.c +++ b/src/monmove.c @@ -159,6 +159,15 @@ m_break_boulder(struct monst *mtmp, coordxy x, coordxy y) set_msg_xy(x, y); pline_The("boulder falls apart."); } + + /* boulders pushed onto shop's boundary or free spot are cases where + an item not in hero's inventory can have its unpaid flag set; + if the boulder isn't already on the bill, don't charge for it */ + if (otmp->unpaid) { + /* remove original from bill and add cloned copy to used-up bill */ + bill_dummy_object(otmp); + } + /* fracturing keeps otmp, changing its otyp from BOULDER to ROCK */ fracture_rock(otmp); } } diff --git a/src/zap.c b/src/zap.c index e4ead85a6..6de9b7d59 100644 --- a/src/zap.c +++ b/src/zap.c @@ -5416,7 +5416,7 @@ mon_spell_hits_spot( } } -/* fractured by pick-axe or wand of striking or by vault guard */ +/* fractured by pick-axe or wand of striking or by vault guard or shopkeeper */ void fracture_rock(struct obj *obj) /* no texts here! */ {