Exemplo n.º 1
0
        public override float GetDamage(params Unit[] targets)
        {
            // "4 6 8 10"
            var damagePercent = this.Ability.GetAbilitySpecialData("damage_health_pct");

            var talent = this.Owner.GetAbilityById(AbilityId.special_bonus_unique_zeus);

            if (talent != null && talent.Level > 0)
            {
                damagePercent += talent.GetAbilitySpecialData("value");
            }

            damagePercent /= 100.0f;
            var amplify = this.Owner.GetSpellAmplification();

            var totalDamage = 0.0f;

            foreach (var target in targets)
            {
                var reduction = this.Ability.GetDamageReduction(target, this.DamageType);
                var damage    = damagePercent * target.Health;
                totalDamage += DamageHelpers.GetSpellDamage(damage, amplify, reduction);
            }

            return(totalDamage);
        }
        public float GetDamage(float concotionDuration, params Unit[] targets)
        {
            var minDamage = this.Ability.GetAbilitySpecialData("min_damage");
            var maxDamage = this.Ability.GetAbilitySpecialData("max_damage");

            var talent = this.Owner.GetAbilityById(AbilityId.special_bonus_unique_alchemist_2);

            if (talent != null && talent.Level > 0)
            {
                var dmgValue = talent.GetAbilitySpecialData("value");
                minDamage += dmgValue;
                maxDamage += dmgValue;
            }

            var percentage = concotionDuration / this.Duration;
            var damage     = minDamage + ((maxDamage - minDamage) * percentage);
            var amp        = this.Owner.GetSpellAmplification();
            var reduction  = 0.0f;

            if (targets.Any())
            {
                reduction = this.Ability.GetDamageReduction(targets.First(), this.Ability.DamageType);
            }

            return(DamageHelpers.GetSpellDamage(damage, amp, reduction));
        }
        public override float GetDamage(params Unit[] targets)
        {
            var damage  = this.RawDamage;
            var amplify = this.Ability.SpellAmplification();

            if (!targets.Any())
            {
                return(damage);
            }

            var totalDamage = 0.0f;

            foreach (var target in targets)
            {
                var hero = target is Hero;
                if (hero)
                {
                    damage += this.Ability.GetAbilitySpecialData("damage_per_hero");
                }

                var creep = target is Creep;
                if (target.IsNeutral || creep)
                {
                    damage += this.Ability.GetAbilitySpecialData("damage_per_unit");
                }
            }

            var reduction = this.Ability.GetDamageReduction(targets.First(), this.DamageType);

            totalDamage += DamageHelpers.GetSpellDamage(damage, amplify, reduction);

            return(totalDamage);
        }
        public override float GetDamage(params Unit[] targets)
        {
            var damage   = base.GetDamage(targets);
            var spellAmp = this.Owner.GetSpellAmplification();
            var distance = this.Ability.GetAbilitySpecialData("distance_damage_pct");

            var talent = this.Owner.GetAbilityById(AbilityId.special_bonus_unique_enchantress_4);

            if (talent != null && talent.Level > 0)
            {
                distance += talent.GetAbilitySpecialData("value");
            }

            var reduction = 0.0f;

            if (targets.Any())
            {
                var target         = targets.First();
                var targetdistance = Math.Min(this.Owner.Distance2D(target) + 50, this.Owner.AttackRange()) / 100;

                reduction = this.Ability.GetDamageReduction(target, this.DamageType);
                var distanceDamage = DamageHelpers.GetSpellDamage(distance, spellAmp, reduction);

                damage += targetdistance * distanceDamage;
            }

            return(damage);
        }
Exemplo n.º 5
0
        public float GetDamage(Unit target)
        {
            var damage    = GetDamage();
            var reduction = Ability.GetDamageReduction(target, DamageType);

            return(DamageHelpers.GetSpellDamage(damage, 0f, reduction));
        }
        public override float GetDamage(params Unit[] targets)
        {
            if (!targets.Any())
            {
                return(0);
            }

            var amplify     = this.Ability.SpellAmplification();
            var multiplier  = this.RawDamage;
            var totalDamage = 0.0f;

            foreach (var target in targets)
            {
                var hero = target as Hero;
                if (hero == null)
                {
                    continue;
                }

                var intelligenceDifference = ((Hero)this.Owner).TotalIntelligence - hero.TotalIntelligence;
                if (intelligenceDifference <= 0)
                {
                    continue;
                }

                var reduction = this.Ability.GetDamageReduction(hero, this.DamageType);
                totalDamage += DamageHelpers.GetSpellDamage(intelligenceDifference * multiplier, amplify, reduction);
            }

            return(totalDamage);
        }
Exemplo n.º 7
0
        public override float GetDamage(Unit target, float physicalDamageModifier, float targetHealth = float.MinValue)
        {
            var amplify   = this.Ability.SpellAmplification();
            var reduction = this.Ability.GetDamageReduction(target, this.DamageType);

            return(base.GetDamage(target, physicalDamageModifier, targetHealth) + DamageHelpers.GetSpellDamage(this.RawDamage, amplify, -reduction, physicalDamageModifier));
        }
Exemplo n.º 8
0
        public override float GetDamage(params Unit[] targets)
        {
            if (!targets.Any())
            {
                return(this.RawDamage);
            }

            var creepPenalty = this.Ability.GetAbilitySpecialData("creep_damage_penalty") / -100;
            var heroBonus    = this.Ability.GetAbilitySpecialData("bonus_hero_damage");

            var totalDamage = 0.0f;

            foreach (var target in targets)
            {
                var targetDamage = this.Owner.GetAttackDamage(target, true);

                if (target is Creep)
                {
                    totalDamage += targetDamage * creepPenalty;
                }
                else
                {
                    var reduction = this.Ability.GetDamageReduction(target, this.DamageType);
                    totalDamage += DamageHelpers.GetSpellDamage(heroBonus, 0, reduction) + targetDamage;
                }
            }

            return(totalDamage);
        }
        public override float GetDamage(params Unit[] targets)
        {
            var damage   = base.GetDamage(targets);
            var spellAmp = this.Owner.GetSpellAmplification();

            var damagePercent = this.Ability.GetAbilitySpecialData("intellect_damage_pct") / 100.0f;

            var hero        = this.Owner as Hero;
            var bonusDamage = Math.Max(hero.TotalIntelligence, 0) * damagePercent;

            var isSilenced = targets.First().IsSilenced();

            if (isSilenced && this.Owner.HasAghanimsScepter())
            {
                bonusDamage *= 2;
            }

            var reduction = 0.0f;

            if (targets.Any())
            {
                var target = targets.First();
                reduction = this.Ability.GetDamageReduction(target, this.DamageType);
            }

            damage += DamageHelpers.GetSpellDamage(bonusDamage, spellAmp, reduction);
            return(damage);
        }
Exemplo n.º 10
0
        public override float GetDamage(params Unit[] targets)
        {
            if (!targets.Any())
            {
                return(0);
            }

            var amplify     = this.Ability.SpellAmplification();
            var rawDamage   = this.RawDamage;
            var multiplier  = Ability.GetAbilitySpecialDataWithTalent(Owner, "damage_multiplier");
            var totalDamage = 0.0f;

            foreach (var target in targets)
            {
                var hero = target as Hero;
                if (hero == null)
                {
                    continue;
                }

                var manaDifference = ((Hero)this.Owner).MaximumMana - hero.MaximumMana;
                if (manaDifference <= 0)
                {
                    continue;
                }

                var reduction = this.Ability.GetDamageReduction(hero, this.DamageType);
                totalDamage += DamageHelpers.GetSpellDamage((manaDifference * multiplier) + rawDamage, amplify, reduction);
            }

            return(totalDamage);
        }
Exemplo n.º 11
0
        public override float GetDamage(params Unit[] targets)
        {
            if (!targets.Any())
            {
                return(0);
            }

            var mainTarget = targets.First();

            if (mainTarget.MaximumMana <= 0)
            {
                return(0);
            }

            var amplify    = this.Ability.SpellAmplification();
            var manaDamage = (mainTarget.MaximumMana - mainTarget.Mana) * this.RawDamage;

            var totalDamage = 0f;

            foreach (var target in targets)
            {
                var reduction = this.Ability.GetDamageReduction(target, this.DamageType);
                totalDamage += DamageHelpers.GetSpellDamage(manaDamage, amplify, reduction);
            }

            return(totalDamage);
        }
Exemplo n.º 12
0
 public override float GetDamage(params Unit[] targets)
 {
     float rawDamage = this.RawDamage;
     Unit target = ((IEnumerable<Unit>)targets).First<Unit>();
     float damageReduction = DamageHelpers.GetDamageReduction(this, target, DamageType.Physical);
     var finalDamage = DamageHelpers.GetSpellDamage(rawDamage, 0, damageReduction);
     return finalDamage;
 }
Exemplo n.º 13
0
        public override float GetDamage(params Unit[] targets)
        {
            if (!targets.Any())
            {
                return(base.GetDamage() + this.RawDamage);
            }

            var reduction = this.Ability.GetDamageReduction(targets.First(), this.DamageType);
            var amplify   = this.Ability.SpellAmplification();

            return(base.GetDamage(targets) + DamageHelpers.GetSpellDamage(this.RawDamage, amplify, reduction));
        }
Exemplo n.º 14
0
        public float GetTickDamage(params Unit[] targets)
        {
            var damage = this.RawTickDamage;
            var amplify = this.Ability.SpellAmplification();
            var reduction = 0.0f;
            if (targets.Any())
            {
                reduction = this.Ability.GetDamageReduction(targets.First(), this.DamageType);
            }

            return DamageHelpers.GetSpellDamage(damage, amplify, reduction);
        }
Exemplo n.º 15
0
        public override float GetDamage(params Unit[] targets)
        {
            var amplify   = this.Owner.GetSpellAmplification();
            var reduction = 0.0f;

            if (targets.Any())
            {
                reduction = this.Ability.GetDamageReduction(targets.First());
            }

            return(DamageHelpers.GetSpellDamage(this.RawDamage, amplify, reduction));
        }
        public float GetTickDamage(params Unit[] targets)
        {
            var damage    = this.RawTickDamage / 2.0f; // Internal data gives damage per second meanwhile ability ticks every half second.
            var amplify   = this.Ability.SpellAmplification();
            var reduction = 0.0f;

            if (targets.Any())
            {
                reduction = this.Ability.GetDamageReduction(targets.First(), this.DamageType);
            }

            return(DamageHelpers.GetSpellDamage(damage, amplify, reduction));
        }
Exemplo n.º 17
0
        public override float GetDamage([NotNull] Unit target, float damageModifier, float targetHealth = float.MinValue)
        {
            if (this.lightningBolt == null)
            {
                return(0);
            }

            var rawLightningDamage = this.lightningBolt.GetDamage();
            var reduction          = this.Ability.GetDamageReduction(target, this.DamageType);

            // no spell amp on cloud
            return(DamageHelpers.GetSpellDamage(rawLightningDamage, 0, -reduction, damageModifier));
        }
Exemplo n.º 18
0
        public override float GetDamage(params Unit[] targets)
        {
            if (!targets.Any())
            {
                return 0;
            }

            var damage = this.RawDamage;
            var amplify = this.Owner.GetSpellAmplification();
            var reduction = this.Ability.GetDamageReduction(targets.First(), this.DamageType);

            return this.Owner.GetAttackDamage(targets.First()) + DamageHelpers.GetSpellDamage(damage, amplify, reduction);
        }
Exemplo n.º 19
0
        public float DamageReCalc(float damage, Hero target, List <Hero> heroes, IReadOnlyCollection <BaseAbility> abilities)
        {
            if (target.IsInvulnerable() || target.HasAnyModifiers(BlockModifiers))
            {
                return(0);
            }
            var damageReduction = DamageReduction(target, heroes);
            var livingArmor     = LivingArmor(target, heroes, abilities);

            damage = DamageBlock(target, heroes) + damage;
            var amp = DamageAmplifyByItem();

            return(DamageHelpers.GetSpellDamage(damage, 0, damageReduction) - livingArmor);
        }
Exemplo n.º 20
0
        public override float GetDamage(params Unit[] targets)
        {
            var manaBurnMultiplier = this.Ability.GetAbilitySpecialData("damage_per_burn");

            if (!targets.Any())
            {
                return(this.Owner.MinimumDamage + this.Owner.BonusDamage + (this.RawDamage * manaBurnMultiplier));
            }

            var reduction      = this.Ability.GetDamageReduction(targets.First(), this.DamageType);
            var manaBurnDamage = Math.Min(this.RawDamage, targets.First().Mana) * manaBurnMultiplier;

            return(this.Owner.GetAttackDamage(targets.First()) + DamageHelpers.GetSpellDamage(manaBurnDamage, 0, reduction));
        }
Exemplo n.º 21
0
        public override float GetDamage([NotNull] Unit target, float damageModifier, float targetHealth = float.MinValue)
        {
            var damage = (target.MaximumHealth - targetHealth) * DamagePerHealth;

            if (damage <= 0)
            {
                return(0);
            }

            var amplify   = this.Owner.GetSpellAmplification();
            var reduction = this.Ability.GetDamageReduction(target, this.DamageType);

            return(DamageHelpers.GetSpellDamage(damage, amplify, -reduction, damageModifier));
        }
Exemplo n.º 22
0
        public override float GetDamage(params Unit[] targets)
        {
            var totalDamage = 0.0f;
            var amplify     = this.Owner.GetSpellAmplification();

            foreach (var target in targets)
            {
                var damage    = (Ability.GetAbilitySpecialData("arrow_damage_pct") / 100f) * Owner.GetAttackDamage(target, false, amplify);
                var reduction = this.Ability.GetDamageReduction(target, this.DamageType);
                totalDamage += DamageHelpers.GetSpellDamage(damage, amplify, reduction);
            }

            return(totalDamage);
        }
Exemplo n.º 23
0
        public override float GetDamage(params Unit[] targets)
        {
            var damage      = this.RawDamage;
            var amplify     = this.Owner.GetSpellAmplification();
            var totalDamage = 0.0f;

            foreach (var target in targets)
            {
                var reduction = this.Ability.GetDamageReduction(target, this.DamageType);
                totalDamage += DamageHelpers.GetSpellDamage(damage, amplify, reduction);
            }

            return(totalDamage);
        }
Exemplo n.º 24
0
        public override float GetDamage([NotNull] Unit target, float damageModifier, float targetHealth = float.MinValue)
        {
            if (targetHealth == float.MinValue)
            {
                targetHealth = target.Health;
            }

            var damagePercent = this.RawDamage;
            var damage        = damagePercent * targetHealth;
            var amplify       = this.Owner.GetSpellAmplification();
            var reduction     = this.Ability.GetDamageReduction(target, this.DamageType);

            return(DamageHelpers.GetSpellDamage(damage, amplify, -reduction, damageModifier));
        }
Exemplo n.º 25
0
        public override float GetDamage(params Unit[] targets)
        {
            var damage    = this.RawDamage;
            var amplify   = this.Ability.SpellAmplification();
            var reduction = 0.0f;

            if (targets.Any())
            {
                damage   *= targets.First().Health;
                reduction = this.Ability.GetDamageReduction(targets.First(), this.DamageType);
            }

            return(DamageHelpers.GetSpellDamage(damage, amplify, reduction));
        }
Exemplo n.º 26
0
        public override float GetDamage(Unit target, float damageModifier, float targetHealth = float.MinValue)
        {
            var damage = RawDamage;

            if (damage == 0)
            {
                return(0);
            }

            var amplify   = Owner.GetSpellAmplification();
            var reduction = this.GetDamageReduction(target, DamageType);

            return(DamageHelpers.GetSpellDamage(damage, amplify, -reduction, damageModifier));
        }
Exemplo n.º 27
0
        public override float GetDamage(Unit target, float damageModifier, float targetHealth = float.MinValue)
        {
            var targetHit = this.TargetHit;

            if (targetHit != target)
            {
                return(0);
            }

            var damage    = this.RawDamage;
            var amplify   = this.Owner.GetSpellAmplification();
            var reduction = this.Ability.GetDamageReduction(targetHit, this.DamageType);

            return(DamageHelpers.GetSpellDamage(damage, amplify, -reduction, damageModifier));
        }
Exemplo n.º 28
0
        public override float GetDamage(params Unit[] targets)
        {
            var targetHit = this.TargetHit;

            if (!targets.Any(x => x == targetHit))
            {
                return(0);
            }

            var damage    = this.RawDamage;
            var amplify   = this.Owner.GetSpellAmplification();
            var reduction = this.Ability.GetDamageReduction(targetHit, this.DamageType);

            return(DamageHelpers.GetSpellDamage(damage, amplify, reduction));
        }
Exemplo n.º 29
0
        public float GetTickDamage(params Unit[] targets)
        {
            var totalDamage = 0.0f;

            var damage  = RawTickDamage;
            var amplify = Owner.GetSpellAmplification();

            foreach (var target in targets)
            {
                var reduction = Ability.GetDamageReduction(target, DamageType);
                totalDamage += DamageHelpers.GetSpellDamage(damage, amplify, reduction);
            }

            return(totalDamage);
        }
Exemplo n.º 30
0
        public float GetTickDamage(params Unit[] targets)
        {
            var damage    = this.RawTickDamage;
            var amplify   = this.Ability.SpellAmplification();
            var reduction = 0.0f;

            if (targets.Any())
            {
                var percentageDamage = this.Ability.GetAbilitySpecialDataWithTalent(this.Owner, "burn_damage_pct") / 100f;
                damage   += targets.First().MaximumHealth *percentageDamage;
                reduction = this.Ability.GetDamageReduction(targets.First(), this.DamageType);
            }

            return(DamageHelpers.GetSpellDamage(damage, amplify, reduction));
        }