Skip to content

Commit

Permalink
Revert "Some HealthPrediction tweaks"
Browse files Browse the repository at this point in the history
This reverts commit 941a99b.
  • Loading branch information
Esk0r committed Sep 4, 2015
1 parent 17480cf commit dfa9541
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 27 deletions.
33 changes: 8 additions & 25 deletions HealthPrediction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
{
Expand Down Expand Up @@ -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++;
}
Expand All @@ -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,
Expand Down
7 changes: 5 additions & 2 deletions Orbwalking.cs
Original file line number Diff line number Diff line change
Expand Up @@ -661,7 +661,10 @@ public virtual AttackableUnit GetTarget()
ObjectManager.Get<Obj_AI_Minion>()
.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)
Expand All @@ -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))
Expand Down

0 comments on commit dfa9541

Please sign in to comment.