]> granicus.if.org Git - nethack/commitdiff
monster use of artifacts
authornethack.rankin <nethack.rankin>
Sun, 24 Feb 2002 06:12:57 +0000 (06:12 +0000)
committernethack.rankin <nethack.rankin>
Sun, 24 Feb 2002 06:12:57 +0000 (06:12 +0000)
     From the newsgroup:  some of the fake player monsters on the
astral level were unable to use artifacts that they were created
with due to alignment mismatch.  Rather than try to adjust the
artifact creation of only select matching items, this patch lets
them handle artifacts when alignments differ (more or less like
the player; monsters don't occasionally get blasted though).

     This also restores chaotic monsters with the ability to use
Stormbringer; I'm not sure how long that has been broken.  It also
gives lawful ones the ability to use Excalibur.

doc/fixes34.0
src/artifact.c

index d4f62c34bec6f531ccd0b8d8ab26825476e6d848..0be84bb90e92d2b1ab7b2d695d156d1b0bdab494 100644 (file)
@@ -439,6 +439,8 @@ monsters hitting other monsters can split puddings with weapons
 be consistent with checking for iron weapons when splitting puddings
 prevent corpses of undead creatures just killed by undead turning from being
        instantly revived by the same undead turning attack
+allow fake player monsters to handle artifacts that don't match alignment/role
+chaotic monsters can use Stormbringer; lawful monsters can use Excalibur
 
 
 Platform- and/or Interface-Specific Fixes
index e5bc1f0a50f294d50759109df28e8789fb0a9b49..a8db867bec556887150f47c16d3d0d4a8490f329 100644 (file)
@@ -474,16 +474,18 @@ touch_artifact(obj,mon)
     /* all quest artifacts are self-willed; it this ever changes, `badclass'
        will have to be extended to explicitly include quest artifacts */
     self_willed = ((oart->spfx & SPFX_INTEL) != 0);
-    if (yours || !(mon->data->mflags3 & M3_WANTSALL)) {
-       badclass = (self_willed && (!yours ||
-                       (oart->role != NON_PM && !Role_if(oart->role)) ||
-                       (oart->race != NON_PM && !Race_if(oart->race))));
-       badalign = (oart->spfx & SPFX_RESTR) &&
-                  oart->alignment != A_NONE &&
-           ((oart->alignment !=
-             (yours ? u.ualign.type : sgn(mon->data->maligntyp))) ||
-            (yours && u.ualign.record < 0));
-    } else {   /* an M3_WANTSxxx monster */
+    if (yours) {
+       badclass = self_willed &&
+                  ((oart->role != NON_PM && !Role_if(oart->role)) ||
+                   (oart->race != NON_PM && !Race_if(oart->race)));
+       badalign = (oart->spfx & SPFX_RESTR) && oart->alignment != A_NONE &&
+                  (oart->alignment != u.ualign.type || u.ualign.record < 0);
+    } else if (!is_covetous(mon->data) && !is_mplayer(mon->data)) {
+       badclass = self_willed &&
+                  oart->role != NON_PM && oart != &artilist[ART_EXCALIBUR];
+       badalign = (oart->spfx & SPFX_RESTR) && oart->alignment != A_NONE &&
+                  (oart->alignment != sgn(mon->data->maligntyp));
+    } else {    /* an M3_WANTSxxx monster or a fake player */
        /* special monsters trying to take the Amulet, invocation tools or
           quest item can touch anything except for `spec_applies' artifacts */
        badclass = badalign = FALSE;