Пример #1
0
 // Token: 0x060005ED RID: 1517 RVA: 0x0001D97C File Offset: 0x0001BB7C
 public override bool Orbwalk(Unit9 target, bool attack, bool move, ComboModeMenu comboMenu = null)
 {
     if (comboMenu != null && target != null && comboMenu.IsHarassCombo)
     {
         ActiveAbility ability = this.tidebringer.Ability;
         if (ability.CanBeCasted(true))
         {
             Vector3 ownerPosition           = base.Owner.Position;
             float   num                     = base.Owner.GetAttackPoint(null) + Game.Ping / 1000f + 0.3f;
             Vector3 targetPredictedPosition = target.GetPredictedPosition(num);
             Unit9   unit                    = (from x in EntityManager9.Units
                                                where x.IsUnit && !x.Equals(target) && x.IsAlive && x.IsVisible && !x.IsInvulnerable && !x.IsAlly(this.Owner) && x.Distance(target) < ability.Range
                                                orderby Vector3Extensions.AngleBetween(ownerPosition, x.Position, targetPredictedPosition)
                                                select x).FirstOrDefault <Unit9>();
             if (unit != null)
             {
                 Vector3 position = unit.Position;
                 if (this.CanAttack(unit, 0f) && Vector3Extensions.AngleBetween(ownerPosition, position, targetPredictedPosition) < 45f)
                 {
                     base.LastMovePosition = Vector3.Zero;
                     base.LastTarget       = unit;
                     base.OrbwalkSleeper.Sleep(0.05f);
                     return(this.Attack(unit, comboMenu));
                 }
                 float   num2         = Math.Min(Math.Max(unit.Distance(ownerPosition), 150f), base.Owner.GetAttackRange(null, 0f));
                 Vector3 movePosition = Vector3Extensions.Extend2D(position, targetPredictedPosition, -num2);
                 base.OrbwalkSleeper.Sleep(0.05f);
                 return(base.Move(movePosition));
             }
         }
     }
     return(base.Orbwalk(target, attack, move, comboMenu));
 }
        // Token: 0x060004A6 RID: 1190 RVA: 0x000188EC File Offset: 0x00016AEC
        public override bool UseAbility(TargetManager targetManager, Sleeper comboSleeper, bool aoe)
        {
            if (!base.Owner.HasModifier("modifier_pangolier_gyroshell"))
            {
                return(false);
            }
            Unit9 target = targetManager.Target;
            float num    = base.Owner.Distance(target);

            if (num < 300f)
            {
                return(false);
            }
            if (target.HasModifier("modifier_pangolier_gyroshell_timeout") || (base.Owner.GetAngle(target.Position, false) < 1.25f && num < 800f))
            {
                return(false);
            }
            Vector3 predictedPosition = target.GetPredictedPosition(0.1f);

            if (base.Ability.CastRange < base.Owner.Distance(predictedPosition))
            {
                return(false);
            }
            if (!base.Ability.UseAbility(predictedPosition, false, false))
            {
                return(false);
            }
            float castDelay = base.Ability.GetCastDelay(predictedPosition);

            comboSleeper.Sleep(castDelay);
            base.Sleeper.Sleep(castDelay + 0.5f);
            base.OrbwalkSleeper.Sleep(castDelay);
            return(true);
        }
Пример #3
0
        // Token: 0x060002C4 RID: 708 RVA: 0x00011870 File Offset: 0x0000FA70
        private bool MoveToProjectile(Unit9 target)
        {
            if (!this.CanMove())
            {
                return(false);
            }
            TrackingProjectile trackingProjectile = ObjectManager.TrackingProjectiles.FirstOrDefault(delegate(TrackingProjectile x)
            {
                if (x.IsValid)
                {
                    Entity source             = x.Source;
                    EntityHandle?entityHandle = (source != null) ? new EntityHandle?(source.Handle) : null;
                    if (((entityHandle != null) ? new uint?(entityHandle.GetValueOrDefault()) : null) == base.Owner.Handle)
                    {
                        Entity target3 = x.Target;
                        return(target3 != null && target3.IsValid);
                    }
                }
                return(false);
            });

            if (trackingProjectile == null)
            {
                return(false);
            }
            Entity  target2           = trackingProjectile.Target;
            Vector3 predictedPosition = target.GetPredictedPosition(trackingProjectile.Position.Distance2D(target2.Position, false) / (float)trackingProjectile.Speed + Game.Ping / 1000f);
            Vector3 position          = Vector3Extensions.Extend2D(target2.Position, predictedPosition, -base.Owner.Distance(target2.Position));

            base.Owner.BaseUnit.Move(position);
            return(true);
        }
 // Token: 0x0600064D RID: 1613 RVA: 0x0001EAEC File Offset: 0x0001CCEC
 public override bool Orbwalk(Unit9 target, bool attack, bool move, ComboModeMenu comboMenu = null)
 {
     if (target != null)
     {
         if (comboMenu != null && comboMenu.IsAbilityEnabled(this.stomp.Ability) && this.stomp.Ability.CanBeCasted(true))
         {
             return(base.Move(target.GetPredictedPosition(1f)));
         }
         if (!this.damagedUnits.Contains(target))
         {
             return(base.Move(target.Position));
         }
         Unit9 unit = (from x in this.moveUnits
                       where x.IsValid && x.IsAlive && x.Distance(base.Owner) < 1000f
                       orderby x.IsHero descending, x.Distance(base.Owner)
                       select x).FirstOrDefault <Unit9>();
         if (unit != null)
         {
             return(base.Move(unit.Position));
         }
         ActiveAbility activeAbility = base.Owner.Abilities.FirstOrDefault((Ability9 x) => x.Id == AbilityId.elder_titan_return_spirit) as ActiveAbility;
         if (activeAbility != null && activeAbility.CanBeCasted(true) && activeAbility.UseAbility(false, false))
         {
             base.OrbwalkSleeper.Sleep(3f);
             return(true);
         }
     }
     return(base.Orbwalk(target, attack, move, comboMenu));
 }
Пример #5
0
        public override bool Orbwalk(Unit9 target, bool attack, bool move, ComboModeMenu comboMenu = null)
        {
            if (this.OrbwalkSleeper.IsSleeping)
            {
                return(false);
            }

            if (target != null && comboMenu?.IsHarassCombo == true && target.Distance(this.Owner) > this.Owner.GetAttackRange(target))
            {
                if (this.MoveSleeper.IsSleeping)
                {
                    return(false);
                }

                if (this.MoveToProjectile(target))
                {
                    return(true);
                }

                var psi                     = (PsiBlades)this.Owner.Abilities.First(x => x.Id == AbilityId.templar_assassin_psi_blades);
                var ownerPosition           = this.Owner.Position;
                var attackDelay             = this.Owner.GetAttackPoint() + (GameManager.Ping / 1000) + 0.3f;
                var targetPredictedPosition = target.GetPredictedPosition(attackDelay);

                var unitTarget = EntityManager9.Units
                                 .Where(
                    x => x.IsUnit && !x.Equals(target) && x.IsAlive && x.IsVisible && !x.IsInvulnerable &&
                    (!x.IsAlly(this.Owner) || (x.IsCreep && x.HealthPercentage < 50)) &&
                    x.Distance(target) < psi.SplitRange - 75)
                                 .OrderBy(x => ownerPosition.AngleBetween(x.Position, targetPredictedPosition))
                                 .FirstOrDefault();

                if (unitTarget != null)
                {
                    var unitTargetPosition = unitTarget.Position;

                    if (this.CanAttack(unitTarget) && ownerPosition.AngleBetween(unitTargetPosition, targetPredictedPosition) < 15)
                    {
                        this.LastMovePosition = Vector3.Zero;
                        this.LastTarget       = unitTarget;
                        this.OrbwalkSleeper.Sleep(0.05f);
                        return(this.Attack(unitTarget, comboMenu));
                    }

                    var range        = Math.Min(Math.Max(unitTarget.Distance(ownerPosition), 150), this.Owner.GetAttackRange());
                    var movePosition = unitTargetPosition.Extend2D(targetPredictedPosition, -range);
                    this.OrbwalkSleeper.Sleep(0.05f);

                    return(this.Move(movePosition));
                }

                attack = false;
            }

            return(base.Orbwalk(target, attack, move, comboMenu));
        }
Пример #6
0
        public override bool Orbwalk(Unit9 target, bool attack, bool move, ComboModeMenu comboMenu = null)
        {
            if (comboMenu != null && target != null)
            {
                if (comboMenu.IsHarassCombo)
                {
                    var ability = this.tidebringer.Ability;
                    if (ability.CanBeCasted())
                    {
                        var ownerPosition           = this.Owner.Position;
                        var attackDelay             = this.Owner.GetAttackPoint() + (GameManager.Ping / 1000) + 0.3f;
                        var targetPredictedPosition = target.GetPredictedPosition(attackDelay);

                        var unitTarget = EntityManager9.Units
                                         .Where(
                            x => x.IsUnit && !x.Equals(target) && x.IsAlive && x.IsVisible && !x.IsInvulnerable && !x.IsAlly(this.Owner) &&
                            x.Distance(target) < ability.Range)
                                         .OrderBy(x => ownerPosition.AngleBetween(x.Position, targetPredictedPosition))
                                         .FirstOrDefault();

                        if (unitTarget != null)
                        {
                            var unitTargetPosition = unitTarget.Position;

                            if (this.CanAttack(unitTarget) && ownerPosition.AngleBetween(unitTargetPosition, targetPredictedPosition) < 45)
                            {
                                this.LastMovePosition = Vector3.Zero;
                                this.LastTarget       = unitTarget;
                                this.OrbwalkSleeper.Sleep(0.05f);
                                return(this.Attack(unitTarget, comboMenu));
                            }

                            var range        = Math.Min(Math.Max(unitTarget.Distance(ownerPosition), 150), this.Owner.GetAttackRange());
                            var movePosition = unitTargetPosition.Extend2D(targetPredictedPosition, -range);
                            this.OrbwalkSleeper.Sleep(0.05f);

                            return(this.Move(movePosition));
                        }
                    }
                }

                //else
                //{
                //    if (!this.xMark.Position.IsZero && this.xReturn.Ability.CanBeCasted()
                //                                    && this.Owner.Distance(target) > this.Owner.GetAttackRange(target))
                //    {
                //        return this.Move(this.xMark.Position);
                //    }
                //}
            }

            return(base.Orbwalk(target, attack, move, comboMenu));
        }
Пример #7
0
        // Token: 0x06000046 RID: 70 RVA: 0x0000F638 File Offset: 0x0000D838
        public PredictionOutput9 GetSimplePrediction(PredictionInput9 input)
        {
            Unit9             target           = input.Target;
            Vector3           position         = input.Target.Position;
            Unit9             caster           = input.Caster;
            bool              isVisible        = target.IsVisible;
            float             num              = input.Delay;
            PredictionOutput9 predictionOutput = new PredictionOutput9
            {
                Target = target
            };

            if (target.Equals(caster))
            {
                predictionOutput.HitChance      = HitChance.High;
                predictionOutput.TargetPosition = position;
                predictionOutput.CastPosition   = position;
                return(predictionOutput);
            }
            if (input.RequiresToTurn)
            {
                num += caster.GetTurnTime(position);
            }
            if (input.Speed > 0f)
            {
                num += caster.Distance(position) / input.Speed;
            }
            Vector3 predictedPosition = target.GetPredictedPosition(num);

            predictionOutput.TargetPosition = predictedPosition;
            predictionOutput.CastPosition   = predictedPosition;
            if (!isVisible)
            {
                predictionOutput.HitChance = HitChance.Low;
                return(predictionOutput);
            }
            if (target.IsStunned || target.IsRooted || target.IsHexed)
            {
                predictionOutput.HitChance = HitChance.Immobile;
                return(predictionOutput);
            }
            if (!target.IsMoving && !caster.IsVisibleToEnemies)
            {
                predictionOutput.HitChance = HitChance.High;
                return(predictionOutput);
            }
            predictionOutput.HitChance = ((num > 0.5f) ? HitChance.Medium : HitChance.High);
            return(predictionOutput);
        }
Пример #8
0
 // Token: 0x060002C1 RID: 705 RVA: 0x0001163C File Offset: 0x0000F83C
 public override bool Orbwalk(Unit9 target, bool attack, bool move, ComboModeMenu comboMenu = null)
 {
     if (base.OrbwalkSleeper.IsSleeping)
     {
         return(false);
     }
     if (target != null && comboMenu != null && comboMenu.IsHarassCombo && target.Distance(base.Owner) > base.Owner.GetAttackRange(target, 0f))
     {
         if (base.MoveSleeper.IsSleeping)
         {
             return(false);
         }
         if (this.MoveToProjectile(target))
         {
             return(true);
         }
         PsiBlades psi                     = (PsiBlades)base.Owner.Abilities.First((Ability9 x) => x.Id == AbilityId.templar_assassin_psi_blades);
         Vector3   ownerPosition           = base.Owner.Position;
         float     num                     = base.Owner.GetAttackPoint(null) + Game.Ping / 1000f + 0.3f;
         Vector3   targetPredictedPosition = target.GetPredictedPosition(num);
         Unit9     unit                    = (from x in EntityManager9.Units
                                              where x.IsUnit && !x.Equals(target) && x.IsAlive && x.IsVisible && !x.IsInvulnerable && (!x.IsAlly(this.Owner) || (x.IsCreep && x.HealthPercentage < 50f)) && x.Distance(target) < psi.SplitRange - 75f
                                              orderby Vector3Extensions.AngleBetween(ownerPosition, x.Position, targetPredictedPosition)
                                              select x).FirstOrDefault <Unit9>();
         if (unit != null)
         {
             Vector3 position = unit.Position;
             if (this.CanAttack(unit, 0f) && Vector3Extensions.AngleBetween(ownerPosition, position, targetPredictedPosition) < 15f)
             {
                 base.LastMovePosition = Vector3.Zero;
                 base.LastTarget       = unit;
                 base.OrbwalkSleeper.Sleep(0.05f);
                 return(this.Attack(unit, comboMenu));
             }
             float   num2         = Math.Min(Math.Max(unit.Distance(ownerPosition), 150f), base.Owner.GetAttackRange(null, 0f));
             Vector3 movePosition = Vector3Extensions.Extend2D(position, targetPredictedPosition, -num2);
             base.OrbwalkSleeper.Sleep(0.05f);
             return(base.Move(movePosition));
         }
         else
         {
             attack = false;
         }
     }
     return(base.Orbwalk(target, attack, move, comboMenu));
 }
Пример #9
0
        public override bool CanBeCasted(Unit9 ally, Unit9 enemy, IObstacle obstacle)
        {
            if (!this.IsAbilityEnabled(obstacle))
            {
                return(false);
            }

            if (!this.Ability.CanBeCasted(false))
            {
                return(false);
            }

            var castRange = this.ActiveAbility.CastRange;
            var radius    = this.ActiveAbility.Radius;
            var jumpRange = this.firesnapCookie.JumpRange;
            var maxRange  = this.ActiveAbility.Range;
            var minRange  = jumpRange - radius;

            var targets = EntityManager9.Units.Where(
                x => x.IsUnit && (x.IsMyHero || (!x.IsHero || x.IsIllusion)) && x.IsAlly(this.Owner) && x.IsAlive &&
                x.Distance(enemy) < maxRange && x.Distance(enemy) > minRange && x.Distance(this.Owner) < castRange)
                          .OrderBy(x => x.IsMyHero);

            foreach (var unit in targets)
            {
                var delay              = this.ActiveAbility.GetCastDelay(unit);
                var targetPosition     = unit.GetPredictedPosition(delay - this.ActiveAbility.ActivationDelay);
                var targetJumpPosition = targetPosition.Extend2D(unit.InFront(2000), jumpRange);
                var enemyPosition      = enemy.GetPredictedPosition(delay);

                if (targetJumpPosition.Distance2D(enemyPosition) < radius)
                {
                    this.target = unit;
                    return(true);
                }
            }

            return(false);
        }
Пример #10
0
        private bool MoveToProjectile(Unit9 target)
        {
            if (!this.CanMove())
            {
                return(false);
            }

            var projectile = ProjectileManager.TrackingProjectiles.FirstOrDefault(x => x.IsValid && x.Source?.Handle == this.Owner.Handle && x.Target?.IsValid == true);

            if (projectile == null)
            {
                return(false);
            }

            var projectileTarget        = projectile.Target;
            var targetPredictedPosition = target.GetPredictedPosition(
                (projectile.Position.Distance2D(projectileTarget.Position) / projectile.Speed) + (GameManager.Ping / 1000));
            var psiPosition = projectileTarget.Position.Extend2D(targetPredictedPosition, -this.Owner.Distance(projectileTarget.Position));

            this.Owner.BaseUnit.Move(psiPosition);
            return(true);
        }
Пример #11
0
        public override bool Orbwalk(Unit9 target, bool attack, bool move, ComboModeMenu comboMenu = null)
        {
            if (target != null)
            {
                if (comboMenu?.IsAbilityEnabled(this.stomp.Ability) == true && this.stomp.Ability.CanBeCasted())
                {
                    return(this.Move(target.GetPredictedPosition(1f)));
                }

                if (this.damagedUnits.Contains(target))
                {
                    var moveTarget = this.moveUnits.Where(x => x.IsValid && x.IsAlive && x.Distance(this.Owner) < 1000)
                                     .OrderByDescending(x => x.IsHero)
                                     .ThenBy(x => x.Distance(this.Owner))
                                     .FirstOrDefault();

                    if (moveTarget != null)
                    {
                        return(this.Move(moveTarget.Position));
                    }

                    var spiritReturn =
                        this.Owner.Abilities.FirstOrDefault(x => x.Id == AbilityId.elder_titan_return_spirit) as ActiveAbility;

                    if (spiritReturn?.CanBeCasted() == true && spiritReturn.UseAbility())
                    {
                        this.OrbwalkSleeper.Sleep(3f);
                        return(true);
                    }
                }
                else
                {
                    return(this.Move(target.Position));
                }
            }

            return(base.Orbwalk(target, attack, move, comboMenu));
        }
Пример #12
0
        // Token: 0x060007E9 RID: 2025 RVA: 0x000241C4 File Offset: 0x000223C4
        public float GetRequiredRemnants(TargetManager targetManager)
        {
            Unit9 target = targetManager.Target;
            float speed  = this.remnant.Speed;
            int   damage = this.remnant.GetDamage(target);

            if (damage <= 0)
            {
                return(0f);
            }
            int   num  = EntityManager9.Units.Count((Unit9 x) => x.IsUnit && x.IsAlly(this.Owner) && x.Name == "npc_dota_ember_spirit_remnant" && x.Distance(target.GetPredictedPosition(this.Owner.Distance(x) / speed)) < this.Ability.Radius);
            float num2 = target.Health - (float)(num * damage);
            int   num3 = 0;

            while (num2 > 0f)
            {
                num2 -= (float)damage;
                num3++;
            }
            return((float)Math.Min(this.Charges, num3));
        }
Пример #13
0
        // Token: 0x060007E8 RID: 2024 RVA: 0x00024154 File Offset: 0x00022354
        public float GetDamage(TargetManager targetManager)
        {
            Unit9 target = targetManager.Target;
            float speed  = this.remnant.Speed;
            int   num    = EntityManager9.Units.Count((Unit9 x) => x.IsUnit && x.IsAlly(this.Owner) && x.Name == "npc_dota_ember_spirit_remnant" && x.Distance(target.GetPredictedPosition(this.Owner.Distance(x) / speed)) < this.Ability.Radius);

            return((float)(this.remnant.GetDamage(target) * (this.remnant.Charges + num)));
        }
Пример #14
0
        // Token: 0x060009C3 RID: 2499 RVA: 0x0002A788 File Offset: 0x00028988
        public override bool UseAbility(TargetManager targetManager, Sleeper comboSleeper, bool aoe)
        {
            Unit9 target      = targetManager.Target;
            float attackRange = base.Owner.GetAttackRange(target, 0f);
            float num         = target.Distance(base.Owner);

            if (num <= attackRange + 100f)
            {
                return(false);
            }
            if (num <= attackRange + 250f && base.Owner.Speed > targetManager.Target.Speed + 50f)
            {
                return(false);
            }
            Vector3 vector = (target.GetAngle(base.Owner, false) < 1f) ? Vector3Extensions.Extend2D(target.Position, EntityManager9.EnemyFountain, 100f) : target.GetPredictedPosition(base.Ability.CastPoint + 0.3f);

            if (base.Owner.Distance(vector) > base.Ability.CastRange)
            {
                return(false);
            }
            if (!base.Ability.UseAbility(vector, false, false))
            {
                return(false);
            }
            float castDelay = base.Ability.GetCastDelay(target);

            comboSleeper.Sleep(castDelay);
            base.Sleeper.Sleep(castDelay + 0.5f);
            base.OrbwalkSleeper.Sleep(castDelay);
            return(true);
        }
Пример #15
0
        // Token: 0x060007F9 RID: 2041 RVA: 0x00024918 File Offset: 0x00022B18
        public void RollSmashCombo(TargetManager targetManager, RollSmashModeMenu menu)
        {
            if (base.ComboSleeper.IsSleeping)
            {
                return;
            }
            Unit9         target        = targetManager.Target;
            float         num           = base.Owner.Distance(target.Position);
            AbilityHelper abilityHelper = new AbilityHelper(targetManager, null, this);

            if (base.Owner.HasModifier("modifier_earth_spirit_rolling_boulder_caster") && abilityHelper.ForceUseAbility(this.stone, true, true))
            {
                base.ComboSleeper.Sleep(3f);
                return;
            }
            Unit9 unit = (from x in targetManager.AllyHeroes
                          where !x.Equals(this.Owner) && menu.IsAllyEnabled(x.Name) && x.Distance(target) > 300f && x.Distance(target) < 1500f
                          orderby x.Distance(target)
                          select x).FirstOrDefault <Unit9>();

            if (unit == null)
            {
                return;
            }
            if (target.HasModifier("modifier_earth_spirit_boulder_smash"))
            {
                if (abilityHelper.CanBeCasted(this.rolling, false, false, true, true) && this.rolling.SimpleUseAbility(target.Position))
                {
                    base.ComboSleeper.Sleep(0.5f);
                    return;
                }
                return;
            }
            else
            {
                BoulderSmash boulderSmash = this.smash;
                if (boulderSmash == null || !boulderSmash.Ability.CanBeCasted(true))
                {
                    return;
                }
                if (num < this.smash.Ability.CastRange + 100f)
                {
                    if (Vector3Extensions.AngleBetween(base.Owner.Position, target.Position, unit.Position) < 30f)
                    {
                        this.smash.Ability.UseAbility(target, false, false);
                        base.ComboSleeper.Sleep(0.3f);
                        return;
                    }
                    if (target.GetImmobilityDuration() > 0.5f)
                    {
                        base.Owner.BaseUnit.Move(Vector3Extensions.Extend2D(target.Position, unit.Position, -100f));
                        base.OrbwalkSleeper.Sleep(0.1f);
                        base.ComboSleeper.Sleep(0.1f);
                        return;
                    }
                }
                if (abilityHelper.CanBeCasted(this.blink, true, true, true, true))
                {
                    Vector3 position = Vector3Extensions.Extend2D(target.GetPredictedPosition(base.Owner.GetTurnTime(target.Position) + Game.Ping / 2000f + 0.2f), unit.Position, -125f);
                    if (abilityHelper.UseAbility(this.blink, position))
                    {
                        base.ComboSleeper.ExtendSleep(0.1f);
                        return;
                    }
                    return;
                }
                else
                {
                    if (!abilityHelper.CanBeCasted(this.rolling, true, true, true, true))
                    {
                        return;
                    }
                    if (abilityHelper.UseAbility(this.rolling, true))
                    {
                        return;
                    }
                    if (abilityHelper.CanBeCasted(this.stone, false, true, true, true))
                    {
                        abilityHelper.ForceUseAbility(this.stone, true, true);
                        return;
                    }
                    abilityHelper.ForceUseAbility(this.rolling, true, true);
                    return;
                }
            }
        }