Ejemplo n.º 1
0
    private static void Harass()
    {
        foreach (var enemyInRange in
                 ObjectManager.Get <Obj_AI_Hero>()
                 .Where(
                     enemy =>
                     enemy.IsValidTarget(_q.Range) &&
                     Config.Item("Harass-" + enemy.ChampionName).GetValue <bool>()))
        {
            var qPred = _q.GetPrediction(enemyInRange);
            var wPred = _w.GetPrediction(enemyInRange);

            var manaPercent = (Player.Mana / Player.MaxMana) * 100;

            if (Config.Item("Harass-Use-Q").GetValue <bool>() && _q.IsReady() && manaPercent >= Config.Item("Harass-Mana-Q").GetValue <Slider>().Value&&
                qPred.Hitchance >= HarassHitChance)
            {
                _q.Cast(qPred.CastPosition);
            }

            if (Config.Item("Harass-Use-W").GetValue <bool>() && _w.IsReady() && manaPercent >= Config.Item("Harass-Mana-W").GetValue <Slider>().Value&& Player.Distance(enemyInRange) < _w.Range &&
                wPred.Hitchance >= HarassHitChance)
            {
                _w.Cast(enemyInRange);
            }

            if (!_e.IsReady() || !_q.IsReady() || qPred.Hitchance > HitChance.Impossible || Player.Distance(enemyInRange) > _q.Range ||
                Player.Mana <= (Player.Spellbook.GetSpell(SpellSlot.E).ManaCost + Player.Spellbook.GetSpell(SpellSlot.Q).ManaCost) ||
                !Config.Item("Harass-Use-E").GetValue <bool>() ||
                manaPercent < Config.Item("Harass-Mana-E").GetValue <Slider>().Value)
            {
                return;
            }

            var c     = new Geometry.Circle(Player.Position.To2D(), 490);
            var point = c.ToPolygon().Points.OrderByDescending(vector2 => vector2.Distance(enemyInRange.Position.To2D())).Reverse();

            for (var i = 1; i < 3; i++)
            {
                var pointTo = point.ElementAt(i).To3D();
                if (pointTo.IsWall() || pointTo.UnderTurret(true) ||
                    ObjectManager.Get <Obj_AI_Hero>().Any(enemy => enemy != enemyInRange && enemy.IsValidTarget(300, true, pointTo)))
                {
                    continue;
                }

                var qNewPred = new PredictionInput
                {
                    Unit      = enemyInRange,
                    Radius    = _q.Width,
                    From      = pointTo,
                    Aoe       = false,
                    Delay     = 0.5f,
                    Range     = _q.Range,
                    Speed     = _q.Speed,
                    Type      = SkillshotType.SkillshotLine,
                    Collision = true
                };

                var qHit = Prediction.GetPrediction(qNewPred);

                if (qHit.Hitchance < HarassHitChance || !_e.IsReady() || !_q.IsReady())
                {
                    continue;
                }

                _e.Cast(pointTo);
                break;
            }
        }
    }
Ejemplo n.º 2
0
    private static void Harass()
    {
        foreach (var enemyInRange in
                    ObjectManager.Get<Obj_AI_Hero>()
                        .Where(
                            enemy =>
                                enemy.IsValidTarget(_q.Range) &&
                                Config.Item("Harass-" + enemy.ChampionName).GetValue<bool>()))
        {
            var qPred = _q.GetPrediction(enemyInRange);
            var wPred = _w.GetPrediction(enemyInRange);

            var manaPercent = (Player.Mana / Player.MaxMana) * 100;

            if (Config.Item("Harass-Use-Q").GetValue<bool>() && _q.IsReady() && manaPercent >= Config.Item("Harass-Mana-Q").GetValue<Slider>().Value &&
                qPred.Hitchance >= HarassHitChance)
                _q.Cast(qPred.CastPosition);

            if (Config.Item("Harass-Use-W").GetValue<bool>() && _w.IsReady() && manaPercent >= Config.Item("Harass-Mana-W").GetValue<Slider>().Value && Player.Distance(enemyInRange) < _w.Range &&
                wPred.Hitchance >= HarassHitChance)
                _w.Cast(enemyInRange);

            if (!_e.IsReady() || !_q.IsReady() || qPred.Hitchance > HitChance.Impossible || Player.Distance(enemyInRange) > _q.Range ||
                Player.Mana <= (Player.Spellbook.GetSpell(SpellSlot.E).ManaCost + Player.Spellbook.GetSpell(SpellSlot.Q).ManaCost) ||
                !Config.Item("Harass-Use-E").GetValue<bool>() ||
                manaPercent < Config.Item("Harass-Mana-E").GetValue<Slider>().Value) return;

            var c = new Geometry.Circle(Player.Position.To2D(), 490);
            var point = c.ToPolygon().Points.OrderByDescending(vector2 => vector2.Distance(enemyInRange.Position.To2D())).Reverse();

            for (var i = 1; i < 3; i++)
            {
                var pointTo = point.ElementAt(i).To3D();
                if (pointTo.IsWall() || pointTo.UnderTurret(true) ||
                    ObjectManager.Get<Obj_AI_Hero>().Any(enemy => enemy != enemyInRange && enemy.IsValidTarget(300, true, pointTo))) continue;

                var qNewPred = new PredictionInput
                {
                    Unit = enemyInRange,
                    Radius = _q.Width,
                    From = pointTo,
                    Aoe = false,
                    Delay = 0.5f,
                    Range = _q.Range,
                    Speed = _q.Speed,
                    Type = SkillshotType.SkillshotLine,
                    Collision = true
                };

                var qHit = Prediction.GetPrediction(qNewPred);

                if (qHit.Hitchance < HarassHitChance || !_e.IsReady() || !_q.IsReady()) continue;

                _e.Cast(pointTo);
                break;
            }
        }
    }
Ejemplo n.º 3
0
        public void UpdatePolygon()
        {
            switch (SpellData.Type)
            {
            case SkillShotType.SkillshotCircle:
                Polygon                 = Circle.ToPolygon();
                EvadePolygon            = Circle.ToPolygon(15);
                PathFindingPolygon      = Circle.ToPolygon(60);
                PathFindingInnerPolygon = Circle.ToPolygon(35);
                DrawingPolygon          = Circle.ToPolygon(
                    0,
                    !SpellData.AddHitbox
                            ? SpellData.Radius
                            : (SpellData.Radius - ObjectManager.Player.BoundingRadius));
                break;

            case SkillShotType.SkillshotLine:
                Polygon        = Rectangle.ToPolygon();
                DrawingPolygon = Rectangle.ToPolygon(
                    0,
                    !SpellData.AddHitbox
                            ? SpellData.Radius
                            : (SpellData.Radius - ObjectManager.Player.BoundingRadius));
                EvadePolygon            = Rectangle.ToPolygon(15);
                PathFindingPolygon      = Rectangle.ToPolygon(60);
                PathFindingInnerPolygon = Rectangle.ToPolygon(35);
                break;

            case SkillShotType.SkillshotMissileLine:
                Polygon        = Rectangle.ToPolygon();
                DrawingPolygon = Rectangle.ToPolygon(
                    0,
                    !SpellData.AddHitbox
                            ? SpellData.Radius
                            : (SpellData.Radius - ObjectManager.Player.BoundingRadius));
                EvadePolygon            = Rectangle.ToPolygon(15);
                PathFindingPolygon      = Rectangle.ToPolygon(60);
                PathFindingInnerPolygon = Rectangle.ToPolygon(35);
                break;

            case SkillShotType.SkillshotCone:
                Polygon                 = Sector.ToPolygon();
                DrawingPolygon          = Polygon;
                EvadePolygon            = Sector.ToPolygon(15);
                PathFindingPolygon      = Sector.ToPolygon(60);
                PathFindingInnerPolygon = Sector.ToPolygon(35);
                break;

            case SkillShotType.SkillshotRing:
                Polygon                 = Ring.ToPolygon();
                DrawingPolygon          = Polygon;
                EvadePolygon            = Ring.ToPolygon(15);
                PathFindingPolygon      = Ring.ToPolygon(60);
                PathFindingInnerPolygon = Ring.ToPolygon(35);
                break;

            case SkillShotType.SkillshotArc:
                Polygon                 = Arc.ToPolygon();
                DrawingPolygon          = Polygon;
                EvadePolygon            = Arc.ToPolygon(15);
                PathFindingPolygon      = Arc.ToPolygon(60);
                PathFindingInnerPolygon = Arc.ToPolygon(35);
                break;
            }
        }