public void Clear()
 {
     for (Int32 i = 0; i < m_resistance.Length; i++)
     {
         m_resistance[i] = new Resistance((EDamageType)i, 0);
     }
 }
        public void Modify(EDamageType p_type, Single p_factor)
        {
            Resistance resistance = m_resistance[(Int32)p_type];

            resistance.Value            = (Int32)Math.Round(resistance.Value * p_factor, MidpointRounding.AwayFromZero);
            m_resistance[(Int32)p_type] = resistance;
        }
Esempio n. 3
0
        public static DamageResult Create(Damage damage, Resistance resistance)
        {
            if (damage.Type != resistance.Type)
            {
                throw new InvalidOperationException();
            }
            Damage damage2 = Damage.ResistedDamage(damage, resistance);

            return(new DamageResult(damage.Type, damage.Value - damage2.Value, damage2.Value, damage.percentage));
        }
Esempio n. 4
0
        public static Damage ResistedDamage(Damage left, Resistance resistance)
        {
            if (left.Type != resistance.Type)
            {
                throw new InvalidOperationException();
            }
            Single num = resistance.Value - left.IgnoreResistance;

            if (num > 0f)
            {
                num *= 1f - left.IgnoreResistancePercent;
            }
            if (num > 100f)
            {
                num = 100f;
            }
            return(new Damage(left.Type, (Int32)Math.Round(left.Value * num / 100f, MidpointRounding.AwayFromZero), left.CriticalBonusMod, left.percentage));
        }
 public void Add(Resistance p_data)
 {
     m_resistance[(Int32)p_data.Type] += p_data;
 }
 public void Set(Resistance p_data)
 {
     m_resistance[(Int32)p_data.Type].Value = p_data.Value;
 }