예제 #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);
     }
 }
예제 #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);
     }
 }
예제 #3
0
파일: Points.cs 프로젝트: FireBuddy/zilean
 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;
     }
 }
예제 #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);
 }
예제 #5
0
파일: Points.cs 프로젝트: FireBuddy/zilean
 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;
 }
예제 #6
0
파일: Points.cs 프로젝트: FireBuddy/zilean
 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);
     }
 }