CalculateMyCurrentDamage() public static method

public static CalculateMyCurrentDamage ( Hero globalTarget, bool checkForRange = false ) : float
globalTarget Hero
checkForRange bool
return float
コード例 #1
0
        public static async void OnUpdate(EventArgs args)
        {
            if (!IsEnable)
            {
                return;
            }
            if (!Members.MyHero.IsAlive)
            {
                return;
            }
            if (_attacker == null)
            {
                _attacker = new Sleeper();
            }
            if (_spellSleeper == null)
            {
                _spellSleeper = new MultiSleeper();
            }
            if (_ethereal == null)
            {
                _ethereal = new Sleeper();
            }
            if (_laser == null)
            {
                _laser = Abilities.FindAbility("tinker_laser");
            }
            if (_rockets == null)
            {
                _rockets = Abilities.FindAbility("tinker_heat_seeking_missile");
            }
            if (_spellSleeper.Sleeping(Abilities.FindAbility("tinker_rearm")))
            {
                return;
            }
            if (_testCombo != null && !_testCombo.IsCompleted)
            {
                return;
            }

            _tks       = new CancellationTokenSource();
            _testCombo = Action(_tks.Token);
            try
            {
                await _testCombo;
                _testCombo = null;
            }
            catch (OperationCanceledException)
            {
                _testCombo = null;
            }
            if (IsEnableKillSteal && !IsComboHero)
            {
                foreach (var x in Heroes.GetByTeam(Members.MyHero.GetEnemyTeam())
                         .Where(x => x.IsAlive && x.IsVisible && !x.IsIllusion() && !x.IsMagicImmune())
                         .Where(x => Helper.CalculateMyCurrentDamage(x, true) < 0))
                {
                    await DoTrash(x, CancellationToken.None, true);
                }
            }
        }
コード例 #2
0
        public static void Drawing_OnDraw(EventArgs args)
        {
            if (!IsEnable)
            {
                return;
            }
            if (_globalTarget != null && _globalTarget.IsValid)
            {
                Helper.HandleEffect(_globalTarget);
            }
            var closeToMouse = Helper.ClosestToMouse(Members.MyHero);

            if (DamageIndex == (int)DamageDrawing.OnlyForGlobalTarget && (closeToMouse == null || !closeToMouse.IsValid))
            {
                return;
            }
            var list = DamageIndex == (int)DamageDrawing.ForAll
                ? Heroes.GetByTeam(Members.MyHero.GetEnemyTeam())
                       .Where(x => x.IsAlive && x.IsVisible && !x.IsIllusion() && !x.IsMagicImmune()).ToList()
                : new List <Hero> {
                closeToMouse
            };

            foreach (var hero in list)
            {
                var pos = HUDInfo.GetHPbarPosition(hero);
                if (pos.IsZero)
                {
                    continue;
                }
                var size     = HUDInfo.GetHpBarSizeY();
                var text     = $"     {(int) Helper.CalculateMyCurrentDamage(hero)} ({(int) Helper.CalculateMyDamage(hero)})";
                var textSize = Drawing.MeasureText(text, "Arial",
                                                   new Vector2((float)(size * 1.5), 500), FontFlags.AntiAlias);
                var textPos = pos + new Vector2(HUDInfo.GetHPBarSizeX() + 4, 0);
                Drawing.DrawText(
                    text,
                    textPos,
                    new Vector2(textSize.Y, 0),
                    new Color(255, 255, 255, 255),
                    FontFlags.AntiAlias | FontFlags.StrikeOut);
            }
        }
コード例 #3
0
ファイル: ComboAction.cs プロジェクト: weitianhan/EnsageSharp
        public static void Game_OnUpdate(EventArgs args)
        {
            if (!IsEnable)
            {
                return;
            }
            if (!Members.MyHero.IsAlive)
            {
                return;
            }
            //CalculateDamage();
            if (_attacker == null)
            {
                _attacker = new Sleeper();
            }
            if (_spellSleeper == null)
            {
                _spellSleeper = new MultiSleeper();
            }
            if (_ethereal == null)
            {
                _ethereal = new Sleeper();
            }
            var laser   = Abilities.FindAbility("tinker_laser");
            var rockets = Abilities.FindAbility("tinker_heat_seeking_missile");

            if (IsEnableKillSteal && !IsComboHero)
            {
                foreach (var x in Heroes.GetByTeam(Members.MyHero.GetEnemyTeam())
                         .Where(x => x.IsAlive && x.IsVisible && !x.IsIllusion() && !x.IsMagicImmune())
                         .Where(x => Helper.CalculateMyCurrentDamage(x, true) < 0))
                {
                    CastCombo(x, laser, rockets, true);
                }
            }

            if (!IsComboHero)
            {
                if (_globalTarget != null)
                {
                    Helper.UnHandleEffect(_globalTarget);
                }
                _globalTarget = null;
                return;
            }
            if (_globalTarget == null || !_globalTarget.IsValid)
            {
                _globalTarget = Helper.ClosestToMouse(Members.MyHero);
                return;
            }
            Helper.HandleEffect(_globalTarget);
            if (Members.MyHero.IsChanneling() ||
                _spellSleeper.Sleeping(Abilities.FindAbility("tinker_rearm")) ||
                _globalTarget.Distance2D(Members.MyHero) > 2500)
            {
                return;
            }
            if (AutoAttack)
            {
                if (UseOrbWalkker)
                {
                    Orbwalking.Orbwalk(_globalTarget, followTarget: true);
                }
                else if (!Members.MyHero.IsAttacking() && !_attacker.Sleeping && !_globalTarget.IsAttackImmune())
                {
                    Members.MyHero.Attack(_globalTarget);
                    _attacker.Sleep(250);
                }
            }
            CastCombo(_globalTarget, laser, rockets);
        }
コード例 #4
0
        public static void Game_OnUpdate(EventArgs args)
        {
            if (!IsEnable)
            {
                return;
            }
            if (!Members.MyHero.IsAlive)
            {
                return;
            }
            //CalculateDamage();
            if (_attacker == null)
            {
                _attacker = new Sleeper();
            }
            if (_spellSleeper == null)
            {
                _spellSleeper = new MultiSleeper();
            }
            if (_ethereal == null)
            {
                _ethereal = new Sleeper();
            }
            var laser   = Abilities.FindAbility("tinker_laser");
            var rockets = Abilities.FindAbility("tinker_heat_seeking_missile");

            if (_spellSleeper.Sleeping(Abilities.FindAbility("tinker_rearm")))
            {
                return;
            }

            /*var data = _laser.AbilitySpecialData;
             * var dmg = _laser.GetAbilityData("laser_damage", 1);
             * Console.WriteLine($"dmg: {dmg}");
             * foreach (var abilitySpecialData in data.Where(x=>x.IsSpellDamageValue))
             * {
             *  Console.WriteLine($"{abilitySpecialData.Name}: {abilitySpecialData.GetValue(_laser.Level-1)}");
             * }
             * Console.WriteLine($"Laser: {_laser.GetDamage(0)}/{_laser.GetDamage(1)}/{_laser.GetDamage(2)}/{_laser.GetDamage(3)}");*/
            if (IsEnableKillSteal && !IsComboHero)
            {
                foreach (var x in Heroes.GetByTeam(Members.MyHero.GetEnemyTeam())
                         .Where(x => x.IsAlive && x.IsVisible && !x.IsIllusion() && !x.IsMagicImmune())
                         .Where(x => Helper.CalculateMyCurrentDamage(x, true) < 0))
                {
                    CastCombo(x, laser, rockets, true);
                }
            }

            if (!IsComboHero)
            {
                if (_globalTarget != null)
                {
                    Helper.UnHandleEffect(_globalTarget);
                }
                _globalTarget = null;
                return;
            }
            if (_globalTarget == null || !_globalTarget.IsValid)
            {
                _globalTarget = Helper.ClosestToMouse(Members.MyHero);
                return;
            }
            Helper.HandleEffect(_globalTarget);
            if (Members.MyHero.IsChanneling() || _globalTarget.Distance2D(Members.MyHero) > 2500)
            {
                return;
            }
            if (AutoAttack)
            {
                if (UseOrbWalkker)
                {
                    Orbwalking.Orbwalk(_globalTarget, followTarget: true);
                }
                else if (!Members.MyHero.IsAttacking() && !_attacker.Sleeping && !_globalTarget.IsAttackImmune())
                {
                    Members.MyHero.Attack(_globalTarget);
                    _attacker.Sleep(250);
                }
            }
            CastCombo(_globalTarget, laser, rockets);
        }