Protection groundwork/artifact tweaks (trunk only)
This is mostly groundwork prior to making the Protection intrinsic
become more meaningful. The Mitre of Holiness (priest quest artifact)
and the Tsurugi of Muramasa (samurai quest artifact) will now confer
Protection when worn/wielded (though at present that effectively does
nothing). While in there, this also changes the Eye of the Aethiopica
(wizard quest artifact), the Eyes of the Overworld (monk quest artifact),
and the Sceptre of Might (caveman quest artifact) so that they need to
be worn/wielded rather than just carried in order for them to confer
magic resistance. That way they're a little less attractive for wishing
by other roles and a little more likely to be actively used by their own
roles (not an issues for the Eyes, I'm sure). This change actually works
to the player's advantage, since it means that monsters who successfully
steal those items won't instantly obtain magic resistance in the process.
This adds protects() as a predicate routine to check an item for
conferring Protection. In order to do that, it renames the existing
protects() routine to defends_when_carried(), because that predicate is
actually a variant of defends() for items which aren't worn or wielded.
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
/* 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. */
|
||||
|
||||
@@ -407,7 +406,7 @@ register struct obj *otmp;
|
||||
|
||||
/* used for monsters */
|
||||
boolean
|
||||
protects(adtyp, otmp)
|
||||
defends_when_carried(adtyp, otmp)
|
||||
int adtyp;
|
||||
struct obj *otmp;
|
||||
{
|
||||
@@ -418,6 +417,22 @@ 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.
|
||||
@@ -548,6 +563,10 @@ long wp_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 */
|
||||
|
||||
@@ -113,7 +113,7 @@ struct monst *mon;
|
||||
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;
|
||||
}
|
||||
@@ -150,7 +150,7 @@ struct monst *mon;
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -1231,7 +1231,7 @@ glovecheck: (void) rust_dmg(uarmg, "gauntlets", 1, TRUE, &youmonst);
|
||||
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;
|
||||
|
||||
@@ -2399,7 +2399,8 @@ glovecheck: target = which_armor(mtmp, W_ARMG);
|
||||
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;
|
||||
|
||||
Reference in New Issue
Block a user