Esempio n. 1
0
        public static void GetTargetAndAim()
        {
            var castingId = LocalPlayer.Instance.AbilitySystem.CastingAbilityId;
            var skill     = ActiveSkills.Get(castingId);

            if (skill == null)
            {
                return;
            }
            if (OrbLogic(skill, true))
            {
                return;
            }

            var prediction = TargetSelection.GetTargetPrediction(skill, ActiveSkills.GetData(skill.Slot));

            if (!prediction.CanHit)
            {
                if (OrbLogic(skill))
                {
                    Main.DebugOutput = "Attacking orb (no valid targets)";
                }
                else if (MenuHandler.InterruptSpells)
                {
                    LocalPlayer.PressAbility(AbilitySlot.Interrupt, true);
                }
                return;
            }

            Main.DebugOutput            = "Aiming at " + prediction.Target.CharName;
            LocalPlayer.EditAimPosition = true;
            LocalPlayer.Aim(prediction.CastPosition);
        }
Esempio n. 2
0
        private static void HealTeammate()
        {
            var minAllyHp      = HealMenu.GetSlider("heal.minHpOther");
            var energyRequired = HealMenu.GetIntSlider("heal.minEnergyBars") * 25;

            var possibleAllies = EntitiesManager.LocalTeam.Where(x => !x.IsLocalPlayer && !x.Living.IsDead && !x.PhysicsCollision.IsImmaterial &&
                                                                 x.Living.HealthPercent <= minAllyHp);

            var allyToTarget = TargetSelector.GetTarget(possibleAllies, TargetingMode.NearMouse, TrueERange);

            var isCastingOrChanneling = KaanHero.AbilitySystem.IsCasting || KaanHero.IsChanneling || KaanHero.HasBuff("ConsumeBuff") || KaanHero.HasBuff("ReapingScytheBuff");

            if (isCastingOrChanneling && LastAbilityFired == null)
            {
                LastAbilityFired = CastingIndexToSlot(KaanHero.AbilitySystem.CastingAbilityIndex);
            }

            var myPos = KaanHero.MapObject.Position;

            if (isCastingOrChanneling)
            {
                LocalPlayer.EditAimPosition = true;

                switch (LastAbilityFired)
                {
                case AbilitySlot.EXAbility2:
                    if (allyToTarget != null)
                    {
                        var pred = TestPrediction.GetNormalLinePrediction(myPos, allyToTarget, TrueERange, ESpeed, ERadius, true);
                        if (pred.CanHit)
                        {
                            LocalPlayer.Aim(pred.CastPosition);
                        }
                    }
                    break;
                }
            }
            else
            {
                LocalPlayer.EditAimPosition = false;
                LastAbilityFired            = null;
            }

            if (MiscUtils.CanCast(AbilitySlot.EXAbility2))
            {
                if (energyRequired <= KaanHero.Energized.Energy)
                {
                    if (LastAbilityFired == null && allyToTarget != null)
                    {
                        var pred = TestPrediction.GetNormalLinePrediction(myPos, allyToTarget, TrueERange, ESpeed, ERadius, true);
                        if (pred.CanHit)
                        {
                            LocalPlayer.PressAbility(AbilitySlot.EXAbility2, true);
                            LocalPlayer.EditAimPosition = true;
                            LocalPlayer.Aim(pred.CastPosition);
                        }
                    }
                }
            }
        }
Esempio n. 3
0
        private static void HealSelf()
        {
            InGameObject cloneToUse = null;

            if (UltiClone != null && ZanderHero.Distance(UltiClone.Get <MapGameObject>().Position) <= M1Range)
            {
                cloneToUse = UltiClone;
            }
            else if (EX2Clone != null && ZanderHero.Distance(EX2Clone.Get <MapGameObject>().Position) <= M1Range)
            {
                cloneToUse = EX2Clone;
            }
            else if (SpaceClone != null && ZanderHero.Distance(SpaceClone.Get <MapGameObject>().Position) <= M1Range)
            {
                cloneToUse = SpaceClone;
            }

            if (cloneToUse != null)
            {
                LocalPlayer.EditAimPosition = true;
                var pred = TestPrediction.GetNormalLinePrediction(cloneToUse.Get <MapGameObject>().Position, ZanderHero, M1Range, M1Speed, M1Radius, true);
                if (pred.CanHit && MiscUtils.CanCast(AbilitySlot.Ability1))
                {
                    LocalPlayer.Aim(pred.CastPosition);
                    LocalPlayer.PressAbility(AbilitySlot.Ability1, true);
                }
            }
        }
Esempio n. 4
0
        private static void Update(EventArgs args)
        {
            if (!MenuHandler.Enabled || !_shouldUse || !_isCasting || Game.CurrentMatchState != MatchState.InRound)
            {
                return;
            }
            var skill = ActiveSkills.Get(_castingId);

            if (skill == null)
            {
                return;
            }

            if (MenuHandler.Get(skill.Slot))
            {
                if (OrbLogic(skill, true))
                {
                    return;
                }
                var pred = TargetSelection.GetTargetPrediction(skill, AbilityDatabase.Get(_castingId));
                if (!pred.CanHit && !OrbLogic(skill))
                {
                    if (MenuHandler.Interrupt)
                    {
                        LocalPlayer.PressAbility(AbilitySlot.Interrupt, true);
                    }
                    LocalPlayer.EditAimPosition = false;
                    return;
                }

                LocalPlayer.EditAimPosition = true;
                LocalPlayer.Aim(pred.CastPosition);
            }
        }
Esempio n. 5
0
        private static bool OrbLogic(SkillBase skill, bool shouldCheckHover = false)
        {
            var orb = EntitiesManager.CenterOrb;

            if (orb == null || !orb.IsValid || !orb.IsActiveObject)
            {
                return(false);
            }
            var livingObj = orb.Get <LivingObject>();

            if (livingObj.IsDead)
            {
                return(false);
            }

            var orbMapObj = orb.Get <MapGameObject>();
            var orbPos    = orbMapObj.Position;

            if (!TargetSelection.CursorDistCheck(orbPos))
            {
                return(false);
            }

            if (livingObj.Health <= 14 && skill.Slot == AbilitySlot.Ability1)
            {
                Main.DebugOutput            = "Attacking orb (Orb Steal)";
                LocalPlayer.EditAimPosition = true;
                LocalPlayer.Aim(orbPos);
                return(true);
            }
            if (livingObj.Health <= 22 && skill.Slot == AbilitySlot.Ability2)
            {
                Main.DebugOutput            = "Attacking orb (Orb Steal)";
                LocalPlayer.EditAimPosition = true;
                LocalPlayer.Aim(orbPos);
                return(true);
            }
            if (orbPos.Distance(LocalPlayer.Instance) > skill.Range ||
                shouldCheckHover && !orbMapObj.IsHoveringNear())
            {
                return(false);
            }

            if (shouldCheckHover)
            {
                Main.DebugOutput = "Attacking orb (mouse hovering)";
            }
            if (skill.SkillType == SkillType.Line && Prediction.UseClosestPointOnLine)
            {
                orbPos = GeometryLib.NearestPointOnFiniteLine(LocalPlayer.Instance.Pos().Extend(orbPos, 0.6f),
                                                              orbPos, Base.Main.MouseWorldPos);
            }
            LocalPlayer.EditAimPosition = true;
            LocalPlayer.Aim(orbPos);
            return(true);
        }
Esempio n. 6
0
        public void OnUpdate(EventArgs args)
        {
            if (!Game.IsInGame)
            {
                return;
            }

            if (ProjSpeed < float.Epsilon && AirTimeProj < float.Epsilon)
            {
                return;
            }

            LocalPlayer.EditAimPosition = false;

            var movingDummy = EntitiesManager.GetObjectByName("ArenaWalkingDummy");

            if (movingDummy != null)
            {
                ArenaMovingDummy = movingDummy as ArenaDummy;
            }
            else
            {
                return;
            }

            if (UnityEngine.Input.GetKey(UnityEngine.KeyCode.LeftControl))
            {
                if (EntitiesManager.LocalPlayer.AbilitySystem.IsCasting)
                {
                    LocalPlayer.EditAimPosition = true;
                    if (ArenaMovingDummy != null)
                    {
                        if (ProjSpeed > float.Epsilon)
                        {
                            var predProj = TestPrediction.GetPrediction(EntitiesManager.LocalPlayer.MapObject.Position, ArenaMovingDummy, float.MaxValue, ProjSpeed);

                            if (predProj.CanHit)
                            {
                                LocalPlayer.Aim(predProj.CastPosition);
                            }
                        }
                        else if (AirTimeProj > float.Epsilon)
                        {
                            var predAir = TestPrediction.GetPrediction(EntitiesManager.LocalPlayer.MapObject.Position, ArenaMovingDummy, float.MaxValue, 0f, 0f, AirTimeProj);

                            if (predAir.CanHit)
                            {
                                LocalPlayer.Aim(predAir.CastPosition);
                            }
                        }
                    }
                }
            }
        }
Esempio n. 7
0
        private static void OrbMode()
        {
            var orb = EntitiesManager.CenterOrb;

            if (orb == null)
            {
                return;
            }

            var orbHealth = orb.Get <LivingObject>().Health;
            var orbPos    = orb.Get <MapGameObject>().Position;

            if (orbHealth <= 0)
            {
                return;
            }

            LocalPlayer.EditAimPosition = true;
            LocalPlayer.Aim(orbPos);

            if (JadeHero.Distance(orbPos) <= M2Range)
            {
                if (MiscUtils.CanCast(AbilitySlot.EXAbility1) && orbHealth <= (TrueEX1Damage))
                {
                    LocalPlayer.PressAbility(AbilitySlot.EXAbility1, true);
                }
                else if (MiscUtils.CanCast(AbilitySlot.Ability2) && orbHealth > 6f * 4f && orbHealth <= (TrueM2Damage) && false)
                {
                    LocalPlayer.PressAbility(AbilitySlot.Ability2, true);
                }
            }

            if (JadeHero.Distance(orbPos) <= M1Range)
            {
                if (JadeHero.Blessings.Blessings > 0)
                {
                    if (orb.EnemiesAroundAlive(6f) == 0)
                    {
                        LocalPlayer.PressAbility(AbilitySlot.Ability1, true);
                    }
                    else
                    {
                        if (orbHealth <= 6f * 4f || orbHealth >= 6f * 4f + (6f * 4f / 2f))
                        {
                            LocalPlayer.PressAbility(AbilitySlot.Ability1, true);
                        }
                    }
                }
            }
        }
Esempio n. 8
0
        private static void KillstealMode()
        {
            var invisibleEnemies = KSMenu.GetBoolean("ks.invisibleTargets");

            var possibleEnemies = EntitiesManager.EnemyTeam.Where(x => x.IsValid && !x.Living.IsDead && !x.HasProjectileBlocker());

            if (!invisibleEnemies)
            {
                possibleEnemies = possibleEnemies.Where(x => !x.CharacterModel.IsModelInvisible);
            }

            foreach (var enemy in possibleEnemies)
            {
                if (KSMenu.GetBoolean("ks.useEX1") && LastAbilityFired == null && enemy.Living.Health <= (TrueEX1Damage) && enemy.Distance(JadeHero) < M2Range && MiscUtils.CanCast(AbilitySlot.EXAbility1)) //EX1
                {
                    var testPred = TestPrediction.GetNormalLinePrediction(MyPos, enemy, M2Range, M2Speed, M2Radius, true);

                    if (testPred.CanHit)
                    {
                        LocalPlayer.PressAbility(AbilitySlot.EXAbility1, true);
                    }
                }

                if (KSMenu.GetBoolean("ks.useR") && LastAbilityFired == null && enemy.Living.Health <= 6f && enemy.Distance(JadeHero) < RRange && MiscUtils.CanCast(AbilitySlot.Ability6)) //R
                {
                    var testPred = TestPrediction.GetNormalLinePrediction(MyPos, enemy, RRange, RSpeed, RRadius, true);

                    if (testPred.CanHit)
                    {
                        LocalPlayer.PressAbility(AbilitySlot.Ability6, true);
                        LocalPlayer.EditAimPosition = true;
                        LocalPlayer.Aim(testPred.CastPosition);
                    }
                }

                if (KSMenu.GetBoolean("ks.useR") && LastAbilityFired == null && enemy.Living.Health <= 6f * 3f && enemy.Distance(JadeHero) < 1.25f && MiscUtils.CanCast(AbilitySlot.Ability6)) //R
                {
                    var testPred = TestPrediction.GetNormalLinePrediction(MyPos, enemy, RRange, RSpeed, RRadius, true);

                    if (testPred.CanHit)
                    {
                        LocalPlayer.PressAbility(AbilitySlot.Ability6, true);
                        LocalPlayer.EditAimPosition = true;
                        LocalPlayer.Aim(testPred.CastPosition);
                    }
                }
            }
        }
Esempio n. 9
0
        private static void HealSelf()
        {
            var useM2       = HealMenu.GetBoolean("heal.useM2");
            var useM2FullHP = HealMenu.GetBoolean("heal.useM2.fullHP");
            var useSpace    = HealMenu.GetBoolean("heal.useSpace");
            var safeRange   = HealMenu.GetSlider("heal.allySafeRange");

            var shouldM2    = useM2 && (useM2FullHP || LucieHero.Living.Health < LucieHero.Living.MaxRecoveryHealth);
            var shouldSpace = useSpace && LucieHero.EnemiesAroundAlive(safeRange) > 0;

            var isCastingOrChanneling = LucieHero.AbilitySystem.IsCasting || LucieHero.IsChanneling;

            if (isCastingOrChanneling && LastAbilityFired == null)
            {
                LastAbilityFired = CastingIndexToSlot(LucieHero.AbilitySystem.CastingAbilityIndex);
            }

            if (isCastingOrChanneling)
            {
                LocalPlayer.EditAimPosition = true;

                switch (LastAbilityFired)
                {
                case AbilitySlot.Ability3:
                case AbilitySlot.Ability2:
                    LocalPlayer.Aim(LucieHero.MapObject.Position);
                    break;
                }
            }
            else
            {
                LocalPlayer.EditAimPosition = false;
                LastAbilityFired            = null;
            }

            if (shouldSpace && MiscUtils.CanCast(AbilitySlot.Ability3) && LastAbilityFired == null)
            {
                LocalPlayer.PressAbility(AbilitySlot.Ability3, true);
            }

            if (shouldM2 && MiscUtils.CanCast(AbilitySlot.Ability2) && LastAbilityFired == null)
            {
                LocalPlayer.PressAbility(AbilitySlot.Ability2, true);
            }
        }
Esempio n. 10
0
        public static void GetTargetAndAim()
        {
            var castingId = LocalPlayer.Instance.AbilitySystem.CastingAbilityId;

            if (castingId == 238454699 && MenuHandler.SkillBool("close_a3") && EnemiesInRange(2.5f).Count > 0)
            {
                Main.DebugOutput            = "Shielding self";
                LocalPlayer.EditAimPosition = true;
                LocalPlayer.Aim(LocalPlayer.Instance.Pos());
                return;
            }
            var skill = ActiveSkills.Get(castingId);

            if (skill == null)
            {
                return;
            }
            if (OrbLogic(skill, true))
            {
                return;
            }
            var prediction = skill.Slot == AbilitySlot.Ability5 ?
                             GetEPrediction(skill, ActiveSkills.GetData(skill.Slot)) :
                             TargetSelection.GetTargetPrediction(skill, ActiveSkills.GetData(skill.Slot), skill.Slot == AbilitySlot.Ability2);

            if (!prediction.CanHit)
            {
                if (OrbLogic(skill))
                {
                    Main.DebugOutput = "Attacking orb (no valid targets)";
                }
                else
                {
                    if (MenuHandler.InterruptSpells && (!MenuHandler.NeverInterruptE || skill.Slot != AbilitySlot.Ability5))
                    {
                        LocalPlayer.PressAbility(AbilitySlot.Interrupt, true);
                    }
                }
                return;
            }

            Main.DebugOutput            = "Aiming at " + prediction.Target.CharName;
            LocalPlayer.EditAimPosition = true;
            LocalPlayer.Aim(prediction.CastPosition);
        }
Esempio n. 11
0
        public static void AimUlt()
        {
            var skill = ActiveSkills.Active.Get(AbilitySlot.Ability7);

            if (OrbLogic(skill, true))
            {
                return;
            }
            var prediction = TargetSelection.GetTargetPrediction(skill, ActiveSkills.GetData(skill.Slot), true);

            if (!prediction.CanHit)
            {
                Main.DebugOutput = OrbLogic(skill) ? "Attacking orb (no valid targets)" : "Cant find any targets";
                return;
            }
            Main.DebugOutput            = "Aiming at " + prediction.Target.CharName;
            LocalPlayer.EditAimPosition = true;
            LocalPlayer.Aim(prediction.CastPosition);
        }
Esempio n. 12
0
        public static void GetTargetAndAim()
        {
            var castingId = LocalPlayer.Instance.AbilitySystem.CastingAbilityId;
            var skill     = ActiveSkills.Get(castingId);

            if (skill == null)
            {
                return;
            }
            if (OrbLogic(skill, true))
            {
                return;
            }
            var useOnIncaps = skill.Slot == AbilitySlot.Ability2 || skill.Slot == AbilitySlot.Ability5 ||
                              skill.Slot == AbilitySlot.Ability7;

            var prediction = skill.Slot == AbilitySlot.Ability1 && LocalPlayer.Instance.HasBuff("AscensionBuff")
                ? TargetSelection.GetTargetPrediction(Main.AscendedM1, Main.AM1Info, true) :
                             TargetSelection.GetTargetPrediction(skill, ActiveSkills.GetData(skill.Slot), useOnIncaps);

            if (!prediction.CanHit)
            {
                if (OrbLogic(skill))
                {
                    Main.DebugOutput = "Attacking orb (no valid targets)";
                }
                else
                {
                    if (skill.SkillType == SkillType.Line && skill.Slot != AbilitySlot.Ability7 && MenuHandler.InterruptSpells)
                    {
                        LocalPlayer.PressAbility(AbilitySlot.Interrupt, true);
                    }
                }
                return;
            }

            Main.DebugOutput            = "Aiming at " + prediction.Target.CharName;
            LocalPlayer.EditAimPosition = true;
            LocalPlayer.Aim(prediction.CastPosition);
        }
Esempio n. 13
0
        private static void HealOthers()
        {
            var possibleAllies = EntitiesManager.LocalTeam.Where(x => !x.IsLocalPlayer && !x.Living.IsDead);

            //var allyToHealM1 = possibleAllies.Where(x => x.Distance(ZanderHero) < M1Range)
            //    .OrderBy(x => x.Living.Health)
            //    .FirstOrDefault(x => x.Living.Health < x.Living.MaxRecoveryHealth);

            var allyToHealEX1 = possibleAllies.Where(x => x.Distance(ZanderHero) < EX1Range)
                                .OrderBy(x => x.Living.Health)
                                .FirstOrDefault(x => x.HasHardCC() && x.EnemiesAroundAlive(5f) > 0);

            var nearMouseAllyZander = TargetSelector.GetAlly(TargetingMode.NearMouse, M1Range);
            var nearMouseAllySpace  = SpaceClone == null ? null : TargetSelector.GetAlly(TargetingMode.NearMouse, M1Range, SpaceClone.Get <MapGameObject>().Position);
            var nearMouseAllyEX2    = EX2Clone == null ? null : TargetSelector.GetAlly(TargetingMode.NearMouse, M1Range, EX2Clone.Get <MapGameObject>().Position);
            var nearMouseAllyUlti   = UltiClone == null ? null : TargetSelector.GetAlly(TargetingMode.NearMouse, M1Range, UltiClone.Get <MapGameObject>().Position);

            var isCastingOrChanneling = ZanderHero.AbilitySystem.IsCasting || ZanderHero.IsChanneling;

            if (isCastingOrChanneling && LastAbilityFired == null)
            {
                LastAbilityFired = CastingIndexToSlot(ZanderHero.AbilitySystem.CastingAbilityIndex);
            }

            var myPos = ZanderHero.MapObject.Position;

            if (isCastingOrChanneling)
            {
                LocalPlayer.EditAimPosition = true;
                switch (LastAbilityFired)
                {
                case AbilitySlot.Ability1:
                    if (nearMouseAllyZander != null)
                    {
                        var pred = TestPrediction.GetNormalLinePrediction(myPos, nearMouseAllyZander, M1Range, M1Speed, M1Radius, true);
                        if (pred.CanHit)
                        {
                            LocalPlayer.Aim(pred.CastPosition);
                        }
                        else
                        {
                            LocalPlayer.PressAbility(AbilitySlot.Interrupt, true);
                        }
                    }
                    else if (nearMouseAllyUlti != null)
                    {
                        var pred = TestPrediction.GetNormalLinePrediction(UltiClone.Get <MapGameObject>().Position, nearMouseAllyUlti, M1Range, M1Speed, M1Radius, true);
                        if (pred.CanHit)
                        {
                            LocalPlayer.Aim(pred.CastPosition);
                        }
                        else
                        {
                            LocalPlayer.PressAbility(AbilitySlot.Interrupt, true);
                        }
                    }
                    else if (nearMouseAllySpace != null)
                    {
                        var pred = TestPrediction.GetNormalLinePrediction(SpaceClone.Get <MapGameObject>().Position, nearMouseAllySpace, M1Range, M1Speed, M1Radius, true);
                        if (pred.CanHit)
                        {
                            LocalPlayer.Aim(pred.CastPosition);
                        }
                        else
                        {
                            LocalPlayer.PressAbility(AbilitySlot.Interrupt, true);
                        }
                    }
                    else if (nearMouseAllyEX2 != null)
                    {
                        var pred = TestPrediction.GetNormalLinePrediction(EX2Clone.Get <MapGameObject>().Position, nearMouseAllyEX2, M1Range, M1Speed, M1Radius, true);
                        if (pred.CanHit)
                        {
                            LocalPlayer.Aim(pred.CastPosition);
                        }
                        else
                        {
                            LocalPlayer.PressAbility(AbilitySlot.Interrupt, true);
                        }
                    }
                    break;

                case AbilitySlot.EXAbility1:
                    if (allyToHealEX1 != null)
                    {
                        var pred = TestPrediction.GetPrediction(myPos, allyToHealEX1, EX1Range, 0f, EX1Radius, EX1AirTime);
                        if (pred.CanHit)
                        {
                            LocalPlayer.Aim(pred.CastPosition);
                        }
                    }
                    break;
                }
            }
            else
            {
                LocalPlayer.EditAimPosition = false;
                LastAbilityFired            = null;
            }

            if (HealMenu.GetBoolean("heal.useEX1.CC") && MiscUtils.CanCast(AbilitySlot.EXAbility1))
            {
                if (LastAbilityFired == null && allyToHealEX1 != null && allyToHealEX1.Living.HealthPercent <= HealMenu.GetSlider("heal.useEX1.CC.minHealth"))
                {
                    var pred = TestPrediction.GetPrediction(myPos, allyToHealEX1, EX1Range, 0f, EX1Radius, EX1AirTime);
                    if (pred.CanHit)
                    {
                        LocalPlayer.PressAbility(AbilitySlot.EXAbility1, true);
                    }
                }
            }

            if (HealMenu.GetBoolean("heal.useM1") && MiscUtils.CanCast(AbilitySlot.Ability1))
            {
                if (LastAbilityFired == null)
                {
                    if (nearMouseAllyUlti != null)
                    {
                        var pred = TestPrediction.GetNormalLinePrediction(UltiClone.Get <MapGameObject>().Position, nearMouseAllyUlti, M1Range, M1Speed, M1Radius, true);
                        if (pred.CanHit)
                        {
                            LocalPlayer.PressAbility(AbilitySlot.Ability1, true);
                        }
                    }
                    else if (nearMouseAllyZander != null)
                    {
                        var pred = TestPrediction.GetNormalLinePrediction(myPos, nearMouseAllyZander, M1Range, M1Speed, M1Radius, true);
                        if (pred.CanHit)
                        {
                            LocalPlayer.PressAbility(AbilitySlot.Ability1, true);
                        }
                    }
                    else if (nearMouseAllySpace != null)
                    {
                        var pred = TestPrediction.GetNormalLinePrediction(SpaceClone.Get <MapGameObject>().Position, nearMouseAllySpace, M1Range, M1Speed, M1Radius, true);
                        if (pred.CanHit)
                        {
                            LocalPlayer.PressAbility(AbilitySlot.Ability1, true);
                        }
                    }
                    else if (nearMouseAllyEX2 != null)
                    {
                        var pred = TestPrediction.GetNormalLinePrediction(EX2Clone.Get <MapGameObject>().Position, nearMouseAllyEX2, M1Range, M1Speed, M1Radius, true);
                        if (pred.CanHit)
                        {
                            LocalPlayer.PressAbility(AbilitySlot.Ability1, true);
                        }
                    }
                }
            }
        }
Esempio n. 14
0
        private static void ComboMode()
        {
            var targetModeKey = KeysMenu.GetKeybind("keys.changeTargeting");
            var targetMode    = targetModeKey ? TargetingMode.LowestHealth : TargetingMode.NearMouse;

            var invisibleTargets = ComboMenu.GetBoolean("combo.invisibleTargets");

            var enemiesToTarget = EntitiesManager.EnemyTeam.Where(x => x.IsValid && !x.Living.IsDead &&
                                                                  !x.PhysicsCollision.IsImmaterial && !x.IsCountering && !x.HasShield() && !x.HasConsumeBuff && !x.HasParry());

            if (!invisibleTargets)
            {
                enemiesToTarget = enemiesToTarget.Where(x => !x.CharacterModel.IsModelInvisible);
            }

            var M1Target    = TargetSelector.GetTarget(enemiesToTarget, targetMode, M1Range);
            var M2Target    = TargetSelector.GetTarget(enemiesToTarget, targetMode, M2Range);
            var SpaceTarget = TargetSelector.GetTarget(enemiesToTarget, targetMode, SpaceMaxRange);
            var ETarget     = TargetSelector.GetTarget(enemiesToTarget, targetMode, TrueERange);
            var RTarget     = TargetSelector.GetTarget(enemiesToTarget, targetMode, RRange);
            var F_M2Target  = TargetSelector.GetTarget(enemiesToTarget, targetMode, F_M2Range);

            var isCastingOrChanneling = KaanHero.AbilitySystem.IsCasting || KaanHero.IsChanneling || KaanHero.HasBuff("ConsumeBuff") || KaanHero.HasBuff("ReapingScytheBuff");

            if (isCastingOrChanneling && LastAbilityFired == null)
            {
                LastAbilityFired = CastingIndexToSlot(KaanHero.AbilitySystem.CastingAbilityIndex);
            }

            var myPos = KaanHero.MapObject.Position;

            if (isCastingOrChanneling)
            {
                LocalPlayer.EditAimPosition = true;

                switch (LastAbilityFired)
                {
                case AbilitySlot.Ability4:
                    Projectile enemyProj;
                    if (EnemyProjectileGoingToHitUnit(KaanHero, out enemyProj))
                    {
                        LocalPlayer.Aim(enemyProj.MapObject.Position);
                    }
                    else
                    {
                        LocalPlayer.Aim(InputManager.MousePosition.ScreenToWorld());
                    }
                    break;

                case AbilitySlot.Ability5:
                    if (ETarget != null)
                    {
                        var pred = TestPrediction.GetNormalLinePrediction(myPos, ETarget, TrueERange, ESpeed, ERadius, true);
                        if (pred.CanHit)
                        {
                            LocalPlayer.Aim(pred.CastPosition);
                        }
                    }
                    else
                    {
                        LocalPlayer.PressAbility(AbilitySlot.Interrupt, true);
                    }
                    break;

                case AbilitySlot.Ability2:
                    if (!IsInUltimate)     //Normal mode
                    {
                        if (M2Target != null)
                        {
                            var pred = TestPrediction.GetNormalLinePrediction(myPos, M2Target, M2Range, M2Speed, M2Radius, true);
                            if (pred.CanHit)
                            {
                                LocalPlayer.Aim(pred.CastPosition);
                            }
                        }
                        else
                        {
                            LocalPlayer.PressAbility(AbilitySlot.Interrupt, true);
                        }
                    }
                    else     //Ulti mode
                    {
                        if (F_M2Target != null)
                        {
                            var pred = TestPrediction.GetNormalLinePrediction(myPos, F_M2Target, F_M2Range, F_M2Speed, F_M2Radius, true);
                            if (pred.CanHit)
                            {
                                LocalPlayer.Aim(pred.CastPosition);
                            }
                        }
                        else
                        {
                            LocalPlayer.PressAbility(AbilitySlot.Interrupt, true);
                        }
                    }
                    break;

                case AbilitySlot.Ability6:
                    if (ComboMenu.GetBoolean("combo.useR.evade") && EvadeExists && IsREvading && RTarget == null)
                    {
                        var pos = MathUtils.GetBestJumpPosition(0, 32, SpaceMaxRange);
                        LocalPlayer.Aim(pos);
                    }
                    else
                    {
                        if (RTarget != null)
                        {
                            var pred = TestPrediction.GetPrediction(myPos, RTarget, RRange, 0f, RRadius, RAirTime);
                            if (pred.CanHit)
                            {
                                LocalPlayer.Aim(pred.CastPosition);
                            }
                        }
                    }
                    break;

                case AbilitySlot.Ability3:
                    if (SpaceTarget != null)
                    {
                        var pred = TestPrediction.GetPrediction(myPos, SpaceTarget, SpaceMaxRange, 0f, SpaceRadius, SpaceAirTime);
                        if (pred.CanHit)
                        {
                            LocalPlayer.Aim(pred.CastPosition);
                        }
                    }
                    break;

                case AbilitySlot.Ability1:
                    if (M1Target != null)
                    {
                        LocalPlayer.Aim(M1Target.MapObject.Position);
                    }
                    else
                    {
                        LocalPlayer.PressAbility(AbilitySlot.Interrupt, true);
                    }
                    break;
                }
            }
            else
            {
                LocalPlayer.EditAimPosition = false;
                LastAbilityFired            = null;
            }

            if (!IsInUltimate)
            {
                if (ComboMenu.GetBoolean("combo.useQ") && MiscUtils.CanCast(AbilitySlot.Ability4) && !MiscUtils.CanCast(AbilitySlot.Ability2))
                {
                    Projectile closestProj;
                    if (EnemyProjectileGoingToHitUnit(KaanHero, out closestProj))
                    {
                        LocalPlayer.PressAbility(AbilitySlot.Ability4, true);
                        LocalPlayer.EditAimPosition = true;
                        LocalPlayer.Aim(closestProj.MapObject.Position);
                        return;
                    }
                }

                if (ComboMenu.GetBoolean("combo.useF") && MiscUtils.CanCast(AbilitySlot.Ability7))
                {
                    if (LastAbilityFired == null && KaanHero.EnemiesAroundAlive(FRange) > 0)
                    {
                        LocalPlayer.PressAbility(AbilitySlot.Ability7, true);
                        return;
                    }
                }

                if (ComboMenu.GetBoolean("combo.useE") && MiscUtils.CanCast(AbilitySlot.Ability5))
                {
                    if (LastAbilityFired == null && ETarget != null && ETarget.Distance(KaanHero) > ComboMenu.GetSlider("combo.useE.minRange"))
                    {
                        var pred = TestPrediction.GetNormalLinePrediction(myPos, ETarget, TrueERange, ESpeed, ERadius, true);
                        if (pred.CanHit)
                        {
                            LocalPlayer.PressAbility(AbilitySlot.Ability5, true);
                            LocalPlayer.EditAimPosition = true;
                            LocalPlayer.Aim(pred.CastPosition);
                            return;
                        }
                    }
                }

                if (ComboMenu.GetBoolean("combo.useM2") && MiscUtils.CanCast(AbilitySlot.Ability2))
                {
                    if (LastAbilityFired == null && M2Target != null &&
                        KaanHero.EnemiesAroundAlive(ComboMenu.GetSlider("combo.useM2.safeRange")) == 0)
                    {
                        var pred = TestPrediction.GetNormalLinePrediction(myPos, M2Target, M2Range, M2Speed, M2Radius, true);
                        if (pred.CanHit)
                        {
                            LocalPlayer.PressAbility(AbilitySlot.Ability2, true);
                            LocalPlayer.EditAimPosition = true;
                            LocalPlayer.Aim(pred.CastPosition);
                            return;
                        }
                    }
                }

                if (ComboMenu.GetBoolean("combo.useR") && MiscUtils.CanCast(AbilitySlot.Ability6) && !KaanHero.IsWeaponCharged && HasNetherBlade)
                {
                    var energyRequired = ComboMenu.GetIntSlider("combo.useR.minEnergyBars") * 25;
                    if (energyRequired <= KaanHero.Energized.Energy)
                    {
                        if (LastAbilityFired == null && RTarget != null)
                        {
                            var pred = TestPrediction.GetPrediction(myPos, RTarget, RRange, 0f, RRadius, RAirTime);
                            if (pred.CanHit)
                            {
                                LocalPlayer.PressAbility(AbilitySlot.Ability6, true);
                                LocalPlayer.EditAimPosition = true;
                                LocalPlayer.Aim(pred.CastPosition);
                                return;
                            }
                        }
                    }
                }

                if (ComboMenu.GetBoolean("combo.useEX1") && MiscUtils.CanCast(AbilitySlot.EXAbility1))
                {
                    var energyRequired = ComboMenu.GetIntSlider("combo.useEX1.minEnergyBars") * 25;
                    if (energyRequired <= KaanHero.Energized.Energy)
                    {
                        if (LastAbilityFired == null && M1Target != null)
                        {
                            LocalPlayer.PressAbility(AbilitySlot.EXAbility1, true);
                            return;
                        }
                    }
                }

                if (ComboMenu.GetBoolean("combo.useSpace") && MiscUtils.CanCast(AbilitySlot.Ability3))
                {
                    if (LastAbilityFired == null && SpaceTarget != null)
                    {
                        var pred = TestPrediction.GetPrediction(myPos, SpaceTarget, SpaceMaxRange, 0f, SpaceRadius, SpaceAirTime);
                        if (pred.CanHit)
                        {
                            LocalPlayer.PressAbility(AbilitySlot.Ability3, true);
                            LocalPlayer.EditAimPosition = true;
                            LocalPlayer.Aim(pred.CastPosition);
                            return;
                        }
                    }
                }

                if (ComboMenu.GetBoolean("combo.useM1") && MiscUtils.CanCast(AbilitySlot.Ability1))
                {
                    if (LastAbilityFired == null && M1Target != null)
                    {
                        LocalPlayer.PressAbility(AbilitySlot.Ability1, true);
                        LocalPlayer.EditAimPosition = true;
                        LocalPlayer.Aim(M1Target.MapObject.Position);
                        return;
                    }
                }
            }
            else
            {
                if (ComboMenu.GetBoolean("combo.ultiMode.useM2") && MiscUtils.CanCast(AbilitySlot.Ability2))
                {
                    if (LastAbilityFired == null && F_M2Target != null &&
                        F_M2Target.Distance(KaanHero) > ComboMenu.GetSlider("combo.ultiMode.useM2.minRange"))
                    {
                        var pred = TestPrediction.GetNormalLinePrediction(myPos, F_M2Target, F_M2Range, F_M2Speed, F_M2Radius, true);
                        if (pred.CanHit)
                        {
                            LocalPlayer.PressAbility(AbilitySlot.Ability2, true);
                            LocalPlayer.EditAimPosition = true;
                            LocalPlayer.Aim(pred.CastPosition);
                            return;
                        }
                    }
                }

                if (ComboMenu.GetBoolean("combo.ultiMode.useM1") && MiscUtils.CanCast(AbilitySlot.Ability1))
                {
                    if (LastAbilityFired == null && M1Target != null)
                    {
                        LocalPlayer.PressAbility(AbilitySlot.Ability1, true);
                        LocalPlayer.EditAimPosition = true;
                        LocalPlayer.Aim(M1Target.MapObject.Position);
                        return;
                    }
                }
            }
        }
Esempio n. 15
0
        private static void ComboMode()
        {
            var targetModeKey = KeysMenu.GetKeybind("keys.changeTargeting");
            var targetMode    = targetModeKey ? TargetingMode.LowestHealth : TargetingMode.NearMouse;

            var invisibleTargets = ComboMenu.GetBoolean("combo.invisibleTargets");
            var noBubble         = ComboMenu.GetBoolean("combo.noBubble");

            var enemiesBase = EntitiesManager.EnemyTeam.Where(x => x.IsValid && !x.Living.IsDead && !x.HasCollisionLineToPos(MyPos));
            var enemiesProj = enemiesBase.Where(x => !x.HasProjectileBlocker());

            if (!invisibleTargets)
            {
                enemiesProj = enemiesProj.Where(x => !x.CharacterModel.IsModelInvisible);
            }

            var M1Target   = TargetSelector.GetTarget(enemiesProj, targetMode, M1Range);
            var M2_FTarget = TargetSelector.GetTarget(enemiesProj, targetMode, M2Range);
            var RTarget    = TargetSelector.GetTarget(enemiesProj, targetMode, !ComboMenu.GetBoolean("combo.useR.closeRange") ? RRange : RRange / 2f);
            var ETarget    = enemiesProj
                             .Where(x => (x.AbilitySystem.IsCasting || x.IsChanneling) && x.Distance(JadeHero) < TrueERange)
                             .OrderBy(x => x.Distance(JadeHero))
                             .FirstOrDefault();

            var isCastingOrChanneling = JadeHero.AbilitySystem.IsCasting || JadeHero.IsChanneling;

            if (isCastingOrChanneling && LastAbilityFired == null)
            {
                LastAbilityFired = CastingIndexToSlot(JadeHero.AbilitySystem.CastingAbilityIndex);
            }

            var useEX2 = ComboMenu.GetBoolean("combo.useEX2") && (ComboMenu.GetIntSlider("combo.useEX2.minEnergyBars") * 25 <= JadeHero.Energized.Energy);

            if (!isCastingOrChanneling && ComboMenu.GetBoolean("combo.useQ.near") && MiscUtils.CanCast(AbilitySlot.Ability4) && JadeHero.EnemiesAroundAlive(2f) > 0)
            {
                if (!useEX2)
                {
                    LocalPlayer.PressAbility(AbilitySlot.Ability4, true);
                }
                else
                {
                    LocalPlayer.PressAbility(AbilitySlot.EXAbility2, true);
                }
            }

            if (!isCastingOrChanneling && ComboMenu.GetBoolean("combo.useQ.reset") && MiscUtils.CanCast(AbilitySlot.Ability4) &&
                LocalPlayer.GetAbilityHudData(AbilitySlot.Ability2).CooldownLeft > 2f)
            {
                if (!useEX2)
                {
                    LocalPlayer.PressAbility(AbilitySlot.Ability4, true);
                }
                else
                {
                    LocalPlayer.PressAbility(AbilitySlot.EXAbility2, true);
                }
            }

            if (isCastingOrChanneling)
            {
                LocalPlayer.EditAimPosition = true;

                switch (LastAbilityFired)
                {
                case AbilitySlot.Ability3:     //Space
                    var priorityMode = ComboMenu.GetComboBox("combo.useSpace.direction");
                    var accuracy     = ComboMenu.GetIntSlider("combo.useSpace.accuracy");
                    var bestPosition = MathUtils.GetBestJumpPosition(priorityMode, accuracy, TrueSpaceRange);

                    LocalPlayer.Aim(bestPosition);
                    break;

                case AbilitySlot.Ability5:     //E
                    if (ETarget != null)
                    {
                        var testPred = TestPrediction.GetNormalLinePrediction(MyPos, ETarget, ERange, ESpeed, ERadius, true);

                        if (testPred.CanHit)
                        {
                            if (noBubble && WillCollideWithEnemyBubble(MyPos, testPred.CastPosition, ERadius))
                            {
                                LocalPlayer.PressAbility(AbilitySlot.Interrupt, true);
                            }
                            else
                            {
                                LocalPlayer.Aim(testPred.CastPosition);
                            }
                        }
                        else
                        {
                            LocalPlayer.PressAbility(AbilitySlot.Interrupt, true);
                        }
                    }
                    else
                    {
                        LocalPlayer.PressAbility(AbilitySlot.Interrupt, true);
                    }
                    break;

                case AbilitySlot.Ability7:     //F
                    if (M2_FTarget != null)
                    {
                        var testPred = TestPrediction.GetNormalLinePrediction(MyPos, M2_FTarget, M2Range, FSpeed, FRadius, true);

                        if (testPred.CanHit)
                        {
                            LocalPlayer.Aim(testPred.CastPosition);
                        }
                        else
                        {
                            if (ComboMenu.GetBoolean("combo.interruptF"))
                            {
                                LocalPlayer.PressAbility(AbilitySlot.Interrupt, true);
                            }
                        }
                    }
                    else
                    {
                        if (ComboMenu.GetBoolean("combo.interruptF"))
                        {
                            LocalPlayer.PressAbility(AbilitySlot.Interrupt, true);
                        }
                    }
                    break;

                case AbilitySlot.Ability6:     //R
                    if (RTarget != null)
                    {
                        var testPred = TestPrediction.GetNormalLinePrediction(MyPos, RTarget, RRange, RSpeed, RRadius, true);

                        if (testPred.CanHit)
                        {
                            if (noBubble && WillCollideWithEnemyBubble(MyPos, testPred.CastPosition, RRadius))
                            {
                                LocalPlayer.PressAbility(AbilitySlot.Interrupt, true);
                            }
                            else
                            {
                                LocalPlayer.Aim(testPred.CastPosition);
                            }
                        }
                        else
                        {
                            LocalPlayer.PressAbility(AbilitySlot.Interrupt, true);
                        }
                    }
                    else
                    {
                        LocalPlayer.PressAbility(AbilitySlot.Interrupt, true);
                    }
                    break;

                case AbilitySlot.Ability2:     //M2
                case AbilitySlot.EXAbility1:
                    if (M2_FTarget != null)
                    {
                        var testPred = TestPrediction.GetNormalLinePrediction(MyPos, M2_FTarget, M2Range, M2Speed, M2Radius, true);

                        if (testPred.CanHit)
                        {
                            if (noBubble && WillCollideWithEnemyBubble(MyPos, testPred.CastPosition, M2Radius))
                            {
                                LocalPlayer.PressAbility(AbilitySlot.Interrupt, true);
                            }
                            else
                            {
                                LocalPlayer.Aim(testPred.CastPosition);
                            }
                        }
                        else
                        {
                            LocalPlayer.PressAbility(AbilitySlot.Interrupt, true);
                        }
                    }
                    else
                    {
                        LocalPlayer.PressAbility(AbilitySlot.Interrupt, true);
                    }
                    break;

                case AbilitySlot.Ability1:     //M1
                    if (M1Target != null)
                    {
                        var testPred = TestPrediction.GetNormalLinePrediction(MyPos, M1Target, M1Range, M1Speed, M1Radius, true);

                        if (testPred.CanHit)
                        {
                            if (noBubble && WillCollideWithEnemyBubble(MyPos, testPred.CastPosition, M1Radius))
                            {
                                LocalPlayer.PressAbility(AbilitySlot.Interrupt, true);
                            }
                            else
                            {
                                LocalPlayer.Aim(testPred.CastPosition);
                            }
                        }
                        else
                        {
                            LocalPlayer.PressAbility(AbilitySlot.Interrupt, true);
                        }
                    }
                    else
                    {
                        LocalPlayer.PressAbility(AbilitySlot.Interrupt, true);
                    }
                    break;
                }
            }
            else
            {
                LastAbilityFired            = null;
                LocalPlayer.EditAimPosition = false;
            }

            if (!isCastingOrChanneling && ComboMenu.GetBoolean("combo.useSpace") && MiscUtils.CanCast(AbilitySlot.Ability3) && JadeHero.EnemiesAroundAlive(ComboMenu.GetSlider("combo.useSpace.maxRange")) > 0)
            {
                if (!MiscUtils.HasBuff(JadeHero, "Stealth")) //Not stealthed
                {
                    var priorityMode = ComboMenu.GetComboBox("combo.useSpace.direction");
                    var accuracy     = ComboMenu.GetIntSlider("combo.useSpace.accuracy");
                    var bestPosition = MathUtils.GetBestJumpPosition(priorityMode, accuracy, TrueSpaceRange);

                    LocalPlayer.PressAbility(AbilitySlot.Ability3, true);
                    LocalPlayer.EditAimPosition = true;
                    LocalPlayer.Aim(bestPosition);
                    return;
                }
            }

            if (ComboMenu.GetBoolean("combo.useE") && MiscUtils.CanCast(AbilitySlot.Ability5))
            {
                if (LastAbilityFired == null && ETarget != null)
                {
                    var testPred = TestPrediction.GetNormalLinePrediction(MyPos, ETarget, ERange, ESpeed, ERadius, true);

                    if (testPred.CanHit)
                    {
                        if (noBubble && WillCollideWithEnemyBubble(MyPos, testPred.CastPosition, ERadius))
                        {
                            //Do nothing
                        }
                        else
                        {
                            LocalPlayer.PressAbility(AbilitySlot.Ability5, true);
                            LocalPlayer.EditAimPosition = true;
                            LocalPlayer.Aim(testPred.CastPosition);
                            return;
                        }
                    }
                }
            }

            if (ComboMenu.GetBoolean("combo.useF") && MiscUtils.CanCast(AbilitySlot.Ability7))
            {
                if (JadeHero.EnemiesAroundAlive(ComboMenu.GetSlider("combo.useF.safeRange")) == 0)
                {
                    if (LastAbilityFired == null && M2_FTarget != null)
                    {
                        var testPred = TestPrediction.GetNormalLinePrediction(MyPos, M2_FTarget, M2Range, FSpeed, FRadius, true);

                        if (testPred.CanHit)
                        {
                            if (noBubble && WillCollideWithEnemyBubble(MyPos, testPred.CastPosition, FRadius))
                            {
                                //Do nothing
                            }
                            else
                            {
                                LocalPlayer.PressAbility(AbilitySlot.Ability7, true);
                                LocalPlayer.EditAimPosition = true;
                                LocalPlayer.Aim(testPred.CastPosition);
                                return;
                            }
                        }
                    }
                }
            }

            if (ComboMenu.GetBoolean("combo.useR") && MiscUtils.CanCast(AbilitySlot.Ability6))
            {
                var energyRequired = ComboMenu.GetIntSlider("combo.useR.minEnergyBars") * 25;
                if (energyRequired <= JadeHero.Energized.Energy)
                {
                    if (LastAbilityFired == null && RTarget != null)
                    {
                        var testPred = TestPrediction.GetNormalLinePrediction(MyPos, RTarget, RRange, RSpeed, RRadius, true);

                        if (testPred.CanHit)
                        {
                            if (noBubble && WillCollideWithEnemyBubble(MyPos, testPred.CastPosition, RRadius))
                            {
                                //Do nothing
                            }
                            else
                            {
                                LocalPlayer.PressAbility(AbilitySlot.Ability6, true);
                                LocalPlayer.EditAimPosition = true;
                                LocalPlayer.Aim(testPred.CastPosition);
                                return;
                            }
                        }
                    }
                }
            }

            if (ComboMenu.GetBoolean("combo.useEX1") && MiscUtils.CanCast(AbilitySlot.EXAbility1))
            {
                var energyRequired = ComboMenu.GetIntSlider("combo.useEX1.minEnergyBars") * 25;
                if (energyRequired <= JadeHero.Energized.Energy)
                {
                    if (LastAbilityFired == null && M2_FTarget != null)
                    {
                        var testPred = TestPrediction.GetNormalLinePrediction(MyPos, M2_FTarget, M2Range, M2Speed, M2Radius, true);

                        if (testPred.CanHit)
                        {
                            if (noBubble && WillCollideWithEnemyBubble(MyPos, testPred.CastPosition, M2Radius))
                            {
                                //Do nothing
                            }
                            else
                            {
                                LocalPlayer.PressAbility(AbilitySlot.EXAbility1, true);
                                return;
                            }
                        }
                    }
                }
            }

            if (ComboMenu.GetBoolean("combo.useM2") && MiscUtils.CanCast(AbilitySlot.Ability2))
            {
                if (JadeHero.EnemiesAroundAlive(ComboMenu.GetSlider("combo.useM2.safeRange")) == 0)
                {
                    if (LastAbilityFired == null && M2_FTarget != null)
                    {
                        var testPred = TestPrediction.GetNormalLinePrediction(MyPos, M2_FTarget, M2Range, M2Speed, M2Radius, true);

                        if (testPred.CanHit)
                        {
                            if (noBubble && WillCollideWithEnemyBubble(MyPos, testPred.CastPosition, M2Radius))
                            {
                                //Do nothing
                            }
                            else
                            {
                                LocalPlayer.PressAbility(AbilitySlot.Ability2, true);
                                return;
                            }
                        }
                    }
                }
            }

            if (ComboMenu.GetBoolean("combo.useM1") && JadeHero.Blessings.Blessings > 0)
            {
                if (LastAbilityFired == null && M1Target != null)
                {
                    var testPred = TestPrediction.GetNormalLinePrediction(MyPos, M1Target, M1Range, M1Speed, M1Radius, true);

                    if (testPred.CanHit)
                    {
                        if (noBubble && WillCollideWithEnemyBubble(MyPos, testPred.CastPosition, M1Radius))
                        {
                            //Do nothing
                        }
                        else
                        {
                            LocalPlayer.PressAbility(AbilitySlot.Ability1, true);
                            LocalPlayer.EditAimPosition = true;
                            LocalPlayer.Aim(testPred.CastPosition);
                            return;
                        }
                    }
                }
            }
        }
Esempio n. 16
0
        private static bool SkillAimLogic()
        {
            var dangerousProjectiles = new List <TrackedProjectile>();

            dangerousProjectiles.AddRange(ObjectTracker.Enemy.Projectiles.TrackedObjects);
            dangerousProjectiles = dangerousProjectiles.Where(p => p.IsDangerous).ToList();
            if (_castingLastFrame != null && LocalPlayer.Instance.AbilitySystem.IsCasting &&
                LocalPlayer.Instance.AbilitySystem.CastingAbilityId == _castingLastFrame.AbilityId)
            {
                var casting = _castingLastFrame;
                casting.SetStatus(true);

                if (casting.OverrideValue() != 0)
                {
                    return(false);
                }

                if (casting.AbilityType == DodgeAbilityType.Jump && casting.UsesMousePos)
                {
                    LocalPlayer.EditAimPosition = true;
                    LocalPlayer.Aim(casting.GetJumpPos());
                }
                else if (casting.AbilityType == DodgeAbilityType.Obstacle && dangerousProjectiles.Any())
                {
                    LocalPlayer.EditAimPosition = true;
                    var projectile = dangerousProjectiles
                                     .OrderByDescending(p => p.Data.Danger)
                                     .First().Projectile;
                    var pos = LocalPlayer.Instance.Pos().Extend(projectile.MapObject.Position, 1.5f);
                    LocalPlayer.Aim(pos);
                }
                else if (casting.AbilityType == DodgeAbilityType.Shield && casting.UsesMousePos && dangerousProjectiles.Any())
                {
                    var projectile = dangerousProjectiles
                                     .OrderByDescending(p => p.Data.Danger)
                                     .First().Projectile;
                    var pos = GeometryLib.NearestPointOnFiniteLine(projectile.MapObject.Position,
                                                                   LocalPlayer.Instance.Pos(), Main.MouseWorldPos);
                    if (LocalPlayer.Instance.Distance(pos) < 1)
                    {
                        pos = LocalPlayer.Instance.Pos().Extend(projectile.MapObject.Position, 1);
                    }
                    LocalPlayer.Aim(pos);
                }
                else if (casting.NeedsSelfCast)
                {
                    LocalPlayer.EditAimPosition = true;
                    LocalPlayer.Aim(LocalPlayer.Instance.Pos());
                }

                return(true);
            }

            if (!LocalPlayer.Instance.AbilitySystem.IsCasting && _castingLastFrame != null)
            {
                _castingLastFrame.SetStatus(false);
                _castingLastFrame           = null;
                LocalPlayer.EditAimPosition = false;
            }

            return(false);
        }
Esempio n. 17
0
        private static void HealOthers()
        {
            var useM2        = HealMenu.GetBoolean("heal.useM2");
            var useM2FullHP  = HealMenu.GetBoolean("heal.useM2.fullHP");
            var useSpace     = HealMenu.GetBoolean("heal.useSpace");
            var useSpaceMode = HealMenu.GetComboBox("heal.useSpace.mode");
            var useQ         = HealMenu.GetBoolean("heal.useQ");
            var safeRange    = HealMenu.GetSlider("heal.allySafeRange");

            var possibleAllies = EntitiesManager.LocalTeam.Where(x => !x.IsLocalPlayer &&
                                                                 !x.Living.IsDead && !x.PhysicsCollision.IsImmaterial);

            var allySpace = useSpaceMode == 0
                ? possibleAllies.Where(x => x.EnemiesAroundAlive(safeRange) > 0)
                            .OrderByDescending(x => x.EnemiesAroundAlive(safeRange))
                            .ThenBy(x => x.MapObject.ScreenPosition.Distance(InputManager.MousePosition)).FirstOrDefault()

                : possibleAllies.Where(x => x.EnemiesAroundAlive(safeRange) > 0)
                            .OrderBy(x => x.MapObject.ScreenPosition.Distance(InputManager.MousePosition))
                            .ThenBy(x => x.EnemiesAroundAlive(safeRange)).FirstOrDefault();

            if (!useM2FullHP)
            {
                possibleAllies = possibleAllies.Where(x => x.Living.Health < x.Living.MaxRecoveryHealth);
            }

            var allyM2 = TargetSelector.GetTarget(possibleAllies, TargetingMode.NearMouse, M2Range);

            var isCastingOrChanneling = LucieHero.AbilitySystem.IsCasting || LucieHero.IsChanneling;

            if (isCastingOrChanneling && LastAbilityFired == null)
            {
                LastAbilityFired = CastingIndexToSlot(LucieHero.AbilitySystem.CastingAbilityIndex);
            }

            if (isCastingOrChanneling)
            {
                LocalPlayer.EditAimPosition = true;

                switch (LastAbilityFired)
                {
                case AbilitySlot.Ability3:
                    if (allySpace != null)
                    {
                        LocalPlayer.Aim(allySpace.MapObject.Position);
                    }
                    break;

                case AbilitySlot.Ability2:
                    if (allyM2 != null)
                    {
                        var pred = TestPrediction.GetNormalLinePrediction(MyPos, allyM2, M2Range, M2Speed, M2Radius, true);
                        if (pred.CanHit)
                        {
                            LocalPlayer.Aim(pred.CastPosition);
                        }
                    }
                    else
                    {
                        LocalPlayer.PressAbility(AbilitySlot.Interrupt, true);
                    }
                    break;
                }
            }
            else
            {
                LocalPlayer.EditAimPosition = false;
                LastAbilityFired            = null;
            }

            if (useSpace && MiscUtils.CanCast(AbilitySlot.Ability3))
            {
                if (LastAbilityFired == null && allySpace != null)
                {
                    LocalPlayer.PressAbility(AbilitySlot.Ability3, true);
                    LocalPlayer.EditAimPosition = true;
                    LocalPlayer.Aim(allySpace.MapObject.Position);
                    return;
                }
            }

            if (useM2 && MiscUtils.CanCast(AbilitySlot.Ability2))
            {
                if (LastAbilityFired == null && allyM2 != null)
                {
                    var pred = TestPrediction.GetNormalLinePrediction(MyPos, allyM2, M2Range, M2Speed, M2Radius, true);
                    if (pred.CanHit)
                    {
                        LocalPlayer.PressAbility(AbilitySlot.Ability2, true);
                        LocalPlayer.EditAimPosition = true;
                        LocalPlayer.Aim(pred.CastPosition);
                    }
                    return;
                }
            }
        }
Esempio n. 18
0
        private static void ComboMode()
        {
            var targetModeKey = KeysMenu.GetKeybind("keys.changeTargeting");
            var targetMode    = targetModeKey ? TargetingMode.LowestHealth : TargetingMode.NearMouse;

            var enemiesToTargetBase = EntitiesManager.EnemyTeam.Where(x => x.IsValid && !x.Living.IsDead &&
                                                                      !x.HasBuff("OtherSideBuff"));

            if (!ComboMenu.GetBoolean("combo.invisible"))
            {
                enemiesToTargetBase = enemiesToTargetBase.Where(x => !x.CharacterModel.IsModelInvisible);
            }

            var enemiesToTargetProjs = enemiesToTargetBase.Where(x =>
                                                                 !x.IsCountering && !x.HasShield() && !x.HasConsumeBuff && !x.HasParry());
            var enemiesToTargetQ = enemiesToTargetBase.Where(x =>
                                                             x.Buffs.Any(y => y.BuffType == BuffType.Buff));

            var targetM1  = TargetSelector.GetTarget(enemiesToTargetProjs, targetMode, M1Range);
            var targetE   = TargetSelector.GetTarget(enemiesToTargetProjs, targetMode, ERange);
            var targetQ   = TargetSelector.GetTarget(enemiesToTargetQ, targetMode, QRange);
            var targetEX1 = TargetSelector.GetTarget(enemiesToTargetProjs, targetMode, EX1Range);
            var targetEX2 = TargetSelector.GetTarget(enemiesToTargetProjs, targetMode, EX2Range);
            var targetF   = TargetSelector.GetTarget(enemiesToTargetBase, targetMode, FRange);

            var isCastingOrChanneling = LucieHero.AbilitySystem.IsCasting || LucieHero.IsChanneling;

            if (isCastingOrChanneling && LastAbilityFired == null)
            {
                LastAbilityFired = CastingIndexToSlot(LucieHero.AbilitySystem.CastingAbilityIndex);
            }

            if (isCastingOrChanneling)
            {
                LocalPlayer.EditAimPosition = true;

                switch (LastAbilityFired)
                {
                case AbilitySlot.Ability6:
                    var priorityMode = ComboMenu.GetComboBox("combo.useR.direction");
                    var bestPosition = MathUtils.GetBestJumpPosition(priorityMode, 46, RRange);

                    LocalPlayer.Aim(bestPosition);
                    break;

                case AbilitySlot.Ability7:
                    if (targetF != null)
                    {
                        LocalPlayer.Aim(targetF.MapObject.Position);
                    }
                    else
                    {
                        LocalPlayer.PressAbility(AbilitySlot.Interrupt, true);
                    }
                    break;

                case AbilitySlot.Ability5:
                    if (targetE != null)
                    {
                        var pred = TestPrediction.GetNormalLinePrediction(MyPos, targetE, ERange, ESpeed, ERadius, true);
                        if (pred.CanHit)
                        {
                            LocalPlayer.Aim(pred.CastPosition);
                        }
                    }
                    else
                    {
                        LocalPlayer.PressAbility(AbilitySlot.Interrupt, true);
                    }
                    break;

                case AbilitySlot.Ability4:
                    if (targetQ != null)
                    {
                        var pred = TestPrediction.GetPrediction(MyPos, targetQ, QRange, 0f, QRadius, QAirTime);
                        if (pred.CanHit)
                        {
                            LocalPlayer.Aim(pred.CastPosition);
                        }
                    }
                    else
                    {
                        LocalPlayer.PressAbility(AbilitySlot.Interrupt, true);
                    }
                    break;

                case AbilitySlot.EXAbility2:
                    if (targetEX2 != null)
                    {
                        var pred = TestPrediction.GetNormalLinePrediction(MyPos, targetEX2, EX2Range, EX2Speed, EX2Radius, true);
                        if (pred.CanHit)
                        {
                            LocalPlayer.Aim(pred.CastPosition);
                        }
                    }
                    else
                    {
                        LocalPlayer.PressAbility(AbilitySlot.Interrupt, true);
                    }
                    break;

                case AbilitySlot.EXAbility1:
                    if (targetEX1 != null)
                    {
                        var pred = TestPrediction.GetNormalLinePrediction(MyPos, targetEX1, EX1Range, EX1Speed, EX1Radius, true);
                        if (pred.CanHit)
                        {
                            LocalPlayer.Aim(pred.CastPosition);
                        }
                    }
                    else
                    {
                        LocalPlayer.PressAbility(AbilitySlot.Interrupt, true);
                    }
                    break;

                case AbilitySlot.Ability1:
                    if (targetM1 != null)
                    {
                        var pred = TestPrediction.GetNormalLinePrediction(MyPos, targetM1, M1Range, M1Speed, M1Radius, true);
                        if (pred.CanHit)
                        {
                            LocalPlayer.Aim(pred.CastPosition);
                        }
                    }
                    else
                    {
                        LocalPlayer.PressAbility(AbilitySlot.Interrupt, true);
                    }
                    break;
                }
            }
            else
            {
                LocalPlayer.EditAimPosition = false;
                LastAbilityFired            = null;
            }

            if (!isCastingOrChanneling && ComboMenu.GetBoolean("combo.useR") && MiscUtils.CanCast(AbilitySlot.Ability6))
            {
                var energyRequired = ComboMenu.GetIntSlider("combo.useR.minEnergyBars") * 25;
                if (energyRequired <= LucieHero.Energized.Energy)
                {
                    var safeRange = ComboMenu.GetSlider("combo.useR.safeRange");

                    if (LucieHero.EnemiesAroundAlive(safeRange) > 0)
                    {
                        var priorityMode = ComboMenu.GetComboBox("combo.useR.direction");
                        var bestPosition = MathUtils.GetBestJumpPosition(priorityMode, 46, RRange);

                        LocalPlayer.PressAbility(AbilitySlot.Ability6, true);
                        LocalPlayer.EditAimPosition = true;
                        LocalPlayer.Aim(bestPosition);
                        return;
                    }
                }
            }

            if (ComboMenu.GetBoolean("combo.useF") && MiscUtils.CanCast(AbilitySlot.Ability7))
            {
                if (LastAbilityFired == null && targetF != null && !targetF.HasBuff("Panic"))
                {
                    LocalPlayer.PressAbility(AbilitySlot.Ability7, true);
                    return;
                }
            }

            if (ComboMenu.GetBoolean("combo.useEX2") && MiscUtils.CanCast(AbilitySlot.EXAbility2))
            {
                var energyRequired = ComboMenu.GetIntSlider("combo.useEX2.minEnergyBars") * 25;
                if (energyRequired <= LucieHero.Energized.Energy)
                {
                    if (LastAbilityFired == null && targetEX2 != null)
                    {
                        var pred = TestPrediction.GetNormalLinePrediction(MyPos, targetEX2, EX2Range, EX2Speed, EX2Radius, true);
                        if (pred.CanHit)
                        {
                            LocalPlayer.PressAbility(AbilitySlot.EXAbility2, true);
                            return;
                        }
                    }
                }
            }

            if (ComboMenu.GetBoolean("combo.useEX1") && MiscUtils.CanCast(AbilitySlot.EXAbility1))
            {
                var energyRequired = ComboMenu.GetIntSlider("combo.useEX1.minEnergyBars") * 25;
                if (energyRequired <= LucieHero.Energized.Energy)
                {
                    if (LastAbilityFired == null && targetEX1 != null)
                    {
                        var pred = TestPrediction.GetNormalLinePrediction(MyPos, targetEX1, EX1Range, EX1Speed, EX1Radius, true);
                        if (pred.CanHit)
                        {
                            LocalPlayer.PressAbility(AbilitySlot.EXAbility1, true);
                            return;
                        }
                    }
                }
            }

            if (ComboMenu.GetBoolean("combo.useE") && MiscUtils.CanCast(AbilitySlot.Ability5))
            {
                if (LastAbilityFired == null && targetE != null && !targetE.HasBuff("CripplingGooSlow"))
                {
                    var pred = TestPrediction.GetNormalLinePrediction(MyPos, targetE, ERange, ESpeed, ERadius, true);
                    if (pred.CanHit)
                    {
                        LocalPlayer.PressAbility(AbilitySlot.Ability5, true);
                        return;
                    }
                }
            }

            if (ComboMenu.GetBoolean("combo.useQ") && MiscUtils.CanCast(AbilitySlot.Ability4))
            {
                if (LastAbilityFired == null && targetQ != null)
                {
                    var pred = TestPrediction.GetPrediction(MyPos, targetQ, QRange, 0f, QRadius, QAirTime);
                    if (pred.CanHit)
                    {
                        LocalPlayer.PressAbility(AbilitySlot.Ability4, true);
                        LocalPlayer.EditAimPosition = true;
                        LocalPlayer.Aim(pred.CastPosition);
                        return;
                    }
                }
            }

            if (ComboMenu.GetBoolean("combo.useM1") && MiscUtils.CanCast(AbilitySlot.Ability1))
            {
                if (LastAbilityFired == null && targetM1 != null)
                {
                    var pred = TestPrediction.GetNormalLinePrediction(MyPos, targetM1, M1Range, M1Speed, M1Radius, true);
                    if (pred.CanHit)
                    {
                        LocalPlayer.PressAbility(AbilitySlot.Ability1, true);
                        return;
                    }
                }
            }
        }
Esempio n. 19
0
        private static void ComboMode()
        {
            var targetModeKey = KeysMenu.GetKeybind("keys.changeTargeting");
            var targetMode    = targetModeKey ? TargetingMode.LowestHealth : TargetingMode.NearMouse;

            var M1TargetZander = TargetSelector.GetTarget(targetMode, M1Range);
            var M1TargetSpace  = SpaceClone == null ? null : TargetSelector.GetTarget(targetMode, M1Range, SpaceClone.Get <MapGameObject>().Position);
            var M1TargetEX2    = EX2Clone == null ? null : TargetSelector.GetTarget(targetMode, M1Range, EX2Clone.Get <MapGameObject>().Position);
            var M1TargetUlti   = UltiClone == null ? null : TargetSelector.GetTarget(targetMode, M1Range, UltiClone.Get <MapGameObject>().Position);

            var M2TargetZander = TargetSelector.GetTarget(targetMode, M2Range);
            var M2TargetUlti   = UltiClone == null ? null : TargetSelector.GetTarget(targetMode, M2Range, UltiClone.Get <MapGameObject>().Position);

            var ETarget = EntitiesManager.EnemyTeam
                          .Where(x => x.IsValid && !x.Living.IsDead && (x.AbilitySystem.IsCasting || x.IsChanneling) && !x.IsCountering && x.Distance(ZanderHero) < ERange)
                          .OrderBy(x => x.Distance(ZanderHero))
                          .FirstOrDefault();

            var isCastingOrChanneling = ZanderHero.AbilitySystem.IsCasting || ZanderHero.IsChanneling;

            if (isCastingOrChanneling && LastAbilityFired == null)
            {
                LastAbilityFired = CastingIndexToSlot(ZanderHero.AbilitySystem.CastingAbilityIndex);
            }

            var myPos = ZanderHero.MapObject.Position;

            if (isCastingOrChanneling)
            {
                LocalPlayer.EditAimPosition = true;
                switch (LastAbilityFired)
                {
                case AbilitySlot.Ability4:
                    if (!IsQRecast)
                    {
                        LocalPlayer.Aim(UltiClone.Get <MapGameObject>().Position);
                    }
                    else
                    {
                        if (M2TargetZander != null)
                        {
                            LocalPlayer.Aim(M2TargetZander.MapObject.Position);
                        }
                        else
                        {
                            LocalPlayer.Aim(ZanderHero.MapObject.Position);
                        }
                    }
                    break;

                case AbilitySlot.Ability5:
                    if (ETarget != null)
                    {
                        var pred = TestPrediction.GetPrediction(myPos, ETarget, ERange, 0f, ERadius, EAirTime);
                        if (pred.CanHit)
                        {
                            LocalPlayer.Aim(pred.CastPosition);
                        }
                    }
                    else
                    {
                        LocalPlayer.PressAbility(AbilitySlot.Interrupt, true);
                    }
                    break;

                case AbilitySlot.Ability7:
                    if (M2TargetZander != null)
                    {
                        LocalPlayer.Aim(M2TargetZander.MapObject.Position);
                    }
                    break;

                case AbilitySlot.EXAbility2:
                    if (M1TargetZander != null)
                    {
                        LocalPlayer.Aim(M1TargetZander.MapObject.Position);
                    }
                    break;

                case AbilitySlot.Ability2:
                    if (M2TargetZander != null && !M2TargetZander.IsCountering && !M2TargetZander.HasShield())
                    {
                        var pred = TestPrediction.GetNormalLinePrediction(myPos, M2TargetZander, M2Range, M2Speed, M2Radius, true);
                        if (pred.CollisionResult.IsColliding && UltiClone == null)
                        {
                            LocalPlayer.PressAbility(AbilitySlot.Interrupt, true);
                        }
                        if (pred.CanHit)
                        {
                            LocalPlayer.Aim(pred.CastPosition);
                        }
                    }
                    else if (M2TargetUlti != null)
                    {
                        var pred = TestPrediction.GetNormalLinePrediction(UltiClone.Get <MapGameObject>().Position, M2TargetUlti, M2Range, M2Speed, M2Radius, true);
                        if (pred.CanHit)
                        {
                            LocalPlayer.Aim(pred.CastPosition);
                        }
                    }
                    break;

                case AbilitySlot.Ability1:
                    if (M1TargetUlti != null && !M1TargetUlti.IsCountering && !M1TargetUlti.HasShield())
                    {
                        var pred = TestPrediction.GetNormalLinePrediction(UltiClone.Get <MapGameObject>().Position, M1TargetUlti, M1Range, M1Speed, M1Radius, true);
                        if (pred.CanHit)
                        {
                            LocalPlayer.Aim(pred.CastPosition);
                        }
                    }
                    else if (M1TargetZander != null && !M1TargetZander.IsCountering && !M1TargetZander.HasShield())
                    {
                        var pred = TestPrediction.GetNormalLinePrediction(myPos, M1TargetZander, M1Range, M1Speed, M1Radius, true);
                        if (pred.CanHit)
                        {
                            LocalPlayer.Aim(pred.CastPosition);
                        }
                    }
                    else if (M1TargetEX2 != null && !M1TargetEX2.IsCountering && !M1TargetEX2.HasShield())
                    {
                        var pred = TestPrediction.GetNormalLinePrediction(EX2Clone.Get <MapGameObject>().Position, M1TargetEX2, M1Range, M1Speed, M1Radius, true);
                        if (pred.CanHit)
                        {
                            LocalPlayer.Aim(pred.CastPosition);
                        }
                    }
                    else if (M1TargetSpace != null && !M1TargetSpace.IsCountering && !M1TargetSpace.HasShield())
                    {
                        var pred = TestPrediction.GetNormalLinePrediction(SpaceClone.Get <MapGameObject>().Position, M1TargetSpace, M1Range, M1Speed, M1Radius, true);
                        if (pred.CanHit)
                        {
                            LocalPlayer.Aim(pred.CastPosition);
                        }
                    }
                    break;
                }
            }
            else
            {
                LocalPlayer.EditAimPosition = false;
                LastAbilityFired            = null;
            }

            if (LastAbilityFired == null && ComboMenu.GetBoolean("combo.useQ") && MiscUtils.CanCast(AbilitySlot.Ability4))
            {
                if (LocalPlayer.GetAbilityHudData(AbilitySlot.Ability4).Name.Equals("PortalRecastAbility"))
                {
                    Buff portalBuff;

                    if (MiscUtils.CanCast(AbilitySlot.Ability2))
                    {
                        IsQRecast = true;
                        LocalPlayer.PressAbility(AbilitySlot.Ability4, true);
                        LocalPlayer.EditAimPosition = true;
                        if (M2TargetZander != null)
                        {
                            LocalPlayer.Aim(M2TargetZander.MapObject.Position);
                        }
                        else
                        {
                            LocalPlayer.Aim(ZanderHero.MapObject.Position);
                        }
                    }
                    else if (ZanderHero.HasBuff("PortalRecastBuff", out portalBuff))
                    {
                        if (portalBuff.TimeToExpire <= 1.0f)
                        {
                            IsQRecast = true;
                            LocalPlayer.PressAbility(AbilitySlot.Ability4, true);
                            LocalPlayer.EditAimPosition = true;
                            if (M2TargetZander != null)
                            {
                                LocalPlayer.Aim(M2TargetZander.MapObject.Position);
                            }
                            else
                            {
                                LocalPlayer.Aim(ZanderHero.MapObject.Position);
                            }
                        }
                    }
                }
                else
                {
                    if (UltiClone != null && !MiscUtils.CanCast(AbilitySlot.Ability2))
                    {
                        IsQRecast = false;
                        LocalPlayer.PressAbility(AbilitySlot.Ability4, true);
                        LocalPlayer.EditAimPosition = true;
                        LocalPlayer.Aim(UltiClone.Get <MapGameObject>().Position);
                    }
                }
            }

            if (ComboMenu.GetBoolean("combo.useE") && MiscUtils.CanCast(AbilitySlot.Ability5))
            {
                if (LastAbilityFired == null && ETarget != null)
                {
                    var pred = TestPrediction.GetPrediction(myPos, ETarget, ERange, 0f, ERadius, EAirTime);
                    if (pred.CanHit)
                    {
                        LocalPlayer.PressAbility(AbilitySlot.Ability5, true);
                    }
                }
            }

            if (ComboMenu.GetBoolean("combo.useM2") && MiscUtils.CanCast(AbilitySlot.Ability2))
            {
                if (LastAbilityFired == null)
                {
                    if (M2TargetZander != null && !M2TargetZander.IsCountering && !M2TargetZander.HasShield())
                    {
                        if (ComboMenu.GetBoolean("combo.useF") && MiscUtils.CanCast(AbilitySlot.Ability7))
                        {
                            LocalPlayer.PressAbility(AbilitySlot.Ability7, true);
                        }
                        else
                        {
                            var pred = TestPrediction.GetNormalLinePrediction(myPos, M2TargetZander, M2Range, M2Speed, M2Radius, true);
                            if (pred.CanHit)
                            {
                                LocalPlayer.PressAbility(AbilitySlot.Ability2, true);
                            }
                        }
                    }
                    else if (M2TargetUlti != null && !M2TargetUlti.IsCountering && !M2TargetUlti.HasShield())
                    {
                        var pred = TestPrediction.GetNormalLinePrediction(UltiClone.Get <MapGameObject>().Position, M2TargetUlti, M2Range, M2Speed, M2Radius, true);
                        if (pred.CanHit)
                        {
                            LocalPlayer.PressAbility(AbilitySlot.Ability2, true);
                        }
                    }
                }
            }

            if (ComboMenu.GetBoolean("combo.useEX2") && MiscUtils.CanCast(AbilitySlot.EXAbility2))
            {
                var energyRequired = ComboMenu.GetIntSlider("combo.useEX2.minEnergyBars") * 25;
                if (energyRequired <= ZanderHero.Energized.Energy)
                {
                    if (LastAbilityFired == null && M1TargetZander != null)
                    {
                        LocalPlayer.PressAbility(AbilitySlot.EXAbility2, true);
                    }
                }
            }

            if (ComboMenu.GetBoolean("combo.useM1") && MiscUtils.CanCast(AbilitySlot.Ability1))
            {
                if (LastAbilityFired == null)
                {
                    if (M1TargetUlti != null && !M1TargetUlti.IsCountering && !M1TargetUlti.HasShield())
                    {
                        var pred = TestPrediction.GetNormalLinePrediction(UltiClone.Get <MapGameObject>().Position, M1TargetUlti, M1Range, M1Speed, M1Radius, true);
                        if (pred.CanHit)
                        {
                            LocalPlayer.PressAbility(AbilitySlot.Ability1, true);
                        }
                    }
                    else if (M1TargetZander != null && !M1TargetZander.IsCountering && !M1TargetZander.HasShield())
                    {
                        var pred = TestPrediction.GetNormalLinePrediction(myPos, M1TargetZander, M1Range, M1Speed, M1Radius, true);
                        if (pred.CanHit)
                        {
                            LocalPlayer.PressAbility(AbilitySlot.Ability1, true);
                        }
                    }
                    else if (M1TargetEX2 != null && !M1TargetEX2.IsCountering && !M1TargetEX2.HasShield())
                    {
                        var pred = TestPrediction.GetNormalLinePrediction(EX2Clone.Get <MapGameObject>().Position, M1TargetEX2, M1Range, M1Speed, M1Radius, true);
                        if (pred.CanHit)
                        {
                            LocalPlayer.PressAbility(AbilitySlot.Ability1, true);
                        }
                    }
                    else if (M1TargetSpace != null && !M1TargetSpace.IsCountering && !M1TargetSpace.HasShield())
                    {
                        var pred = TestPrediction.GetNormalLinePrediction(SpaceClone.Get <MapGameObject>().Position, M1TargetSpace, M1Range, M1Speed, M1Radius, true);
                        if (pred.CanHit)
                        {
                            LocalPlayer.PressAbility(AbilitySlot.Ability1, true);
                        }
                    }
                }
            }
        }
Esempio n. 20
0
        internal static void Update()
        {
            var invisibleTargets = ComboMenu.GetBoolean("invisible");
            var interruptCast    = ComboMenu.GetBoolean("interrupt");
            //TODO Bubble detection
            var enemiesBase = Utilities.EnemiesBase;
            var enemiesProj = enemiesBase.Where(x => !x.HasProjectileBlocker());

            if (!invisibleTargets)
            {
                enemiesBase = enemiesBase.Where(x => !x.CharacterModel.IsModelInvisible);
                enemiesProj = enemiesProj.Where(x => !x.CharacterModel.IsModelInvisible);
            }

            var TargetM1      = TargetSelector.GetTarget(enemiesProj, TargetMode, AH.M1.Range);
            var TargetM2      = TargetSelector.GetTarget(enemiesProj, TargetMode, AH.M2.Range);
            var TargetQNormal = TargetSelector.GetTarget(enemiesBase, TargetMode, AH.Q.Range);
            var TargetENear   = TargetSelector.GetTarget(enemiesProj, TargetMode, ComboMenu.GetSlider("useE.near.safeRange"));
            var TargetR       = TargetSelector.GetTarget(enemiesBase, TargetMode, AH.M1.Range);
            var TargetF       = TargetSelector.GetTarget(enemiesBase, TargetMode, AH.F.Range);

            var hero  = Utilities.Hero;
            var myPos = hero.MapObject.Position;

            Drawing.DrawCircle(myPos, 1f, UnityEngine.Color.green);

            if (TargetM1 != null)
            {
                var targetPos = TargetM1.MapObject.Position;
                var rPos      = myPos.Extend(targetPos, 1f);
                Drawing.DrawCircle(rPos, 1f, UnityEngine.Color.magenta);
            }

            #region Aiming
            if (IsCasting)
            {
                LocalPlayer.EditAimPosition = true;

                switch (LastAbility)
                {
                case AbilitySlot.Ability7:
                    if (TargetF != null)
                    {
                        var pred = AH.F.GetPrediction(TargetF, false, myPos);
                        if (pred.CanHit)
                        {
                            LocalPlayer.Aim(pred.CastPosition);
                        }
                        else
                        {
                            LocalPlayer.Aim(InputManager.MousePosition.ScreenToWorld());
                        }
                    }
                    else
                    {
                        LocalPlayer.Aim(InputManager.MousePosition.ScreenToWorld());
                    }

                    break;

                case AbilitySlot.EXAbility1:
                case AbilitySlot.Ability3:
                    var bestPos = MathUtils.GetBestJumpPosition(0, 40, AH.Space.Range);
                    LocalPlayer.Aim(bestPos);
                    break;

                case AbilitySlot.EXAbility2:
                    //Not Aimed
                    break;

                case AbilitySlot.Ability6:
                    if (TargetM1 != null)
                    {
                        var targetPos = TargetM1.MapObject.Position;
                        var wallPos   = myPos.Extend(targetPos, 1f);
                        LocalPlayer.Aim(wallPos);
                    }
                    break;

                case AbilitySlot.Ability5:
                    if (IsCondemning)
                    {
                        LocalPlayer.Aim(CondemnPos);
                    }
                    else if (TargetENear != null)
                    {
                        var pred = AH.E.GetPrediction(TargetENear, true, myPos, Utilities.TrueERange);
                        if (pred.CanHit)
                        {
                            LocalPlayer.Aim(pred.CastPosition);
                        }
                    }

                    break;

                case AbilitySlot.Ability4:
                    if (IsChainingCC)
                    {
                        LocalPlayer.Aim(ChainCCPos);
                    }
                    else if (TargetQNormal != null)
                    {
                        var pred = AH.Q.GetPrediction(TargetQNormal, false, myPos);
                        if (pred.CanHit)
                        {
                            LocalPlayer.Aim(pred.CastPosition);
                        }
                        else
                        {
                            AH.Interrupt.Cast();
                        }
                    }
                    else
                    {
                        AH.Interrupt.Cast();
                    }

                    break;

                case AbilitySlot.Ability2:
                    if (TargetM2 != null)
                    {
                        var pred = AH.M2.GetPrediction(TargetM2, true, myPos);
                        if (pred.CanHit)
                        {
                            LocalPlayer.Aim(pred.CastPosition);
                        }
                        else
                        {
                            if (interruptCast)
                            {
                                AH.Interrupt.Cast();
                            }
                        }
                    }
                    else
                    {
                        if (interruptCast)
                        {
                            AH.Interrupt.Cast();
                        }
                    }

                    break;

                case AbilitySlot.Ability1:
                    if (TargetM1 != null)
                    {
                        var pred = AH.M1.GetPrediction(TargetM1, true, myPos);
                        if (pred.CanHit)
                        {
                            LocalPlayer.Aim(pred.CastPosition);
                        }
                        else
                        {
                            if (interruptCast)
                            {
                                AH.Interrupt.Cast();
                            }
                        }
                    }
                    else
                    {
                        if (interruptCast)
                        {
                            AH.Interrupt.Cast();
                        }
                    }

                    break;
                }
            }
            else
            {
                IsChainingCC = false;
                IsCondemning = false;
                LocalPlayer.EditAimPosition = false;
                LastAbility = null;
            }
            #endregion

            #region Casting
            if (LastAbility == null && !IsCasting && !hero.IsDashing && !hero.IsTraveling)
            {
                var priorityM1 = ComboMenu.GetBoolean("useM1.priority");

                if (ComboMenu.GetBoolean("useF") && AH.F.IsReady && TargetF != null)
                {
                    var pred = AH.F.GetPrediction(TargetF, false, myPos);
                    if (pred.CanHit)
                    {
                        AH.F.Cast();
                        return;
                    }
                }

                if (ComboMenu.GetBoolean("useEX1") && AH.EX1.IsReady)
                {
                    if (hero.EnemiesAroundAlive(JumpSafeRange) > 0)
                    {
                        var minHP     = ComboMenu.GetSlider("useEX1.minHP");
                        var energyReq = ComboMenu.GetIntSlider("useEX1.energy") * 25;
                        if (hero.Living.HealthPercent <= minHP &&
                            hero.Energized.Energy >= energyReq)
                        {
                            AH.EX1.Cast();
                            return;
                        }
                    }
                }

                if (ComboMenu.GetBoolean("useSpace") && AH.Space.IsReady)
                {
                    if (hero.EnemiesAroundAlive(JumpSafeRange) > 0)
                    {
                        AH.Space.Cast();
                        return;
                    }
                }

                if (AH.EX2.IsReady)
                {
                    var energyReq = ComboMenu.GetIntSlider("useEX2.energy") * 25;
                    if (hero.Energized.Energy >= energyReq)
                    {
                        if (ComboMenu.GetBoolean("useEX2.enemies"))
                        {
                            var count = ComboMenu.GetIntSlider("useEX2.enemies.count");
                            if (hero.EnemiesAroundAlive(AH.EX2.Range) >= count)
                            {
                                AH.EX2.Cast();
                                return;
                            }
                        }

                        if (ComboMenu.GetBoolean("useEX2.panic"))
                        {
                            var minHP = ComboMenu.GetSlider("useEX2.panic.minHP");
                            if (hero.EnemiesAroundAlive(AH.EX2.Range) > 0 &&
                                hero.Living.HealthPercent <= minHP)
                            {
                                AH.EX2.Cast();
                                return;
                            }
                        }
                    }
                }

                //if (ComboMenu.GetBoolean("useR.harass") && AH.R.IsReady && AH.M1.IsReady && TargetM1 != null
                //    && BM.HasConflagration)
                //{
                //    var energyReq = ComboMenu.GetIntSlider("useR.harass.energy") * 25;
                //    if (hero.Energized.Energy >= energyReq)
                //    {
                //        var pred = AH.M1.GetPrediction(TargetM1, true, myPos);
                //        if (pred.CanHit)
                //        {
                //            AH.R.Cast();
                //            return;
                //        }
                //    }
                //}

                if (AH.E.IsReady)
                {
                    var trueERange = Utilities.TrueERange;

                    if (ComboMenu.GetBoolean("useE.condemn") && BM.HasKnockout)
                    {
                        var enemies = enemiesBase
                                      .Where(x => !x.IsCountering)
                                      .OrderBy(x => x.MapObject.ScreenPosition.Distance(InputManager.MousePosition));

                        foreach (var enemy in enemies)
                        {
                            if (enemy.Distance(hero) > trueERange)
                            {
                                continue;
                            }

                            var pred = AH.E.GetPrediction(enemy, true, myPos, trueERange);
                            if (pred.CanHit)
                            {
                                var direction   = pred.CastPosition - myPos;
                                var distance    = pred.CastPosition.Distance(myPos);
                                var extendedPos = (direction.Normalized * (distance + 4.5f)) + myPos;
                                Drawing.DrawCircle(extendedPos, 1f, UnityEngine.Color.red);
                                var col = CollisionSolver.CheckLineCollision(pred.CastPosition, extendedPos);
                                if (col.IsColliding)
                                {
                                    IsCondemning = true;
                                    CondemnPos   = pred.CastPosition;
                                    AH.E.Cast();
                                    return;
                                }
                            }
                        }
                    }

                    if (ComboMenu.GetBoolean("useE.near") && TargetENear != null)
                    {
                        var pred = AH.E.GetPrediction(TargetENear, true, myPos, trueERange);
                        if (pred.CanHit)
                        {
                            AH.E.Cast();
                            return;
                        }
                    }
                }

                if (!(priorityM1 && HasEnhancedM1))
                {
                    if (AH.Q.IsReady)
                    {
                        if (ComboMenu.GetBoolean("useQ"))
                        {
                            if (!ComboMenu.GetBoolean("useQ.chainCC") && TargetQNormal != null)
                            {
                                var pred = AH.Q.GetPrediction(TargetQNormal, false, myPos);
                                if (pred.CanHit)
                                {
                                    AH.Q.Cast();
                                    return;
                                }
                            }
                            else if (ComboMenu.GetBoolean("useQ.chainCC"))
                            {
                                var enemies = enemiesBase;
                                foreach (var enemy in enemies)
                                {
                                    if (enemy.Distance(hero) <= AH.Q.Range &&
                                        enemy.HasHardCC() &&
                                        enemy.CCTotalDuration >= 1.5f)
                                    {
                                        IsChainingCC = true;
                                        ChainCCPos   = enemy.MapObject.Position;
                                        AH.Q.Cast();
                                        return;
                                    }
                                }
                            }
                        }
                    }


                    if (ComboMenu.GetBoolean("useM2") && AH.M2.IsReady && TargetM2 != null)
                    {
                        var safeRange = ComboMenu.GetSlider("useM2.safeRange");
                        if (hero.EnemiesAroundAlive(safeRange) == 0)
                        {
                            var pred = AH.M2.GetPrediction(TargetM2, true, myPos);
                            if (pred.CanHit)
                            {
                                AH.M2.Cast();
                                return;
                            }
                        }
                    }
                }

                if (ComboMenu.GetBoolean("useM1") && AH.M1.IsReady && TargetM1 != null)
                {
                    var pred = AH.M1.GetPrediction(TargetM1, true, myPos);
                    if (pred.CanHit)
                    {
                        AH.M1.Cast();
                        return;
                    }
                }
            }
            #endregion
        }