don't report "fried to a crisp" for disintegration from divine wrath
spellcasting monsters' spell selection became less likely to choose harder
spells as their level got higher (including Wizard's "double trouble")
+Eye of the Aethiopica, Eyes of the Overworld, and Sceptre of Might must be
+ worn or wielded rather than just carried to convey magic resistance
+Mitre of Holiness and Tsurugi of Muramasa convey Protection when worn/wielded
Platform- and/or Interface-Specific Fixes
/* NetHack 3.5 artifact.h $Date$ $Revision$ */
-/* SCCS Id: @(#)artifact.h 3.5 1995/05/31 */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
#ifndef ARTIFACT_H
#define ARTIFACT_H
-#define SPFX_NONE 0x0000000L /* no special effects, just a bonus */
-#define SPFX_NOGEN 0x0000001L /* item is special, bequeathed by gods */
-#define SPFX_RESTR 0x0000002L /* item is restricted - can't be named */
-#define SPFX_INTEL 0x0000004L /* item is self-willed - intelligent */
-#define SPFX_SPEAK 0x0000008L /* item can speak (not implemented) */
-#define SPFX_SEEK 0x0000010L /* item helps you search for things */
-#define SPFX_WARN 0x0000020L /* item warns you of danger */
-#define SPFX_ATTK 0x0000040L /* item has a special attack (attk) */
-#define SPFX_DEFN 0x0000080L /* item has a special defence (defn) */
-#define SPFX_DRLI 0x0000100L /* drains a level from monsters */
-#define SPFX_SEARCH 0x0000200L /* helps searching */
-#define SPFX_BEHEAD 0x0000400L /* beheads monsters */
-#define SPFX_HALRES 0x0000800L /* blocks hallucinations */
-#define SPFX_ESP 0x0001000L /* ESP (like amulet of ESP) */
-#define SPFX_STLTH 0x0002000L /* Stealth */
-#define SPFX_REGEN 0x0004000L /* Regeneration */
-#define SPFX_EREGEN 0x0008000L /* Energy Regeneration */
-#define SPFX_HSPDAM 0x0010000L /* 1/2 spell damage (on player) in combat */
-#define SPFX_HPHDAM 0x0020000L /* 1/2 physical damage (on player) in combat */
-#define SPFX_TCTRL 0x0040000L /* Teleportation Control */
-#define SPFX_LUCK 0x0080000L /* Increase Luck (like Luckstone) */
-#define SPFX_DMONS 0x0100000L /* attack bonus on one monster type */
-#define SPFX_DCLAS 0x0200000L /* attack bonus on monsters w/ symbol mtype */
-#define SPFX_DFLAG1 0x0400000L /* attack bonus on monsters w/ mflags1 flag */
-#define SPFX_DFLAG2 0x0800000L /* attack bonus on monsters w/ mflags2 flag */
-#define SPFX_DALIGN 0x1000000L /* attack bonus on non-aligned monsters */
-#define SPFX_DBONUS 0x1F00000L /* attack bonus mask */
-#define SPFX_XRAY 0x2000000L /* gives X-RAY vision to player */
-#define SPFX_REFLECT 0x4000000L /* Reflection */
-
+#define SPFX_NONE 0x00000000L /* no special effects, just a bonus */
+#define SPFX_NOGEN 0x00000001L /* item is special, bequeathed by gods */
+#define SPFX_RESTR 0x00000002L /* item is restricted - can't be named */
+#define SPFX_INTEL 0x00000004L /* item is self-willed - intelligent */
+#define SPFX_SPEAK 0x00000008L /* item can speak (not implemented) */
+#define SPFX_SEEK 0x00000010L /* item helps you search for things */
+#define SPFX_WARN 0x00000020L /* item warns you of danger */
+#define SPFX_ATTK 0x00000040L /* item has a special attack (attk) */
+#define SPFX_DEFN 0x00000080L /* item has a special defence (defn) */
+#define SPFX_DRLI 0x00000100L /* drains a level from monsters */
+#define SPFX_SEARCH 0x00000200L /* helps searching */
+#define SPFX_BEHEAD 0x00000400L /* beheads monsters */
+#define SPFX_HALRES 0x00000800L /* blocks hallucinations */
+#define SPFX_ESP 0x00001000L /* ESP (like amulet of ESP) */
+#define SPFX_STLTH 0x00002000L /* Stealth */
+#define SPFX_REGEN 0x00004000L /* Regeneration */
+#define SPFX_EREGEN 0x00008000L /* Energy Regeneration */
+#define SPFX_HSPDAM 0x00010000L /* 1/2 spell damage (on player) in combat */
+#define SPFX_HPHDAM 0x00020000L /* 1/2 physical damage (on player) in combat */
+#define SPFX_TCTRL 0x00040000L /* Teleportation Control */
+#define SPFX_LUCK 0x00080000L /* Increase Luck (like Luckstone) */
+#define SPFX_DMONS 0x00100000L /* attack bonus on one monster type */
+#define SPFX_DCLAS 0x00200000L /* attack bonus on monsters w/ symbol mtype */
+#define SPFX_DFLAG1 0x00400000L /* attack bonus on monsters w/ mflags1 flag */
+#define SPFX_DFLAG2 0x00800000L /* attack bonus on monsters w/ mflags2 flag */
+#define SPFX_DALIGN 0x01000000L /* attack bonus on non-aligned monsters */
+#define SPFX_DBONUS 0x01F00000L /* attack bonus mask */
+#define SPFX_XRAY 0x02000000L /* gives X-RAY vision to player */
+#define SPFX_REFLECT 0x04000000L /* Reflection */
+#define SPFX_PROTECT 0x08000000L /* Protection */
struct artifact {
short otyp;
/* NetHack 3.5 artilist.h $Date$ $Revision$ */
-/* SCCS Id: @(#)artilist.h 3.5 2003/02/12 */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
A("The Sceptre of Might", MACE,
(SPFX_NOGEN|SPFX_RESTR|SPFX_INTEL|SPFX_DALIGN), 0, 0,
- PHYS(5,0), NO_DFNS, CARY(AD_MAGM),
+ PHYS(5,0), DFNS(AD_MAGM), NO_CARY,
CONFLICT, A_LAWFUL, PM_CAVEMAN, NON_PM, 2500L ),
#if 0 /* OBSOLETE */
A("The Eyes of the Overworld", LENSES,
(SPFX_NOGEN|SPFX_RESTR|SPFX_INTEL|SPFX_XRAY), 0, 0,
- NO_ATTK, NO_DFNS, CARY(AD_MAGM),
+ NO_ATTK, DFNS(AD_MAGM), NO_CARY,
ENLIGHTENING, A_NEUTRAL, PM_MONK, NON_PM, 2500L ),
A("The Mitre of Holiness", HELM_OF_BRILLIANCE,
- (SPFX_NOGEN|SPFX_RESTR|SPFX_DFLAG2|SPFX_INTEL), 0, M2_UNDEAD,
+ (SPFX_NOGEN|SPFX_RESTR|SPFX_DFLAG2|SPFX_INTEL|SPFX_PROTECT),
+ 0, M2_UNDEAD,
NO_ATTK, NO_DFNS, CARY(AD_FIRE),
ENERGY_BOOST, A_LAWFUL, PM_PRIEST, NON_PM, 2000L ),
UNTRAP, A_CHAOTIC, PM_ROGUE, NON_PM, 3500L ),
A("The Tsurugi of Muramasa", TSURUGI,
- (SPFX_NOGEN|SPFX_RESTR|SPFX_INTEL|SPFX_BEHEAD|SPFX_LUCK), 0, 0,
+ (SPFX_NOGEN|SPFX_RESTR|SPFX_INTEL|SPFX_BEHEAD|SPFX_LUCK|SPFX_PROTECT),
+ 0, 0,
PHYS(0,8), NO_DFNS, NO_CARY,
0, A_LAWFUL, PM_SAMURAI, NON_PM, 4500L ),
A("The Eye of the Aethiopica", AMULET_OF_ESP,
(SPFX_NOGEN|SPFX_RESTR|SPFX_INTEL), (SPFX_EREGEN|SPFX_HSPDAM), 0,
- NO_ATTK, NO_DFNS, CARY(AD_MAGM),
+ NO_ATTK, DFNS(AD_MAGM), NO_CARY,
CREATE_PORTAL, A_NEUTRAL, PM_WIZARD, NON_PM, 4000L ),
/*
E boolean FDECL(shade_glare, (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 *));
+E boolean FDECL(defends_when_carried, (int,struct obj *));
+E boolean FDECL(protects, (struct obj *,BOOLEAN_P));
E void FDECL(set_artifact_intrinsic, (struct obj *,BOOLEAN_P,long));
E int FDECL(touch_artifact, (struct obj *,struct monst *));
E int FDECL(spec_abon, (struct obj *,struct monst *));
/* NetHack 3.5 artifact.c $Date$ $Revision$ */
-/* SCCS Id: @(#)artifact.c 3.5 2008/02/19 */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
/* used for monsters */
boolean
-protects(adtyp, otmp)
+defends_when_carried(adtyp, otmp)
int adtyp;
struct obj *otmp;
{
return FALSE;
}
+/* determine whether an item confers Protection */
+boolean
+protects(otmp, is_worn)
+struct obj *otmp;
+boolean is_worn;
+{
+ const struct artifact *arti;
+
+ if (is_worn && objects[otmp->oclass].oc_oprop == PROTECTION)
+ return TRUE;
+ arti = get_artifact(otmp);
+ if (!arti) return FALSE;
+ return (arti->cspfx & SPFX_PROTECT) != 0 ||
+ (is_worn && (arti->spfx & SPFX_PROTECT) != 0);
+}
+
/*
* a potential artifact has just been worn/wielded/picked-up or
* unworn/unwielded/dropped. Pickup/drop only set/reset the W_ART mask.
if (on) EReflecting |= wp_mask;
else EReflecting &= ~wp_mask;
}
+ if (spfx & SPFX_PROTECT) {
+ if (on) EProtection |= wp_mask;
+ else EProtection &= ~wp_mask;
+ }
if(wp_mask == W_ART && !on && oart->inv_prop) {
/* might have to turn off invoked power too */
for ( ; o; o = o->nobj)
if (((o->owornmask & slotmask) != 0L &&
objects[o->otyp].oc_oprop == ANTIMAGIC) ||
- (o->oartifact && protects(AD_MAGM, o)))
+ (o->oartifact && defends_when_carried(AD_MAGM, o)))
return TRUE;
return FALSE;
}
for ( ; o; o = o->nobj)
if (((o->owornmask & slotmask) != 0L &&
objects[o->otyp].oc_oprop == BLINDED) ||
- (o->oartifact && protects(AD_BLND, o)))
+ (o->oartifact && defends_when_carried(AD_BLND, o)))
return TRUE;
return FALSE;
}
also increases the effect */
for (otmp = invent; otmp; otmp = otmp->nobj)
if (otmp->oartifact && !is_quest_artifact(otmp) &&
- protects(AD_MAGM, otmp)) break;
+ defends_when_carried(AD_MAGM, otmp)) break;
if (otmp) dmgval2 += rnd(4);
if (Passes_walls) dmgval2 = (dmgval2 + 3) / 4;
otmp->oartifact == ART_MAGICBANE)
dmgval2 += rnd(4);
for (otmp = mtmp->minvent; otmp; otmp = otmp->nobj)
- if (otmp->oartifact && protects(AD_MAGM, otmp))
+ if (otmp->oartifact &&
+ defends_when_carried(AD_MAGM, otmp))
break;
if (otmp) dmgval2 += rnd(4);
if (passes_walls(mptr)) dmgval2 = (dmgval2 + 3) / 4;