Beispiel #1
0
 public static void UpdateMaxMinValue(Heroes item, IEnumerable <Targets.Heroes> targets, bool simulation = false)
 {
     try
     {
         var min = float.MaxValue;
         var max = float.MinValue;
         foreach (var target in targets)
         {
             var value = GetValue(item, target);
             if (value < min)
             {
                 min = value;
             }
             if (value > max)
             {
                 max = value;
             }
         }
         if (!simulation)
         {
             item.MinValue = min > 1 ? min : 1;
             item.MaxValue = max > min ? max : min + 1;
         }
         else
         {
             item.SimulationMinValue = min > 1 ? min : 1;
             item.SimulationMaxValue = max > min ? max : min + 1;
         }
     }
     catch (Exception ex)
     {
         Chat.Print(ex);
     }
 }
Beispiel #2
0
 public static float GetValue(Heroes item, Targets.Heroes target)
 {
     try
     {
         var value = item.GetValueFunc(target.Hero);
         return(value > 1 ? value : 1);
     }
     catch (Exception ex)
     {
         Chat.Print(ex);
         return(0);
     }
 }
Beispiel #3
0
 public static float GetValue(Heroes item, Targets.Heroes target)
 {
     try
     {
         var value = item.GetValueFunc(target.Hero);
         return value > 1 ? value : 1;
     }
     catch (Exception ex)
     {
        Chat.Print(ex);
         return 0;
     }
 }
Beispiel #4
0
 public static float CalculatedWeight(Heroes item, Targets.Heroes target, bool simulation = false)
 {
     try
     {
         if (item.Value == 0)
         {
             return(0);
         }
         var value = item.Value * GetValue(item, target) / item.MaxValue;
         return(float.IsNaN(value) || float.IsInfinity(value) ? 0 : value);
     }
     catch (Exception ex)
     {
         Chat.Print(ex);
     }
     return(0);
 }
Beispiel #5
0
 public static float CalculatedWeight(Heroes item, Targets.Heroes target, bool simulation = false)
 {
     try
     {
         if (item.Value == 0)
         {
             return 0;
         }
         var value = item.Value * GetValue(item, target) /  item.MaxValue;
         return float.IsNaN(value) || float.IsInfinity(value) ? 0 : value;
     }
     catch (Exception ex)
     {
         Chat.Print(ex);
     }
     return 0;
 }
Beispiel #6
0
 public static void UpdateMaxMinValue(Heroes item, IEnumerable<Targets.Heroes> targets, bool simulation = false)
 {
     try
     {
         var min = float.MaxValue;
         var max = float.MinValue;
         foreach (var target in targets)
         {
             var value = GetValue(item, target);
             if (value < min)
             {
                 min = value;
             }
             if (value > max)
             {
                 max = value;
             }
         }
         if (!simulation)
         {
             item.MinValue = min > 1 ? min : 1;
             item.MaxValue = max > min ? max : min + 1;
         }
         else
         {
             item.SimulationMinValue = min > 1 ? min : 1;
             item.SimulationMaxValue = max > min ? max : min + 1;
         }
     }
     catch (Exception ex)
     {
         Chat.Print(ex);
     }
 }