fix #H4061 - uncursed scroll of enchant armor

In 3.4.3, reading an uncursed scroll of enchant armor while wearing
a piece of cursed armor performed an uncurse as well as raising
enchantment.  A fairly big patch to redo how pending shop bills were
affected by altering the items on the bill accidentally took away
the uncurse part when modifying the scroll code to use the bless()/
uncurse()/curse() functions instead of manipulating the armor's
blessed and cursed flags directly.
This commit is contained in:
PatR
2015-12-12 18:08:11 -08:00
parent 2219a6a667
commit ead5b0f210
2 changed files with 13 additions and 6 deletions

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 read.c $NHDT-Date: 1449645144 2015/12/09 07:12:24 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.126 $ */
/* NetHack 3.6 read.c $NHDT-Date: 1449972474 2015/12/13 02:07:54 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.127 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -1050,9 +1050,12 @@ struct obj *sobj; /* scroll, or fake spellbook object for scroll-like spell */
useup(otmp);
break;
}
s = scursed ? -1 : otmp->spe >= 9
? (rn2(otmp->spe) == 0)
: sblessed ? rnd(3 - otmp->spe / 3) : 1;
s = scursed ? -1
: (otmp->spe >= 9)
? (rn2(otmp->spe) == 0)
: sblessed
? rnd(3 - otmp->spe / 3)
: 1;
if (s >= 0 && Is_dragon_scales(otmp)) {
/* dragon scales get turned into dragon scale mail */
pline("%s merges and hardens!", Yname2(otmp));
@@ -1075,8 +1078,8 @@ struct obj *sobj; /* scroll, or fake spellbook object for scroll-like spell */
s == 0 ? "violently " : "",
otense(otmp, Blind ? "vibrate" : "glow"),
(!Blind && !same_color) ? " " : "",
(Blind || same_color) ? ""
: hcolor(scursed ? NH_BLACK : NH_SILVER),
(Blind || same_color)
? "" : hcolor(scursed ? NH_BLACK : NH_SILVER),
(s * s > 1) ? "while" : "moment");
/* [this cost handling will need updating if shop pricing is
ever changed to care about curse/bless status of armor] */
@@ -1086,6 +1089,8 @@ struct obj *sobj; /* scroll, or fake spellbook object for scroll-like spell */
curse(otmp);
else if (sblessed && !otmp->blessed)
bless(otmp);
else if (!scursed && otmp->cursed)
uncurse(otmp);
if (s) {
otmp->spe += s;
adj_abon(otmp, s);