monster use of artifacts

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.
This commit is contained in:
nethack.rankin
2002-02-24 06:12:57 +00:00
parent cae2ef47c3
commit 163f394fbe
2 changed files with 14 additions and 10 deletions

View 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

View 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;