コード例 #1
0
        private static void OnProcessSpell(
            Obj_AI_Base sender,
            GameObjectProcessSpellCastEventArgs args,
            SpellData data,
            SpellArgs spellArgs)
        {
            switch (data.MenuName)
            {
            case "MalphiteR":
            {
                var newData = (SpellData)data.Clone();
                newData.MissileSpeed += (int)sender.MoveSpeed;
                spellArgs.NewData     = newData;
            }
            break;

            case "SionR":
            {
                var newData = (SpellData)data.Clone();
                newData.MissileSpeed = (int)sender.MoveSpeed;
                spellArgs.NewData    = newData;
            }
            break;
            }

            if (data.MultipleNumber == -1 || (data.MenuName == "KhazixW" && args.SData.Name == data.SpellName))
            {
                return;
            }

            var startPos = sender.ServerPosition.To2D();
            var start    = startPos;
            var endPos   = args.End.To2D();

            if (data.InfrontStart > 0)
            {
                start = start.Extend(endPos, data.InfrontStart);
            }

            var dir = (endPos - start).Normalized();

            for (var i = -(data.MultipleNumber - 1) / 2; i <= (data.MultipleNumber - 1) / 2; i++)
            {
                SpellDetector.AddSpell(
                    sender,
                    startPos,
                    start + dir.Rotated(data.MultipleAngle * i) * (data.Range / 2f),
                    data);
            }

            spellArgs.NoProcess = true;
        }
コード例 #2
0
        private static void FizzR(Obj_AI_Base sender, MissileClient missile, SpellData data, SpellArgs spellArgs)
        {
            if (data.MenuName != "FizzR")
            {
                return;
            }

            var dist   = missile.StartPosition.Distance(missile.EndPosition);
            var radius = dist >= 910 ? 450 : (dist >= 455 ? 325 : 0);

            if (radius == 0)
            {
                return;
            }

            var spell =
                Evade.DetectedSpells.Values.FirstOrDefault(
                    i => i.Data.MenuName == data.MenuName && i.Unit.CompareId(sender) && i.Type == SpellType.Circle);

            if (spell != null)
            {
                Evade.DetectedSpells[spell.SpellId].Radius = radius + (int)ObjectManager.Player.BoundingRadius;

                return;
            }

            var newData = (SpellData)data.Clone();

            newData.RadiusEx  = radius;
            spellArgs.NewData = newData;
        }
コード例 #3
0
ファイル: Azir.cs プロジェクト: mrokksc1/yasssuuoo
        private static void AzirR(
            Obj_AI_Base sender,
            GameObjectProcessSpellCastEventArgs args,
            SpellData data,
            SpellArgs spellArgs)
        {
            if (data.MenuName != "AzirR")
            {
                return;
            }

            var newData = (SpellData)data.Clone();

            newData.Radius = data.Radius * new[] { 4, 5, 6 }[((Obj_AI_Hero)sender).GetSpell(data.Slot).Level - 1];
            //spellArgs.NewData = newData;
        }
コード例 #4
0
        private static void PoppyR1(
            Obj_AI_Base sender,
            GameObjectProcessSpellCastEventArgs args,
            SpellData data,
            SpellArgs spellArgs)
        {
            if (data.MenuName != "PoppyRCharge")
            {
                return;
            }

            var newData = (SpellData)data.Clone();

            newData.FixedRange = true;
            spellArgs.NewData  = newData;
        }
コード例 #5
0
        private static void YasuoQ(
            Obj_AI_Base sender,
            GameObjectProcessSpellCastEventArgs args,
            SpellData data,
            SpellArgs spellArgs)
        {
            if (data.MenuName != "YasuoQ")
            {
                return;
            }

            var delay = (int)(sender.Spellbook.CastTime - Game.Time) * 1000;

            if (delay <= 0)
            {
                return;
            }

            var newData = (SpellData)data.Clone();

            newData.Delay     = delay;
            spellArgs.NewData = newData;
        }
コード例 #6
0
ファイル: Bard.cs プロジェクト: SupportExTraGoZ/LeagueSharp-2
        private static void BardR(Obj_AI_Base sender, MissileClient missile, SpellData data, SpellArgs spellArgs)
        {
            if (data.MenuName != "BardR" || !missile.SData.Name.Contains("Fixed"))
            {
                return;
            }

            var newData = (SpellData)data.Clone();

            newData.MissileSpeed = newData.MissileMinSpeed;
            var spell =
                Evade.DetectedSpells.Values.FirstOrDefault(
                    i => i.Data.MenuName == data.MenuName && i.Unit.NetworkId == sender.NetworkId);

            if (spell == null)
            {
                spellArgs.NewData = newData;

                return;
            }

            Evade.DetectedSpells.Remove(spell.SpellId);
            SpellDetector.AddSpell(sender, missile.StartPosition, missile.EndPosition, newData, missile);
        }
コード例 #7
0
        private static void OnDash(Obj_AI_Base sender, Dash.DashItem args, SpellData data)
        {
            var caster = sender as AIHeroClient;

            if (caster == null || !caster.IsValid || (!caster.IsEnemy && !Configs.Debug) ||
                caster.ChampionName != data.ChampName)
            {
                return;
            }

            if (Utils.GameTimeTickCount - lastQTick > 100)
            {
                return;
            }

            var newData = (SpellData)data.Clone();

            if (caster.HasBuff("RivenFengShuiEngine"))
            {
                newData.Radius += 75;
            }

            SpellDetector.AddSpell(caster, args.StartPos, args.EndPos, newData, null, SpellType.None, true, lastQTick);
        }
コード例 #8
0
        public static void AddSpell(
            Obj_AI_Base sender,
            Vector2 spellStart,
            Vector2 spellEnd,
            SpellData data,
            MissileClient missile = null,
            SpellType type        = SpellType.None,
            bool checkExplosion   = true,
            int startT            = 0)
        {
            var isFromFoW = !sender.IsVisible;

            if (isFromFoW && Configs.DodgeFoW == 0)
            {
                return;
            }

            if (!Configs.Debug && Evade.PlayerPosition.Distance(spellStart) > (data.Range + data.Radius + 1000) * 1.5)
            {
                return;
            }

            if (type == SpellType.None)
            {
                type = data.Type;
            }

            var startPos  = spellStart;
            var endPos    = spellEnd;
            var startTime = startT > 0 ? startT : Utils.GameTimeTickCount - Game.Ping / 2;
            var endTime   = data.Delay;

            if (missile == null)
            {
                if (data.BehindStart > 0)
                {
                    startPos = startPos.Extend(endPos, -data.BehindStart);
                }

                if (data.InfrontStart > 0)
                {
                    startPos = startPos.Extend(endPos, data.InfrontStart);
                }
            }
            else
            {
                if (!data.MissileDelayed)
                {
                    startTime -= data.Delay;
                }

                if (data.MissileSpeed != 0)
                {
                    startTime -= (int)(startPos.Distance(missile.Position) / data.MissileSpeed * 1000);
                }
            }

            if (type == SpellType.Cone || type == SpellType.MissileCone || data.FixedRange ||
                (data.Range > 0 && endPos.Distance(startPos) > data.Range))
            {
                endPos = startPos.Extend(endPos, data.Range);
            }

            if (missile == null)
            {
                if (data.ExtraRange > 0)
                {
                    endPos = endPos.Extend(startPos, -Math.Min(data.ExtraRange, data.Range - endPos.Distance(startPos)));
                }

                if (data.Invert)
                {
                    endPos = startPos.Extend(endPos, -startPos.Distance(endPos));
                }

                if (data.Perpendicular)
                {
                    var pDir = (endPos - startPos).Normalized().Perpendicular();
                    startPos = spellEnd - pDir * data.RadiusEx;
                    endPos   = spellEnd + pDir * data.RadiusEx;
                }
            }

            switch (type)
            {
            case SpellType.MissileLine:
                endTime += data.MissileAccel != 0
                                   ? 5000
                                   : (int)(startPos.Distance(endPos) / data.MissileSpeed * 1000);
                break;

            case SpellType.Circle:
                if (data.MissileSpeed != 0)
                {
                    endTime += (int)(startPos.Distance(endPos) / data.MissileSpeed * 1000);

                    if (data.Type == SpellType.MissileLine && data.HasStartExplosion)
                    {
                        endPos  = startPos;
                        endTime = data.Delay;
                    }
                }
                else if (data.Range == 0 && data.Radius > 0)
                {
                    endPos = startPos;
                }
                break;

            case SpellType.Arc:
            case SpellType.MissileCone:
                endTime += (int)(startPos.Distance(endPos) / data.MissileSpeed * 1000);
                break;
            }

            var dir          = (endPos - startPos).Normalized();
            var alreadyAdded = false;

            if (missile == null)
            {
                if (!data.DontCheckForDuplicates)
                {
                    foreach (var spell in
                             Evade.DetectedSpells.Values.Where(
                                 i =>
                                 i.Data.MenuName == data.MenuName && i.Unit.CompareId(sender) &&
                                 dir.AngleBetween(i.Direction) < 3 && i.Start.Distance(startPos) < 100))
                    {
                        alreadyAdded = spell.MissileObject != null && spell.MissileObject.IsValid;

                        if (alreadyAdded)
                        {
                            break;
                        }
                    }
                }
            }
            else if (!data.MissileOnly)
            {
                foreach (var spell in
                         Evade.DetectedSpells.Values.Where(
                             i =>
                             i.Data.MenuName == data.MenuName && i.Unit.CompareId(sender) &&
                             dir.AngleBetween(i.Direction) < 3 && i.Start.Distance(startPos) < 100 &&
                             i.MissileObject == null))
                {
                    spell.MissileObject = missile;
                    spell.Start         = missile.StartPosition.To2D();
                    alreadyAdded        = true;

                    if (Configs.Debug)
                    {
                        Console.WriteLine($"=> M: {spell.SpellId} | {Utils.GameTimeTickCount}");
                    }

                    break;
                }
            }

            if (alreadyAdded)
            {
                return;
            }

            if (checkExplosion && (data.HasStartExplosion || data.HasEndExplosion))
            {
                var newData = (SpellData)data.Clone();

                if (data.HasStartExplosion)
                {
                    newData.CollisionObjects = null;
                }

                AddSpell(sender, spellStart, spellEnd, newData, missile, SpellType.Circle, false, startT);
            }

            var newSpell = new SpellInstance(data, startTime, endTime + data.ExtraDelay, startPos, endPos, sender, type)
            {
                SpellId = spellIdCount++, IsFromFoW = isFromFoW, MissileObject = missile
            };

            Evade.DetectedSpells.Add(newSpell.SpellId, newSpell);

            if (Configs.Debug)
            {
                Console.WriteLine($"=> A: {newSpell.SpellId} | {Utils.GameTimeTickCount}");
            }
        }