public static void HandleMagicDefenseProtection(Creature target, ref float damage, bool defense = true, bool protection = true)
{
if (defense)
damage = Math.Max(1, damage - target.MagicDefense);
if (protection && damage > 1)
damage = Math.Max(1, damage - (damage / 100 * target.MagicProtection));
}