Exemplo n.º 1
0
        /// <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);
        }
Exemplo n.º 2
0
        /// <summary>
        ///     Checks if attack is currently on cooldown
        /// </summary>
        /// <param name="target"></param>
        /// <param name="bonusWindupMs"></param>
        /// <returns></returns>
        public static bool AttackOnCooldown(Entity target = null, float bonusWindupMs = 0)
        {
            if (me == null)
            {
                return(false);
            }
            var turnTime = 0d;

            if (target != null)
            {
                turnTime = me.GetTurnTime(target);
            }
            //Console.WriteLine(turnTime*1000);
            return((LastAttackStart + UnitDatabase.GetAttackRate(me) * 1000 - Game.Ping - turnTime * 1000 - 75
                    + bonusWindupMs) > tick);
        }
Exemplo n.º 3
0
        /// <summary>
        /// </summary>
        /// <param name="unit"></param>
        /// <returns></returns>
        public static bool IsInBackswingtime(Unit unit)
        {
            if (MaxCount < 1)
            {
                return(false);
            }

            var attackPoint = UnitDatabase.GetAttackPoint(unit);
            //if (attackPoint * 1000 < Game.Ping/2)
            //    return false;
            var data =
                AttackAnimation.FirstOrDefault(
                    unitData => unitData.UnitName == unit.Name || unitData.UnitClassId == unit.ClassID);

            //Console.WriteLine(data);
            return(data != null && data.CanMove);
        }