diff --git a/include/hack.h b/include/hack.h index c9ae85eb8..d6600798f 100644 --- a/include/hack.h +++ b/include/hack.h @@ -64,7 +64,7 @@ #define COST_DRAIN 1 /* drain life upon an object */ #define COST_UNCHRG 2 /* cursed charging */ #define COST_UNBLSS 3 /* unbless (devalues holy water) */ -#define COST_UNHOLY 4 /* uncurse (devalues unholy water) */ +#define COST_UNCURS 4 /* uncurse (devalues unholy water) */ #define COST_DECHNT 5 /* disenchant weapons or armor */ #define COST_DEGRD 6 /* removal of rustproofing, dulling via engraving */ #define COST_DILUTE 7 /* potion dilution */ diff --git a/src/mkobj.c b/src/mkobj.c index d84ff79da..ec635534b 100644 --- a/src/mkobj.c +++ b/src/mkobj.c @@ -369,6 +369,7 @@ int alter_type; { xchar ox, oy; char objroom; + boolean set_bknown; const char *those, *them, *what; struct monst *shkp = 0; @@ -401,9 +402,15 @@ int alter_type; else those = "those", them = "them"; + /* when shopkeeper describes the object as being uncursed or unblessed + hero will know that it is now uncursed; will also make the feedback + from `I x' after bill_dummy_object() be more specific for this item */ + set_bknown = (alter_type == COST_UNCURS || alter_type == COST_UNBLSS); + switch (obj->where) { case OBJ_FREE: /* obj_no_longer_held() */ case OBJ_INVENT: + if (set_bknown) obj->bknown = 1; what = simple_typename(obj->otyp); if (obj->quan != 1L) what = makeplural(what); verbalize("You %s %s %s, you pay for %s!", @@ -411,6 +418,7 @@ int alter_type; bill_dummy_object(obj); break; case OBJ_FLOOR: + if (set_bknown) obj->bknown = 1; if (costly_spot(u.ux, u.uy) && objroom == *u.ushops) { verbalize("You %s %s, you pay for %s!", alteration_verbs[alter_type], those, them); diff --git a/src/potion.c b/src/potion.c index 1c5310497..399105794 100644 --- a/src/potion.c +++ b/src/potion.c @@ -1693,7 +1693,7 @@ dodip() hcolor(NH_AMBER)); obj->bknown = 1; if (obj->otyp == POT_WATER && obj->unpaid) - costly_alteration(obj, COST_UNHOLY); + costly_alteration(obj, COST_UNCURS); uncurse(obj); poof: if(!(objects[potion->otyp].oc_name_known) && diff --git a/src/read.c b/src/read.c index 4a572e1c3..c88d25aaa 100644 --- a/src/read.c +++ b/src/read.c @@ -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); + } } } } diff --git a/src/zap.c b/src/zap.c index 61b9e49b6..93bd5f888 100644 --- a/src/zap.c +++ b/src/zap.c @@ -855,7 +855,7 @@ register struct obj *obj; (obj->spe && (obj->oclass == ARMOR_CLASS || obj->oclass == WEAPON_CLASS || is_weptool(obj))) || otyp == POT_ACID || otyp == POT_SICKNESS || - (otyp == WATER && (obj->blessed || obj->cursed))) { + (otyp == POT_WATER && (obj->blessed || obj->cursed))) { if (obj->spe != ((obj->oclass == WAND_CLASS) ? -1 : 0) && otyp != WAN_CANCELLATION && /* can't cancel cancellation */ otyp != MAGIC_LAMP && /* cancelling doesn't remove djini */ @@ -876,8 +876,8 @@ register struct obj *obj; } break; case POTION_CLASS: - costly_alteration(obj, (otyp == WATER && obj->cursed) ? - COST_UNHOLY : COST_CANCEL); + costly_alteration(obj, (otyp != POT_WATER) ? COST_CANCEL : + obj->cursed ? COST_UNCURS : COST_UNBLSS); if (otyp == POT_SICKNESS || otyp == POT_SEE_INVISIBLE) { /* sickness is "biologically contaminated" fruit juice; cancel it and it just becomes fruit juice...