Example #1
0
        private static void HandleRecallShot(PlayerInfo playerInfo)
        {
            bool shoot = false;

            foreach (Obj_AI_Hero champ in _ownTeam.Where(x =>
                x.IsValid && (x.IsMe || Helper.GetSafeMenuItem<bool>(_menu.Item(x.ChampionName))) &&
                !x.IsDead && !x.IsStunned &&
                (x.Spellbook.CanUseSpell(SpellSlot.R) == SpellState.Ready ||
                 (x.Spellbook.GetSpell(SpellSlot.R).Level > 0 &&
                  x.Spellbook.CanUseSpell(SpellSlot.R) == SpellState.Surpressed &&
                  x.Mana >= GetUltManaCost(x)))))
                //use when fixed: champ.Spellbook.GetSpell(SpellSlot.R) = Ready or champ.Spellbook.GetSpell(SpellSlot.R).ManaCost)
            {
                if (champ.ChampionName != "Ezreal" && champ.ChampionName != "Karthus" &&
                    Helper.IsCollidingWithChamps(champ, _enemySpawnPos, UltInfo[champ.ChampionName].Width))
                    continue;

                //increase timeneeded if it should arrive earlier, decrease if later
                float timeneeded =
                    Helper.GetSpellTravelTime(champ, UltInfo[champ.ChampionName].Speed,
                        UltInfo[champ.ChampionName].Delay, _enemySpawnPos) -
                    (_menu.Item("extraDelay").GetValue<Slider>().Value + 65);

                if (timeneeded - playerInfo.GetRecallCountdown() > 60)
                    continue;

                playerInfo.IncomingDamage[champ.NetworkId] = (float) Helper.GetUltDamage(champ, playerInfo.Champ)*
                                                             UltInfo[champ.ChampionName].DamageMultiplicator;

                if (playerInfo.GetRecallCountdown() <= timeneeded)
                    if (champ.IsMe)
                        shoot = true;
            }

            float totalUltDamage = playerInfo.IncomingDamage.Values.Sum();

            float targetHealth = Helper.GetTargetHealth(playerInfo);

            if (!shoot || _menu.Item("panicKey").GetValue<KeyBind>().Active) {
                if (_menu.Item("debugMode").GetValue<bool>())
                    Game.PrintChat("!SHOOT/PANICKEY {0} (Health: {1} TOTAL-UltDamage: {2})",
                        playerInfo.Champ.ChampionName, targetHealth, totalUltDamage);

                return;
            }

            playerInfo.IncomingDamage.Clear(); //wrong placement?

            int time = Environment.TickCount;

            if (time - playerInfo.LastSeen > 20000 && !_menu.Item("regardlessKey").GetValue<KeyBind>().Active) {
                if (totalUltDamage < playerInfo.Champ.MaxHealth) {
                    if (_menu.Item("debugMode").GetValue<bool>())
                        Game.PrintChat("DONT SHOOT, TOO LONG NO VISION {0} (Health: {1} TOTAL-UltDamage: {2})",
                            playerInfo.Champ.ChampionName, targetHealth, totalUltDamage);

                    return;
                }
            }
            else if (totalUltDamage < targetHealth) {
                if (_menu.Item("debugMode").GetValue<bool>())
                    Game.PrintChat("DONT SHOOT {0} (Health: {1} TOTAL-UltDamage: {2})", playerInfo.Champ.ChampionName,
                        targetHealth, totalUltDamage);

                return;
            }

            if (_menu.Item("debugMode").GetValue<bool>())
                Game.PrintChat("SHOOT {0} (Health: {1} TOTAL-UltDamage: {2})", playerInfo.Champ.ChampionName,
                    targetHealth, totalUltDamage);

            Game.PrintChat("Should shoot {0}: Target Health: {1} UltDamage: {2}", playerInfo.Champ.ChampionName,
                targetHealth, totalUltDamage);

            _ult.Cast(_enemySpawnPos, true);
            _ultCasted = time;
        }