]> granicus.if.org Git - nethack/commitdiff
fix #H4061 - uncursed scroll of enchant armor
authorPatR <rankin@nethack.org>
Sun, 13 Dec 2015 02:08:11 +0000 (18:08 -0800)
committerPatR <rankin@nethack.org>
Sun, 13 Dec 2015 02:08:11 +0000 (18:08 -0800)
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.

doc/fixes36.1
src/read.c

index ed314e2dd3684bf5a639f80abf656638a1043640..65d8a83c6520db39ec350ad20a0df9736e54f23d 100644 (file)
@@ -15,6 +15,8 @@ support explicit 'symset:default' and 'symset:Default symbols' in options
 crash during startup if player name set as 'player' in defaults
 any existing vampire shape-shifted into critter (fog cloud, bat, wolf) became
        an unkillable critter if vampires were genocided
+unlike in previous versions, an uncursed scroll of enchant armor failed to
+       uncurse the piece of armor being enchanted (change was unintentional)
 
 
 Platform- and/or Interface-Specific Fixes
index 570ca74f84b814208d0dcea6feff9f6de012ca7a..617bb0dd918c4ab09668d0d0259c5d11c159cb78 100644 (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);