Example #1
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);
                        }
                    }
                }
            }
        }
Example #2
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);
                }
            }
        }
Example #3
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);
                            }
                        }
                    }
                }
            }
        }
Example #4
0
 public TestOutput GetPrediction(InGameObject target, bool checkCollision, Vector2 fromPos, float overrideRange = 0f)
 {
     if (Speed >= float.Epsilon)
     {
         return(TestPrediction.GetNormalLinePrediction(fromPos, target, overrideRange >= float.Epsilon ? overrideRange : Range, Speed, Radius, checkCollision));
     }
     else
     {
         //I should seriously wrap this into a GetFixedDelayPrediction. So TODO for later.
         return(TestPrediction.GetPrediction(fromPos, target, overrideRange >= float.Epsilon ? overrideRange : Range, 0f, Radius, FixedDelay, 1.75f, checkCollision));
     }
 }
Example #5
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);
                    }
                }
            }
        }
Example #6
0
        private static Output TestPred(Character target, SkillBase spell)
        {
            if (spell.SkillType == SkillType.Line)
            {
                var output = TestPrediction.GetPrediction(LocalPlayer.Instance.Pos(), target, spell.Range, spell.Speed, spell.SpellCollisionRadius,
                                                          spell.FixedDelay, 1.75f, true, IgnoreFlags);
                if (UseClosestPointOnLine)
                {
                    output.CastPosition = GeometryLib.NearestPointOnFiniteLine(LocalPlayer.Instance.Pos().Extend(output.CastPosition, 0.6f),
                                                                               output.CastPosition, Main.MouseWorldPos);
                }
                return(output);
            }

            return(TestPrediction.GetPrediction(LocalPlayer.Instance.Pos(), target, spell.Range, spell.Speed, spell.SpellCollisionRadius,
                                                spell.FixedDelay));
        }
Example #7
0
        public void OnDraw(EventArgs args)
        {
            if (!Game.IsInGame)
            {
                return;
            }

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

            if (ArenaMovingDummy != null)
            {
                if (ProjSpeed > float.Epsilon)
                {
                    var predProj = TestPrediction.GetPrediction(EntitiesManager.LocalPlayer.MapObject.Position, ArenaMovingDummy, float.MaxValue, ProjSpeed, 0, 0, 2f, true);

                    if (predProj.CanHit)
                    {
                        Drawing.DrawCircle(predProj.CastPosition, 1f, UnityEngine.Color.red);
                    }

                    Drawing.DrawString(ArenaMovingDummy.MapObject.Position, predProj.HitchancePercentage.ToString() + " - " + Enum.GetName(typeof(TestHitchance), predProj.Hitchance), UnityEngine.Color.cyan);
                }

                if (AirTimeProj > float.Epsilon)
                {
                    var predAir = TestPrediction.GetPrediction(EntitiesManager.LocalPlayer.MapObject.Position, ArenaMovingDummy, float.MaxValue, 0f, 0f, AirTimeProj, 2f, true);

                    if (predAir.CanHit)
                    {
                        Drawing.DrawCircle(predAir.CastPosition, 1.5f, UnityEngine.Color.blue);
                    }

                    Drawing.DrawString(ArenaMovingDummy.MapObject.Position, predAir.HitchancePercentage.ToString() + " - " + Enum.GetName(typeof(TestHitchance), predAir.Hitchance), UnityEngine.Color.white);
                }
            }
        }
Example #8
0
        private void OnDraw(EventArgs args)
        {
            //Drawing.DrawString(new Vector2(1280f / 2f, 1024f / 2f), "Game.IsInGame: " + Game.IsInGame, UnityEngine.Color.white, ViewSpace.ScreenSpacePixels);

            if (!Game.IsInGame)
            {
                return;
            }

            if (JadeHero.Living.IsDead)
            {
                return;
            }

            if (DrawingsMenu.GetBoolean("draw.disableAll"))
            {
                return;
            }

            foreach (var obj in SpecialCircleObjects)
            {
                if (obj.Active)
                {
                    Drawing.DrawCircle(obj.Position, obj.Radius, UnityEngine.Color.green);
                }
            }

            Drawing.DrawString(new Vector2(1920f / 2f, 1080f / 2f - 5f),
                               "Targeting mode: " + (KeysMenu.GetKeybind("keys.changeTargeting") ? "LowestHealth" : "NearMouse"), UnityEngine.Color.yellow, ViewSpace.ScreenSpacePixels);

            if (DrawingsMenu.GetBoolean("draw.rangeM1"))
            {
                Drawing.DrawCircle(JadeHero.MapObject.Position, M1Range, UnityEngine.Color.red);
            }

            if (DrawingsMenu.GetBoolean("draw.rangeM2"))
            {
                Drawing.DrawCircle(JadeHero.MapObject.Position, M2Range, UnityEngine.Color.red);
            }

            if (DrawingsMenu.GetBoolean("draw.rangeM2.safeRange"))
            {
                Drawing.DrawCircle(JadeHero.MapObject.Position, ComboMenu.GetSlider("combo.useM2.safeRange"), UnityEngine.Color.blue);
            }

            if (DrawingsMenu.GetBoolean("draw.rangeSpace"))
            {
                Drawing.DrawCircle(JadeHero.MapObject.Position, TrueSpaceRange, UnityEngine.Color.green);
            }

            if (DrawingsMenu.GetBoolean("draw.rangeSpace.safeRange"))
            {
                Drawing.DrawCircle(JadeHero.MapObject.Position, ComboMenu.GetSlider("combo.useSpace.maxRange"), UnityEngine.Color.blue);
            }

            if (DrawingsMenu.GetBoolean("draw.rangeE"))
            {
                Drawing.DrawCircle(JadeHero.MapObject.Position, TrueERange, UnityEngine.Color.red);
            }

            if (DrawingsMenu.GetBoolean("draw.rangeR"))
            {
                Drawing.DrawCircle(JadeHero.MapObject.Position, RRange, UnityEngine.Color.red);
            }

            if (DrawingsMenu.GetBoolean("draw.rangeF"))
            {
                Drawing.DrawCircle(JadeHero.MapObject.Position, FRange, UnityEngine.Color.magenta);
            }

            if (DrawingsMenu.GetBoolean("draw.rangeF.safeRange"))
            {
                Drawing.DrawCircle(JadeHero.MapObject.Position, ComboMenu.GetSlider("combo.useF.safeRange"), UnityEngine.Color.blue);
            }

            if (DrawingsMenu.GetBoolean("draw.escapeSkillsScreen"))
            {
                var abilitySpace = LocalPlayer.GetAbilityHudData(AbilitySlot.Ability3);
                if (abilitySpace != null)
                {
                    var drawSpacePos      = new Vector2(760f, 1080f - 350f);
                    var abilitySpaceReady = MiscUtils.CanCast(AbilitySlot.Ability3);
                    var textToDrawSpace   = "Space state: " + (abilitySpaceReady ? "Ready" : Math.Round(abilitySpace.CooldownLeft, 2).ToString());
                    Drawing.DrawString(drawSpacePos, textToDrawSpace, abilitySpaceReady ? UnityEngine.Color.cyan : UnityEngine.Color.gray, ViewSpace.ScreenSpacePixels);
                }

                var abilityQ = LocalPlayer.GetAbilityHudData(AbilitySlot.Ability4);
                if (abilityQ != null)
                {
                    var drawQPos      = new Vector2(1920f - 760f, 1080f - 350f);
                    var abilityQReady = MiscUtils.CanCast(AbilitySlot.Ability4);
                    var textToDrawQ   = "Q state: " + (abilityQReady ? "Ready" : Math.Round(abilityQ.CooldownLeft, 2).ToString());
                    Drawing.DrawString(drawQPos, textToDrawQ, abilityQReady ? UnityEngine.Color.cyan : UnityEngine.Color.gray, ViewSpace.ScreenSpacePixels);
                }
            }

            if (DrawingsMenu.GetBoolean("draw.debugTestPred"))
            {
                Drawing.DrawString(JadeHero.MapObject.Position, JadeHero.NetworkMovement.Velocity.ToString(), UnityEngine.Color.cyan);

                var aliveEnemies = EntitiesManager.EnemyTeam.Where(x => !x.Living.IsDead);

                foreach (var enemy in aliveEnemies)
                {
                    Drawing.DrawString(enemy.MapObject.Position, enemy.NetworkMovement.Velocity.ToString(), UnityEngine.Color.green);

                    var testPred = TestPrediction.GetNormalLinePrediction(JadeHero.MapObject.Position, enemy, M2Range, M2Speed, M2Radius);

                    if (testPred.CanHit)
                    {
                        Drawing.DrawCircle(testPred.CastPosition, 1f, UnityEngine.Color.red);
                    }

                    if (testPred.CollisionResult != null ? testPred.CollisionResult.IsColliding : false)
                    {
                        Drawing.DrawCircle(testPred.CollisionResult.CollisionPoint, 1f, UnityEngine.Color.blue);
                    }
                }
            }
        }
Example #9
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;
                        }
                    }
                }
            }
        }
Example #10
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;
                }
            }
        }
Example #11
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;
                    }
                }
            }
        }
Example #12
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);
                        }
                    }
                }
            }
        }
Example #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);
                        }
                    }
                }
            }
        }
Example #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;
                    }
                }
            }
        }