Exemplo n.º 1
0
        public static void ExecuteW()
        {
            if (!LocalMenu.Item("Flee.UseW").GetValue <bool>())
            {
                return;
            }


            var pos = Game.CursorPos;

            if (jumpingWithQ)
            {
                return;
            }
            if (WStage != Program.WCastStage.IsReady)
            {
                canJumpWithW = false;
                return;
            }

            toPolygon =
                new Geometry.Rectangle(ObjectManager.Player.Position.To2D(),
                                       ObjectManager.Player.Position.To2D()
                                       .Extend(pos.To2D(),
                                               ObjectManager.Player.Position.Distance(pos) < W.Range
                                ? W.Range
                                : +ObjectManager.Player.Position.Distance(pos)),
                                       LocalMenu.Item("Flee.Range").GetValue <Slider>().Value).ToPolygon();


            if (wardJumpObjectforFlee != null && WStage == Program.WCastStage.IsReady)
            {
                Render.Circle.DrawCircle(wardJumpObjectforFlee.Position, 85f, Color.Coral);
                canJumpWithW = true;
                W.CastOnUnit(wardJumpObjectforFlee);

                return;
            }

            var jObjects = ObjectManager.Get <Obj_AI_Base>()
                           .OrderByDescending(obj => obj.Distance(ObjectManager.Player.ServerPosition))
                           .FirstOrDefault(obj => obj.IsAlly && !obj.IsMe && !obj.IsDead &&
                                           !(obj.Name.IndexOf("turret", StringComparison.InvariantCultureIgnoreCase) >= 0) &&
                                           obj.Distance(ObjectManager.Player.Position) <= W.Range &&
                                           obj.Distance(ObjectManager.Player.Position) >
                                           Orbwalking.GetRealAutoAttackRange(null) + 100 &&
                                           toPolygon.IsInside(obj.Position));

            if (jObjects != null)
            {
                Render.Circle.DrawCircle(jObjects.Position, 85f, Color.Coral);
                Program.WardJump(jObjects.Position);
                canJumpWithW = true;
                return;
            }

            if (Items.GetWardSlot() != null && Items.GetWardSlot().Stacks > 0)
            {
                canJumpWithW = true;
                Program.PutWard(ObjectManager.Player.Position.Extend(pos, wardRange));
                return;
            }
            canJumpWithW = false;
        }