Exemplo n.º 1
0
        /// <summary>
        ///     Gets the passive percent mod.
        /// </summary>
        /// <param name="source">The source.</param>
        /// <param name="target">The target.</param>
        /// <param name="amount">The amount.</param>
        /// <param name="damageType">The damageType.</param>
        /// <returns>System.Double.</returns>
        private static double GetPassivePercentMod(
            this Obj_AI_Base source,
            AttackableUnit target,
            double amount,
            // ReSharper disable once UnusedParameter.Local
            DamageType damageType)
        {
            var hero   = source as Obj_AI_Hero;
            var turret = source as Obj_AI_Turret;
            var minion = source as Obj_AI_Minion;

            var minionTarget = target as Obj_AI_Minion;
            var targetHero   = target as Obj_AI_Hero;

            if (turret != null)
            {
                if (minionTarget != null &&
                    (minionTarget.UnitSkinName.Contains("MinionSiege") || minionTarget.UnitSkinName.Contains("MinionSuper")))
                {
                    amount *= 0.7;
                }
            }

            if (minion != null)
            {
                if (minionTarget != null &&
                    Game.MapId == GameMapId.SummonersRift)
                {
                    amount *= 1f + minion.PercentDamageToBarracksMinionMod;
                }
            }

            if (minionTarget != null)
            {
                if (minionTarget.UnitSkinName.Contains("MinionMelee") &&
                    minionTarget.HasBuff("exaltedwithbaronnashorminion"))
                {
                    amount *= 0.25;
                }
            }

            if (hero != null)
            {
                var doubleEdgedSword = hero.GetFerocityPage(MasteryId.Ferocity.DoubleEdgedSword);
                if (doubleEdgedSword != null &&
                    hero.IsUsingMastery(doubleEdgedSword))
                {
                    amount *= 1 + 3 / 100;
                }

                var greenfathersgift = hero.GetCunningPage(MasteryId.Cunning.GreenFathersGift);
                if (greenfathersgift != null &&
                    hero.IsUsingMastery(greenfathersgift) &&
                    hero.HasBuff("Mastery6341"))
                {
                    amount *= target.Health * 3 / 100;
                }

                if (minionTarget != null)
                {
                    if (source.HasBuff("barontarget") &&
                        minionTarget.UnitSkinName.Contains("SRU_Baron"))
                    {
                        amount *= 0.5;
                    }

                    if (source.HasBuff("dragonbuff_tooltipmanager") &&
                        minionTarget.HasBuff("s5_dragonvengeance") &&
                        minionTarget.UnitSkinName.Contains("SRU_Dragon"))
                    {
                        /* TODO: Broscience, not 100% consistent:
                         *  Real Effect: "7% reduced damage for each dragon killed by your team."
                         *  Code Effect: "7% reduced damage for each dragon TYPE killed by your team."
                         *  Reason for inconsistence:
                         *      No Hero Buffs can tell you how many dragons you've killed, nor the name, nor its quantity
                         *          (You receive a determined buff whenever you kill a different dragon and that's it,
                         *          the quantity wont change nor further buffs will be added by killing another dragon of the same type),
                         *
                         *      No Dragon Buffs can tell you how many dragons you've killed, nor the name, nor its quantity,
                         *          (The dragon gets the "s5_dragonvengeance" buff which reduces his damage received by 7% for each
                         *          elemental dragon killed by the attacking team and that's it, the quantity wont change nor further
                         *          buffs will be added by killing another dragon of the same type)
                         *
                         *      No Effect Names can tell you how many dragons you've killed,
                         *      No Objects Names can tell you how many dragons you've killed,
                         *      No existent Property can tell you how many dragons you've killed, the best I found is "NeutralMinionsKilled", which is int, not a determined List/Array,
                         *      so I can't just take it and filter the dragons.
                         *
                         *  TL:DR; There is no way of telling in-game how many dragons a determined team has killed, so, for now, this is the best possible logic for it.
                         */
                        amount *= 1 - 7 * source.ValidActiveBuffs().Count(b => b.Name.Contains("dragonbuff") && b.Name.Contains("_manager")) / 100;
                    }
                }

                if (targetHero != null)
                {
                    var battleTrance = hero.GetFerocityPage(MasteryId.Ferocity.BattleTrance);
                    if (battleTrance != null &&
                        hero.IsUsingMastery(battleTrance))
                    {
                        amount *= 1 + 3 / 100;
                    }

                    var assassin = hero.GetCunningPage(MasteryId.Cunning.Assassin);
                    if (assassin != null &&
                        hero.IsUsingMastery(assassin) &&
                        source.CountAllyHeroesInRange(800f) == 0)
                    {
                        amount *= 1.02;
                    }

                    var merciless = hero.GetCunningPage(MasteryId.Cunning.Merciless);
                    if (merciless != null &&
                        hero.IsUsingMastery(merciless) &&
                        targetHero.HealthPercent() < 40)
                    {
                        amount *= 1 + new[] { 0.6, 1.2, 1.8, 2.4, 3 }[merciless.Points - 1] / 100;
                    }

                    var exposeweakness = targetHero.GetBuff("ExposeWeaknessDebuff");
                    if (exposeweakness != null)
                    {
                        var caster = exposeweakness.Caster;
                        if (caster != null &&
                            hero.Team == caster.Team &&
                            hero.NetworkId != caster.NetworkId)
                        {
                            amount *= 1 + 3 / 100;
                        }
                    }

                    var doubleEdgedSword2 = targetHero.GetFerocityPage(MasteryId.Ferocity.DoubleEdgedSword);
                    if (doubleEdgedSword2 != null &&
                        targetHero.IsUsingMastery(doubleEdgedSword2))
                    {
                        amount *= 1 + 1.5 / 100;
                    }

                    if (hero.MaxHealth < targetHero.MaxHealth && damageType == DamageType.Physical)
                    {
                        var healthDiff = Math.Min(targetHero.MaxHealth - hero.MaxHealth, 1000);
                        if (hero.HasItem(ItemId.LordDominiksRegards))
                        {
                            amount *= 1 + healthDiff / 5000;
                        }
                        else if (hero.HasItem(ItemId.GiantSlayer))
                        {
                            amount *= 1 + healthDiff / 10000;
                        }
                    }

                    var damageReductions = DamageReductions.ComputeReductions(hero, targetHero, damageType);
                    amount *= damageReductions.PercentDamageReduction;
                    amount += damageReductions.FlatDamageReduction;
                }
            }

            return(amount);
        }
Exemplo n.º 2
0
        /// <summary>
        ///     Gets the passive percent mod.
        /// </summary>
        /// <param name="source">The source.</param>
        /// <param name="target">The target.</param>
        /// <param name="amount">The amount.</param>
        /// <param name="damageType">The damageType.</param>
        /// <returns>System.Double.</returns>
        private static double GetPassivePercentMod(
            this Obj_AI_Base source,
            AttackableUnit target,
            double amount,
            // ReSharper disable once UnusedParameter.Local
            DamageType damageType)
        {
            var hero   = source as Obj_AI_Hero;
            var turret = source as Obj_AI_Turret;
            var minion = source as Obj_AI_Minion;

            var minionTarget = target as Obj_AI_Minion;
            var targetHero   = target as Obj_AI_Hero;

            if (turret != null)
            {
                if (minionTarget != null &&
                    (minionTarget.UnitSkinName.Contains("MinionSiege") || minionTarget.UnitSkinName.Contains("MinionSuper")))
                {
                    amount *= 0.7;
                }
            }

            if (minion != null)
            {
                if (minionTarget != null &&
                    Game.MapId == GameMapId.SummonersRift)
                {
                    amount *= 1f + minion.PercentDamageToBarracksMinionMod;
                }
            }

            if (minionTarget != null)
            {
                if (minionTarget.UnitSkinName.Contains("MinionMelee") &&
                    minionTarget.HasBuff("exaltedwithbaronnashorminion"))
                {
                    amount *= 0.25;
                }
            }

            if (hero != null)
            {
                if (minionTarget != null)
                {
                    if (source.HasBuff("barontarget") &&
                        minionTarget.UnitSkinName.Contains("SRU_Baron"))
                    {
                        amount *= 0.5;
                    }

                    if (source.HasBuff("dragonbuff_tooltipmanager") &&
                        minionTarget.HasBuff("s5_dragonvengeance") &&
                        minionTarget.UnitSkinName.Contains("SRU_Dragon"))
                    {
                        amount *= 1 - 7 * source.ValidActiveBuffs().Count(b => b.Name.Contains("dragonbuff") && b.Name.Contains("_manager")) / 100;
                    }
                }

                if (targetHero != null)
                {
                    if (damageType == DamageType.Physical &&
                        hero.MaxHealth < targetHero.MaxHealth)
                    {
                        var healthDiff = Math.Min(targetHero.MaxHealth - hero.MaxHealth, 2000);
                        if (hero.HasItem(ItemId.LordDominiksRegards))
                        {
                            amount *= 1 + healthDiff / 10000;
                        }
                        else if (hero.HasItem(ItemId.GiantSlayer))
                        {
                            amount *= 1 + healthDiff / 20000;
                        }
                    }

                    var damageReductions = DamageReductions.ComputeReductions(hero, targetHero, damageType);
                    amount *= damageReductions.PercentDamageReduction;
                    amount -= damageReductions.FlatDamageReduction;
                }
            }

            return(amount);
        }
Exemplo n.º 3
0
        /// <summary>
        ///     Gets the passive percent mod.
        /// </summary>
        /// <param name="source">The source.</param>
        /// <param name="target">The target.</param>
        /// <param name="amount">The amount.</param>
        /// <param name="damageType">The damageType.</param>
        /// <returns>System.Double.</returns>
        private static double GetPassivePercentMod(
            this Obj_AI_Base source,
            AttackableUnit target,
            double amount,
            // ReSharper disable once UnusedParameter.Local
            DamageType damageType)
        {
            var hero   = source as Obj_AI_Hero;
            var turret = source as Obj_AI_Turret;
            var minion = source as Obj_AI_Minion;

            var minionTarget = target as Obj_AI_Minion;
            var targetHero   = target as Obj_AI_Hero;

            if (turret != null)
            {
                if (minionTarget != null &&
                    (minionTarget.UnitSkinName.Contains("MinionSiege") || minionTarget.UnitSkinName.Contains("MinionSuper")))
                {
                    amount *= 0.7;
                }
            }

            if (minion != null)
            {
                if (minionTarget != null &&
                    Game.MapId == GameMapId.SummonersRift)
                {
                    amount *= 1f + minion.PercentDamageToBarracksMinionMod;
                }
            }

            if (minionTarget != null)
            {
                if (minionTarget.UnitSkinName.Contains("MinionMelee") &&
                    minionTarget.HasBuff("exaltedwithbaronnashorminion"))
                {
                    amount *= 0.25;
                }
            }

            if (hero != null)
            {
                /*
                 * var doubleEdgedSword = hero.GetFerocityPage(MasteryId.Ferocity.DoubleEdgedSword);
                 * if (doubleEdgedSword != null &&
                 *  hero.IsUsingMastery(doubleEdgedSword))
                 * {
                 *  amount *= 1 + 3 / 100;
                 * }
                 *
                 * var greenfathersgift = hero.GetCunningPage(MasteryId.Cunning.GreenFathersGift);
                 * if (greenfathersgift != null &&
                 *  hero.IsUsingMastery(greenfathersgift) &&
                 *  hero.HasBuff("Mastery6341"))
                 * {
                 *  amount *= target.Health * 3 / 100;
                 * }
                 */

                if (minionTarget != null)
                {
                    if (source.HasBuff("barontarget") &&
                        minionTarget.UnitSkinName.Contains("SRU_Baron"))
                    {
                        amount *= 0.5;
                    }

                    if (source.HasBuff("dragonbuff_tooltipmanager") &&
                        minionTarget.HasBuff("s5_dragonvengeance") &&
                        minionTarget.UnitSkinName.Contains("SRU_Dragon"))
                    {
                        amount *= 1 - 7 * source.ValidActiveBuffs().Count(b => b.Name.Contains("dragonbuff") && b.Name.Contains("_manager")) / 100;
                    }
                }

                if (targetHero != null)
                {
                    /*
                     * var battleTrance = hero.GetFerocityPage(MasteryId.Ferocity.BattleTrance);
                     * if (battleTrance != null &&
                     *  hero.IsUsingMastery(battleTrance))
                     * {
                     *  amount *= 1 + 3 / 100;
                     * }
                     *
                     * var assassin = hero.GetCunningPage(MasteryId.Cunning.Assassin);
                     * if (assassin != null &&
                     *  hero.IsUsingMastery(assassin) &&
                     *  source.CountAllyHeroesInRange(800f) == 0)
                     * {
                     *  amount *= 1.02;
                     * }
                     *
                     * var merciless = hero.GetCunningPage(MasteryId.Cunning.Merciless);
                     * if (merciless != null &&
                     *  hero.IsUsingMastery(merciless) &&
                     *  targetHero.HealthPercent() < 40)
                     * {
                     *  amount *= 1 + new[] { 0.6, 1.2, 1.8, 2.4, 3 }[merciless.Points - 1] / 100;
                     * }
                     *
                     * var exposeweakness = targetHero.GetBuff("ExposeWeaknessDebuff");
                     * if (exposeweakness != null)
                     * {
                     *  var caster = exposeweakness.Caster;
                     *  if (caster != null &&
                     *      hero.Team == caster.Team &&
                     *      hero.NetworkId != caster.NetworkId)
                     *  {
                     *      amount *= 1 + 3 / 100;
                     *  }
                     * }
                     *
                     * var doubleEdgedSword2 = targetHero.GetFerocityPage(MasteryId.Ferocity.DoubleEdgedSword);
                     * if (doubleEdgedSword2 != null &&
                     *  targetHero.IsUsingMastery(doubleEdgedSword2))
                     * {
                     *  amount *= 1 + 1.5 / 100;
                     * }
                     */

                    if (hero.MaxHealth < targetHero.MaxHealth && damageType == DamageType.Physical)
                    {
                        var healthDiff = Math.Min(targetHero.MaxHealth - hero.MaxHealth, 1000);
                        if (hero.HasItem(ItemId.LordDominiksRegards))
                        {
                            amount *= 1 + healthDiff / 5000;
                        }
                        else if (hero.HasItem(ItemId.GiantSlayer))
                        {
                            amount *= 1 + healthDiff / 10000;
                        }
                    }

                    var damageReductions = DamageReductions.ComputeReductions(hero, targetHero, damageType);
                    amount *= damageReductions.PercentDamageReduction;
                    amount += damageReductions.FlatDamageReduction;
                }
            }

            return(amount);
        }