private bool CanSunStrikeHitWithPrediction(Hero target) { if (!target.IsRotating() && target.IsMoving) { var num1 = target.MovementSpeed * 1.75f + Game.Ping / 1000f; var position = target.InFront(num1); var num2 = 0; while (num2 < (double)num1) { num2 += 64; _config.Main.NavMeshHelper.Pathfinding.GetCellPosition(target.InFront(num2), out var cellX, out var cellY); var flag = _config.Main.NavMeshHelper.Pathfinding.GetCell(cellX, cellY).NavMeshCellFlags; if (CheckForFlags(flag)) { continue; } FlushTiming(target); return(false); } if (!CheckForTiming(target)) { return(false); } CameraAction(position); SunStrike.UseAbility(position); FlushTiming(target); return(true); } FlushTiming(target); return(false); }
private void SunStrikeAction() { if (_config.ComboKey) { return; } if (!Me.IsAlive || Me.IsSilenced()) { return; } var allEnemies = EntityManager <Hero> .Entities.Where(x => x.IsValid && x.IsEnemy(Me) && !x.IsIllusion); var enumerable = allEnemies as Hero[] ?? allEnemies.ToArray(); if (!SunStrike.CanBeCasted) { foreach (var enemy in enumerable) { if (UpdateDamage(enemy, out _) && Notification && enemy.IsAlive) { _config.Main.NotificationHelper.Notificate(enemy, AbilityId.invoker_sun_strike, 0f); } else { _config.Main.NotificationHelper.Deactivate(enemy); } if (!SunStrike.CanBeCasted) { ParitecleManager.Remove($"AutoSunStikePrediction{enemy.Handle}"); } return; } } if (!SunStrike.IsInvoked) { if (!InvokeSunStike) { return; } } if (Me.IsInvisible()) { return; } //var ssDamage = SunStrike.GetDamage(); foreach (var enemy in enumerable) { var isAlive = enemy.IsAlive; if (!isAlive || !enemy.IsVisible) { FlushTiming(enemy); if (!isAlive) { _config.Main.NotificationHelper.Deactivate(enemy); } ParitecleManager.Remove($"AutoSunStikePrediction{enemy.Handle}"); continue; } if (UpdateDamage(enemy, out var heroWillDie) || !KillStealOnly) { if (Notification && heroWillDie) { _config.Main.NotificationHelper.Notificate(enemy, AbilityId.invoker_sun_strike, 0f); } var stunned = UnitExtensions.IsStunned(enemy, out var stunDuration); var immobile = stunDuration >= 1.5f; //_config.Main.AbilitiesInCombo.SunStrike.ActivationDelay; var invulModifier = enemy.GetModifierByName("modifier_eul_cyclone") ?? enemy.GetModifierByName(_config.Main.AbilitiesInCombo.Tornado.TargetModifierName) ?? enemy.GetModifierByName("modifier_brewmaster_storm_cyclone") ?? enemy.GetModifierByName("modifier_shadow_demon_disruption") ?? enemy.GetModifierByName("modifier_obsidian_destroyer_astral_imprisonment_prison"); PredictionInput input = null; PredictionOutput output = null; if (DrawPrediction && (heroWillDie || !DrawPredictionKillSteal)) { input = SunStrike.GetPredictionInput(enemy); output = SunStrike.GetPredictionOutput(input); ParitecleManager.DrawTargetLine(enemy, $"AutoSunStikePrediction{enemy.Handle}", output.UnitPosition, CanSunStikerHit(enemy) ? Color.AliceBlue : Color.Red); } else { ParitecleManager.Remove($"AutoSunStikePrediction{enemy.Handle}"); } if (enemy.HasModifier(_config.Main.AbilitiesInCombo.ColdSnap.TargetModifierName) && !enemy.HasModifier(_config.Main.AbilitiesInCombo.Tornado.TargetModifierName)) { continue; } if ((enemy.UnitState & UnitState.Stunned) == 0 && invulModifier == null) { if (UseOnlyOnStunnedEnemies) { continue; } } if (invulModifier != null) { if (invulModifier.RemainingTime <= 1.7f + Game.Ping * 0.75f / 1000f && invulModifier.RemainingTime >= 1.0f) { InvokerCrappahilationPaid.Log.Warn( $"[AutoSunStrike] use on invul modifiers [{enemy.HeroId}] (mod RemTime: {invulModifier.RemainingTime}ms + ping: {Game.Ping * 0.75f}ms) total: {1.7f + Game.Ping * 0.75f / 1000f}"); CameraAction(enemy.NetworkPosition); SunStrike.UseAbility(enemy.NetworkPosition); } } else { if (input == null) { input = SunStrike.GetPredictionInput(enemy); output = SunStrike.GetPredictionOutput(input); } if (output.HitChance == HitChance.High || output.HitChance == HitChance.VeryHigh || output.HitChance == HitChance.Medium || immobile && output.HitChance == HitChance.Immobile) { if ((enemy.UnitState & UnitState.Stunned) != 0) { if (stunDuration >= 1.5f) { InvokerCrappahilationPaid.Log.Warn( $"[AutoSunStrike] use on stunned enemy [{enemy.HeroId}] (left {stunDuration}ms) HitChance: {output.HitChance}"); CameraAction(enemy.NetworkPosition); SunStrike.UseAbility(enemy.NetworkPosition); } else { InvokerCrappahilationPaid.Log.Warn( $"[AutoSunStrike] DONT use on stunned enemy [{enemy.HeroId}] (left {stunDuration}ms) HitChance: {output.HitChance}"); } } else if (heroWillDie && CanSunStrikeHitWithPrediction(enemy)) { InvokerCrappahilationPaid.Log.Warn( $"[AutoSunStrike] use cuz killSteal on predicted position [{enemy.HeroId}] HitChance: {output.HitChance}"); } } } } else { _config.Main.NotificationHelper.Deactivate(enemy); ParitecleManager.Remove($"AutoSunStikePrediction{enemy.Handle}"); } } }