Beispiel #1
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);
                        }
                    }
                }
            }
        }