It compiles, but server crashed
Exception:
System.InvalidCastException: Unable to cast object of type 'Server.Items.HeaterShield' to type 'Server.Items.AntiDragonShield'.
at Server.Mobiles.Dragon.AlterMeleeDamageTo(Mobile to, Int32& damage)
at Server.Items.BaseWeapon.OnHit(Mobile attacker, Mobile defender, Double damageBonus)
at Server.Timer.Slice()
at Server.Core.Main(String[] args)
It is due the type of shield right? maybe should i change it to a heater one?
public override void AlterMeleeDamageTo( Mobile to, ref int damage )
{
if ( to is PlayerMobile )
{
Item shield = (Item)to.FindItemOnLayer(Layer.TwoHanded);
if (shield != null && shield is AntiDragonShield) damage /= 2;
}
}
public override void AlterMeleeDamageTo( Mobile to, ref int damage )
{
if ( to is PlayerMobile )
{
Item shield = (Item)to.FindItemOnLayer(Layer.TwoHanded);
if (shield != null && shield is AntiDragonShield)
{
int negfactor = Utility.Random(20);
damage = (int)(damage * ((50 + negfactor)/100));
}
}
}
We use essential cookies to make this site work, and optional cookies to enhance your experience.