Beispiel #1
0
 private static void Swap(Obj_AI_Hero target)
 {
     if (DeadByRMark(target))
     {
         return;
     }
     if (MainMenu["Combo"]["SwapGap"].GetValue<MenuList>().Index > 0 && !target.InAutoAttackRange())
     {
         var distPlayer = Player.Distance(target);
         var distW = WState == 1 && wShadow.IsValid() ? wShadow.Distance(target) : 999999;
         var distR = RState == 1 && rShadow.IsValid() ? rShadow.Distance(target) : 999999;
         var minDist = Math.Min(Math.Min(distW, distR), distPlayer);
         if (minDist < distPlayer)
         {
             switch (MainMenu["Combo"]["SwapGap"].GetValue<MenuList>().Index)
             {
                 case 1:
                     if (Math.Abs(minDist - distW) < float.Epsilon)
                     {
                         var calcCombo = GetComboDmg(
                             target,
                             Q.IsReady(),
                             minDist < Q.Range || (rShadow.IsValid() && rShadow.Distance(target) < Q.Range),
                             E.IsReady(),
                             MainMenu["Combo"]["R"] && MainMenu["Combo"]["RCast" + target.ChampionName]
                             && RState == 0);
                         if (target.Health + target.PhysicalShield < calcCombo[0]
                             && (Player.Mana >= calcCombo[1] || Player.Mana * OverkillValue >= calcCombo[1]))
                         {
                             W.Cast();
                         }
                         if (MainMenu["Combo"]["R"] && MainMenu["Combo"]["RCast" + target.ChampionName]
                             && RState == 0 && !R.IsInRange(target) && minDist < R.Range)
                         {
                             W.Cast();
                         }
                     }
                     else if (Math.Abs(minDist - distR) < float.Epsilon)
                     {
                         var calcCombo = GetComboDmg(
                             target,
                             Q.IsReady(),
                             minDist < Q.Range || (wShadow.IsValid() && wShadow.Distance(target) < Q.Range),
                             E.IsReady(),
                             false);
                         if (target.Health + target.PhysicalShield < calcCombo[0]
                             && (Player.Mana >= calcCombo[1] || Player.Mana * OverkillValue >= calcCombo[1]))
                         {
                             R.Cast();
                         }
                         if (MainMenu["Combo"]["WNormal"] && WState == 0 && distPlayer > RangeW - 100
                             && !HaveRMark(target))
                         {
                             if (Q.IsReady() && Player.Mana >= Q.Instance.ManaCost + W.Instance.ManaCost
                                 && minDist < RangeW + Q.Range)
                             {
                                 R.Cast();
                             }
                             if (E.IsReady() && Player.Mana >= E.Instance.ManaCost + W.Instance.ManaCost
                                 && minDist < RangeW + E.Range)
                             {
                                 R.Cast();
                             }
                         }
                     }
                     break;
                 case 2:
                     if (minDist <= 500)
                     {
                         if (Math.Abs(minDist - distW) < float.Epsilon)
                         {
                             W.Cast();
                         }
                         else if (Math.Abs(minDist - distR) < float.Epsilon)
                         {
                             R.Cast();
                         }
                     }
                     break;
             }
         }
     }
     if ((MainMenu["Combo"]["SwapIfHpU"] > Player.HealthPercent && Player.HealthPercent < target.HealthPercent)
         || (MainMenu["Combo"]["SwapIfKill"] && deathMark != null))
     {
         var countPlayer = Player.CountEnemyHeroesInRange(400);
         var countW = WState == 1 && wShadow.IsValid() ? wShadow.CountEnemyHeroesInRange(400) : 10;
         var countR = RState == 1 && rShadow.IsValid() ? rShadow.CountEnemyHeroesInRange(400) : 10;
         var minCount = Math.Min(countR, countW);
         if (minCount < countPlayer)
         {
             if (minCount == countW)
             {
                 W.Cast();
             }
             else if (minCount == countR)
             {
                 R.Cast();
             }
         }
     }
 }