public static float GetAttackSpeed(Hero unit)
{
try
{
double attackBaseTime;
if (!AttackRateDictionary.TryGetValue(unit.Handle, out attackBaseTime))
{
attackBaseTime =
Game.FindKeyValues(unit.StoredName() + "/AttackRate", KeyValueSource.Hero).FloatValue;
AttackRateDictionary.Add(unit.Handle, attackBaseTime);
}
var attackSpeed = Math.Min(unit.AttackSpeedValue, 600);
if (unit.HasModifier("modifier_ursa_overpower"))
{
attackSpeed = 600;
}
return (float)attackSpeed;
}
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;
}
}