Another artifact damage update

Make being hit by an artifact which does fire, cold, or
lightning (or magic missiles, since the code is there) affect
inventory even when the target resists the damage him-/her-/itself.
This removes the need for the redundant fire vs slime handling that
I put in yesterday.  Unfortunately it also means that Valkyries who
throw Mjollnir will inevitably end up destroying all their mettalic
wands and rings, so I reduced the chance of it hitting upon its
return.
This commit is contained in:
nethack.rankin
2002-02-23 10:55:43 +00:00
parent 6cb52557c1
commit 6f90e5bc8c
3 changed files with 45 additions and 32 deletions

View File

@@ -721,14 +721,6 @@ int dieroll; /* needed for Magicbane and vorpal blades */
if (youattack && youdefend) {
impossible("attacking yourself with weapon?");
return FALSE;
} else if (!spec_dbon_applies) {
if (youdefend && Slimed && attacks(AD_FIRE, otmp)) {
pline_The("fiery blade hits you.");
burn_away_slime();
return TRUE;
}
/* since damage bonus didn't apply, nothing more to do */
return FALSE;
}
realizes_damage = (youdefend || vis);
@@ -736,9 +728,11 @@ int dieroll; /* needed for Magicbane and vorpal blades */
/* the four basic attacks: fire, cold, shock and missiles */
if (attacks(AD_FIRE, otmp)) {
if (realizes_damage)
pline_The("fiery blade %s %s!",
pline_The("fiery blade %s %s%c",
!spec_dbon_applies ? "hits" :
(mdef->data == &mons[PM_WATER_ELEMENTAL]) ?
"vaporizes part of" : "burns", hittee);
"vaporizes part of" : "burns",
hittee, !spec_dbon_applies ? '.' : '!');
if (!rn2(4)) (void) destroy_mitem(mdef, POTION_CLASS, AD_FIRE);
if (!rn2(4)) (void) destroy_mitem(mdef, SCROLL_CLASS, AD_FIRE);
if (!rn2(7)) (void) destroy_mitem(mdef, SPBOOK_CLASS, AD_FIRE);
@@ -747,15 +741,19 @@ int dieroll; /* needed for Magicbane and vorpal blades */
}
if (attacks(AD_COLD, otmp)) {
if (realizes_damage)
pline_The("ice-cold blade freezes %s!", hittee);
pline_The("ice-cold blade %s %s%c",
!spec_dbon_applies ? "hits" : "freezes",
hittee, !spec_dbon_applies ? '.' : '!');
if (!rn2(4)) (void) destroy_mitem(mdef, POTION_CLASS, AD_COLD);
return realizes_damage;
}
if (attacks(AD_ELEC, otmp)) {
if (realizes_damage) {
if (youattack && otmp != uwep)
pline("%s %s!", Tobjnam(otmp, "hit"), hittee);
pline("Lightning strikes %s!", hittee);
if (youattack ? otmp != uwep : !spec_dbon_applies)
pline("%s %s%c", Tobjnam(otmp, "hit"),
hittee, !spec_dbon_applies ? '.' : '!');
if (spec_dbon_applies)
pline("Lightning strikes %s!", hittee);
}
if (!rn2(5)) (void) destroy_mitem(mdef, RING_CLASS, AD_ELEC);
if (!rn2(5)) (void) destroy_mitem(mdef, WAND_CLASS, AD_ELEC);
@@ -763,13 +761,21 @@ int dieroll; /* needed for Magicbane and vorpal blades */
}
if (attacks(AD_MAGM, otmp)) {
if (realizes_damage) {
if (youattack && otmp != uwep)
pline("%s %s!", Tobjnam(otmp, "hit"), hittee);
pline("A hail of magic missiles strikes %s!", hittee);
if (youattack ? otmp != uwep : !spec_dbon_applies)
pline("%s %s%c", Tobjnam(otmp, "hit"),
hittee, !spec_dbon_applies ? '.' : '!');
if (spec_dbon_applies)
pline("A hail of magic missiles strikes %s!", hittee);
}
return realizes_damage;
}
if (!spec_dbon_applies) {
/* since damage bonus didn't apply, nothing more to do;
no further attacks have side-effects on inventory */
return FALSE;
}
/*
* Magicbane's intrinsic magic is incompatible with normal
* enchantment magic. Thus, its effects have a negative

View File

@@ -990,18 +990,25 @@ boolean twoweap; /* used to restore twoweapon mode if wielded weapon returns */
if(cansee(bhitpos.x, bhitpos.y))
newsym(bhitpos.x,bhitpos.y);
} else {
int dmg = rnd(4);
if (Blind)
pline("%s your %s!",
Tobjnam(obj, "hit"), body_part(ARM));
else
pline("%s back toward you, hitting your %s!",
Tobjnam(obj, "fly"), body_part(ARM));
(void) artifact_hit((struct monst *) 0, &youmonst,
obj, &dmg, 0);
losehp(dmg, xname(obj), KILLED_BY);
if(ship_object(obj, u.ux, u.uy, FALSE))
return;
int dmg = rn2(2);
if (!dmg) {
pline(Blind ? "%s lands %s your %s." :
"%s back to you, landing %s your %s.",
Blind ? Something : Tobjnam(obj, "return"),
Levitation ? "beneath" : "at",
makeplural(body_part(FOOT)));
} else {
dmg += rnd(3);
pline(Blind ? "%s your %s!" :
"%s back toward you, hitting your %s!",
Tobjnam(obj, Blind ? "hit" : "fly"),
body_part(ARM));
(void) artifact_hit((struct monst *)0,
&youmonst, obj, &dmg, 0);
losehp(dmg, xname(obj), KILLED_BY);
}
if (ship_object(obj, u.ux, u.uy, FALSE))
return;
dropy(obj);
}
return;