示例#1
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);
        }
示例#2
0
        // Token: 0x06001082 RID: 4226 RVA: 0x00028F2C File Offset: 0x0002712C
        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(queue, bypass));
        }
        // 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);
        }
示例#4
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);
        }
示例#5
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);
        }
示例#6
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);
        }
        // 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));
        }
示例#8
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);
        }
示例#9
0
        // Token: 0x0600057F RID: 1407 RVA: 0x0001BEC4 File Offset: 0x0001A0C4
        internal bool UseAbilityIfCondition(TargetManager targetManager, Sleeper comboSleeper, ComboModeMenu menu, ReversePolarity polarity, bool blink, bool force)
        {
            if (blink || force || polarity == null)
            {
                return(false);
            }
            PredictionInput9 predictionInput = polarity.Ability.GetPredictionInput(targetManager.Target, targetManager.EnemyHeroes);

            predictionInput.Delay        += base.Ability.CastPoint + 0.5f;
            predictionInput.Range        += base.Ability.CastRange;
            predictionInput.CastRange     = base.Ability.CastRange;
            predictionInput.SkillShotType = 4;
            PredictionOutput9 predictionOutput = polarity.Ability.GetPredictionOutput(predictionInput);

            if (predictionOutput.HitChance < 1 || predictionOutput.AoeTargetsHit.Count < polarity.TargetsToHit(menu))
            {
                return(false);
            }
            Vector3 castPosition = predictionOutput.CastPosition;

            if (base.Owner.Distance(castPosition) > base.Ability.CastRange)
            {
                return(false);
            }
            float castDelay = base.Ability.GetCastDelay(targetManager.Target);

            comboSleeper.Sleep(base.Ability.GetHitTime(targetManager.Target));
            base.Sleeper.Sleep(castDelay + 0.5f);
            base.OrbwalkSleeper.Sleep(castDelay);
            return(base.Ability.UseAbility(castPosition, false, false));
        }
示例#10
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);
            }
        }
        // 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);
            }
        }
        // Token: 0x060004B4 RID: 1204 RVA: 0x00018BC8 File Offset: 0x00016DC8
        public override bool UseAbility(TargetManager targetManager, Sleeper comboSleeper, bool aoe)
        {
            PredictionInput9 predictionInput = base.Ability.GetPredictionInput(targetManager.Target, targetManager.EnemyHeroes);

            predictionInput.CastRange    = base.Ability.CastRange;
            predictionInput.Range        = base.Ability.Range;
            predictionInput.UseBlink     = true;
            predictionInput.AreaOfEffect = true;
            PredictionOutput9 predictionOutput = base.Ability.GetPredictionOutput(predictionInput);

            if (predictionOutput.HitChance < 1 || base.Owner.Distance(predictionOutput.TargetPosition) > base.Ability.CastRange + 100f)
            {
                return(false);
            }
            if (!this.swashbuckle.UseAbility(predictionOutput.BlinkLinePosition, predictionOutput.CastPosition, false, false))
            {
                return(false);
            }
            float hitTime = base.Ability.GetHitTime(targetManager.Target);

            comboSleeper.Sleep(hitTime);
            base.Sleeper.Sleep(hitTime + 0.5f);
            base.OrbwalkSleeper.Sleep(hitTime);
            return(true);
        }
示例#13
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);
     }
 }
        // Token: 0x060002A5 RID: 677 RVA: 0x00010E94 File Offset: 0x0000F094
        public override bool ShouldConditionCast(TargetManager targetManager, IComboModeMenu menu, List <UsableAbility> usableAbilities)
        {
            Unit9 target = targetManager.Target;

            if (base.Owner.Distance(target) < 600f)
            {
                return(false);
            }
            if (usableAbilities.FirstOrDefault((UsableAbility x) => x.Ability.Id == AbilityId.shredder_timber_chain) == null)
            {
                return(true);
            }
            this.blinkPosition = target.Position;
            UsableAbility usableAbility = usableAbilities.FirstOrDefault((UsableAbility x) => x.Ability.Id == AbilityId.shredder_whirling_death);

            if (usableAbility != null)
            {
                PredictionInput9 predictionInput = usableAbility.Ability.GetPredictionInput(target, targetManager.EnemyHeroes);
                predictionInput.Range        += base.Ability.CastRange;
                predictionInput.CastRange     = base.Ability.CastRange;
                predictionInput.SkillShotType = 4;
                PredictionOutput9 predictionOutput = usableAbility.Ability.GetPredictionOutput(predictionInput);
                if (predictionOutput.HitChance < 1)
                {
                    return(false);
                }
                this.blinkPosition = predictionOutput.CastPosition;
            }
            return(base.Owner.Distance(this.blinkPosition) < base.Ability.CastRange);
        }
示例#15
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);
        }
示例#16
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);
        }
示例#17
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);
        }
示例#18
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;
         }
     }
 }
示例#19
0
        // Token: 0x06000C1E RID: 3102 RVA: 0x00025620 File Offset: 0x00023820
        public override bool UseAbility(Unit9 mainTarget, List <Unit9> aoeTargets, HitChance minimumChance, int minAOETargets = 0, bool queue = false, bool bypass = false)
        {
            if (!this.PositionCast)
            {
                return(this.UseAbility(mainTarget, queue, bypass));
            }
            PredictionInput9  predictionInput  = this.GetPredictionInput(mainTarget, aoeTargets);
            PredictionOutput9 predictionOutput = this.GetPredictionOutput(predictionInput);

            return(predictionOutput.HitChance >= minimumChance && this.UseAbility(predictionOutput.CastPosition, queue, bypass));
        }
示例#20
0
        // Token: 0x06000C9E RID: 3230 RVA: 0x00025BC0 File Offset: 0x00023DC0
        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);
            PredictionOutput9 predictionOutput = this.GetPredictionOutput(predictionInput);

            return(predictionOutput.HitChance > HitChance.Impossible && base.Owner.GetAngle(predictionOutput.CastPosition, false) <= 0.1f);
        }
示例#21
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);
        }
示例#22
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);
        }
        // Token: 0x06000171 RID: 369 RVA: 0x0000CF5C File Offset: 0x0000B15C
        public Vector3 GetBlinkPosition(TargetManager targetManager, float range)
        {
            Unit9 target = targetManager.Target;

            if (target.IsMagicImmune || target.IsEthereal || target.IsInvulnerable || !target.IsVisible || target.IsBlockingAbilities)
            {
                return(Vector3.Zero);
            }
            PredictionInput9 predictionInput = this.shackleshot.GetPredictionInput(target, null);

            predictionInput.Range  = this.shackleshot.CastRange;
            predictionInput.Delay -= Math.Max((base.Owner.Distance(target) - 200f) / base.Ability.Speed, 0f);
            Vector3 targetPosition = this.shackleshot.PredictionManager.GetSimplePrediction(predictionInput).TargetPosition;

            foreach (Unit9 unit in from x in targetManager.EnemyUnits
                     orderby x.IsHero descending
                     select x)
            {
                if (unit.Distance(targetPosition) >= 50f && (!unit.IsMagicImmune || this.shackleshot.CanHitSpellImmuneEnemy) && !unit.Equals(target) && !unit.IsInvulnerable && unit.Distance(targetPosition) <= this.shackleshot.ShackleRange)
                {
                    PredictionInput9 predictionInput2 = base.Ability.GetPredictionInput(unit, null);
                    predictionInput2.Delay = predictionInput.Delay;
                    PredictionOutput9 predictionOutput = base.Ability.GetPredictionOutput(predictionInput2);
                    Vector3           vector           = Vector3Extensions.Extend2D(predictionOutput.TargetPosition, targetPosition, predictionOutput.TargetPosition.Distance2D(targetPosition, false) + 200f);
                    if (base.Owner.Distance(vector) < range)
                    {
                        return(vector);
                    }
                }
            }
            if (!target.IsBlockingAbilities)
            {
                foreach (Tree tree in this.trees)
                {
                    if (tree.IsValid && tree.IsAlive && tree.Distance2D(targetPosition) <= this.shackleshot.ShackleRange)
                    {
                        Vector3 vector2 = Vector3Extensions.Extend2D(tree.Position, targetPosition, tree.Distance2D(targetPosition) + 200f);
                        if (base.Owner.Distance(vector2) < range)
                        {
                            return(vector2);
                        }
                    }
                }
            }
            return(Vector3.Zero);
        }
示例#26
0
        // Token: 0x06000413 RID: 1043 RVA: 0x00016940 File Offset: 0x00014B40
        public void HookAlly(TargetManager targetManager)
        {
            MeatHook meatHook = this.hook;

            if (meatHook == null || !meatHook.Ability.CanBeCasted(true))
            {
                return;
            }
            Unit9             target           = targetManager.Target;
            PredictionInput9  predictionInput  = this.hook.Ability.GetPredictionInput(target, null);
            PredictionOutput9 predictionOutput = this.hook.Ability.GetPredictionOutput(predictionInput);

            if (predictionOutput.HitChance < 1)
            {
                return;
            }
            this.hook.Ability.UseAbility(predictionOutput.CastPosition, false, false);
        }
示例#27
0
        // Token: 0x06000505 RID: 1285 RVA: 0x0001A2F0 File Offset: 0x000184F0
        public override bool UseAbility(TargetManager targetManager, Sleeper comboSleeper, bool aoe)
        {
            Unit9             target           = targetManager.Target;
            PredictionInput9  predictionInput  = base.Ability.GetPredictionInput(target, targetManager.EnemyHeroes);
            PredictionOutput9 predictionOutput = base.Ability.GetPredictionOutput(predictionInput);

            this.castPosition = predictionOutput.CastPosition;
            if (!base.Ability.UseAbility(this.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);
        }
示例#28
0
        private static void GetProperCastPosition(PredictionInput9 input, PredictionOutput9 output)
        {
            if (input.SkillShotType == SkillShotType.RangedAreaOfEffect || input.SkillShotType == SkillShotType.AreaOfEffect)
            {
                return;
            }

            if (input.SkillShotType == SkillShotType.Line && input.UseBlink)
            {
                return;
            }

            var radius = input.Radius;

            if (radius <= 0)
            {
                return;
            }

            var caster         = input.Caster;
            var casterPosition = caster.Position;
            var castPosition   = output.CastPosition;
            var distance       = casterPosition.Distance2D(castPosition);
            var range          = input.CastRange;

            if (range >= distance)
            {
                return;
            }

            castPosition = castPosition.Extend2D(casterPosition, Math.Min(distance - range, radius));

            if (output.AoeTargetsHit.Count > 1)
            {
                var maxDistance = output.AoeTargetsHit.Max(x => x.TargetPosition.Distance2D(castPosition));
                if (maxDistance > radius)
                {
                    distance     = casterPosition.Distance2D(castPosition);
                    castPosition = casterPosition.Extend2D(castPosition, distance + (maxDistance - radius));
                }
            }

            output.CastPosition = castPosition;
        }
示例#29
0
        // Token: 0x06000675 RID: 1653 RVA: 0x0001F5E4 File Offset: 0x0001D7E4
        public override bool ShouldConditionCast(TargetManager targetManager, IComboModeMenu menu, List <UsableAbility> usableAbilities)
        {
            UsableAbility usableAbility = usableAbilities.Find((UsableAbility x) => x.Ability.Id == AbilityId.earthshaker_enchant_totem);

            if (usableAbility != null)
            {
                PredictionInput9 predictionInput = usableAbility.Ability.GetPredictionInput(targetManager.Target, targetManager.EnemyHeroes);
                predictionInput.Range        += base.Ability.CastRange;
                predictionInput.CastRange     = base.Ability.CastRange;
                predictionInput.SkillShotType = 4;
                if (base.Owner.HasModifier("modifier_earthshaker_enchant_totem"))
                {
                    predictionInput.AreaOfEffect = false;
                    predictionInput.Delay       -= 0.1f;
                }
                PredictionOutput9 predictionOutput = usableAbility.Ability.GetPredictionOutput(predictionInput);
                if (predictionOutput.HitChance < 1)
                {
                    return(false);
                }
                this.blinkPosition = predictionOutput.CastPosition;
                return(base.Owner.Distance(this.blinkPosition) <= base.Ability.CastRange);
            }
            else
            {
                EchoSlam echoSlam;
                if ((echoSlam = (usableAbilities.Find((UsableAbility x) => x.Ability.Id == AbilityId.earthshaker_echo_slam) as EchoSlam)) == null)
                {
                    return(false);
                }
                PredictionInput9 predictionInput2 = echoSlam.Ability.GetPredictionInput(targetManager.Target, targetManager.EnemyHeroes);
                predictionInput2.Range        += base.Ability.CastRange;
                predictionInput2.CastRange     = base.Ability.CastRange;
                predictionInput2.SkillShotType = 4;
                PredictionOutput9 predictionOutput2 = echoSlam.Ability.GetPredictionOutput(predictionInput2);
                if (predictionOutput2.HitChance < 1 || predictionOutput2.AoeTargetsHit.Count < echoSlam.TargetsToHit(menu))
                {
                    return(false);
                }
                this.blinkPosition = predictionOutput2.CastPosition;
                return(base.Owner.Distance(this.blinkPosition) <= base.Ability.CastRange);
            }
        }
示例#30
0
        // Token: 0x06000169 RID: 361 RVA: 0x0000C8E0 File Offset: 0x0000AAE0
        public bool CancelChanneling(TargetManager targetManager)
        {
            if (!base.Ability.IsChanneling || !base.Ability.BaseAbility.IsChanneling)
            {
                return(false);
            }
            Unit9 target = targetManager.Target;

            if (target.IsStunned || target.IsRooted)
            {
                return(false);
            }
            Polygon          polygon         = new Polygon.Rectangle(base.Owner.Position, Vector3Extensions.Extend2D(base.Owner.Position, this.castPosition, base.Ability.Range), base.Ability.Radius - 75f);
            PredictionInput9 predictionInput = base.Ability.GetPredictionInput(target, null);

            predictionInput.Delay = this.powershot.ChannelTime - base.Ability.BaseAbility.ChannelTime;
            PredictionOutput9 predictionOutput = base.Ability.GetPredictionOutput(predictionInput);

            return((!polygon.IsInside(predictionOutput.TargetPosition) || (float)this.powershot.GetCurrentDamage(target) > target.Health) && base.Owner.BaseUnit.Stop());
        }