From dfa9541a4025f4a58c780fa70807a822dd666f17 Mon Sep 17 00:00:00 2001 From: Esk0r Date: Fri, 4 Sep 2015 23:59:50 +0200 Subject: [PATCH] Revert "Some HealthPrediction tweaks" This reverts commit 941a99b88a7df17c5b666b39033403bd90652fca. --- HealthPrediction.cs | 33 ++++++++------------------------- Orbwalking.cs | 7 +++++-- 2 files changed, 13 insertions(+), 27 deletions(-) diff --git a/HealthPrediction.cs b/HealthPrediction.cs index bc48f64e..4ee3fb0a 100644 --- a/HealthPrediction.cs +++ b/HealthPrediction.cs @@ -42,23 +42,6 @@ static HealthPrediction() Obj_AI_Base.OnProcessSpellCast += ObjAiBaseOnOnProcessSpellCast; Game.OnUpdate += Game_OnGameUpdate; Spellbook.OnStopCast += SpellbookOnStopCast; - MissileClient.OnDelete += MissileClient_OnDelete; - } - - static void MissileClient_OnDelete(GameObject sender, EventArgs args) - { - var missile = sender as MissileClient; - if (missile != null) - { - var casterNetworkId = missile.SpellCaster.NetworkId; - foreach (var activeAttack in ActiveAttacks) - { - if (activeAttack.Key == casterNetworkId) - { - ActiveAttacks[casterNetworkId].StartTick = 0; - } - } - } } private static void Game_OnGameUpdate(EventArgs args) @@ -116,7 +99,7 @@ public static float GetHealthPrediction(Obj_AI_Base unit, int time, int delay = attack.Target.IsValidTarget(float.MaxValue, false) && attack.Target.NetworkId == unit.NetworkId) { var landTime = attack.StartTick + attack.Delay + - 1000 * (unit.Distance(attack.Source) - attack.Source.BoundingRadius) / attack.ProjectileSpeed + delay; + 1000 * unit.Distance(attack.Source) / attack.ProjectileSpeed + delay; if (Utils.GameTimeTickCount < landTime - delay && landTime < Utils.GameTimeTickCount + time) { @@ -150,7 +133,7 @@ public static float LaneClearHealthPrediction(Obj_AI_Base unit, int time, int de while (fromT < toT) { if (fromT >= Utils.GameTimeTickCount && - (fromT + attack.Delay + (unit.Distance(attack.Source) - attack.Source.BoundingRadius) / attack.ProjectileSpeed < toT)) + (fromT + attack.Delay + unit.Distance(attack.Source) / attack.ProjectileSpeed < toT)) { n++; } @@ -172,12 +155,12 @@ private class PredictedDamage { public readonly float AnimationTime; - public float Damage { get; private set; } - public float Delay { get; private set; } - public int ProjectileSpeed { get; private set; } - public Obj_AI_Base Source { get; private set; } - public int StartTick { get; internal set; } - public Obj_AI_Base Target { get; private set; } + public readonly float Damage; + public readonly float Delay; + public readonly int ProjectileSpeed; + public readonly Obj_AI_Base Source; + public readonly int StartTick; + public readonly Obj_AI_Base Target; public PredictedDamage(Obj_AI_Base source, Obj_AI_Base target, diff --git a/Orbwalking.cs b/Orbwalking.cs index 368f36ed..00a5ca79 100644 --- a/Orbwalking.cs +++ b/Orbwalking.cs @@ -661,7 +661,10 @@ public virtual AttackableUnit GetTarget() ObjectManager.Get() .Where( minion => - minion.IsValidTarget() && InAutoAttackRange(minion)) + minion.IsValidTarget() && InAutoAttackRange(minion) && + minion.Health < + 2 * + (ObjectManager.Player.BaseAttackDamage + ObjectManager.Player.FlatPhysicalDamageMod)) .OrderByDescending(minion => minion.CharData.BaseSkinName.Contains("Siege")) .ThenBy(minion => minion.CharData.BaseSkinName.Contains("Super")) .ThenBy(minion => minion.Health) @@ -670,7 +673,7 @@ public virtual AttackableUnit GetTarget() foreach (var minion in MinionList) { var t = (int)(Player.AttackCastDelay * 1000) - 100 + Game.Ping / 2 + - 1000 * (int) Math.Max(0, Player.Distance(minion) - Player.BoundingRadius) / (int)GetMyProjectileSpeed(); + 1000 * (int)Player.Distance(minion) / (int)GetMyProjectileSpeed(); var predHealth = HealthPrediction.GetHealthPrediction(minion, t, FarmDelay); if (minion.Team != GameObjectTeam.Neutral && MinionManager.IsMinion(minion, true))