Esempio n. 1
0
 public void AutoSmiteFunc()
 {
     while (true)
     {
         foreach (Minion minion in Engine.GetAll <Minion>())
         {
             //Console.WriteLine(unit.name);
             if (minion.name.StartsWith("SRU") && !minion.name.Contains("Mini") && !minion.name.Contains("Wall")) //temporary workaround for the new summoners rift
             {
                 if (!minion.IsVisible())                                                                         //must be visible to smite
                 {
                     continue;
                 }
                 if (minion.hp > 0 && !minion.isDead)
                 {
                     MainChampion myHero = Champion.Me;
                     if (myHero == null)
                     {
                         break;
                     }
                     if (minion.hp < minion.maxhp && myHero.DistanceFrom(minion) < SMITE_RANGE && Engine.CanCastSpell(smiteKey))
                     {
                         Engine.FloatingText(minion, "Ready To Smite", MessageType.Red);
                         Console.WriteLine("written ready to smite");
                     }
                     int myLevel = myHero.level;
                     if (myLevel < 1 || myLevel > 18) // happens sometimes when the game ends
                     {
                         break;
                     }
                     if (minion.hp <= smiteDmg[myLevel - 1])
                     {
                         //check distance
                         if (myHero.DistanceFrom(minion) < SMITE_RANGE && Engine.CanCastSpell(smiteKey))
                         {
                             //maybe install a mouse hook to disable mouse movement while moving mouse and smiting
                             Console.WriteLine("smiting " + minion.name + DateTime.Now);
                             //move camera
                             Engine.LookAtTarget(minion);
                             AutoItX3Declarations.AU3_MouseMove(Win32.GetSystemMetrics(0) / 2, Win32.GetSystemMetrics(1) / 2, 0);
                             AutoItX3Declarations.AU3_Send(smiteKey, 0);
                         }
                     }
                 }
             }
         }
         System.Threading.Thread.Sleep(20);
     }
 }
 public void IgniteLoop()
 {
     while (true)
     {
         MainChampion me = Champion.Me;
         foreach (Unit u in Engine.GetAll <Champion>())
         {
             if (me == null)
             {
                 break;
             }
             if (u.team == me.team)
             {
                 continue;
             }
             if (u.hp <= 0 || u.isDead || !u.IsVisible())
             {
                 continue;
             }
             int myLevel = me.level;
             if (myLevel <= 0) //happens when the game ends?
             {
                 continue;
             }
             if (u.hp < igniteDps[myLevel - 1] * 5)
             {
                 bool  kill = false;
                 float hp   = u.hp;
                 for (int i = 0; i < 5; i++) //apply 5 ticks of ignite, consider hp regen, and see if the target unit dies.
                 {
                     hp += u.hpRegenPerSec;
                     hp -= igniteDps[myLevel - 1];
                     if (hp <= 0)
                     {
                         kill = true;
                         break;
                     }
                 }
                 if (kill) //ignite will kill
                 {
                     Console.WriteLine("ignite will kill " + u.name);
                     Engine.FloatingText(u, "ignite! ", MessageType.Red);
                 }
             }
         }
         Thread.Sleep(10);
     }
 }