From ead5b0f21019936c9b0aefb7b84e01e38b2705cd Mon Sep 17 00:00:00 2001 From: PatR Date: Sat, 12 Dec 2015 18:08:11 -0800 Subject: [PATCH] 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. --- doc/fixes36.1 | 2 ++ src/read.c | 17 +++++++++++------ 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/doc/fixes36.1 b/doc/fixes36.1 index ed314e2dd..65d8a83c6 100644 --- a/doc/fixes36.1 +++ b/doc/fixes36.1 @@ -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 diff --git a/src/read.c b/src/read.c index 570ca74f8..617bb0dd9 100644 --- a/src/read.c +++ b/src/read.c @@ -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); -- 2.40.0