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:
@@ -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 */
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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) &&
|
||||
|
||||
47
src/read.c
47
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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...
|
||||
|
||||
Reference in New Issue
Block a user