Пример #1
0
         public bool Equals(Damage other)
 {
     return this == other;
 }
Пример #2
0
 /// <summary>
 /// Multiplies the values of damage by b.  
 /// However, does NOT change the DamageMultiplier values.
 /// </summary>
 /// <param name="a"></param>
 /// <param name="b"></param>
 /// <returns></returns>
 public static Damage operator *(Damage a, float b)
 {
     Damage d = new Damage();
     float max = 0;
     foreach (ItemDamageType i in Enum.GetValues(typeof(ItemDamageType)))
     {
         d.DamageArray[(int)i] = a.DamageArray[(int)i] * b;
         if (d.DamageArray[(int)i] > max)
         {
             // Set the Primary Dam type based on max damage.
             max = d.DamageArray[(int)i];
             d.DamageTypePrimary = i;
         }
     }
     return d;
 }
Пример #3
0
        public static Damage operator /(Damage a, float b)
        {
            if (b == 0)
            {
#if DEBUG
                throw new DivideByZeroException();
#else
                return a;
#endif
            }
            Damage d = new Damage();
            float max = 0;
            foreach (ItemDamageType i in Enum.GetValues(typeof(ItemDamageType)))
            {
                d.DamageArray[(int)i] = a.DamageArray[(int)i] / b;
                if (d.DamageArray[(int)i] > max)
                {
                    // Set the Primary Dam type based on max damage.
                    max = d.DamageArray[(int)i];
                    d.DamageTypePrimary = i;
                }
            }
            return d;
        }
Пример #4
0
        public static Damage operator -(Damage a, Damage b)
        {
            Damage d = new Damage();
            float max = 0;
            foreach (ItemDamageType i in Enum.GetValues(typeof(ItemDamageType)))
            {
                d.DamageArray[(int)i] = a.DamageArray[(int)i] - b.DamageArray[(int)i];
//                d.DamageMultiplier[(int)i] = (1 + a.DamageMultiplier[(int)i]) / (1 + b.DamageMultiplier[(int)i]) - 1;
                if (d.DamageArray[(int)i] > max)
                {
                    // Set the Primary Dam type based on max damage.
                    max = d.DamageArray[(int)i];
                    d.DamageTypePrimary = i;
                }
            }
            return d;
        }