]> granicus.if.org Git - nethack/commitdiff
fix github issue #477 - incorrect MC calculation
authorPatR <rankin@nethack.org>
Mon, 29 Mar 2021 17:46:29 +0000 (10:46 -0700)
committerPatR <rankin@nethack.org>
Mon, 29 Mar 2021 17:46:29 +0000 (10:46 -0700)
when wearing an amulet.  Wearing any amulet while having the
Protected attribute was conferring an amulet of guarding's +2 MC
bonus.  Mattered when Protected via worn ring(s) of protection or
wearing Mitre of Holiness or wielding Tsurugi of Muramasa for
hero, or the latter two or being a high priest[ess] for monsters.
(Being Proteced via cloak of protection already yields maximum MC,
or via amulet of guarding yields intended result.)

The fixes37.0 entry oversimplifies.

Fixes #477

doc/fixes37.0
src/mhitu.c

index fce516d0a89b9cf8659103db30b8545b149f853f..9301c24ad1959cc710e7578a09e0ebd4bf644f67 100644 (file)
@@ -563,6 +563,8 @@ avoid complaints of "nothing to foo" for 'force_invmenu' if there are no
        likely candidates to foo with but there are hidden acceptable choices
 avoid "Not carrying anything.  Never mind." for 'force_invmenu'
 'altmeta' option could be toggled On but once On could not be toggled back Off
+wearing a ring of protection and any amulet behaved as if wearing an amulet of
+       guarding when determining MC value
 
 curses: 'msg_window' option wasn't functional for curses unless the binary
        also included tty support
index 664c7cd4e85316cb562d47ac93831abd7e147d00..faf177388dbc865c3f03b5244cab94d0bd4495b6 100644 (file)
@@ -902,7 +902,7 @@ magic_negation(struct monst *mon)
             if (armpro > mc)
                 mc = armpro;
         } else if ((o->owornmask & W_AMUL) != 0L) {
-            via_amul = TRUE;
+            via_amul = (o->otyp == AMULET_OF_GUARDING);
         }
         /* if we've already confirmed Protection, skip additional checks */
         if (is_you || gotprot)
@@ -917,7 +917,8 @@ magic_negation(struct monst *mon)
     }
 
     if (gotprot) {
-        /* extrinsic Protection increases mc by 1; 2 for amulet */
+        /* extrinsic Protection increases mc by 1 (2 for amulet of guarding);
+           multiple sources don't provide multiple increments */
         mc += via_amul ? 2 : 1;
         if (mc > 3)
             mc = 3;