H206 - passive fire damage affecting weapons (trunk only)
<email deleted> reported back on 8/31/06 that elven weapons were not affected when he poked a fire elemental with them. This is true, but moreover, there was no code to have passive fire to affect attackers. Now erode_obj() supports all the same damage types as rust_dmg(), and added the connecting code to allow passive fire attacks do something. There probably should be macros for the damage types used by rust_dmg and erode_obj, and possibly these functions should be combined, but they are slightly different and dealing with that requires more thought.
This commit is contained in:
15
src/mhitm.c
15
src/mhitm.c
@@ -885,7 +885,7 @@ mdamagem(magr, mdef, mattk)
|
||||
pline("It burns %s!", mon_nam(mdef));
|
||||
}
|
||||
if (!rn2(30)) erode_armor(mdef, TRUE);
|
||||
if (!rn2(6)) (void) erode_obj(MON_WEP(mdef), TRUE, TRUE, FALSE);
|
||||
if (!rn2(6)) (void) erode_obj(MON_WEP(mdef), 3, TRUE, FALSE);
|
||||
break;
|
||||
case AD_RUST:
|
||||
if (magr->mcan) break;
|
||||
@@ -1299,16 +1299,19 @@ mrustm(magr, mdef, obj)
|
||||
register struct monst *magr, *mdef;
|
||||
register struct obj *obj;
|
||||
{
|
||||
boolean is_acid;
|
||||
int dmgtyp;
|
||||
|
||||
if (!magr || !mdef || !obj) return; /* just in case */
|
||||
/* AD_ACID is handled in passivemm */
|
||||
if (dmgtype(mdef->data, AD_CORR))
|
||||
is_acid = TRUE;
|
||||
dmgtyp = 3;
|
||||
else if (dmgtype(mdef->data, AD_RUST))
|
||||
is_acid = FALSE;
|
||||
dmgtyp = 1;
|
||||
else if (dmgtype(mdef->data, AD_FIRE))
|
||||
dmgtyp = 0;
|
||||
else
|
||||
return;
|
||||
(void) erode_obj(obj, is_acid, FALSE, FALSE);
|
||||
(void) erode_obj(obj, dmgtyp, FALSE, FALSE);
|
||||
}
|
||||
|
||||
STATIC_OVL void
|
||||
@@ -1365,6 +1368,8 @@ int mdead;
|
||||
tmp = 0;
|
||||
}
|
||||
} else tmp = 0;
|
||||
if (!rn2(30)) erode_armor(magr, TRUE);
|
||||
if (!rn2(6)) (void)erode_obj(MON_WEP(magr), 3, TRUE, FALSE);
|
||||
goto assess_dmg;
|
||||
case AD_ENCH: /* KMH -- remove enchantment (disenchanter) */
|
||||
if (mhit && !mdef->mcan && otmp) {
|
||||
|
||||
Reference in New Issue
Block a user