示例#1
0
        /// <summary>
        /// Check Yasuo wall collisions
        /// </summary>
        /// <param name="from">Start position</param>
        /// <param name="to">End position</param>
        /// <param name="width">Rectangle scale</param>
        /// <param name="isArc">Check collision for arc spell</param>
        /// <returns>true if collision found</returns>
        public static bool CheckYasuoWallCollision(Vector2 from, Vector2 to, float width, bool isArc = false)
        {
            if (Utils.TickCount - yasuoWallCastedTick > 4000)
            {
                return(false);
            }

            GameObject yasuoWall = ObjectManager.Get <GameObject>().Where(p => p.IsValid && Regex.IsMatch(p.Name, "_w_windwall_enemy_0.\\.troy", RegexOptions.IgnoreCase)).FirstOrDefault();

            if (yasuoWall == null)
            {
                return(false);
            }

            Vector2 yasuoWallDirection = (yasuoWall.Position.To2D() - yasuoWallCastedPos).Normalized().Perpendicular();
            float   yasuoWallWidth     = 300 + 50 * yasuoWallLevel;

            Vector2 yasuoWallStart = yasuoWall.Position.To2D() + yasuoWallWidth / 2f * yasuoWallDirection;
            Vector2 yasuoWallEnd   = yasuoWallStart - yasuoWallWidth * yasuoWallDirection;

            Geometry.Polygon yasuoWallPoly = ClipperWrapper.DefineRectangle(yasuoWallStart, yasuoWallEnd, 5);
            Geometry.Polygon spellHitBox   = ClipperWrapper.DefineRectangle(from, to, width);

            if (isArc)
            {
                spellHitBox = new SPrediction.Geometry.Polygon(
                    ClipperWrapper.DefineArc(from - new Vector2(900 / 2f, 20), to, (float)Math.PI * (to.Distance(from) / 900), 410, 200 * (to.Distance(from) / 900)),
                    ClipperWrapper.DefineArc(from - new Vector2(900 / 2f, 20), to, (float)Math.PI * (to.Distance(from) / 900), 410, 320 * (to.Distance(from) / 900)));
            }

            return(ClipperWrapper.IsIntersects(ClipperWrapper.MakePaths(yasuoWallPoly), ClipperWrapper.MakePaths(spellHitBox)));
        }
示例#2
0
        /// <summary>
        /// Checks Yasuo wall collisions
        /// </summary>
        /// <param name="poly">Polygon to check collision</param>
        /// <returns>true if collision found</returns>
        public static bool CheckYasuoWallCollision(Geometry.Polygon spellHitBox)
        {
            if (Utils.TickCount - yasuoWallCastedTick > 4000)
            {
                return(false);
            }

            GameObject yasuoWall = ObjectManager.Get <GameObject>().Where(p => p.IsValid && Regex.IsMatch(p.Name, "_w_windwall_enemy_0.\\.troy", RegexOptions.IgnoreCase)).FirstOrDefault();

            if (yasuoWall == null)
            {
                return(false);
            }

            Vector2 yasuoWallDirection = (yasuoWall.Position.To2D() - yasuoWallCastedPos).Normalized().Perpendicular();
            float   yasuoWallWidth     = 300 + 50 * yasuoWallLevel;

            Vector2 yasuoWallStart = yasuoWall.Position.To2D() + yasuoWallWidth / 2f * yasuoWallDirection;
            Vector2 yasuoWallEnd   = yasuoWallStart - yasuoWallWidth * yasuoWallDirection;

            Geometry.Polygon yasuoWallPoly = ClipperWrapper.DefineRectangle(yasuoWallStart, yasuoWallEnd, 5);

            return(ClipperWrapper.IsIntersects(ClipperWrapper.MakePaths(yasuoWallPoly), ClipperWrapper.MakePaths(spellHitBox)));
        }
示例#3
0
        public void EvadeThread()
        {
            //TO DO: collision check (minion, champ, yasuo wall)
            DetectedSpellData dcspell;
            while (true)
            {
                try
                {
                    if (m_spell_queue.TryDequeue(out dcspell))
                    {
                        Vector2 my_pos = ObjectManager.Player.ServerPosition.To2D();
                        Vector2 sender_pos = dcspell.StartPosition;
                        Vector2 end_pos = dcspell.EndPosition;
                        Vector2 direction = (end_pos - sender_pos).Normalized();
                        if (sender_pos.Distance(end_pos) > dcspell.Spell.Range)
                            end_pos = sender_pos + direction * dcspell.Spell.Range;

                        Geometry.Polygon my_hitbox = ClipperWrapper.DefineRectangle(my_pos - 60, my_pos + 60, 60);
                        Geometry.Polygon spell_hitbox = null;

                        if (dcspell.Spell.IsSkillshot)
                        {
                            if (dcspell.Spell.Type == SkillshotType.SkillshotLine)
                                spell_hitbox = ClipperWrapper.DefineRectangle(sender_pos, end_pos, dcspell.Spell.Radius);
                            else if (dcspell.Spell.Type == SkillshotType.SkillshotCircle)
                                spell_hitbox = ClipperWrapper.DefineCircle(end_pos, dcspell.Spell.Radius);
                            else if (dcspell.Spell.Type == SkillshotType.SkillshotCone)
                                spell_hitbox = ClipperWrapper.DefineSector(sender_pos, end_pos - sender_pos, dcspell.Spell.Radius * (float)Math.PI / 180, dcspell.Spell.Range);
                        }

                        //spells with arc
                        if (dcspell.Spell.IsArc)
                        {
                            float mul = (end_pos.Distance(sender_pos) / (dcspell.Spell.Range - 20.0f));

                            spell_hitbox = new Geometry.Polygon(
                                ClipperWrapper.DefineArc(sender_pos - dcspell.Spell.ArcData.Pos, end_pos, dcspell.Spell.ArcData.Angle * mul, dcspell.Spell.ArcData.Width, dcspell.Spell.ArcData.Height * mul),
                                ClipperWrapper.DefineArc(sender_pos - dcspell.Spell.ArcData.Pos, end_pos, dcspell.Spell.ArcData.Angle * mul, dcspell.Spell.ArcData.Width, (dcspell.Spell.ArcData.Height + dcspell.Spell.ArcData.Radius) * mul),
                                spell_hitbox);
                        }

                        if (spell_hitbox != null)
                        {
                            if (ClipperWrapper.IsIntersects(ClipperWrapper.MakePaths(my_hitbox), ClipperWrapper.MakePaths(spell_hitbox)))
                                OnSpellHitDetected(direction, ObjectManager.Player);
                            else
                            {
                                if ((SpecialMethod.HasFlag(EvadeMethods.MorganaE) || SpecialMethod.HasFlag(EvadeMethods.KayleR)) && shieldAlly != null && shieldAlly.Item("SHIELDENABLED").GetValue<bool>())
                                {
                                    var allies = ObjectManager.Player.GetAlliesInRange(EvadeSpell.Range).Where(p => !p.IsMe && shieldAlly.Item("shield" + p.ChampionName).GetValue<bool>()).OrderByDescending(q => Utility.GetPriority(q.ChampionName));

                                    if (allies != null)
                                    {
                                        foreach (Obj_AI_Base ally in allies)
                                        {
                                            Vector2 ally_pos = ally.ServerPosition.To2D();
                                            Geometry.Polygon ally_hitbox = ClipperWrapper.DefineRectangle(ally_pos, ally_pos + 60, 60);
                                            if (ClipperWrapper.IsIntersects(ClipperWrapper.MakePaths(ally_hitbox), ClipperWrapper.MakePaths(spell_hitbox)))
                                            {
                                                OnSpellHitDetected(direction, ally);
                                                break;
                                            }
                                        }
                                    }
                                }
                            }
                        }
                        m_spell_pool.PutObject(dcspell);
                    }
                }
                catch
                {

                }
                Thread.Sleep(1);
            }
        }
示例#4
0
        public void EvadeThread()
        {
            //TO DO: collision check (minion, champ, yasuo wall)
            DetectedSpellData dcspell;

            while (true)
            {
                try
                {
                    if (m_spell_queue.TryDequeue(out dcspell))
                    {
                        Vector2 my_pos     = ObjectManager.Player.ServerPosition.To2D();
                        Vector2 sender_pos = dcspell.StartPosition;
                        Vector2 end_pos    = dcspell.EndPosition;
                        Vector2 direction  = (end_pos - sender_pos).Normalized();
                        if (sender_pos.Distance(end_pos) > dcspell.Spell.Range)
                        {
                            end_pos = sender_pos + direction * dcspell.Spell.Range;
                        }

                        Geometry.Polygon my_hitbox    = ClipperWrapper.DefineRectangle(my_pos - 60, my_pos + 60, 60);
                        Geometry.Polygon spell_hitbox = null;

                        if (dcspell.Spell.IsSkillshot)
                        {
                            if (dcspell.Spell.Type == SkillshotType.SkillshotLine)
                            {
                                spell_hitbox = ClipperWrapper.DefineRectangle(sender_pos, end_pos, dcspell.Spell.Radius);
                            }
                            else if (dcspell.Spell.Type == SkillshotType.SkillshotCircle)
                            {
                                spell_hitbox = ClipperWrapper.DefineCircle(end_pos, dcspell.Spell.Radius);
                            }
                            else if (dcspell.Spell.Type == SkillshotType.SkillshotCone)
                            {
                                spell_hitbox = ClipperWrapper.DefineSector(sender_pos, end_pos - sender_pos, dcspell.Spell.Radius * (float)Math.PI / 180, dcspell.Spell.Range);
                            }
                        }

                        //spells with arc
                        if (dcspell.Spell.IsArc)
                        {
                            float mul = (end_pos.Distance(sender_pos) / (dcspell.Spell.Range - 20.0f));

                            spell_hitbox = new Geometry.Polygon(
                                ClipperWrapper.DefineArc(sender_pos - dcspell.Spell.ArcData.Pos, end_pos, dcspell.Spell.ArcData.Angle * mul, dcspell.Spell.ArcData.Width, dcspell.Spell.ArcData.Height * mul),
                                ClipperWrapper.DefineArc(sender_pos - dcspell.Spell.ArcData.Pos, end_pos, dcspell.Spell.ArcData.Angle * mul, dcspell.Spell.ArcData.Width, (dcspell.Spell.ArcData.Height + dcspell.Spell.ArcData.Radius) * mul),
                                spell_hitbox);
                        }

                        if (spell_hitbox != null)
                        {
                            if (ClipperWrapper.IsIntersects(ClipperWrapper.MakePaths(my_hitbox), ClipperWrapper.MakePaths(spell_hitbox)))
                            {
                                OnSpellHitDetected(direction, ObjectManager.Player);
                            }
                            else
                            {
                                if ((SpecialMethod.HasFlag(EvadeMethods.MorganaE) || SpecialMethod.HasFlag(EvadeMethods.KayleR)) && shieldAlly != null && shieldAlly.Item("SHIELDENABLED").GetValue <bool>())
                                {
                                    var allies = ObjectManager.Player.GetAlliesInRange(EvadeSpell.Range).Where(p => !p.IsMe && shieldAlly.Item("shield" + p.ChampionName).GetValue <bool>()).OrderByDescending(q => Utility.GetPriority(q.ChampionName));

                                    if (allies != null)
                                    {
                                        foreach (Obj_AI_Base ally in allies)
                                        {
                                            Vector2          ally_pos    = ally.ServerPosition.To2D();
                                            Geometry.Polygon ally_hitbox = ClipperWrapper.DefineRectangle(ally_pos, ally_pos + 60, 60);
                                            if (ClipperWrapper.IsIntersects(ClipperWrapper.MakePaths(ally_hitbox), ClipperWrapper.MakePaths(spell_hitbox)))
                                            {
                                                OnSpellHitDetected(direction, ally);
                                                break;
                                            }
                                        }
                                    }
                                }
                            }
                        }
                        m_spell_pool.PutObject(dcspell);
                    }
                }
                catch
                {
                }
                Thread.Sleep(1);
            }
        }