costly_alteration() tweaking (trunk only)

For cancellation I accidentally used terrain type WATER when I meant
object type POT_WATER, so being charged for cancelling holy or unholy water
wasn't working.  When I first put in COST_UNHOLY the name made some sense
based on its usage, but after later adding COST_UNBLSS it didn't any more;
change it to COST_UNCURS.

     A shopkeeper's complaint that you're uncursing or unblessing his wares
(only applies to water) now sets bknown flag since you know that the object
has become uncursed.  I hadn't realized that confused remove curse only
affects uncursed objects; this greatly simplifies extra code I added there
for costly_alteration().

[No fixes entry needed.]
This commit is contained in:
nethack.rankin
2005-04-15 02:41:53 +00:00
parent 1a2ebd1ce9
commit 4e9c26fc28
5 changed files with 28 additions and 37 deletions

View File

@@ -964,39 +964,22 @@ struct obj *sobj;
if (sobj->blessed || wornmask ||
obj->otyp == LOADSTONE ||
(obj->otyp == LEASH && obj->leashmon)) {
unsigned save_bknown, save_cursed, save_blessed;
boolean was_cursed = !!obj->cursed,
was_blessed = !!obj->blessed,
was_normal = !(was_cursed || was_blessed);
if(confused) blessorcurse(obj, 2);
else uncurse(obj);
/* water price varies by curse/bless status */
if (obj->unpaid && obj->otyp == POT_WATER) {
if ((was_cursed && !obj->cursed) ||
(was_blessed && !obj->blessed)) {
/* make `Ix' more specific for this item */
save_bknown = obj->bknown;
obj->bknown = 1;
/* temporarily restore curse/bless to
obtain the right shop price (if potion
went from cursed directly to blessed
or vice versa its price didn't change
but hero will have to buy it anyway) */
save_cursed = obj->cursed;
obj->cursed = was_cursed ? 1 : 0;
save_blessed = obj->blessed;
obj->blessed = was_blessed ? 1 : 0;
costly_alteration(obj, was_cursed ?
COST_UNHOLY : COST_UNBLSS);
obj->bknown = save_bknown;
obj->cursed = save_cursed;
obj->blessed = save_blessed;
} else if (was_normal &&
(obj->blessed || obj->cursed)) {
alter_cost(obj, 0L);
}
} /* unpaid water */
boolean shop_h2o = (obj->unpaid &&
obj->otyp == POT_WATER);
if (confused) {
blessorcurse(obj, 2);
/* blessorcurse() only affects uncursed items
so no need to worry about price of water
going down (hence no costly_alteration) */
if (shop_h2o && (obj->cursed || obj->blessed))
alter_cost(obj, 0L); /* price goes up */
} else if (obj->cursed) {
if (shop_h2o)
costly_alteration(obj, COST_UNCURS);
uncurse(obj);
}
}
}
}