]> granicus.if.org Git - nethack/commitdiff
fix #H108 - lost protection
authornethack.rankin <nethack.rankin>
Sat, 27 May 2006 01:58:22 +0000 (01:58 +0000)
committernethack.rankin <nethack.rankin>
Sat, 27 May 2006 01:58:22 +0000 (01:58 +0000)
     Fix the problem From a bug report, where
giving a temple donation of the appropriate amount would fail to restore
protection previously stolen by gremlin attack iff the old protection amount
was big enough that the donation wouldn't have yielded a bonus in the normal
not-stolen case.  It shouldn't be checking the magnitude of u.ublessed at a
time when lack of the intrinsic renders that value inoperative.  After this
fix, the lost intrinsic will be granted and the old protection value will
be restored, same as happens when a prayer boon yields divine protection
(where no u.ublessed magnitude check is made) and as happened with donations
when the old protection was a more modest amount (magnitude test passed).

doc/fixes34.4
src/priest.c

index b1a2c3e29164dad02a27289d2e00c0985fd79c01..80ad4a52ffdce03942c5f27f469cabe3834d0a69 100644 (file)
@@ -229,6 +229,8 @@ when "of <deity>" is intentionally being suppressed, an aligned or high
 specifying role and/or race along with an invalid alignment for it/them in
        NETHACKOPTIONS or config file would yield a prompt which misleadingly
        mentioned the rejected alignment when asking player to pick alignment
+temple donation can recover protection previously stolen by attrcurse attack
+       even when protection amount is so big that no increment would be given
 
 
 Platform- and/or Interface-Specific Fixes
index cb9021c2836c55bcd65a6d63f77a48d9ff10148c..1ebec98cdc160862eb7042aa86f3eee70a81e126 100644 (file)
@@ -1,4 +1,4 @@
-/*     SCCS Id: @(#)priest.c   3.5     2006/01/03      */
+/*     SCCS Id: @(#)priest.c   3.5     2006/05/26      */
 /* Copyright (c) Izchak Miller, Steve Linhart, 1989.             */
 /* NetHack may be freely redistributed.  See license for details. */
 
@@ -582,8 +582,13 @@ register struct monst *priest;
                    incr_itimeout(&HClairvoyant, rn1(500,500));
                }
            } else if(offer < (u.ulevel * 600) &&
-                     u.ublessed < 20 &&
-                     (u.ublessed < 9 || !rn2(u.ublessed))) {
+                     /* u.ublessed is only active when Protection is
+                        enabled via something other than worn gear
+                        (theft by gremlin clears the intrinsic but not
+                        its former magnitude, making it recoverable) */
+                     (!(HProtection & INTRINSIC) ||
+                      (u.ublessed < 20 &&
+                       (u.ublessed < 9 || !rn2(u.ublessed))))) {
                verbalize("Thy devotion has been rewarded.");
                if (!(HProtection & INTRINSIC))  {
                        HProtection |= FROMOUTSIDE;