public static GetAttackPoint ( Hero unit ) : double | ||
unit | Hero | /// The unit. /// |
return | double |
public static double GetAttackPoint(Hero unit)
{
if (unit == null)
{
return 0;
}
try
{
var name = unit.StoredName();
double attackAnimationPoint;
if (!AttackPointDictionary.TryGetValue(unit.Handle, out attackAnimationPoint))
{
attackAnimationPoint =
Game.FindKeyValues(name + "/AttackAnimationPoint", KeyValueSource.Hero).FloatValue;
AttackPointDictionary.Add(unit.Handle, attackAnimationPoint);
}
var attackSpeed = GetAttackSpeed(unit);
return attackAnimationPoint / (1 + (attackSpeed - 100) / 100);
}
catch (KeyValuesNotFoundException)
{
if (!Utils.SleepCheck("Ensage.Common.DemoModeWarning"))
{
return 0;
}
Utils.Sleep(10000, "Ensage.Common.DemoModeWarning");
Console.WriteLine(@"[[Please do not use demo mode for testing assemblies]]");
return 0;
}
}
UnitDatabase::GetAttackPoint ( Unit unit ) : double |
/// <summary> /// Checks if attack animation can be safely canceled /// </summary> /// <returns></returns> public static bool CanCancelAnimation(float delay = 0f) { var time = (tick - LastAttackStart); var cancelDur = UnitDatabase.GetAttackPoint(me) * 1000 - Game.Ping + 50 - delay; return(time > cancelDur); }