From: nethack.rankin Date: Sun, 24 Feb 2002 06:12:57 +0000 (+0000) Subject: monster use of artifacts X-Git-Tag: MOVE2GIT~3133 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=163f394fbeb03e2358c0108bace604839faa5aa4;p=nethack 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. --- diff --git a/doc/fixes34.0 b/doc/fixes34.0 index d4f62c34b..0be84bb90 100644 --- a/doc/fixes34.0 +++ b/doc/fixes34.0 @@ -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 diff --git a/src/artifact.c b/src/artifact.c index e5bc1f0a5..a8db867be 100644 --- a/src/artifact.c +++ b/src/artifact.c @@ -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;