Exemplo n.º 1
0
        private static float HandleDamageIndicator(Obj_AI_Base unit)
        {
            if (!Settings.Drawings.DrawInfo)
            {
                return(0);
            }

            var enemy = (AIHeroClient)unit;

            if (enemy == null)
            {
                return(0);
            }

            if (MenuManager.IsCacheEnabled && Damages.Exist(unit.NetworkId))
            {
                return(Damages.Get(unit.NetworkId));
            }

            var damage = 0f;

            if (!IsCastingR)
            {
                if (R.IsReady() && unit.IsValidTargetCached(R.Range))
                {
                    damage += GetCurrentShootsRCount == 1
                        ? Damage.GetRDamage(unit, true)
                        : Damage.GetRDamage(unit) * (GetCurrentShootsRCount - 1) + Damage.GetRDamage(unit, true);
                }
                if (Q.IsReady() && unit.IsValidTarget(Q.Range))
                {
                    damage += Damage.GetQDamage(unit);
                }
                if (W.IsReady() && unit.IsValidTarget(W.Range))
                {
                    damage += Damage.GetWDamage(unit);
                }
            }
            else
            {
                if (IsInsideRRange(unit))
                {
                    damage += GetCurrentShootsRCount == 1 ? Damage.GetRDamage(unit, true) : Damage.GetRDamage(unit);
                }
            }

            if (unit.IsValidTargetCached(Player.Instance.GetAutoAttackRange()))
            {
                damage += HasAttackBuff ? Damage.Get4ThShootDamage(unit) : Player.Instance.GetAutoAttackDamage(unit);
            }

            if (MenuManager.IsCacheEnabled)
            {
                Damages.Add(unit.NetworkId, damage);
            }

            return(damage);
        }