예제 #1
0
        public Tree GetChaseTree(
            Hero hero,
            Target target,
            TimberChain timberChain,
            float maxDistanceToEnemy,
            float minDistanceToHero)
        {
            var castRange      = timberChain.GetCastRange();
            var targetPosition = target.GetPosition();

            var targetDistance    = target.GetDistance(hero.Position);
            var ignoreMaxDistance = targetDistance > castRange + 200;

            var delay = Game.RawGameTime + timberChain.CastPoint + Game.Ping / 1000;
            var trees = GetAvailableTrees(hero, targetPosition, castRange, delay, timberChain.Speed).ToList();

            return
                (trees.Where(
                     x =>
                     (ignoreMaxDistance ||
                      x.Distance2D(
                          TimberPrediction.PredictedXYZ(
                              target,
                              timberChain.CastPoint + x.Distance2D(targetPosition) / timberChain.Speed))
                      <= maxDistanceToEnemy ||
                      (target.Hero.GetTurnTime(x.Position) <= 0 && x.Distance2D(targetPosition) < 600)) &&
                     x.Distance2D(hero) >= minDistanceToHero)
                 .FirstOrDefault(
                     z =>
                     trees.Where(x => !x.Equals(z))
                     .All(
                         x =>
                         x.Distance2D(hero) > 150 && !IsPointOnLine(x.Position, hero.Position, z.Position, 25))));
        }
예제 #2
0
        public Tree GetChaseTree(
            Hero hero,
            Target target,
            TimberChain timberChain,
            float maxDistanceToEnemy,
            float minDistanceToHero)
        {
            var castRange = timberChain.GetCastRange();
            var targetPosition = target.GetPosition();

            var targetDistance = target.GetDistance(hero.Position);
            var ignoreMaxDistance = targetDistance > castRange + 200;

            var delay = Game.RawGameTime + timberChain.CastPoint + Game.Ping / 1000;
            var trees = GetAvailableTrees(hero, targetPosition, castRange, delay, timberChain.Speed).ToList();

            return
                trees.Where(
                    x =>
                    (ignoreMaxDistance
                     || x.Distance2D(
                         TimberPrediction.PredictedXYZ(
                             target,
                             timberChain.CastPoint + x.Distance2D(targetPosition) / timberChain.Speed))
                     <= maxDistanceToEnemy
                     || (target.Hero.GetTurnTime(x.Position) <= 0 && x.Distance2D(targetPosition) < 600))
                    && x.Distance2D(hero) >= minDistanceToHero)
                    .FirstOrDefault(
                        z =>
                        trees.Where(x => !x.Equals(z))
                            .All(
                                x =>
                                x.Distance2D(hero) > 150 && !IsPointOnLine(x.Position, hero.Position, z.Position, 25)));
        }
예제 #3
0
        public Tree GetChaseTree(
            Vector3 hero,
            Target target,
            TimberChain timberChain,
            float maxDistanceToEnemy,
            float minDistanceToHero)
        {
            var castRange      = timberChain.GetCastRange();
            var targetPosition = target.GetPosition();

            var targetDistance    = target.GetDistance(hero);
            var ignoreMaxDistance = targetDistance > castRange + 200;

            var trees = GetAvailableTrees(hero, targetPosition, castRange).ToList();

            return
                (trees.Where(
                     x =>
                     (ignoreMaxDistance ||
                      x.Distance2D(
                          TimberPrediction.PredictedXYZ(
                              target,
                              timberChain.CastPoint + x.Distance2D(targetPosition) / timberChain.Speed))
                      <= maxDistanceToEnemy ||
                      (Math.Abs(
                           target.Hero.FindAngleR() - Utils.DegreeToRadian(target.Hero.FindAngleForTurnTime(x.Position)))
                       < 0.3 && x.Distance2D(targetPosition) < targetDistance)) &&
                     x.Distance2D(hero) >= minDistanceToHero)
                 .FirstOrDefault(
                     z =>
                     trees.Where(x => !x.Equals(z))
                     .All(x => !IsPointOnLine(x.Position, hero, z.Position, forceRadius: 25))));
        }
예제 #4
0
        public Timbersaw(Unit9 owner, MultiSleeper abilitySleeper, Sleeper orbwalkSleeper, ControllableUnitMenu menu)
            : base(owner, abilitySleeper, orbwalkSleeper, menu)
        {
            this.ComboAbilities = new Dictionary <AbilityId, Func <ActiveAbility, UsableAbility> >
            {
                {
                    AbilityId.shredder_chakram, x =>
                    {
                        var chakram = new Chakram(x);
                        this.chakrams.Add(chakram);
                        return(chakram);
                    }
                },
                {
                    AbilityId.shredder_chakram_2, x =>
                    {
                        var chakram = new Chakram(x);
                        this.chakrams.Add(chakram);
                        return(chakram);
                    }
                },
                { AbilityId.shredder_whirling_death, x => this.whirlingDeath = new NukeAbility(x) },
                { AbilityId.shredder_timber_chain, x => this.timberChain = new TimberChain(x) },

                { AbilityId.item_blink, x => this.blink = new BlinkDaggerTimbersaw(x) },
                { AbilityId.item_shivas_guard, x => this.shiva = new DebuffAbility(x) },
                { AbilityId.item_sheepstick, x => this.hex = new DisableAbility(x) },
                { AbilityId.item_blade_mail, x => this.bladeMail = new ShieldAbility(x) },
            };

            this.MoveComboAbilities.Add(AbilityId.shredder_timber_chain, x => this.timberChainBlink = new TimberChainBlink(x));
        }
예제 #5
0
        public bool CheckTree(Hero hero, Vector3 position, TimberChain timberChain)
        {
            var distance = Math.Max(timberChain.GetCastRange(), hero.Distance2D(position));
            var endPoint = hero.Position.Extend(position, distance);
            var delay    = Game.RawGameTime + timberChain.CastPoint + Game.Ping / 1000;

            return(GetAvailableTrees(hero, endPoint, distance, delay, timberChain.Speed)
                   .Any(x => IsPointOnLine(x.Position, hero.Position, endPoint, 20)));
        }
예제 #6
0
        public bool CheckTree(Hero hero, Vector3 position, TimberChain timberChain)
        {
            var distance = Math.Max(timberChain.GetCastRange(), hero.Distance2D(position));
            var endPoint = hero.Position.Extend(position, distance);
            var delay = Game.RawGameTime + timberChain.CastPoint + Game.Ping / 1000;

            return
                GetAvailableTrees(hero, endPoint, distance, delay, timberChain.Speed)
                    .Any(x => IsPointOnLine(x.Position, hero.Position, endPoint, 20));
        }
예제 #7
0
        public Tree GetDamageTree(Hero hero, Vector3 target, TimberChain timberChain, bool dagger = false)
        {
            var delay = Game.RawGameTime + timberChain.CastPoint + Game.Ping / 1000;

            var trees = GetAvailableTrees(hero, target, timberChain.GetCastRange(), delay, timberChain.Speed).ToList();

            return(trees.OrderBy(x => x.Distance2D(target))
                   .FirstOrDefault(
                       x => trees.Where(z => !z.Equals(x))
                       .All(
                           z => z.Distance2D(hero) > 150 &&
                           !IsPointOnLine(z.Position, hero.Position, x.Position, 25)) &&
                       (IsPointOnLine(target, hero.Position, x.Position, timberChain.Radius, false) ||
                        x.Distance2D(target) < timberChain.Radius - 50) &&
                       (dagger || x.Distance2D(target) < 600)));
        }
예제 #8
0
        public void OnLoad()
        {
            hero        = ObjectManager.LocalHero;
            menuManager = new MenuManager(hero.Name);
            treeFactory = new TreeFactory();
            orbwalker   = new Orbwalker(hero);
            sleeper     = new MultiSleeper();

            TimberPrediction.OnLoad();

            whirlingDeath = new WhirlingDeath(hero.Spellbook.SpellQ);
            timberChain   = new TimberChain(hero.Spellbook.SpellW);

            chakrams.Add(
                new Chakram(
                    hero.Spellbook.Spells.First(x => x.Name == "shredder_chakram"),
                    hero.Spellbook.Spells.First(x => x.Name == "shredder_return_chakram")));
        }
예제 #9
0
 public TimberChainAbility(IBlink blink, GroupSettings settings)
     : base(blink)
 {
     this.timberChain = (TimberChain)blink;
     this.settings    = new BlinkSettings(settings.Menu, blink);
 }
예제 #10
0
파일: Timbersaw.cs 프로젝트: IdcNoob/Ensage
        public void OnLoad()
        {
            hero = ObjectManager.LocalHero;
            menuManager = new MenuManager(hero.Name);
            treeFactory = new TreeFactory();
            orbwalker = new Orbwalker(hero);
            sleeper = new MultiSleeper();

            TimberPrediction.OnLoad();

            whirlingDeath = new WhirlingDeath(hero.Spellbook.SpellQ);
            timberChain = new TimberChain(hero.Spellbook.SpellW);

            chakrams.Add(
                new Chakram(
                    hero.Spellbook.Spells.First(x => x.Name == "shredder_chakram"),
                    hero.Spellbook.Spells.First(x => x.Name == "shredder_return_chakram")));
        }
예제 #11
0
        public Tree GetDamageTree(Hero hero, Vector3 target, TimberChain timberChain, bool dagger = false)
        {
            var delay = Game.RawGameTime + timberChain.CastPoint + Game.Ping / 1000;

            var trees = GetAvailableTrees(hero, target, timberChain.GetCastRange(), delay, timberChain.Speed).ToList();
            return
                trees.OrderBy(x => x.Distance2D(target))
                    .FirstOrDefault(
                        x =>
                        trees.Where(z => !z.Equals(x))
                            .All(
                                z =>
                                z.Distance2D(hero) > 150 && !IsPointOnLine(z.Position, hero.Position, x.Position, 25))
                        && (IsPointOnLine(target, hero.Position, x.Position, timberChain.Radius, false)
                            || x.Distance2D(target) < timberChain.Radius - 50) && (dagger || x.Distance2D(target) < 600));
        }
예제 #12
0
 public TimberChainObstacle(LinearProjectileEvadable ability, Vector3 startPosition)
     : base(ability, startPosition)
 {
     this.timberChain = (TimberChain)ability.RangedAbility;
 }