public int GetAbilityWaitTime(ActiveAbility ability, Hero target) { if (ability.CanBeCasted && ability.CanHit(target) && ability.UseAbility(target)) { int delay; // wait for projectile to hit, so that the amplifier is actually applied for the rest of the combo if (ability is IHasDamageAmplifier && ability.Speed != float.MaxValue) { delay = ability.GetHitTime(target); } else { delay = ability.GetCastDelay(target); } var diff = (int)(50 - Game.Ping); if (diff > 0) { delay += diff; } return(delay); } return(0); }