示例#1
0
        public bool ShouldUseOnMany(Base.Champion hero)
        {
            var alliesFacingMe =
                Activator.Allies().Where(x => !x.Player.IsMe && x.Player.Distance(Player.ServerPosition) <= 1000)
                .Count(x => x.Player.IsFacing(Player));

            var hostileFacingMe =
                Activator.Heroes.Where(x => x.Player.IsEnemy && x.Player.Distance(Player.ServerPosition) <= 1000)
                .Count(x => x.Player.IsFacing(Player));

            if (Priority > 6)
            {
                if (hero.SpellCount >= Menu.Item("manyspell" + Name).GetValue <Slider>().Value)
                {
                    if (alliesFacingMe > 0 || hostileFacingMe == 1)
                    {
                        return(true);
                    }
                }
                if (hero.DangerCount >= Menu.Item("manydanger" + Name).GetValue <Slider>().Value)
                {
                    if (alliesFacingMe > 0 || hostileFacingMe == 1)
                    {
                        return(true);
                    }
                }
                if (hero.CrowdControlCount >= Menu.Item("manycrowdcontrol" + Name).GetValue <Slider>().Value)
                {
                    if (alliesFacingMe > 0 || hostileFacingMe == 1)
                    {
                        return(true);
                    }
                }
            }
            else
            {
                if (hero.SpellCount >= Menu.Item("manyspell" + Name).GetValue <Slider>().Value)
                {
                    if (hostileFacingMe > 1)
                    {
                        return(true);
                    }
                }

                if (hero.DangerCount >= Menu.Item("manydanger" + Name).GetValue <Slider>().Value)
                {
                    if (hostileFacingMe > 1)
                    {
                        return(true);
                    }
                }

                if (hero.CrowdControlCount >= Menu.Item("manycrowdcontrol" + Name).GetValue <Slider>().Value)
                {
                    if (hostileFacingMe > 1)
                    {
                        return(true);
                    }
                }
            }

            return(false);
        }
示例#2
0
        public static int AddDamage(HPInstance hpi, Base.Champion hero, string notes)
        {
            Id++;
            var id = Id;

            var aiHero = Activator.Allies().Find(x => x.Player.NetworkId == hero.Player.NetworkId);

            if (aiHero != null && !IncomeDamage.ContainsKey(id))
            {
                aiHero.Attacker = hpi.Attacker;
                if (aiHero.Player.IsValidTarget(float.MaxValue, false) && !aiHero.Player.IsZombie)
                {
                    bool checkmenu = false;

                    switch (hpi.HitType)
                    {
                    case HitType.Spell:
                        aiHero.AbilityDamage += hpi.PredictedDmg;
                        aiHero.HitTypes.Add(HitType.Spell);
                        checkmenu = true;
                        break;

                    case HitType.Buff:
                        aiHero.BuffDamage += hpi.PredictedDmg;
                        aiHero.HitTypes.Add(HitType.Buff);
                        if (notes == "aura.Evade")
                        {
                            aiHero.HitTypes.Add(HitType.Ultimate);
                        }
                        break;

                    case HitType.Troy:
                        aiHero.TroyDamage += hpi.PredictedDmg;
                        aiHero.HitTypes.Add(HitType.Troy);
                        aiHero.HitTypes.AddRange(hpi.Data.HitTypes);
                        break;

                    case HitType.Item:
                        aiHero.ItemDamage += hpi.PredictedDmg;
                        aiHero.HitTypes.Add(HitType.Spell);
                        break;

                    case HitType.TurretAttack:
                        aiHero.TowerDamage += hpi.PredictedDmg;
                        aiHero.HitTypes.Add(HitType.TurretAttack);
                        break;

                    case HitType.MinionAttack:
                        aiHero.MinionDamage += hpi.PredictedDmg;
                        aiHero.HitTypes.Add(HitType.MinionAttack);
                        break;

                    case HitType.AutoAttack:
                        aiHero.AbilityDamage += hpi.PredictedDmg;
                        aiHero.HitTypes.Add(HitType.AutoAttack);
                        break;

                    case HitType.Stealth:
                        aiHero.HitTypes.Add(HitType.Stealth);
                        break;
                    }

                    if (notes == "debug.Test")
                    {
                        if (!Activator.Origin.Item("acdebug").GetValue <bool>())
                        {
                            Chat.Print("<b><font color=\"#FF3366\">Activator#</font></b> - Damage debugging is not enabled!");
                            return(id);
                        }

                        aiHero.AbilityDamage += hpi.PredictedDmg;
                        aiHero.HitTypes.Add(hpi.HitType);
                    }

                    if (checkmenu && !string.IsNullOrEmpty(hpi.Name)) // QWER Only
                    {
                        if (notes != "debug.Test")
                        {
                            // add spell flags
                            hero.HitTypes.AddRange(
                                Lists.MenuTypes.Where(
                                    x => Activator.Origin.Item(
                                        hpi.Name.ToLower() + x.ToString().ToLower()).GetValue <bool>()));
                        }
                    }

                    if (hpi.HitType == HitType.Stealth)
                    {
                        hpi.PredictedDmg = 0;
                    }

                    if (Activator.Origin.Item("acdebug").GetValue <bool>())
                    {
                        Console.WriteLine(
                            hpi.TargetHero.ChampionName + " << [added]: " + hpi.Name + " - "
                            + hpi.PredictedDmg + " / " + hpi.HitType + " / " + notes);
                    }

                    hpi.Id = id;
                    OnPredictDamage?.Invoke();
                    IncomeDamage.Add(id, hpi);
                }
            }

            return(id);
        }
示例#3
0
        public static void EmulateDamage(Obj_AI_Base sender, Base.Champion hero, Gamedata data, HitType dmgType,
                                         string notes = null, float dmgEntry = 0f, int expiry = 500)
        {
            var hpred = new HPInstance();

            hpred.HitType    = dmgType;
            hpred.TargetHero = hero.Player;
            hpred.Data       = data;
            hpred.Name       = string.Empty;

            if (!string.IsNullOrEmpty(data?.SDataName))
            {
                hpred.Name = data.SDataName;
            }

            if (sender is AIHeroClient)
            {
                hpred.Attacker = sender;
            }

            if (dmgEntry == 0f && sender != null)
            {
                switch (dmgType)
                {
                case HitType.AutoAttack:
                    hpred.PredictedDmg = (float)sender.GetAutoAttackDamage(hero.Player, true);
                    break;

                case HitType.MinionAttack:
                case HitType.TurretAttack:
                    hpred.PredictedDmg =
                        (float)
                        Math.Max(
                            sender.CalcDamage(hero.Player, Damage.DamageType.Physical,
                                              sender.BaseAttackDamage + sender.FlatPhysicalDamageMod), 0);
                    break;

                default:
                    if (!string.IsNullOrEmpty(data?.SDataName))
                    {
                        hpred.PredictedDmg = (float)Math.Max(0, sender.GetSpellDamage(hero.Player, data.SDataName));
                    }
                    break;
                }
            }
            else
            {
                var idmg = dmgEntry;
                hpred.PredictedDmg = (float)Math.Round(idmg);
            }

            if (hpred.PredictedDmg > 0)
            {
                var idmg = hpred.PredictedDmg * Activator.Origin.Item("weightdmg").GetValue <Slider>().Value / 100;
                hpred.PredictedDmg = (float)Math.Round(idmg);
            }
            else
            {
                var idmg = (hero.Player.Health / hero.Player.MaxHealth) * 5;
                hpred.PredictedDmg = (float)Math.Round(idmg);
            }

            if (dmgType != HitType.Buff && dmgType != HitType.Troy)
            {
                // check duplicates (missiles and process spell)
                if (IncomeDamage.Select(entry => entry.Value).Any(o => o.Name == data.SDataName))
                {
                    return;
                }
            }

            var dmg             = AddDamage(hpred, hero, notes);
            var extendedEndtime = Activator.Origin.Item("lagtolerance").GetValue <Slider>().Value * 10;

            LeagueSharp.Common.Utility.DelayAction.Add(expiry + extendedEndtime, () => RemoveDamage(dmg, notes));
        }
示例#4
0
 static bool IsLethal(Base.Champion hero)
 {
     return(hero.Player.Health / hero.Player.MaxHealth * 100 <= 35 && hero.IncomeDamage > 0 ||
            hero.HitTypes.Contains(HitType.Ultimate) && hero.IncomeDamage > 0);
 }