Example #1
0
        public bool ShouldSpendGold(EvadableAbility ability)
        {
            if (sleeper.Sleeping)
            {
                return false;
            }

            float damage;

            try
            {
                damage = (int)Math.Round(AbilityDamage.CalculateDamage(ability.Ability, ability.AbilityOwner, Hero));
            }
            catch (Exception)
            {
                return false;
            }

            if (damage > 850)
            {
                Debugger.WriteLine("// * Damage calculations probably incorrect // " + damage + " // " + ability.Name);
                damage = 350;
            }

            //  Debugger.WriteLine("// * Incoming damage: " + damage + " from: " + ability.Name);
            //  Debugger.WriteLine("// * HP left: " + Hero.Health);

            return Hero.Health <= damage;
        }
Example #2
0
        public override bool CanBeCasted(EvadableAbility ability, Unit unit)
        {
            if (Sleeper.Sleeping || !Ability.CanBeCasted())
            {
                return false;
            }

            Debugger.WriteLine("// * Bloodstone calculations");

            var damageSource = ability.AbilityOwner;

            if (ability.IsDisable)
            {
                var totalDamage = (damageSource.MinimumDamage + damageSource.BonusDamage)
                                  * damageSource.SecondsPerAttack * 2;
                var totalMana = damageSource.Mana;

                foreach (var spell in damageSource.Spellbook.Spells.Where(x => x.Level > 0 && x.Cooldown <= 0))
                {
                    if (totalMana >= spell.ManaCost)
                    {
                        try
                        {
                            totalDamage += (int)Math.Round(AbilityDamage.CalculateDamage(spell, damageSource, unit));
                            totalMana -= spell.ManaCost;
                        }
                        catch (Exception)
                        {
                        }
                    }
                }

                Debugger.WriteLine("// * Incoming damage: " + totalDamage + " from: " + damageSource.GetName());
                Debugger.WriteLine("// * HP left: " + unit.Health);

                return unit.Health <= totalDamage;
            }

            float damage;

            try
            {
                damage = (int)Math.Round(AbilityDamage.CalculateDamage(ability.Ability, ability.AbilityOwner, Hero));
            }
            catch (Exception)
            {
                return false;
            }

            if (damage > 850)
            {
                Debugger.WriteLine("// * Damage calculations probably incorrect // " + damage + " // " + ability.Name);
                damage = 350;
            }

            Debugger.WriteLine("// * Incoming damage: " + damage + " from: " + ability.Name);
            Debugger.WriteLine("// * HP left: " + unit.Health);

            return unit.Health <= damage;
        }
Example #3
0
        public override bool CanBeCasted(EvadableAbility ability, Unit unit)
        {
            // todo: fix ally check

            return !Sleeper.Sleeping && Ability.CanBeCasted() && Hero.Distance2D(unit) <= aftershockRadius
                   && CheckEnemy(unit);
        }
Example #4
0
        public override void Use(EvadableAbility ability, Unit target)
        {
            var range = GetCastRange() - 60;
            BlinkPosition = Hero.NetworkPosition.Extend(BlinkPosition, range);
            var obtsacles = Pathfinder.GetIntersectingObstacles(BlinkPosition, Hero.HullRadius);

            if (obtsacles.Any())
            {
                bool success;
                BlinkPosition =
                    Pathfinder.CalculatePathFromObstacle(BlinkPosition, BlinkPosition, 5, out success).LastOrDefault();

                if (!success)
                {
                    //gg
                    return;
                }

                if (Hero.Distance2D(BlinkPosition) > range)
                {
                    // probably gg
                    BlinkPosition = Hero.NetworkPosition.Extend(BlinkPosition, range);
                }
            }

            Ability.UseAbility(BlinkPosition);
            Sleep();
        }
Example #5
0
 public override void Use(EvadableAbility ability, Unit target)
 {
     base.Use(ability, target);
     if (Menu.PhaseShiftBlock)
     {
         sleeper.Sleep(Math.Min(Menu.PhaseShiftBlockTime, GetShiftDuration()));
     }
 }
Example #6
0
        public override bool CanBeCasted(EvadableAbility ability, Unit unit)
        {
            if (Variables.Hero.Equals(unit))
            {
                return false;
            }

            return base.CanBeCasted(ability, unit);
        }
Example #7
0
 public override void Use(EvadableAbility ability, Unit target)
 {
     Ability.UseAbility(ability.AbilityOwner);
     if (!target.Equals(Hero))
     {
         Hero.Attack(target);
     }
     Sleep();
 }
Example #8
0
        public override float GetRequiredTime(EvadableAbility ability, Unit unit, float remainingTime)
        {
            if (blinkUnit == null)
            {
                return float.MaxValue;
            }

            return CastPoint + (float)Hero.GetTurnTime(blinkUnit);
        }
Example #9
0
        public override void Use(EvadableAbility ability, Unit target)
        {
            if (blinkUnit == null)
            {
                return;
            }

            Ability.UseAbility(blinkUnit);
            Sleep();
        }
Example #10
0
 public override void Use(EvadableAbility ability, Unit target)
 {
     if (Hero.AghanimState())
     {
         Ability.UseAbility(Hero);
     }
     else
     {
         Ability.UseAbility();
     }
     Sleep();
 }
Example #11
0
        public override void Use(EvadableAbility ability, Unit target)
        {
            if (Ability.IsAbilityBehavior(AbilityBehavior.UnitTarget))
            {
                Ability.UseAbility(target);
            }
            else
            {
                Ability.UseAbility(target.Position);
            }

            Sleep();
        }
Example #12
0
        public override void Use(EvadableAbility ability, Unit target)
        {
            if (Hero.GetTurnTime(target) > 0)
            {
                Hero.Move(Hero.Position.Extend(target.Position, 40));
                Ability.UseAbility(Hero, true);
            }
            else
            {
                Ability.UseAbility(Hero);
            }

            Sleep();
        }
Example #13
0
        public override bool CanBeCasted(EvadableAbility ability, Unit unit)
        {
            if (Hero.IsRuptured())
            {
                return false;
            }

            blinkUnit =
                ObjectManager.GetEntitiesFast<Unit>()
                    .FirstOrDefault(
                        x =>
                            x.IsValid && x.IsAlive && (x is Creep || x is Hero) && !x.Equals(Hero)
                            && x.Team == HeroTeam && x.Distance2D(Hero) < GetCastRange() && x.Distance2D(Hero) > 200);

            return !Sleeper.Sleeping && blinkUnit != null && Ability.CanBeCasted();
        }
Example #14
0
        public override bool CanBeCasted(EvadableAbility ability, Unit unit)
        {
            // todo: fix ally check

            if (
                ObjectManager.GetEntitiesParallel<Unit>()
                    .Count(
                        x =>
                            x.IsValid && x.IsAlive && x.IsSpawned && x.Team != HeroTeam && !x.IsMagicImmune()
                            && x.Distance2D(Hero) <= GetCastRange()) >= 3)
            {
                // < 66%
                return false;
            }

            return !Sleeper.Sleeping && Ability.CanBeCasted() && Hero.Distance2D(unit) <= GetCastRange()
                   && CheckEnemy(unit);
        }
Example #15
0
        public override float GetRequiredTime(EvadableAbility ability, Unit unit, float remainingTime)
        {
            var delay = CastPoint + Game.Ping / 1000;
            var requiredTime = (float)Hero.GetTurnTime(unit.Position) * 1.35f + delay + 0.1f;

            if (remainingTime - requiredTime > 0)
            {
                BlinkPosition = unit.Position;
                return requiredTime;
            }

            var left = remainingTime - delay;
            if (left < 0)
            {
                return 111;
            }

            BlinkPosition = Hero.GetBlinkPosition(unit.Position, left - 0.15f);

            return (float)Hero.GetTurnTime(BlinkPosition) + delay + 0.1f;
        }
Example #16
0
 public override float GetRequiredTime(EvadableAbility ability, Unit unit, float remainingTime)
 {
     return CastPoint;
 }
Example #17
0
        public override bool CanBeCasted(EvadableAbility ability, Unit unit)
        {
            if (Sleeper.Sleeping)
            {
                return false;
            }

            var nearEnemies =
                ObjectManager.GetEntitiesParallel<Unit>()
                    .Where(
                        x =>
                            x.IsValid && x.IsAlive && x.IsSpawned && x.AttackCapability != AttackCapability.None
                            && x.Team != HeroTeam && x.Distance2D(Hero) < x.GetAttackRange() + 300);

            var armletEnabled = Hero.Modifiers.Any(x => x.Name == ArmletModifierName);
            if (armletEnabled && DotModifiers(nearEnemies))
            {
                return false;
            }

            var damageSource = ability.AbilityOwner;

            if (ability.IsDisable)
            {
                var totalDamage = (damageSource.MinimumDamage + damageSource.BonusDamage)
                                  * damageSource.AttacksPerSecond * 2;
                var totalMana = damageSource.Mana;

                foreach (var spell in damageSource.Spellbook.Spells.Where(x => x.Level > 0 && x.Cooldown <= 0))
                {
                    if (totalMana >= spell.ManaCost)
                    {
                        totalDamage += (int)Math.Round(AbilityDamage.CalculateDamage(spell, damageSource, unit));
                        totalMana -= spell.ManaCost;
                    }
                }

                return unit.Health <= totalDamage;
            }

            var damage = (int)Math.Round(AbilityDamage.CalculateDamage(ability.Ability, damageSource, unit));

            if (HpRestored(ability.GetRemainingTime(Hero)) < damage)
            {
                return false;
            }

            return unit.Health <= damage;
        }
Example #18
0
        public override void Use(EvadableAbility ability, Unit target)
        {
            var projectile = ability as Projectile;

            if (projectile != null)
            {
                var pos = !projectile.IsDisjointable
                              ? Hero.NetworkPosition.Extend(projectile.StartPosition, 250)
                              : Hero.InFront(50);

                Debugger.DrawRedCircle(pos);

                Ability.UseAbility(pos);
            }
            else if (!pointForLinearProjectile.IsZero && pointForLinearProjectile.Distance2D(Hero) < 500)
            {
                Debugger.DrawRedCircle(pointForLinearProjectile);

                Ability.UseAbility(pointForLinearProjectile);
                pointForLinearProjectile = new Vector3();
            }
            else
            {
                var pos = Hero.InFront(150 + 20 * Ability.Level);

                Debugger.DrawRedCircle(pos);

                Ability.UseAbility(pos);
            }

            Sleep(CastPoint);
        }
Example #19
0
 public override void Use(EvadableAbility ability, Unit target)
 {
     Ability.UseAbility(Hero.InFront(250));
     Sleep();
 }
Example #20
0
 public override bool CanBeCasted(EvadableAbility ability, Unit unit)
 {
     return !Sleeper.Sleeping && Hero.HasModifier("modifier_ember_spirit_fire_remnant_timer")
            && Ability.CanBeCasted();
 }
Example #21
0
 public override float GetRequiredTime(EvadableAbility ability, Unit unit, float remainingTime)
 {
     return Math.Max(ability.GetRemainingTime(Hero) - 0.1f, 0);
 }
Example #22
0
 public override float GetRequiredTime(EvadableAbility ability, Unit unit, float remainingTime)
 {
     return CastPoint + (float)Hero.GetTurnTime(unit) * 1.35f + 0.15f;
 }
Example #23
0
 public override float GetRequiredTime(EvadableAbility ability, Unit unit, float remainingTime)
 {
     return CastPoint + (unit.Equals(Hero) ? 0 : (float)Hero.GetTurnTime(unit) * 1.35f);
 }
Example #24
0
 public override bool CanBeCasted(EvadableAbility ability, Unit unit)
 {
     return !Sleeper.Sleeping && Hero.HasModifier("modifier_morphling_replicate_timer") && Ability.CanBeCasted();
 }
Example #25
0
        public override float GetRequiredTime(EvadableAbility ability, Unit unit, float remainingTime)
        {
            var projectile = ability as Projectile;

            if (projectile != null && !projectile.IsDisjointable)
            {
                Debugger.DrawGreenCircle(ability.AbilityOwner.NetworkPosition);

                return CastPoint + (float)Hero.GetTurnTime(ability.AbilityOwner);
            }

            var linearProjectile = ability as LinearProjectile;
            if (linearProjectile != null)
            {
                bool success;
                var pathfinderPoint = Pathfinder.CalculatePathFromObstacle(5, out success).LastOrDefault();

                var extendPoint = Hero.Position.Extend(
                    ability.AbilityOwner.Position,
                    linearProjectile.GetProjectileRadius(Hero.Position) + 50 * Ability.Level);

                var turnToPathfinder = success
                                           ? CastPoint + (float)Hero.GetTurnTime(pathfinderPoint) * 1.35f
                                           : float.MaxValue;
                var turnToExtend = CastPoint + (float)Hero.GetTurnTime(extendPoint) * 1.35f;

                if (Math.Abs(turnToPathfinder - turnToExtend) < 0.075)
                {
                    if (Hero.Distance2D(pathfinderPoint) < Hero.Distance2D(extendPoint))
                    {
                        Debugger.DrawGreenCircle(pathfinderPoint);

                        pointForLinearProjectile = pathfinderPoint;
                        return turnToPathfinder;
                    }
                    else
                    {
                        Debugger.DrawGreenCircle(extendPoint);

                        pointForLinearProjectile = extendPoint;
                        return turnToExtend;
                    }
                }

                if (turnToPathfinder < turnToExtend)
                {
                    Debugger.DrawGreenCircle(pathfinderPoint);

                    pointForLinearProjectile = pathfinderPoint;
                    return turnToPathfinder;
                }
                else
                {
                    Debugger.DrawGreenCircle(extendPoint);

                    pointForLinearProjectile = extendPoint;
                    return turnToExtend;
                }
            }

            Debugger.DrawGreenCircle(Hero.NetworkPosition);

            return CastPoint;
        }
Example #26
0
 public override void Use(EvadableAbility ability, Unit target)
 {
     Ability.UseAbility();
     Sleep();
 }
Example #27
0
 public override bool CanBeCasted(EvadableAbility ability, Unit unit)
 {
     return !Sleeper.Sleeping && Ability.CanBeCasted() && !Hero.IsRuptured();
 }
Example #28
0
 public override bool CanBeCasted(EvadableAbility ability, Unit unit)
 {
     return !Sleeper.Sleeping && Ability.CanBeCasted() && Hero.Distance2D(unit) <= grabRadius && CheckEnemy(unit);
 }
Example #29
0
 public override void Use(EvadableAbility ability, Unit target)
 {
     Ability.UseAbility(target);
     DelayAction.Add(250 + Game.Ping, () => { Hero.Stop(); });
     Sleep();
 }
Example #30
0
        public override void Use(EvadableAbility ability, Unit target)
        {
            if (Hero.Modifiers.Any(x => x.Name == ArmletModifierName))
            {
                Ability.ToggleAbility();
            }
            Ability.ToggleAbility();

            manualDisable = false;
            Sleep(800);
        }