// Token: 0x060005E3 RID: 1507 RVA: 0x0001D490 File Offset: 0x0001B690
        public override bool UseAbility(TargetManager targetManager, Sleeper comboSleeper, bool aoe)
        {
            if (aoe)
            {
                PredictionInput9 predictionInput = base.Ability.GetPredictionInput(targetManager.Target, (from x in EntityManager9.Units
                                                                                                          where x.IsUnit && !x.IsAlly(base.Owner) && x.IsAlive && x.IsVisible && !x.IsMagicImmune && !x.IsInvulnerable
                                                                                                          select x).ToList <Unit9>());
                PredictionOutput9 predictionOutput = base.Ability.GetPredictionOutput(predictionInput);
                if (predictionOutput.HitChance < 1)
                {
                    return(false);
                }
                if (!base.Ability.UseAbility(predictionOutput.CastPosition, false, false))
                {
                    return(false);
                }
            }
            else if (!base.Ability.UseAbility(targetManager.Target, 1, false, false))
            {
                return(false);
            }
            float castDelay = base.Ability.GetCastDelay(targetManager.Target);

            comboSleeper.Sleep(castDelay);
            base.Sleeper.Sleep(castDelay + 0.5f);
            base.OrbwalkSleeper.Sleep(castDelay);
            return(true);
        }
Пример #2
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);
        }
Пример #3
0
        // Token: 0x060007B5 RID: 1973 RVA: 0x00023558 File Offset: 0x00021758
        public override bool ShouldConditionCast(TargetManager targetManager, IComboModeMenu menu, List <UsableAbility> usableAbilities)
        {
            Chronosphere chronosphere = (Chronosphere)usableAbilities.Find((UsableAbility x) => x.Ability.Id == AbilityId.faceless_void_chronosphere);

            if (chronosphere == null)
            {
                if (base.Owner.Distance(targetManager.Target) < 300f)
                {
                    return(false);
                }
                this.blinkPosition = Vector3.Zero;
                return(true);
            }
            else
            {
                PredictionInput9 predictionInput = chronosphere.Ability.GetPredictionInput(targetManager.Target, EntityManager9.EnemyHeroes);
                predictionInput.CastRange += base.Ability.CastRange;
                predictionInput.Range     += base.Ability.CastRange;
                PredictionOutput9 predictionOutput = chronosphere.Ability.GetPredictionOutput(predictionInput);
                if (predictionOutput.HitChance < 1 || predictionOutput.AoeTargetsHit.Count < chronosphere.TargetsToHit(menu))
                {
                    return(false);
                }
                float num = Math.Min(base.Ability.CastRange, base.Owner.Distance(predictionOutput.CastPosition) - 200f);
                this.blinkPosition = Vector3Extensions.Extend2D(base.Owner.Position, predictionOutput.CastPosition, num);
                return(base.Owner.Distance(this.blinkPosition) <= base.Ability.CastRange);
            }
        }
Пример #4
0
        // Token: 0x06000681 RID: 1665 RVA: 0x0001F880 File Offset: 0x0001DA80
        public override bool UseAbility(TargetManager targetManager, Sleeper comboSleeper, bool aoe)
        {
            Unit9    target  = targetManager.Target;
            Ability9 ability = base.Owner.Abilities.FirstOrDefault((Ability9 x) => x.Id == AbilityId.earthshaker_echo_slam);

            if (ability != null && ability.TimeSinceCasted < 1f)
            {
                if (!base.Ability.UseAbility(target, targetManager.EnemyHeroes, 1, 0, false, false))
                {
                    return(false);
                }
            }
            else
            {
                Vector3           enemyFountain    = targetManager.EnemyFountain;
                PredictionInput9  predictionInput  = base.Ability.GetPredictionInput(target, null);
                PredictionOutput9 predictionOutput = base.Ability.GetPredictionOutput(predictionInput);
                if (predictionOutput.HitChance < 1)
                {
                    return(false);
                }
                if (!base.Ability.UseAbility(Vector3Extensions.Extend2D(predictionOutput.CastPosition, enemyFountain, 200f), false, false))
                {
                    return(false);
                }
            }
            float num       = base.Ability.GetHitTime(targetManager.Target) + 0.5f;
            float castDelay = base.Ability.GetCastDelay(targetManager.Target);

            targetManager.Target.SetExpectedUnitState(base.Disable.AppliesUnitState, num);
            comboSleeper.Sleep(castDelay);
            base.OrbwalkSleeper.Sleep(castDelay);
            base.Sleeper.Sleep(num);
            return(true);
        }
        // Token: 0x06000305 RID: 773 RVA: 0x0001246C File Offset: 0x0001066C
        public override bool UseAbility(TargetManager targetManager, Sleeper comboSleeper, bool aoe)
        {
            Unit9   target    = targetManager.Target;
            Vector3 position  = target.Position;
            Vector3 position2 = base.Owner.Position;
            float   num       = base.Owner.Distance(target);

            if (num > this.menuMaxCastRange)
            {
                return(false);
            }
            Ability9         ability         = base.Owner.Abilities.FirstOrDefault((Ability9 x) => x.Id == AbilityId.storm_spirit_static_remnant);
            Ability9         ability2        = base.Owner.Abilities.FirstOrDefault((Ability9 x) => x.Id == AbilityId.storm_spirit_electric_vortex);
            float            attackRange     = base.Owner.GetAttackRange(target, 0f);
            bool             flag            = num < attackRange;
            float            maxCastRange    = this.ball.MaxCastRange;
            PredictionInput9 predictionInput = base.Ability.GetPredictionInput(targetManager.Target, null);

            predictionInput.CastRange = maxCastRange;
            predictionInput.Range     = maxCastRange;
            predictionInput.Radius    = 1f;
            predictionInput.Delay    += 0.3f;
            Vector3 castPosition = base.Ability.GetPredictionOutput(predictionInput).CastPosition;

            if (ability != null && ability.CanBeCasted(true) && num > 200f)
            {
                if (((target.GetImmobilityDuration() > 0.5f && !target.HasModifier("modifier_storm_spirit_electric_vortex_pull")) || !base.Owner.IsVisibleToEnemies) && (float)this.ball.GetRemainingMana(castPosition) > ability.ManaCost)
                {
                    return(this.UseAbility(targetManager, comboSleeper, castPosition));
                }
                if (ability2 != null && ability2.CanBeCasted(true) && (float)this.ball.GetRemainingMana(castPosition) > ability.ManaCost + ability2.ManaCost && target.GetAngle(position2, false) > 1.5f)
                {
                    return(this.UseAbility(targetManager, comboSleeper, castPosition));
                }
            }
            if (!flag)
            {
                Vector3 toPosition = Vector3Extensions.Extend2D(castPosition, position2, attackRange - 100f);
                return(this.UseAbility(targetManager, comboSleeper, toPosition));
            }
            if (!this.maxDamage || !base.Owner.CanAttack(target, 0f))
            {
                return(false);
            }
            if (target.IsRanged || target.GetAngle(base.Owner, false) > 1f)
            {
                Vector3 vector      = Vector3Extensions.Extend2D(castPosition, position2, attackRange - 50f);
                Vector3 vector2     = Vector3Extensions.Extend2D(position2, castPosition, 100f);
                Vector3 toPosition2 = (castPosition.Distance2D(vector, false) < castPosition.Distance2D(vector2, false)) ? vector : vector2;
                return(this.UseAbility(targetManager, comboSleeper, toPosition2));
            }
            if (!target.IsStunned && !target.IsDisarmed)
            {
                Vector3 vector3     = Vector3Extensions.Extend2D(position, position2, attackRange - 100f);
                Vector3 vector4     = Vector3Extensions.Extend2D(position, position2, 300f);
                Vector3 toPosition3 = (position2.Distance2D(vector3, false) < position2.Distance2D(vector4, false)) ? vector3 : vector4;
                return(this.UseAbility(targetManager, comboSleeper, toPosition3));
            }
            return(false);
        }
Пример #6
0
        // Token: 0x06000818 RID: 2072 RVA: 0x00025094 File Offset: 0x00023294
        public override bool UseAbility(TargetManager targetManager, Sleeper comboSleeper, bool aoe)
        {
            Unit9             target           = targetManager.Target;
            PredictionInput9  predictionInput  = this.GetPredictionInput(target);
            PredictionOutput9 predictionOutput = base.Ability.GetPredictionOutput(predictionInput);

            if (predictionOutput.HitChance < 1)
            {
                return(false);
            }
            foreach (Unit9 unit in from x in EntityManager9.Units
                     where x.Name == "npc_dota_earth_spirit_stone" && x.Distance(base.Owner) < base.Ability.CastRange && x.IsAlive
                     select x)
            {
                if (new Polygon.Rectangle(Vector3Extensions.Extend2D(base.Owner.Position, predictionOutput.TargetPosition, -100f), Vector3Extensions.Extend2D(base.Owner.Position, predictionOutput.TargetPosition, base.Ability.Range), base.Ability.Radius).IsInside(unit.Position) && base.Ability.UseAbility(predictionOutput.CastPosition, false, false))
                {
                    float castDelay = base.Ability.GetCastDelay(targetManager.Target);
                    comboSleeper.Sleep(castDelay);
                    base.Sleeper.Sleep(castDelay + 0.5f);
                    base.OrbwalkSleeper.Sleep(castDelay);
                    return(true);
                }
            }
            return(false);
        }
Пример #7
0
        // Token: 0x060009DA RID: 2522 RVA: 0x0002ACC4 File Offset: 0x00028EC4
        public override bool UseAbility(TargetManager targetManager, Sleeper comboSleeper, bool aoe)
        {
            if (!this.iceBlast.IsUsable)
            {
                return(false);
            }
            PredictionInput9 predictionInput = base.Ability.GetPredictionInput(targetManager.Target, targetManager.EnemyHeroes);

            predictionInput.Delay += this.iceBlast.GetReleaseFlyTime(targetManager.Target.Position);
            PredictionOutput9 predictionOutput = base.Ability.GetPredictionOutput(predictionInput);

            if (predictionOutput.HitChance < 1)
            {
                return(false);
            }
            if (!base.Ability.UseAbility(predictionOutput.CastPosition, false, false))
            {
                return(false);
            }
            this.direction = Vector3Extensions.Extend2D(base.Owner.Position, predictionOutput.CastPosition, 9999f);
            float castDelay = base.Ability.GetCastDelay(targetManager.Target);

            comboSleeper.Sleep(castDelay);
            base.Sleeper.Sleep(castDelay + 0.1f);
            base.OrbwalkSleeper.Sleep(castDelay);
            return(true);
        }
Пример #8
0
        //todo fix this shit prediction

        public PredictionOutput9 GetPrediction(PredictionInput9 input)
        {
            var output = this.GetSimplePrediction(input);

            if (input.AreaOfEffect)
            {
                this.GetAreaOfEffectPrediction(input, output);
            }
            else if (input.SkillShotType == SkillShotType.AreaOfEffect)
            {
                output.CastPosition = input.CastRange > 0 ? input.Caster.InFront(input.CastRange) : input.Caster.Position;
            }

            GetProperCastPosition(input, output);

            if (input.SkillShotType == SkillShotType.Line && !input.AreaOfEffect && input.UseBlink)
            {
                output.BlinkLinePosition = output.TargetPosition.Extend2D(input.Caster.Position, 200);
                output.CastPosition      = output.TargetPosition;
            }

            if (!CheckRange(input, output))
            {
                return(output);
            }

            this.CheckCollision(input, output);

            return(output);
        }
Пример #9
0
        // Token: 0x0600081E RID: 2078 RVA: 0x000251CC File Offset: 0x000233CC
        public override bool ForceUseAbility(TargetManager targetManager, Sleeper comboSleeper)
        {
            Unit9             target           = targetManager.Target;
            PredictionInput9  predictionInput  = base.Ability.GetPredictionInput(target, null);
            PredictionOutput9 predictionOutput = base.Ability.GetPredictionOutput(predictionInput);

            if (predictionOutput.HitChance < 1)
            {
                return(false);
            }
            foreach (Unit9 unit in from x in EntityManager9.Units
                     where x.IsUnit && (!x.IsHero || x.IsIllusion) && x.Distance(base.Owner) < base.Ability.CastRange && x.IsAlive
                     select x)
            {
                predictionInput.Caster = unit;
                predictionOutput       = base.Ability.GetPredictionOutput(predictionInput);
                if (new Polygon.Rectangle(base.Owner.Position, unit.Position, base.Ability.Radius).IsInside(predictionOutput.TargetPosition) && base.Ability.UseAbility(unit, false, false))
                {
                    float castDelay = base.Ability.GetCastDelay(targetManager.Target);
                    comboSleeper.Sleep(castDelay);
                    base.Sleeper.Sleep(castDelay + 0.5f);
                    base.OrbwalkSleeper.Sleep(castDelay);
                    return(true);
                }
            }
            return(false);
        }
Пример #10
0
        // Token: 0x06000045 RID: 69 RVA: 0x0000F570 File Offset: 0x0000D770
        public PredictionOutput9 GetPrediction(PredictionInput9 input)
        {
            PredictionOutput9 simplePrediction = this.GetSimplePrediction(input);

            if (input.AreaOfEffect)
            {
                this.GetAreaOfEffectPrediction(input, simplePrediction);
            }
            else if (input.SkillShotType == SkillShotType.AreaOfEffect)
            {
                simplePrediction.CastPosition = ((input.CastRange > 0f) ? input.Caster.InFront(input.CastRange, 0f, true) : input.Caster.Position);
            }
            PredictionManager9.GetProperCastPosition(input, simplePrediction);
            if (input.SkillShotType == SkillShotType.Line && !input.AreaOfEffect && input.UseBlink)
            {
                simplePrediction.BlinkLinePosition = simplePrediction.TargetPosition.Extend2D(input.Caster.Position, 200f);
                simplePrediction.CastPosition      = simplePrediction.TargetPosition;
            }
            if (!PredictionManager9.CheckRange(input, simplePrediction))
            {
                return(simplePrediction);
            }
            this.CheckCollision(input, simplePrediction);
            return(simplePrediction);
        }
Пример #11
0
        // Token: 0x06000826 RID: 2086 RVA: 0x0002556C File Offset: 0x0002376C
        public override bool UseAbility(TargetManager targetManager, Sleeper comboSleeper, bool aoe)
        {
            Unit9            target          = targetManager.Target;
            float            distance        = base.Owner.Distance(target);
            PredictionInput9 predictionInput = base.Ability.GetPredictionInput(target, null);

            if (EntityManager9.Units.Any((Unit9 x) => x.Name == "npc_dota_earth_spirit_stone" && x.Distance(this.Owner) < distance && x.Distance(this.Owner) < 350f && x.IsAlive && Vector3Extensions.AngleBetween(this.Owner.Position, x.Position, target.Position) < 75f))
            {
                predictionInput.Speed     *= 2f;
                predictionInput.CastRange *= 2f;
                predictionInput.Range     *= 2f;
            }
            else if (distance > 350f)
            {
                return(false);
            }
            PredictionOutput9 predictionOutput = base.Ability.GetPredictionOutput(predictionInput);

            if (predictionOutput.HitChance < 1)
            {
                return(false);
            }
            if (!base.Ability.UseAbility(predictionOutput.CastPosition, false, false))
            {
                return(false);
            }
            float castDelay = base.Ability.GetCastDelay(targetManager.Target);

            comboSleeper.Sleep(castDelay);
            base.Sleeper.Sleep(castDelay + 0.5f);
            base.OrbwalkSleeper.Sleep(castDelay);
            return(true);
        }
Пример #12
0
        // Token: 0x06000819 RID: 2073 RVA: 0x000060AB File Offset: 0x000042AB
        private PredictionInput9 GetPredictionInput(Unit9 target)
        {
            PredictionInput9 predictionInput = base.Ability.GetPredictionInput(target, null);

            predictionInput.SkillShotType = 3;
            return(predictionInput);
        }
Пример #13
0
        // Token: 0x0600107A RID: 4218 RVA: 0x00028E60 File Offset: 0x00027060
        public override bool UseAbility(Unit9 mainTarget, List <Unit9> aoeTargets, HitChance minimumChance, int minAOETargets = 0, bool queue = false, bool bypass = false)
        {
            PredictionInput9  predictionInput  = this.GetPredictionInput(mainTarget, aoeTargets);
            PredictionOutput9 predictionOutput = this.GetPredictionOutput(predictionInput);

            return(predictionOutput.AoeTargetsHit.Count >= minAOETargets && predictionOutput.HitChance >= minimumChance && this.UseAbility(predictionOutput.CastPosition, queue, bypass));
        }
Пример #14
0
        // Token: 0x06000831 RID: 2097 RVA: 0x000258F4 File Offset: 0x00023AF4
        public override bool UseAbility(TargetManager targetManager, Sleeper comboSleeper, bool aoe)
        {
            Unit9    target   = targetManager.Target;
            Modifier modifier = target.GetModifier("modifier_earth_spirit_magnetize");

            if (modifier == null || modifier.RemainingTime > 0.75f)
            {
                return(false);
            }
            List <Unit9> list = (from x in targetManager.EnemyHeroes
                                 where x.HasModifier("modifier_earth_spirit_magnetize")
                                 select x).ToList <Unit9>();
            PredictionInput9 predictionInput = base.Ability.GetPredictionInput(target, list);

            predictionInput.Radius        = 400f;
            predictionInput.AreaOfEffect  = true;
            predictionInput.SkillShotType = 4;
            PredictionOutput9 predictionOutput = base.Ability.GetPredictionOutput(predictionInput);

            if (predictionOutput.HitChance < 1)
            {
                return(false);
            }
            if (!base.Ability.UseAbility(predictionOutput.CastPosition, false, false))
            {
                return(false);
            }
            float castDelay = base.Ability.GetCastDelay(targetManager.Target);

            comboSleeper.Sleep(castDelay + 0.1f);
            base.Sleeper.Sleep(1f);
            base.OrbwalkSleeper.Sleep(castDelay);
            return(true);
        }
        // Token: 0x0600090A RID: 2314 RVA: 0x00028704 File Offset: 0x00026904
        public override bool Use(Unit9 target)
        {
            PredictionInput9  predictionInput  = base.Ability.GetPredictionInput(target, null);
            PredictionOutput9 predictionOutput = base.Ability.GetPredictionOutput(predictionInput);

            if (!target.IsMoving && base.Owner.Distance(target) < base.Ability.CastRange + 140f)
            {
                if (!base.Ability.UseAbility(Vector3Extensions.Extend2D(predictionOutput.CastPosition, base.Owner.Position, 150f), false, false))
                {
                    return(false);
                }
                base.OrbwalkSleeper.Sleep(base.Ability.Owner.Handle, base.Ability.GetCastDelay(target));
                base.AbilitySleeper.Sleep(base.Ability.Handle, 2f);
                return(true);
            }
            else
            {
                if (!base.Ability.UseAbility(predictionOutput.CastPosition, false, false))
                {
                    return(false);
                }
                base.OrbwalkSleeper.Sleep(base.Ability.Owner.Handle, base.Ability.GetCastDelay(target));
                base.AbilitySleeper.Sleep(base.Ability.Handle, 2f);
                return(true);
            }
        }
Пример #16
0
        // Token: 0x0600108E RID: 4238 RVA: 0x0000E89C File Offset: 0x0000CA9C
        public override PredictionInput9 GetPredictionInput(Unit9 target, List <Unit9> aoeTargets = null)
        {
            PredictionInput9 predictionInput = base.GetPredictionInput(target, aoeTargets);

            predictionInput.EndRadius = this.EndRadius;
            return(predictionInput);
        }
        // Token: 0x06000ABD RID: 2749 RVA: 0x000247F8 File Offset: 0x000229F8
        public override bool UseAbility(Unit9 target, HitChance minimumChance, bool queue = false, bool bypass = false)
        {
            PredictionInput9  predictionInput  = this.GetPredictionInput(target, null);
            PredictionOutput9 predictionOutput = this.GetPredictionOutput(predictionInput);

            return(predictionOutput.HitChance >= minimumChance && this.UseAbility(predictionOutput.BlinkLinePosition, predictionOutput.CastPosition, queue, bypass));
        }
Пример #18
0
 // Token: 0x06000047 RID: 71 RVA: 0x0000F754 File Offset: 0x0000D954
 private static bool CheckRange(PredictionInput9 input, PredictionOutput9 output)
 {
     if (input.Radius >= 9999999f || input.Range >= 9999999f)
     {
         return(true);
     }
     if (input.SkillShotType == SkillShotType.AreaOfEffect)
     {
         if (output.TargetPosition.Distance2D(output.CastPosition, false) > input.Radius)
         {
             output.HitChance = HitChance.Impossible;
             return(false);
         }
         return(true);
     }
     else if (input.UseBlink && input.SkillShotType == SkillShotType.Line)
     {
         if (input.Caster.Distance(output.CastPosition) > input.CastRange + input.Range)
         {
             output.HitChance = HitChance.Impossible;
             return(false);
         }
         return(true);
     }
     else
     {
         if (input.Caster.Distance(output.CastPosition) > input.CastRange && (input.SkillShotType == SkillShotType.RangedAreaOfEffect || input.Caster.Distance(output.TargetPosition) > input.Range))
         {
             output.HitChance = HitChance.Impossible;
             return(false);
         }
         return(true);
     }
 }
Пример #19
0
        // Token: 0x06000A3B RID: 2619 RVA: 0x000093DB File Offset: 0x000075DB
        public override PredictionInput9 GetPredictionInput(Unit9 target, List <Unit9> aoeTargets = null)
        {
            PredictionInput9 predictionInput = base.GetPredictionInput(target, aoeTargets);

            predictionInput.Delay += this.GhostshipDistance / this.Speed;
            predictionInput.Speed  = 0f;
            return(predictionInput);
        }
        // Token: 0x06000ABC RID: 2748 RVA: 0x00009B08 File Offset: 0x00007D08
        public override PredictionInput9 GetPredictionInput(Unit9 target, List <Unit9> aoeTargets = null)
        {
            PredictionInput9 predictionInput = base.GetPredictionInput(target, aoeTargets);

            predictionInput.UseBlink     = true;
            predictionInput.AreaOfEffect = false;
            return(predictionInput);
        }
Пример #21
0
        // Token: 0x06000CA0 RID: 3232 RVA: 0x0000B58E File Offset: 0x0000978E
        public override PredictionInput9 GetPredictionInput(Unit9 target, List <Unit9> aoeTargets = null)
        {
            PredictionInput9 predictionInput = base.GetPredictionInput(target, aoeTargets);

            predictionInput.CastRange -= 100f;
            predictionInput.Range     -= 100f;
            return(predictionInput);
        }
Пример #22
0
        public PredictionOutput9 GetSimplePrediction(PredictionInput9 input)
        {
            var target          = input.Target;
            var targetPosition  = input.Target.Position;
            var caster          = input.Caster;
            var targetIsVisible = target.IsVisible;
            var totalDelay      = input.Delay;

            var output = new PredictionOutput9
            {
                Target = target
            };

            if (target.Equals(caster))
            {
                output.HitChance      = HitChance.High;
                output.TargetPosition = targetPosition;
                output.CastPosition   = targetPosition;
                return(output);
            }

            if (input.RequiresToTurn)
            {
                totalDelay += caster.GetTurnTime(targetPosition);
            }

            if (input.Speed > 0)
            {
                totalDelay += caster.Distance(targetPosition) / input.Speed;
            }

            var predicted = target.GetPredictedPosition(totalDelay);

            output.TargetPosition = predicted;
            output.CastPosition   = predicted;

            if (!targetIsVisible)
            {
                output.HitChance = HitChance.Low;
                return(output);
            }

            if (target.IsStunned || target.IsRooted || target.IsHexed)
            {
                output.HitChance = HitChance.Immobile;
                return(output);
            }

            if (!target.IsMoving && !caster.IsVisibleToEnemies)
            {
                output.HitChance = HitChance.High;
                return(output);
            }

            output.HitChance = totalDelay > 0.5f ? HitChance.Medium : HitChance.High;
            return(output);
        }
Пример #23
0
 // Token: 0x06000049 RID: 73 RVA: 0x0000F924 File Offset: 0x0000DB24
 private void CheckCollision(PredictionInput9 input, PredictionOutput9 output)
 {
     if (input.CollisionTypes != CollisionTypes.None)
     {
         Unit9                  caster    = input.Caster;
         float                  scanRange = caster.Distance(output.CastPosition);
         List <Unit9>           list      = new List <Unit9>();
         List <CollisionObject> list2     = new List <CollisionObject>();
         List <Unit9>           source    = (from x in EntityManager9.Units
                                             where x.IsUnit && !x.Equals(caster) && !x.Equals(input.Target) && x.IsAlive && x.IsVisible && x.Distance(caster) < scanRange
                                             select x).ToList <Unit9>();
         if ((input.CollisionTypes & CollisionTypes.AllyCreeps) == CollisionTypes.AllyCreeps)
         {
             list.AddRange(from x in source
                           where x.IsAlly(caster)
                           select x);
         }
         if ((input.CollisionTypes & CollisionTypes.EnemyCreeps) == CollisionTypes.EnemyCreeps)
         {
             list.AddRange(from x in source
                           where !x.IsAlly(caster)
                           select x);
         }
         if ((input.CollisionTypes & CollisionTypes.AllyHeroes) == CollisionTypes.AllyHeroes)
         {
             list.AddRange(from x in source
                           where x.IsHero && x.IsAlly(caster)
                           select x);
         }
         if ((input.CollisionTypes & CollisionTypes.EnemyHeroes) == CollisionTypes.EnemyHeroes)
         {
             list.AddRange(from x in source
                           where x.IsHero && !x.IsAlly(caster)
                           select x);
         }
         foreach (Unit9 unit in list)
         {
             PredictionInput9 input2 = new PredictionInput9
             {
                 Target         = unit,
                 Caster         = input.Caster,
                 Delay          = input.Delay,
                 Speed          = input.Speed,
                 CastRange      = input.CastRange,
                 Radius         = input.Radius,
                 RequiresToTurn = input.RequiresToTurn
             };
             PredictionOutput9 simplePrediction = this.GetSimplePrediction(input2);
             list2.Add(new CollisionObject(unit, simplePrediction.TargetPosition, unit.HullRadius + 10f));
         }
         if (Collision.GetCollision(caster.Position.ToVector2(), output.CastPosition.ToVector2(), input.Radius, list2).Collides)
         {
             output.HitChance = HitChance.Impossible;
         }
     }
 }
Пример #24
0
        // Token: 0x0600107F RID: 4223 RVA: 0x00023C28 File Offset: 0x00021E28
        public override bool CanHit(Unit9 target)
        {
            if (target.IsMagicImmune && ((target.IsEnemy(base.Owner) && !this.CanHitSpellImmuneEnemy) || (target.IsAlly(base.Owner) && !this.CanHitSpellImmuneAlly)))
            {
                return(false);
            }
            PredictionInput9 predictionInput = this.GetPredictionInput(target, null);

            return(this.GetPredictionOutput(predictionInput).HitChance > HitChance.Impossible);
        }
        // Token: 0x06000CFC RID: 3324 RVA: 0x00026080 File Offset: 0x00024280
        public override PredictionInput9 GetPredictionInput(Unit9 target, List <Unit9> aoeTargets = null)
        {
            PredictionInput9 predictionInput = base.GetPredictionInput(target, aoeTargets);

            if (predictionInput.CastRange > 0f)
            {
                predictionInput.CastRange -= predictionInput.Radius;
                predictionInput.Range     -= predictionInput.Radius;
            }
            return(predictionInput);
        }
Пример #26
0
        // Token: 0x06000343 RID: 835 RVA: 0x0001317C File Offset: 0x0001137C
        public override bool CanHit(TargetManager targetManager, IComboModeMenu comboMenu)
        {
            Unit9 target = targetManager.Target;

            if (target.IsMagicImmune)
            {
                return(false);
            }
            PredictionInput9 predictionInput = base.Ability.GetPredictionInput(target, null);

            return(base.Ability.GetPredictionOutput(predictionInput).HitChance > 0);
        }
Пример #27
0
        // Token: 0x06001080 RID: 4224 RVA: 0x00028EAC File Offset: 0x000270AC
        public override bool CanHit(Unit9 mainTarget, List <Unit9> aoeTargets, int minCount)
        {
            PredictionInput9  predictionInput  = this.GetPredictionInput(mainTarget, aoeTargets);
            PredictionOutput9 predictionOutput = this.GetPredictionOutput(predictionInput);

            if (predictionOutput.HitChance <= HitChance.Impossible)
            {
                return(false);
            }
            int num = aoeTargets.Count((Unit9 x) => x.IsMagicImmune && ((x.IsEnemy(base.Owner) && !this.CanHitSpellImmuneEnemy) || (x.IsAlly(base.Owner) && !this.CanHitSpellImmuneAlly)));

            return(predictionOutput.AoeTargetsHit.Count - num >= minCount);
        }
Пример #28
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);
        }
        // Token: 0x060008E4 RID: 2276 RVA: 0x00027EE0 File Offset: 0x000260E0
        public override bool Use(Unit9 target)
        {
            PredictionInput9 predictionInput = base.Ability.GetPredictionInput(target, null);

            predictionInput.Delay += 0.5f;
            PredictionOutput9 predictionOutput = base.Ability.GetPredictionOutput(predictionInput);

            if (!base.Ability.UseAbility(predictionOutput.CastPosition, false, false))
            {
                return(false);
            }
            base.OrbwalkSleeper.Sleep(base.Ability.Owner.Handle, base.Ability.GetCastDelay(target));
            base.AbilitySleeper.Sleep(base.Ability.Handle, 2f);
            return(true);
        }
        // Token: 0x06000A11 RID: 2577 RVA: 0x0002BD14 File Offset: 0x00029F14
        public bool UseBlinkLineCombo(BlinkAbility blink, UsableAbility ability)
        {
            if (!this.CanBeCasted(ability, false, true, true, true) || !this.CanBeCasted(blink, true, true, true, true))
            {
                return(false);
            }
            LineAbility lineAbility;

            if ((lineAbility = (ability.Ability as LineAbility)) == null)
            {
                return(false);
            }
            Unit9 target = this.TargetManager.Target;
            float num    = lineAbility.CastRange;

            if (blink.Ability.CastRange < num)
            {
                num = blink.Ability.CastRange - 100f;
            }
            if (lineAbility.Owner.Distance(target) < num)
            {
                return(false);
            }
            PredictionInput9 predictionInput = lineAbility.GetPredictionInput(target, this.TargetManager.EnemyHeroes);

            predictionInput.CastRange = blink.Ability.Range;
            predictionInput.Range     = lineAbility.CastRange;
            predictionInput.UseBlink  = true;
            PredictionOutput9 predictionOutput = lineAbility.GetPredictionOutput(predictionInput);

            if (predictionOutput.HitChance < 1)
            {
                return(false);
            }
            Vector3 blinkLinePosition = predictionOutput.BlinkLinePosition;

            if (blink.Ability.UseAbility(blinkLinePosition, false, false) && lineAbility.UseAbility(predictionOutput.CastPosition, false, false))
            {
                float castDelay = ability.Ability.GetCastDelay(predictionOutput.CastPosition);
                this.comboSleeper.Sleep(castDelay + 0.3f);
                this.orbwalkSleeper.Sleep(castDelay + 0.5f);
                ability.Sleeper.Sleep(castDelay + 0.5f);
                blink.Sleeper.Sleep(castDelay + 0.5f);
                return(true);
            }
            return(false);
        }