예제 #1
0
        public void RollSmashCombo(TargetManager targetManager, RollSmashModeMenu menu)
        {
            if (this.ComboSleeper.IsSleeping)
            {
                return;
            }

            var target   = targetManager.Target;
            var distance = this.Owner.Distance(target.Position);

            var abilityHelper = new AbilityHelper(targetManager, null, this);

            if (this.Owner.HasModifier("modifier_earth_spirit_rolling_boulder_caster"))
            {
                if (abilityHelper.ForceUseAbility(this.stone, true))
                {
                    this.ComboSleeper.Sleep(3f);
                    return;
                }
            }

            var ally = targetManager.AllyHeroes
                       .Where(x => !x.Equals(this.Owner) && menu.IsAllyEnabled(x.Name) && x.Distance(target) > 300 && x.Distance(target) < 1500)
                       .OrderBy(x => x.Distance(target))
                       .FirstOrDefault();

            if (ally == null)
            {
                return;
            }

            if (target.HasModifier("modifier_earth_spirit_boulder_smash"))
            {
                if (abilityHelper.CanBeCasted(this.rolling, false, false) && this.rolling.SimpleUseAbility(target.Position))
                {
                    this.ComboSleeper.Sleep(0.5f);
                    return;
                }

                return;
            }

            if (this.smash?.Ability.CanBeCasted() != true)
            {
                return;
            }

            if (distance < this.smash.Ability.CastRange + 100)
            {
                if (this.Owner.Position.AngleBetween(target.Position, ally.Position) < 30)
                {
                    this.smash.Ability.UseAbility(target);
                    this.ComboSleeper.Sleep(0.3f);
                    return;
                }

                if (target.GetImmobilityDuration() > 0.5f)
                {
                    this.Owner.BaseUnit.Move(target.Position.Extend2D(ally.Position, -100));
                    this.OrbwalkSleeper.Sleep(0.1f);
                    this.ComboSleeper.Sleep(0.1f);
                    return;
                }
            }

            if (abilityHelper.CanBeCasted(this.blink))
            {
                var predicted = target.GetPredictedPosition(this.Owner.GetTurnTime(target.Position) + (GameManager.Ping / 2000f) + 0.2f);
                var position  = predicted.Extend2D(ally.Position, -125);

                if (abilityHelper.UseAbility(this.blink, position))
                {
                    this.ComboSleeper.ExtendSleep(0.1f);
                    return;
                }

                return;
            }

            if (abilityHelper.CanBeCasted(this.rolling))
            {
                if (abilityHelper.UseAbility(this.rolling))
                {
                    return;
                }

                if (abilityHelper.CanBeCasted(this.stone, false))
                {
                    if (abilityHelper.ForceUseAbility(this.stone, true))
                    {
                        return;
                    }
                }
                else
                {
                    if (abilityHelper.ForceUseAbility(this.rolling, true))
                    {
                        return;
                    }
                }
            }
        }
예제 #2
0
        // Token: 0x060007F9 RID: 2041 RVA: 0x00024918 File Offset: 0x00022B18
        public void RollSmashCombo(TargetManager targetManager, RollSmashModeMenu menu)
        {
            if (base.ComboSleeper.IsSleeping)
            {
                return;
            }
            Unit9         target        = targetManager.Target;
            float         num           = base.Owner.Distance(target.Position);
            AbilityHelper abilityHelper = new AbilityHelper(targetManager, null, this);

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

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