Example #1
0
        private static bool IsDamageType(Obj_AI_Hero hero, String spellName, Damage.DamageType damageType)
        {
            DamageSpell damageSpell = null;

            foreach (SpellDataInst spellDataInst in hero.Spellbook.Spells)
            {
                if (string.Equals(spellDataInst.Name, spellName,
                                  StringComparison.InvariantCultureIgnoreCase))
                {
                    damageSpell = Damage.Spells[hero.ChampionName].FirstOrDefault(s =>
                    {
                        if (s.Slot == spellDataInst.Slot)
                        {
                            return(0 == s.Stage);
                        }
                        return(false);
                    }) ?? Damage.Spells[hero.ChampionName].FirstOrDefault(s => s.Slot == spellDataInst.Slot);
                    if (damageSpell != null)
                    {
                        break;
                    }
                }
            }
            if (damageSpell == null || damageSpell.DamageType != damageType)
            {
                return(false);
            }
            return(true);
        }
        public override HandlerRequest Handle(HandlerRequest handlerRequest)
        {
            String cleanLine = handlerRequest.Line.Replace("\n", "");

            String[] typeSplit = cleanLine.Split('-');
            if (typeSplit[0] != "DamageSpell")
            {
                return(nextHandler?.Handle(handlerRequest));
            }
            String[] values = typeSplit[1].Split(',');


            DamageSpell damageSpell = new DamageSpell(values[0], Convert.ToInt32(values[1]));

            try
            {
                ISpellUser spellUser = (ISpellUser)handlerRequest.ListOfCharacter[handlerRequest.ListOfCharacter.Count - 1];
                spellUser.AddSpell(damageSpell);
            }
            catch (System.Exception)
            {
                throw new InvalidFileFormatException("Formato de archivo inválido: Se intentó agregar un spell a un character que no puede usarlos.");
            }

            return(handlerRequest);
        }
Example #3
0
    protected override List <Spell> getSpells()
    {
        Spell        spell1 = new SummonSkeleton(this);
        Spell        spell2 = new DamageSpell(this, 3, 4, "Use1", target: "player");
        List <Spell> spells = new List <Spell> {
            spell1, spell2
        };

        return(spells);
    }
Example #4
0
        private static double GetEDamageToMinion(Obj_AI_Base minion)
        {
            // Workaround cause DamageLib does not have the correct values for Cassio
            var damageSpell = new DamageSpell {
                Slot = SpellSlot.E, DamageType = LeagueSharp.Common.Damage.DamageType.Magical, Damage = (source, target, level) => new double[] { 45, 85, 120, 155, 190 }[level] +(0.55 * source.FlatMagicDamageMod)
            };
            var rawDamage = damageSpell.Damage(Player, minion, Math.Max(1, Math.Min(Player.Spellbook.GetSpell(SpellSlot.Q).Level - 1, 6)));

            return(CalcMagicDamage(Player, minion, rawDamage));
        }
Example #5
0
    protected override List <Spell> getSpells()
    {
        Spell spell1 = new DamageSpell(this, baseCooldown: 4, baseDamage: 3,
                                       animationKey: "Use1", target: "player");
        List <Spell> spells = new List <Spell> {
            spell1
        };

        return(spells);
    }
Example #6
0
    protected override List <Spell> getSpells()
    {
        float        damage = baseDamage + damageIncreasePerLevel * level;
        Spell        spell1 = new DamageSpell(this, attackCooldown, damage, "skill_3", target: "player");
        List <Spell> spells = new List <Spell> {
            spell1
        };

        return(spells);
    }
Example #7
0
        private void ObjAiBaseOnProcessSpellCast(Obj_AI_Base sender, GameObjectProcessSpellCastEventArgs args)
        {
            if (sender.IsAlly && !sender.IsMe && !sender.IsMinion)
            {
                foreach (Obj_AI_Hero enemy in ObjectManager.Get <Obj_AI_Hero>().Where(hero => hero != null && hero.IsValid && hero.IsVisible && !hero.IsDead && hero.IsEnemy))
                {
                    if (enemy.Distance(V2E(args.Start, args.End, enemy.Distance(sender.Position))) <=
                        (200))
                    {
                        Allydamage = sender.GetDamageSpell(enemy, args.SData.Name);

                        if ((Config.Item("SKSQ").GetValue <bool>()))
                        {
                            Mydamage = Player.GetDamageSpell(enemy, SpellSlot.Q);
                            if ((enemy.Distance(Player) <= _Q.Range) && (Allydamage.CalculatedDamage + Mydamage.CalculatedDamage) > enemy.Health &&
                                Allydamage.CalculatedDamage < enemy.Health)
                            {
                                Game.PrintChat("enemy health: " + enemy.Health + " Total damage : " + (Allydamage.CalculatedDamage + Mydamage.CalculatedDamage) + "health after : " + (enemy.Health - (Allydamage.CalculatedDamage + Mydamage.CalculatedDamage)) + " " + args.SData.Name);
                                var output = Prediction.GetPrediction(enemy, _Q.Delay, _Q.Width, _Q.Speed);
                                _Q.Cast(output.UnitPosition, true);
                            }
                        }

                        if ((Config.Item("SKSW").GetValue <bool>()))
                        {
                            Mydamage = Player.GetDamageSpell(enemy, SpellSlot.W);

                            if ((enemy.Distance(Player) <= _W.Range) && (Allydamage.CalculatedDamage + Mydamage.CalculatedDamage) > enemy.Health &&
                                Allydamage.CalculatedDamage < enemy.Health)
                            {
                                var output = Prediction.GetPrediction(enemy, _W.Delay, _W.Width, _W.Speed);
                                _W.Cast(output.UnitPosition, true);
                            }
                        }

                        if ((Config.Item("SKSE").GetValue <bool>()))
                        {
                            Mydamage = Player.GetDamageSpell(enemy, SpellSlot.E);

                            if ((enemy.Distance(Player) <= _E.Range) && (Allydamage.CalculatedDamage + Mydamage.CalculatedDamage) > enemy.Health &&
                                Allydamage.CalculatedDamage < enemy.Health)
                            {
                                var output = Prediction.GetPrediction(enemy, _E.Delay, _E.Width, _E.Speed);
                                _E.Cast(output.UnitPosition, true);
                            }
                        }
                    }
                }
            }
        }
Example #8
0
            public void Run()
            {
                var spell = new DamageSpell("Fireball", 10, 5)
                {
                    Description = "Big AOE"
                };

                var caster = new Caster("Deccer");

                caster.Learn(spell);

                var enemy1 = new Enemey1(10);

                caster.Cast("Fireball", enemy1);
                caster.Cast("Fireball", enemy1);
            }
Example #9
0
    public override void NewSpell(string element)
    {
        switch (element)
        {
        case ("Fire"):
            settingSpell = new DamageSpell("Fire", 1);
            break;

        case ("Water"):
            settingSpell = new DamageSpell("Water", 1);
            break;

        case ("Earth"):
            settingSpell = new DamageSpell("Earth", 1);
            break;

        case ("Air"):
            settingSpell = new DamageSpell("Air", 1);
            break;
        }
        spellQueue.Enqueue(settingSpell);
    }
        private static Dictionary <Obj_AI_Hero, List <IncomingDamage> > BuffDamage(Obj_AI_Hero hero,
                                                                                   Dictionary <Obj_AI_Hero, List <IncomingDamage> > tempDamages) //TODO: Add Ignite
        {
            foreach (BuffInstance buff in hero.Buffs)
            {
                if (buff.Type == BuffType.Poison || buff.Type == BuffType.Damage)
                {
                    foreach (Database.Spell spell in Database.GetSpellList())
                    {
                        if (string.Equals(spell.Name, buff.DisplayName, StringComparison.InvariantCultureIgnoreCase))
                        {
                            try
                            {
                                DamageSpell damageSpell = null;
                                Obj_AI_Hero enemy       = null;
                                foreach (Obj_AI_Hero champ in ObjectManager.Get <Obj_AI_Hero>())
                                {
                                    if (champ.IsEnemy)
                                    {
                                        foreach (SpellDataInst spellDataInst in champ.Spellbook.Spells)
                                        {
                                            if (string.Equals(spellDataInst.Name, spell.Name,
                                                              StringComparison.InvariantCultureIgnoreCase))
                                            {
                                                damageSpell = Damage.Spells[champ.ChampionName].FirstOrDefault(s =>
                                                {
                                                    if (s.Slot == spellDataInst.Slot)
                                                    {
                                                        return(0 == s.Stage);
                                                    }
                                                    return(false);
                                                }) ??
                                                              Damage.Spells[champ.ChampionName].FirstOrDefault(
                                                    s => s.Slot == spellDataInst.Slot);
                                                if (damageSpell != null)
                                                {
                                                    enemy = champ;
                                                    break;
                                                }
                                            }
                                        }
                                    }
                                }

                                double spellDamage = enemy.GetSpellDamage(hero, spell.Name);
                                bool   exists      = false;
                                foreach (IncomingDamage incomingDamage in tempDamages[hero])
                                {
                                    if (incomingDamage.SpellName.Contains(spell.Name))
                                    {
                                        exists = true;
                                        break;
                                    }
                                }
                                if (spellDamage != 0.0f && !exists)
                                {
                                    tempDamages[hero].Add(new IncomingDamage(spell.Name, enemy, new Vector3(),
                                                                             new Vector3(), spellDamage, buff.EndTime, hero));
                                }
                            }
                            catch (InvalidOperationException)
                            {
                                //Cannot find spell
                            }
                        }
                    }
                }
            }
            return(tempDamages);
        }
Example #11
0
        public void ObjAiBaseOnProcessSpellCast(Obj_AI_Base sender, GameObjectProcessSpellCastEventArgs args)
        {
            var spellData = SpellDatabase.GetByName(args.SData.Name);

            if (sender.IsAlly && !sender.IsMinion && !sender.IsAutoAttacking && !sender.IsMe)
            {
                string[] spelllist = { "EzrealTrueshotBarrage", "LuxMaliceCannon",     "UFSlash",                   "InfernalGuardian",     "EnchantedCrystalArrow", "DravenRCast",                "FizzMarinerDoom", "GravesChargeShot",
                                       "LeonaSolarFlare",       "RivenFengShuiEngine", "SejuaniGlacialPrisonStart", "shyvanatransformcast", "SonaCrescendo",         "XerathArcaneBarrageWrapper", "ZiggsR",
                                       "CaitlynAceintheHole",   "JinxRWrapper" };

                for (int i = 0; i <= spelllist.Length; i++)
                {
                    if (args.SData.Name == spelllist[i])
                    {
                        //var spellData = SpellDatabase.GetByName(args.SData.Name);

                        if (spellData.ChampionName == "Caitlyn")
                        {
                            var diab = (Obj_AI_Base)args.Target;
                            Allydamage = sender.GetDamageSpell(diab, args.SData.Name);
                            Mydamage   = Player.GetDamageSpell(diab, SpellSlot.R);

                            if (Config.Item("Killable").GetValue <bool>())
                            {
                                if ((Mydamage.CalculatedDamage + Allydamage.CalculatedDamage) < diab.Health || Allydamage.CalculatedDamage > diab.Health)
                                {
                                    return;
                                }
                            }
                            Game.PrintChat("Spell Detected: " + args.SData.Name + " By: " + sender.BaseSkinName +
                                           " Ally Casted it On : " + diab.BaseSkinName); //Checks..
                            if (diab.Distance(Player.Position) < 3200 && diab.Distance(Player.Position) <= R.Range)
                            {
                                if (R.IsSkillshot)
                                {
                                    R.Cast(diab, true);
                                }
                                else
                                {
                                    R.CastOnUnit(diab, true);
                                }
                            }
                        }
                        else
                        {
                            foreach (Obj_AI_Hero enemy in ObjectManager.Get <Obj_AI_Hero>().Where(hero => hero != null && hero.IsValid && hero.IsVisible && !hero.IsDead && hero.IsEnemy))
                            {
                                //   PredictionOutput allyOutput = Prediction.GetPrediction(enemy, 500, args.SData.LineWidth, args.SData.MissileSpeed);

                                /*
                                 * Game.PrintChat(sender.BaseSkinName + " Ultimate Damage is : " + Allydamage.CalculatedDamage);
                                 * Game.PrintChat("My Ultimate Damage is : " + Mydamage.CalculatedDamage);
                                 * Game.PrintChat("Total damage is : " + (Allydamage.CalculatedDamage + Mydamage.CalculatedDamage));
                                 */


                                if (Config.Item("Killable").GetValue <bool>())
                                {
                                    Allydamage = sender.GetDamageSpell(enemy, args.SData.Name);
                                    Mydamage   = Player.GetDamageSpell(enemy, SpellSlot.R);

                                    if ((Allydamage.CalculatedDamage + Mydamage.CalculatedDamage) < enemy.Health && Allydamage.CalculatedDamage > enemy.Health)
                                    {
                                        return;
                                    }
                                }

                                if (enemy.Distance(V2E(args.Start, args.End, enemy.Distance(sender.Position))) <= (spellData.Radius - 50))
                                {
                                    Game.PrintChat("SkillShot Detected: " + args.SData.Name + " By: " + sender.BaseSkinName +
                                                   " Ally Casted it right.. On : " + enemy.BaseSkinName);     //Checks..
                                    if (enemy.Distance(Player.Position) < 3200 && enemy.Distance(Player.Position) <= R.Range)
                                    {
                                        if (Player.BaseSkinName == "Riven")
                                        {
                                            R.Cast(false);
                                        }
                                        if (!R.IsSkillshot) // Casting for targetable spells
                                        {
                                            R.CastOnUnit(enemy, true);
                                        }
                                        else
                                        {
                                            R.Cast(enemy, true);
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
Example #12
0
        private void Obj_AI_Base_OnProcessSpellCast(Obj_AI_Base sender, GameObjectProcessSpellCastEventArgs args)
        {
            PredictionInput input = null;

            if (sender.IsMe || sender.IsEnemy || !(sender is Obj_AI_Hero))
            {
                return;
            }
            if (!Spells.Contains(args.SData.Name) || Config.SubMenu("AutoCombo_Spells").Item(args.SData.Name).GetValue <bool>() == false)
            {
                return;
            }
            var targetable = false;
            var line       = false;
            var aoe        = false;

            drawTime = Game.Time;

            var result = SpellDatabase.GetByName(args.SData.Name);

            if (result != null)
            {
                switch (result.Type)
                {
                case SkillShotType.SkillshotLine:
                    _skillshot = new Geometry.Polygon.Rectangle(sender.Position, sender.Position.Extend(args.End, result.Range), result.Radius);
                    line       = true;
                    break;

                case SkillShotType.SkillshotMissileLine:
                    _skillshot = new Geometry.Polygon.Rectangle(sender.Position, sender.Position.Extend(args.End, result.Range), result.Radius);
                    line       = true;
                    break;

                case SkillShotType.SkillshotCircle:
                    _skillshotAoe = new Geometry.Polygon.Circle(args.End, result.Radius);
                    aoe           = true;
                    break;

                case SkillShotType.SkillshotRing:
                    _skillshotAoe = new Geometry.Polygon.Circle(args.End, result.Radius);
                    aoe           = true;
                    break;
                }
            }

            foreach (
                var enemy in
                ObjectManager.Get <Obj_AI_Hero>()
                .Where(enemy => enemy.IsEnemy && enemy.Distance(Player) <= Config.SubMenu("AutoCombo").Item("Range").GetValue <Slider>().Value))
            {
                if (!aoe && !line && args.Target.Position == enemy.Position)
                {
                    targetable = true;
                }
                if (!aoe && !line && !targetable)
                {
                    continue;
                }
                //Game.PrintChat(sender.BaseSkinName + " Ultimate Damage is : " + Allydamage.CalculatedDamage);
                //Game.PrintChat("My Ultimate Damage is : " + Mydamage.CalculatedDamage);
                //Game.PrintChat("Total damage is : " + (Allydamage.CalculatedDamage + Mydamage.CalculatedDamage));

                if (Config.Item("Killable").GetValue <bool>())
                {
                    Allydamage = sender.GetDamageSpell(enemy, args.SData.Name);
                    Mydamage   = Player.GetDamageSpell(enemy, SpellSlot.R);

                    if ((Allydamage.CalculatedDamage + Mydamage.CalculatedDamage) < enemy.Health &&
                        Allydamage.CalculatedDamage > enemy.Health)
                    {
                        return;
                    }
                }

                if (line)
                {
                    input = new PredictionInput
                    {
                        Unit      = enemy,
                        Type      = SkillshotType.SkillshotLine,
                        Speed     = result.MissileSpeed,
                        From      = sender.Position,
                        Delay     = result.Delay,
                        Aoe       = false,
                        Radius    = result.Radius,
                        Range     = result.Range,
                        Collision = false
                    };
                }
                else
                {
                    if (aoe)
                    {
                        input = new PredictionInput
                        {
                            Unit      = enemy,
                            Type      = SkillshotType.SkillshotCircle,
                            Speed     = result.MissileSpeed,
                            From      = sender.Position,
                            Delay     = result.Delay,
                            Aoe       = true,
                            Radius    = result.Radius,
                            Range     = result.Range,
                            Collision = false
                        };
                    }
                }
                if (!targetable)
                {
                    var output = Prediction.GetPrediction(input);
                    var unit   = output.CastPosition;
                    if (line)
                    {
                        if (!_skillshot.IsInside(unit) && !_skillshot.IsInside(enemy))
                        {
                            continue;
                        }
                    }
                    else
                    {
                        if (!_skillshotAoe.IsInside(unit) && !_skillshotAoe.IsInside(enemy))
                        {
                            continue;
                        }
                    }
                }

                R.Cast(enemy.Position);
                if (enemy.Distance(Player.Position) <= Config.SubMenu("AutoCombo").Item("Range").GetValue <Slider>().Value)
                {
                    R.Cast(enemy);
                    R.CastOnUnit(enemy);
                }
            }
        }