Пример #1
0
        public override bool CanBeCasted(Unit9 ally, Unit9 enemy, IObstacle obstacle)
        {
            if (!this.IsAbilityEnabled(obstacle))
            {
                return(false);
            }

            if (!ally.Equals(this.Owner))
            {
                return(false);
            }

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

            var angle = ally.GetAngle(enemy.Position);

            if (angle < 1)
            {
                return(false);
            }

            if (this.Owner.IsStunned || this.Owner.IsChanneling)
            {
                return(false);
            }

            return(true);
        }
Пример #2
0
        // Token: 0x0600014B RID: 331 RVA: 0x0000C64C File Offset: 0x0000A84C
        public override bool Orbwalk(Unit9 target, bool attack, bool move, ComboModeMenu comboMenu = null)
        {
            Windranger windranger = this.windranger;
            bool       flag;

            if (windranger != null && windranger.FocusFireActive)
            {
                Unit9 focusFireTarget = this.windranger.FocusFireTarget;
                flag = (focusFireTarget != null && focusFireTarget.Equals(target));
            }
            else
            {
                flag = false;
            }
            bool flag2 = flag;

            if (flag2 && target.IsReflectingDamage)
            {
                return(this.DirectionalMove());
            }
            if (flag2 && base.Owner.HasModifier("modifier_windrunner_windrun_invis"))
            {
                flag2 = false;
            }
            return(base.Orbwalk(target, !flag2, move, comboMenu));
        }
Пример #3
0
        public override bool CanBeCasted(Unit9 ally, Unit9 enemy, IObstacle obstacle)
        {
            if (!this.Menu.AbilitySettings.IsDodgeEnabled(this.Ability.Name))
            {
                return(false);
            }

            if (!ally.Equals(this.Owner))
            {
                return(false);
            }

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

            if (!this.ActiveAbility.CanHit(ally))
            {
                return(false);
            }

            if (!string.IsNullOrEmpty(this.ModifierName) && ally.HasModifier(this.ModifierName))
            {
                return(false);
            }

            return(true);
        }
Пример #4
0
        public override bool IsIntersecting(Unit9 unit, bool checkPrediction)
        {
            var position = this.missileUnit.NetworkPosition;

            if (this.initialPosition == position)
            {
                return(false);
            }

            var missile = EntityManager9.GetUnit(this.missileUnit.Handle);

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

            var target = EntityManager9.Units.Where(x => x.IsEnemy(this.Caster) && x.IsAlive && x.IsUnit)
                         .OrderBy(x => missile.GetAngle(x.Position))
                         .FirstOrDefault();

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

            return(unit.Equals(target));
        }
Пример #5
0
        // Token: 0x06000445 RID: 1093 RVA: 0x00017400 File Offset: 0x00015600
        public override bool CanHit(TargetManager targetManager, IComboModeMenu comboMenu)
        {
            Unit9            target          = targetManager.Target;
            PredictionInput9 predictionInput = base.Ability.GetPredictionInput(target, null);

            if (base.Ability.GetPredictionOutput(predictionInput).HitChance <= 0)
            {
                return(false);
            }
            if (target.Distance(base.Owner) < 300f || target.GetImmobilityDuration() > 0f)
            {
                return(true);
            }
            if (!target.Equals(this.lastTarget))
            {
                this.lastTarget   = target;
                this.rotationTime = Game.RawGameTime;
                this.rotation     = target.BaseUnit.NetworkRotationRad;
                return(false);
            }
            if ((double)Math.Abs(this.rotation - target.BaseUnit.NetworkRotationRad) > 0.1)
            {
                this.rotationTime = Game.RawGameTime;
                this.rotation     = target.BaseUnit.NetworkRotationRad;
                return(false);
            }
            MeatHookMenu abilitySettingsMenu = comboMenu.GetAbilitySettingsMenu <MeatHookMenu>(this);

            return(this.rotationTime + abilitySettingsMenu.Delay / 1000f <= Game.RawGameTime);
        }
Пример #6
0
        public override bool IsIntersecting(Unit9 unit, bool checkPrediction)
        {
            if (this.Projectile == null)
            {
                return(base.IsIntersecting(unit, checkPrediction));
            }

            return(unit.Equals(this.Target));
        }
        // Token: 0x06000961 RID: 2401 RVA: 0x00023104 File Offset: 0x00021304
        public override bool CanHit(Unit9 mainTarget, List <Unit9> aoeTargets, int minCount)
        {
            Hero9 other = (from x in EntityManager9.Heroes
                           where x.IsAlive && x.IsVisible && !x.IsMagicImmune && !x.IsInvulnerable && !x.IsAlly(base.Owner) && x.Distance(base.Owner) < this.Radius
                           orderby x.Distance(base.Owner)
                           select x).FirstOrDefault <Hero9>();

            return(mainTarget.Equals(other) && base.CanHit(mainTarget, aoeTargets, minCount));
        }
Пример #8
0
        public override bool CanBeCasted(Unit9 ally, Unit9 enemy, IObstacle obstacle)
        {
            if (!this.IsAbilityEnabled(obstacle))
            {
                return(false);
            }

            if (!this.CanBeCastedOnSelf && ally.Equals(this.Owner))
            {
                return(false);
            }

            if (!this.CanBeCastedOnAlly && !ally.Equals(this.Owner))
            {
                return(false);
            }

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

            if (!this.ActiveAbility.CanHit(ally))
            {
                return(false);
            }

            if (this.Owner.IsInvisible && this.Owner.IsImportant && !ally.Equals(this.Owner) && !this.Owner.CanUseAbilitiesInInvisibility &&
                !this.Owner.HasModifier("modifier_item_glimmer_cape_fade"))
            {
                return(false);
            }

            if (!string.IsNullOrEmpty(this.ModifierName) && ally.HasModifier(this.ModifierName))
            {
                return(false);
            }

            return(true);
        }
Пример #9
0
        public override bool CanBeCasted(Unit9 ally, Unit9 enemy, IObstacle obstacle)
        {
            if (!this.IsAbilityEnabled(obstacle))
            {
                return(false);
            }

            if (!ally.Equals(this.Owner))
            {
                return(false);
            }

            return(this.Ability.CanBeCasted(false));
        }
Пример #10
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);
        }
Пример #11
0
        public override bool CanHit(Unit9 mainTarget, List <Unit9> aoeTargets, int minCount)
        {
            var possibleTarget = EntityManager9.Heroes
                                 .Where(
                x => x.IsAlive && x.IsVisible && !x.IsMagicImmune && !x.IsInvulnerable && !x.IsAlly(this.Owner) &&
                x.Distance(this.Owner) < this.Radius)
                                 .OrderBy(x => x.Distance(this.Owner))
                                 .FirstOrDefault();

            if (!mainTarget.Equals(possibleTarget))
            {
                return(false);
            }

            return(base.CanHit(mainTarget, aoeTargets, minCount));
        }
 // Token: 0x06000079 RID: 121 RVA: 0x000094D4 File Offset: 0x000076D4
 private void OnUnitRemoved(Unit9 unit)
 {
     try
     {
         if (this.TargetLocked && !unit.IsAlly(this.Owner) && !(unit.Name != "npc_dota_phoenix_sun"))
         {
             Unit9 target = this.Target;
             if (target != null && target.Equals(unit))
             {
                 this.Target = EntityManager9.Heroes.FirstOrDefault((Hero9 x) => x.Id == HeroId.npc_dota_hero_phoenix);
             }
         }
     }
     catch (Exception ex)
     {
         Logger.Error(ex, null);
     }
 }
Пример #13
0
        public override bool CanBeCasted(Unit9 ally, Unit9 enemy, IObstacle obstacle)
        {
            if (obstacle.IsModifierObstacle && ally.Equals(this.Owner) && obstacle.EvadableAbility.Ability.Id == AbilityId.doom_bringer_doom &&
                this.armlet.Enabled)
            {
                return(this.Ability.IsUsable);
            }

            if (this.toggling.IsSleeping)
            {
                return(false);
            }

            if (!base.CanBeCasted(ally, enemy, obstacle))
            {
                return(false);
            }

            if (this.armlet.Enabled && this.IsAffectedByDot())
            {
                return(false);
            }

            var health = ally.Health;

            var damage = obstacle.GetDamage(ally);

            if (damage > 0 && health > damage + 100)
            {
                return(false);
            }

            if (this.armlet.Enabled)
            {
                health = Math.Max(health - ArmletHpGain, 1);
            }

            if (HpRestored(obstacle.GetEvadeTime(ally, false) - (TogglePing / 1000)) + health < damage)
            {
                return(false);
            }

            return(true);
        }
Пример #14
0
        public override bool Use(Unit9 ally, Unit9 enemy, IObstacle obstacle)
        {
            if (!base.Use(ally, enemy, obstacle))
            {
                return(false);
            }

            if (obstacle.EvadableAbility.Ability.Id == AbilityId.disruptor_glimpse)
            {
                var xReturn = this.Owner.Abilities.FirstOrDefault(x => x.Id == AbilityId.kunkka_return) as ActiveAbility;
                if (xReturn != null)
                {
                    var delay = (int)(obstacle.GetEvadeTime(ally, false) * 1000);
                    if (!ally.Equals(this.Owner))
                    {
                        delay -= (int)(xReturn.GetCastDelay() * 1000) - 100;
                    }

                    UpdateManager.BeginInvoke(
                        delay,
                        () =>
                    {
                        try
                        {
                            if (!xReturn.IsValid || !xReturn.CanBeCasted())
                            {
                                return;
                            }

                            xReturn.UseAbility(false, true);
                        }
                        catch (Exception e)
                        {
                            Logger.Error(e);
                        }
                    });
                }
            }

            return(true);
        }
Пример #15
0
        // Token: 0x060008A9 RID: 2217 RVA: 0x000271DC File Offset: 0x000253DC
        public override bool ShouldCast(Unit9 target)
        {
            if (target.IsInvulnerable)
            {
                return(false);
            }
            if (target.Equals(this.Buff.Owner))
            {
                if (!this.Buff.BuffsOwner)
                {
                    return(false);
                }
            }
            else if (!this.Buff.BuffsAlly)
            {
                return(false);
            }
            ToggleAbility toggleAbility;

            return((!target.IsMagicImmune || this.Buff.PiercesMagicImmunity(target)) && !target.HasModifier(this.Buff.BuffModifierName) && ((toggleAbility = (this.Buff as ToggleAbility)) == null || !toggleAbility.Enabled));
        }
Пример #16
0
        public override bool ShouldCast(Unit9 target)
        {
            if (target.IsInvulnerable)
            {
                return(false);
            }

            if (target.Equals(this.Shield.Owner))
            {
                if (!this.Shield.ShieldsOwner)
                {
                    return(false);
                }
            }
            else
            {
                if (!this.Shield.ShieldsAlly)
                {
                    return(false);
                }
            }

            if (target.IsMagicImmune && !this.Shield.PiercesMagicImmunity(target))
            {
                return(false);
            }

            if (target.HasModifier(this.Shield.ShieldModifierName))
            {
                return(false);
            }

            if (this.Shield is ToggleAbility toggle && toggle.Enabled)
            {
                return(false);
            }

            return(true);
        }
Пример #17
0
        // Token: 0x06000174 RID: 372 RVA: 0x0000D470 File Offset: 0x0000B670
        public override bool UseAbility(TargetManager targetManager, Sleeper comboSleeper, bool aoe)
        {
            Unit9 unit = this.shackleTarget ?? targetManager.Target;

            if (!base.Ability.UseAbility(unit, false, false))
            {
                return(false);
            }
            float num       = base.Ability.GetHitTime(unit) + 0.5f;
            float castDelay = base.Ability.GetCastDelay(unit);

            unit.SetExpectedUnitState(base.Disable.AppliesUnitState, num);
            Unit9 unit2 = this.shackleTarget;

            if (unit2 != null && !unit2.Equals(targetManager.Target))
            {
                targetManager.Target.SetExpectedUnitState(base.Disable.AppliesUnitState, num);
            }
            comboSleeper.Sleep(castDelay);
            base.OrbwalkSleeper.Sleep(castDelay);
            base.Sleeper.Sleep(num);
            this.shackleTarget = null;
            return(true);
        }
Пример #18
0
 // Token: 0x06000117 RID: 279 RVA: 0x0000BE9C File Offset: 0x0000A09C
 private void OnUpdateKillSteal()
 {
     if (Game.IsPaused)
     {
         return;
     }
     try
     {
         foreach (KeyValuePair <Unit9, Dictionary <KillStealAbility, int> > keyValuePair in this.targetDamage)
         {
             Unit9 key = keyValuePair.Key;
             float num = 0f;
             if (key.IsValid && key.IsVisible && key.IsAlive && !key.IsReflectingDamage && !key.IsInvulnerable)
             {
                 List <KillStealAbility> list = new List <KillStealAbility>();
                 foreach (KeyValuePair <KillStealAbility, int> keyValuePair2 in keyValuePair.Value)
                 {
                     KillStealAbility key2 = keyValuePair2.Key;
                     if (key2.Ability.IsValid)
                     {
                         int value = keyValuePair2.Value;
                         if ((this.AbilitySleeper.IsSleeping(key2.Ability.Handle) || key2.Ability.CanBeCasted(true)) && key2.CanHit(key) && key2.ShouldCast(key) && (!key2.Ability.UnitTargetCast || !key.IsBlockingAbilities))
                         {
                             list.Add(key2);
                             num += (float)value - key2.Ability.GetHitTime(key) * key.HealthRegeneration * 1.5f;
                             if (num >= key.Health && (!base.TargetManager.TargetLocked || key.Equals(base.TargetManager.Target)))
                             {
                                 this.Target = key;
                                 this.Kill(key, (from x in list
                                                 where x.Ability.CanBeCasted(true)
                                                 select x).ToList <KillStealAbility>());
                                 return;
                             }
                         }
                     }
                 }
             }
         }
         if (!this.KillStealSleeper.IsSleeping)
         {
             this.Target = null;
         }
     }
     catch (Exception ex)
     {
         Logger.Error(ex, null);
     }
 }
        // Token: 0x06000755 RID: 1877 RVA: 0x0002243C File Offset: 0x0002063C
        protected override void Execute()
        {
            if (this.sleeper.IsSleeping)
            {
                return;
            }
            Unit9 unit = this.ward;

            if (unit == null || !unit.IsValid || !this.ward.IsAlive)
            {
                return;
            }
            Vector3      fountain    = base.TargetManager.Fountain;
            Unit9        owner       = this.ward.Owner;
            HealingWard  healingWard = (HealingWard)owner.Abilities.First((Ability9 x) => x.Id == AbilityId.juggernaut_healing_ward);
            List <Unit9> list        = (from x in base.TargetManager.AllyHeroes
                                        where x.HealthPercentage < 90f || x.IsMyHero
                                        orderby x.HealthPercentage
                                        select x).ToList <Unit9>();
            Unit9 unit2 = (owner.HealthPercentage < 80f && owner.IsAlive) ? owner : list.FirstOrDefault <Unit9>();

            if (unit2 == null || !unit2.IsAlive)
            {
                return;
            }
            PredictionInput9 predictionInput = healingWard.GetPredictionInput(unit2, list);

            predictionInput.CastRange = 2000f;
            PredictionOutput9 predictionOutput = healingWard.GetPredictionOutput(predictionInput);

            if (predictionOutput.HitChance < 1)
            {
                return;
            }
            Vector3 vector = predictionOutput.CastPosition;

            if (predictionOutput.AoeTargetsHit.Count == 1)
            {
                vector = predictionOutput.TargetPosition;
            }
            if (!unit2.Equals(owner) || owner.HealthPercentage > 50f)
            {
                foreach (Unit9 unit3 in from x in base.TargetManager.EnemyHeroes
                         orderby x.GetAttackRange(null, 0f) descending
                         select x)
                {
                    float num = unit3.GetAttackRange(null, 0f) * (unit3.IsRanged ? 2f : 3f);
                    if (unit3.Distance(vector) <= num)
                    {
                        vector = unit2.InFront(5f, 0f, false);
                        break;
                    }
                }
            }
            if (this.ward.Position == vector)
            {
                return;
            }
            this.ward.BaseUnit.Move(vector);
            this.sleeper.Sleep(0.15f);
        }
Пример #20
0
 public override bool IsIntersecting(Unit9 unit, bool checkPrediction)
 {
     return(unit.Equals(this.Target));
 }
Пример #21
0
 public override bool ShouldCast(Unit9 target)
 {
     return(target.Equals(this.Ability.Owner));
 }