From df07fd4b90a5f4e33caaf87a3b0ab8e68f37983f Mon Sep 17 00:00:00 2001 From: "nethack.rankin" Date: Fri, 27 Dec 2002 03:40:57 +0000 Subject: [PATCH] fix buglist entry - artifact bow wielded by monsters The Longbow of Diana (ranger quest artifact) confers reflection to the hero when wielded but didn't do the same for monsters when they wielded it. --- doc/fixes34.1 | 2 ++ include/extern.h | 1 + src/artifact.c | 17 +++++++++++++++++ src/muse.c | 7 ++++++- 4 files changed, 26 insertions(+), 1 deletion(-) diff --git a/doc/fixes34.1 b/doc/fixes34.1 index 66571b385..2d032809e 100644 --- a/doc/fixes34.1 +++ b/doc/fixes34.1 @@ -338,6 +338,8 @@ while over water, killing a monster that had engulfed you does not result in the usual water effects removing a ring of levitation while engulfed should not invoke spoteffects feedback from invoking Orb of Detection was sometimes misleading or wrong +ranger quest artifact (Longbow of Diana) confers reflection when wielded by + monsters like it does for the player Platform- and/or Interface-Specific Fixes diff --git a/include/extern.h b/include/extern.h index 3702eefce..15d321d9b 100644 --- a/include/extern.h +++ b/include/extern.h @@ -63,6 +63,7 @@ E void FDECL(artifact_exists, (struct obj *,const char *,BOOLEAN_P)); E int NDECL(nartifact_exist); E boolean FDECL(spec_ability, (struct obj *,unsigned long)); E boolean FDECL(confers_luck, (struct obj *)); +E boolean FDECL(arti_reflects, (struct obj *)); E boolean FDECL(restrict_name, (struct obj *,const char *)); E boolean FDECL(defends, (int,struct obj *)); E boolean FDECL(protects, (int,struct obj *)); diff --git a/src/artifact.c b/src/artifact.c index 514e5ea4b..80e1ad360 100644 --- a/src/artifact.c +++ b/src/artifact.c @@ -259,6 +259,23 @@ struct obj *obj; return (obj->oartifact && spec_ability(obj, SPFX_LUCK)); } +/* used to check whether a monster is getting reflection from an artifact */ +boolean +arti_reflects(obj) +struct obj *obj; +{ + const struct artifact *arti = get_artifact(obj); + + if (arti) { + /* while being worn */ + if ((obj->owornmask & ~W_ART) && (arti->spfx & SPFX_REFLECT)) + return TRUE; + /* just being carried */ + if (arti->cspfx & SPFX_REFLECT) return TRUE; + } + return FALSE; +} + #endif /* OVL0 */ #ifdef OVLB diff --git a/src/muse.c b/src/muse.c index 68a8a5995..43bf8c570 100644 --- a/src/muse.c +++ b/src/muse.c @@ -1,4 +1,4 @@ -/* SCCS Id: @(#)muse.c 3.4 2002/08/29 */ +/* SCCS Id: @(#)muse.c 3.4 2002/12/23 */ /* Copyright (C) 1990 by Ken Arromdee */ /* NetHack may be freely redistributed. See license for details. */ @@ -2034,6 +2034,11 @@ const char *str; makeknown(SHIELD_OF_REFLECTION); } return TRUE; + } else if (arti_reflects(MON_WEP(mon))) { + /* due to wielded artifact weapon */ + if (str) + pline(str, s_suffix(mon_nam(mon)), "weapon"); + return TRUE; } else if ((orefl = which_armor(mon, W_AMUL)) && orefl->otyp == AMULET_OF_REFLECTION) { if (str) { -- 2.40.0