#define is_mines_prize(o) ((o)->o_id == g.context.achieveo.mines_prize_oid)
#define is_soko_prize(o) ((o)->o_id == g.context.achieveo.soko_prize_oid)
+#define is_art(o,art) ((o) && (o)->oartifact == (art))
+#define u_wield_art(art) is_art(uwep, art)
+
/* Flags for get_obj_location(). */
#define CONTAINED_TOO 0x1
#define BURIED_TOO 0x2
if (!weap || (weap->attk.adtyp == AD_PHYS /* check for `NO_ATTK' */
&& weap->attk.damn == 0 && weap->attk.damd == 0))
g.spec_dbon_applies = FALSE;
- else if (otmp->oartifact == ART_GRIMTOOTH)
+ else if (is_art(otmp, ART_GRIMTOOTH))
/* Grimtooth has SPFX settings to warn against elves but we want its
damage bonus to apply to all targets, so bypass spec_applies() */
g.spec_dbon_applies = TRUE;
/* We really want "on a natural 20" but Nethack does it in */
/* reverse from AD&D. */
if (spec_ability(otmp, SPFX_BEHEAD)) {
- if (otmp->oartifact == ART_TSURUGI_OF_MURAMASA && dieroll == 1) {
+ if (is_art(otmp, ART_TSURUGI_OF_MURAMASA) && dieroll == 1) {
wepdesc = "The razor-sharp blade";
/* not really beheading, but so close, why add another SPFX */
if (youattack && engulfing_u(mdef)) {
otmp->dknown = TRUE;
return TRUE;
}
- } else if (otmp->oartifact == ART_VORPAL_BLADE
+ } else if (is_art(otmp, ART_VORPAL_BLADE)
&& (dieroll == 1 || mdef->data == &mons[PM_JABBERWOCK])) {
static const char *const behead_msg[2] = { "%s beheads %s!",
"%s decapitates %s!" };
the result won't be printed */
char *otmpname = distant_name(otmp, xname);
- if (otmp->oartifact == ART_STORMBRINGER)
+ if (is_art(otmp, ART_STORMBRINGER))
pline_The("%s blade draws the %s from %s!",
hcolor(NH_BLACK), life, mon_nam(mdef));
else
if (Blind) {
You_feel("an %s drain your %s!",
- (otmp->oartifact == ART_STORMBRINGER)
+ is_art(otmp, ART_STORMBRINGER)
? "unholy blade"
: "object",
life);
the result won't be printed */
char *otmpname = distant_name(otmp, xname);
- if (otmp->oartifact == ART_STORMBRINGER)
+ if (is_art(otmp, ART_STORMBRINGER))
pline_The("%s blade drains your %s!",
hcolor(NH_BLACK), life);
else
&& (obj->owornmask & W_ARM) != 0L)
return TRUE;
- return (boolean) (get_artifact(obj) && obj->oartifact == ART_SUNSWORD);
+ return (boolean) (get_artifact(obj) && is_art(obj, ART_SUNSWORD));
}
/* KMH -- Talking artifacts are finally implemented */
void
Sting_effects(int orc_count) /* new count (warn_obj_cnt is old count); -1 is a flag value */
{
- if (uwep
- && (uwep->oartifact == ART_STING
- || uwep->oartifact == ART_ORCRIST
- || uwep->oartifact == ART_GRIMTOOTH)) {
+ if (u_wield_art(ART_STING)
+ || u_wield_art(ART_ORCRIST)
+ || u_wield_art(ART_GRIMTOOTH)) {
int oldstr = glow_strength(g.warn_obj_cnt),
newstr = glow_strength(orc_count);
"hot", "very hot", "like fire"
};
- if (!uarmg && uwep && uwep->oartifact == ART_MASTER_KEY_OF_THIEVERY) {
+ if (!uarmg && u_wield_art(ART_MASTER_KEY_OF_THIEVERY)) {
int idx, ntraps = count_surround_traps(u.ux, u.uy);
if (ntraps != g.mkot_trap_warn_count) {
is_magic_key(struct monst *mon, /* if null, non-rogue is assumed */
struct obj *obj)
{
- if (obj && obj->oartifact == ART_MASTER_KEY_OF_THIEVERY) {
+ if (is_art(obj, ART_MASTER_KEY_OF_THIEVERY)) {
if ((mon == &g.youmonst) ? Role_if(PM_ROGUE)
: (mon && mon->data == &mons[PM_ROGUE]))
return !obj->cursed; /* a rogue; non-cursed suffices for magic */
replace this with what_blocks() comparable to what_gives() */
switch (-propidx) {
case BLINDED:
- if (ublindf
- && ublindf->oartifact == ART_EYES_OF_THE_OVERWORLD)
+ if (is_art(ublindf, ART_EYES_OF_THE_OVERWORLD))
Sprintf(buf, because_of, bare_artifactname(ublindf));
break;
case INVIS:
|| u.umonnum == PM_AMOROUS_DEMON))
return (schar) 18;
} else if (x == A_CON) {
- if (uwep && uwep->oartifact == ART_OGRESMASHER)
+ if (u_wield_art(ART_OGRESMASHER))
return (schar) 25;
} else if (x == A_INT || x == A_WIS) {
/* yes, this may raise int/wis if player is sufficiently
if (uarmg && uarmg->otyp == GAUNTLETS_OF_POWER)
lolimit = hilimit;
} else if (attrindx == A_CON) {
- if (uwep && uwep->oartifact == ART_OGRESMASHER)
+ if (u_wield_art(ART_OGRESMASHER))
lolimit = hilimit;
}
/* this exception is hypothetical; the only other worn item affecting
}
/* Mjollnir is magically too heavy to kick */
- if (g.kickedobj->oartifact == ART_MJOLLNIR)
+ if (is_art(g.kickedobj, ART_MJOLLNIR))
range = 1;
/* see if the object has a place to move into */
if (!canletgo(obj, "throw")) {
return ECMD_OK;
}
- if (obj->oartifact == ART_MJOLLNIR && obj != uwep) {
+ if (is_art(obj, ART_MJOLLNIR) && obj != uwep) {
pline("%s must be wielded before it can be thrown.", The(xname(obj)));
return ECMD_OK;
}
- if ((obj->oartifact == ART_MJOLLNIR && ACURR(A_STR) < STR19(25))
+ if ((is_art(obj, ART_MJOLLNIR) && ACURR(A_STR) < STR19(25))
|| (obj->otyp == BOULDER && !throws_rocks(g.youmonst.data))) {
pline("It's too heavy.");
return ECMD_TIME;
if (obj->otyp == BOULDER)
range = 20; /* you must be giant */
- else if (obj->oartifact == ART_MJOLLNIR)
+ else if (is_art(obj, ART_MJOLLNIR))
range = (range + 1) / 2; /* it's heavy */
else if (tethered_weapon) /* primary weapon is aklys */
/* if an aklys is going to return, range is limited by the
break;
case WEAPON_CLASS:
- if (otmp->oartifact == ART_FIRE_BRAND)
+ if (is_art(otmp, ART_FIRE_BRAND))
type = BURN;
else if (is_blade(otmp)) {
if ((int) otmp->spe > -3)
climb_pit();
break;
case TT_WEB:
- if (uwep && uwep->oartifact == ART_STING) {
+ if (u_wield_art(ART_STING)) {
/* escape trap but don't move and don't destroy it */
u.utrap = 0; /* caller will call reset_utrap() */
pline("Sting cuts through the web!");
if (g.context.forcefight && trap && trap->ttyp == WEB
&& trap->tseen && uwep) {
- if (uwep->oartifact == ART_STING) {
+ if (u_wield_art(ART_STING)) {
/* guaranteed success */
pline("%s cuts through the web!",
bare_artifactname(uwep));
case A_DEX:
break;
case A_CON:
- if (uwep && uwep->oartifact == ART_OGRESMASHER && uwep->cursed)
+ if (u_wield_art(ART_OGRESMASHER) && uwep->cursed)
hide_innate_value = TRUE;
break;
case A_INT:
if (is_dprince(ptr) && ptr->msound == MS_BRIBE) {
mtmp->mpeaceful = mtmp->minvis = mtmp->perminvis = 1;
mtmp->mavenge = 0;
- if (uwep && (uwep->oartifact == ART_EXCALIBUR
- || uwep->oartifact == ART_DEMONBANE))
+ if (u_wield_art(ART_EXCALIBUR) || u_wield_art(ART_DEMONBANE))
mtmp->mpeaceful = mtmp->mtame = FALSE;
}
if (mndx == PM_RAVEN && uwep && uwep->otyp == BEC_DE_CORBIN)
&& (magr->mcan
|| (weap && ((weap->otyp == CORPSE
&& touch_petrifies(&mons[weap->corpsenm]))
- || weap->oartifact == ART_STORMBRINGER
- || weap->oartifact == ART_VORPAL_BLADE)))) {
+ || is_art(weap, ART_STORMBRINGER)
+ || is_art(weap, ART_VORPAL_BLADE))))) {
*alt_attk_buf = *attk;
attk = alt_attk_buf;
attk->adtyp = AD_PHYS;
if (mon) {
ptr = mon->data;
- if (uwep && uwep->oartifact == ART_DEMONBANE && is_demon(ptr)) {
+ if (u_wield_art(ART_DEMONBANE) && is_demon(ptr)) {
if (canseemon(mon))
pline("%s looks puzzled for a moment.", Monnam(mon));
return 0;
{
long cash, demand, offer;
- if (uwep && (uwep->oartifact == ART_EXCALIBUR
- || uwep->oartifact == ART_DEMONBANE)) {
+ if (u_wield_art(ART_EXCALIBUR) || u_wield_art(ART_DEMONBANE)) {
if (canspotmon(mtmp))
pline("%s looks very angry.", Amonnam(mtmp));
else
boolean
can_track(register struct permonst* ptr)
{
- if (uwep && uwep->oartifact == ART_EXCALIBUR)
+ if (u_wield_art(ART_EXCALIBUR))
return TRUE;
else
return (boolean) haseyes(ptr);
&& monmightthrowwep(otmp))
otmp->quan += (long) rn2(is_spear(otmp) ? 4 : 8);
/* mplayers knew better than to overenchant Magicbane */
- if (otmp->oartifact == ART_MAGICBANE)
+ if (is_art(otmp, ART_MAGICBANE))
otmp->spe = rnd(4);
(void) mpickobj(mtmp, otmp);
}
/* 3.3.[01] had this in the A_NEUTRAL case,
preventing chaotic wizards from receiving a spellbook */
if (Role_if(PM_WIZARD)
- && (!uwep || (uwep->oartifact != ART_VORPAL_BLADE
- && uwep->oartifact != ART_STORMBRINGER))
+ && !u_wield_art(ART_VORPAL_BLADE)
+ && !u_wield_art(ART_STORMBRINGER)
&& !carrying(SPE_FINGER_OF_DEATH)) {
class_gift = SPE_FINGER_OF_DEATH;
} else if (Role_if(PM_MONK) && (!uwep || !uwep->oartifact)
break;
case A_NEUTRAL:
u.uevent.uhand_of_elbereth = 2;
- in_hand = (uwep && uwep->oartifact == ART_VORPAL_BLADE);
+ in_hand = u_wield_art(ART_VORPAL_BLADE);
already_exists = exist_artifact(LONG_SWORD,
artiname(ART_VORPAL_BLADE));
verbalize("Thou shalt be my Envoy of Balance!");
break;
case A_CHAOTIC:
u.uevent.uhand_of_elbereth = 3;
- in_hand = (uwep && uwep->oartifact == ART_STORMBRINGER);
+ in_hand = u_wield_art(ART_STORMBRINGER);
already_exists = exist_artifact(RUNESWORD, artiname(ART_STORMBRINGER));
what = (((already_exists && !in_hand) || class_gift != STRANGE_OBJECT)
? "take lives"
Your("sword shines brightly for a moment.");
obj = oname(obj, artiname(ART_EXCALIBUR),
ONAME_GIFT | ONAME_KNOW_ARTI);
- if (obj && obj->oartifact == ART_EXCALIBUR) {
+ if (is_art(obj, ART_EXCALIBUR)) {
u.ugifts++;
livelog_printf(LL_DIVINEGIFT | LL_ARTIFACT,
"had %s wielded %s transformed into %s",
}
/* acquire Excalibur's skill regardless of weapon or gift */
unrestrict_weapon_skill(P_LONG_SWORD);
- if (obj && obj->oartifact == ART_EXCALIBUR)
+ if (is_art(obj, ART_EXCALIBUR))
discover_artifact(ART_EXCALIBUR);
break;
case A_NEUTRAL:
}
/* acquire Vorpal Blade's skill regardless of weapon or gift */
unrestrict_weapon_skill(P_LONG_SWORD);
- if (obj && obj->oartifact == ART_VORPAL_BLADE)
+ if (is_art(obj, ART_VORPAL_BLADE))
discover_artifact(ART_VORPAL_BLADE);
break;
case A_CHAOTIC: {
}
/* acquire Stormbringer's skill regardless of weapon or gift */
unrestrict_weapon_skill(P_BROAD_SWORD);
- if (obj && obj->oartifact == ART_STORMBRINGER)
+ if (is_art(obj, ART_STORMBRINGER))
discover_artifact(ART_STORMBRINGER);
break;
}
"became literate by reading a coin's engravings");
return ECMD_TIME;
- } else if (scroll->oartifact == ART_ORB_OF_FATE) {
+ } else if (is_art(scroll, ART_ORB_OF_FATE)) {
if (Blind)
You("feel the engraved signature:");
else
struct obj *otmp;
static const char mal_aura[] = "feel a malignant aura surround %s.";
- if (uwep && (uwep->oartifact == ART_MAGICBANE) && rn2(20)) {
+ if (u_wield_art(ART_MAGICBANE) && rn2(20)) {
You(mal_aura, "the magic-absorbing blade");
return;
}
if (Half_physical_damage || Half_spell_damage)
dmgval2 += rnd(4);
/* give Magicbane wielder dose of own medicine */
- if (uwep && uwep->oartifact == ART_MAGICBANE)
+ if (u_wield_art(ART_MAGICBANE))
dmgval2 += rnd(4);
/* having an artifact--other than own quest one--which
confers magic resistance simply by being carried
int dmgval2 = rnd(4);
if ((otmp = MON_WEP(mtmp)) != 0
- && otmp->oartifact == ART_MAGICBANE)
+ && is_art(otmp, ART_MAGICBANE))
dmgval2 += rnd(4);
for (otmp = mtmp->minvent; otmp; otmp = otmp->nobj)
if (otmp->oartifact
if (flags.confirm && mtmp->mpeaceful
&& !Confusion && !Hallucination && !Stunned) {
/* Intelligent chaotic weapons (Stormbringer) want blood */
- if (wep && wep->oartifact == ART_STORMBRINGER) {
+ if (is_art(wep, ART_STORMBRINGER)) {
g.override_confirmation = TRUE;
return FALSE;
}
*/
/* Intelligent chaotic weapons (Stormbringer) want blood */
if (is_safemon(mtmp) && !g.context.forcefight) {
- if (!uwep || uwep->oartifact != ART_STORMBRINGER) {
+ if (!u_wield_art(ART_STORMBRINGER)) {
/* There are some additional considerations: this won't work
* if in a shop or Punished or you miss a random roll or
* if you can walk thru walls and your pet cannot (KAA) or
/* Cleaver attacks three spots, 'mon' and one on either side of 'mon';
it can't be part of dual-wielding but we guard against that anyway;
cleave return value reflects status of primary target ('mon') */
- if (uwep && uwep->oartifact == ART_CLEAVER && !u.twoweap
+ if (u_wield_art(ART_CLEAVER) && !u.twoweap
&& !u.uswallow && !u.ustuck && !NODIAG(u.umonnum))
return hitum_cleave(mon, uattk);
if (!train_weapon_skill || mon == u.ustuck || u.twoweap
/* Cleaver can hit up to three targets at once so don't
let it also hit from behind or shatter foes' weapons */
- || (hand_to_hand && obj->oartifact == ART_CLEAVER)) {
+ || (hand_to_hand && is_art(obj, ART_CLEAVER))) {
; /* no special bonuses */
} else if (mon->mflee && Role_if(PM_ROGUE) && !Upolyd
/* multi-shot throwing is too powerful here */
|| (!is_u && (is_flyer(mtmp->data) || is_floater(mtmp->data))))
return FALSE;
- if (otmp && otmp->oartifact == ART_GIANTSLAYER)
+ if (is_art(otmp, ART_GIANTSLAYER))
return TRUE;
return FALSE;
}
pline("%s shining.", Tobjnam(olduwep, "stop"));
}
if (uwep == obj
- && ((uwep && uwep->oartifact == ART_OGRESMASHER)
- || (olduwep && olduwep->oartifact == ART_OGRESMASHER)))
+ && (u_wield_art(ART_OGRESMASHER)
+ || is_art(olduwep, ART_OGRESMASHER)))
g.context.botl = 1;
/* Note: Explicitly wielding a pick-axe will not give a "bashing"
* message. Wielding one via 'a'pplying it will.
* addition adverse reaction on Magicbane whose effects are
* spe dependent. Give an obscure clue here.
*/
- if (uwep->oartifact == ART_MAGICBANE && uwep->spe >= 0) {
+ if (u_wield_art(ART_MAGICBANE) && uwep->spe >= 0) {
Your("right %s %sches!", body_part(HAND),
(((amount > 1) && (uwep->spe > 1)) ? "flin" : "it"));
}