I am using RunUO 2.2 and have added a transformation spell that reduces damage to the transformed party by 20%. I accomplished this by modifying the Damage method in PlayerMobile (included below). I am wondering if there is an easy way to have this apply only to non-spell damage. Thanks in advance for any help.
Code:
public override void Damage( int amount, Mobile from )
{
if ( Spells.Necromancy.EvilOmenSpell.TryEndEffect( this ) )
amount = (int)(amount * 1.25);
Mobile oath = Spells.Necromancy.BloodOathSpell.GetBloodOath( from );
/* Per EA's UO Herald Pub48 (ML):
* ((resist spellsx10)/20 + 10=percentage of damage resisted)
*/
if ( oath == this )
{
amount = (int)(amount * 1.1);
if( amount > 35 && from is PlayerMobile ) /* capped @ 35, seems no expansion */
{
amount = 35;
}
if( Core.ML )
{
from.Damage( (int)(amount * ( 1 - ((( from.Skills.MagicResist.Value * .5 ) + 10) / 100 ))), this );
}
else
{
from.Damage( amount, this );
}
}
if ( from != null && Talisman is BaseTalisman )
{
BaseTalisman talisman = (BaseTalisman) Talisman;
if ( talisman.Protection != null && talisman.Protection.Type != null )
{
Type type = talisman.Protection.Type;
if ( type.IsAssignableFrom( from.GetType() ) )
amount = (int)( amount * ( 1 - (double)talisman.Protection.Amount / 100 ) );
}
}
if (!this.CanBeginAction(typeof(TrasnformationSpell)) )
{
amount = (int)(amount * 0.80);
}
base.Damage( amount, from );
}