public int CalcEffectValue(Unit caster, int value) { if (EffectValueOverrideEffect != null && caster.Spells.Contains(EffectValueOverrideEffect.Spell)) { return EffectValueOverrideEffect.CalcEffectValue(caster, value); } if (caster == null) { return value; } if (APValueFactor != 0 || APPerComboPointValueFactor != 0) { var apFactor = APValueFactor + (APPerComboPointValueFactor * caster.ComboPoints); var ap = Spell.IsRanged ? caster.TotalRangedAP : caster.TotalMeleeAP; value += (int)(ap * apFactor + 0.5f); // implicit rounding } if (caster is Character) { if (SpellPowerValuePct != 0) { value += (SpellPowerValuePct * caster.GetDamageDoneMod(Spell.Schools[0]) + 50) / 100; } } SpellModifierType type; switch (EffectIndex) { case EffectIndex.Zero: type = SpellModifierType.EffectValue1; break; case EffectIndex.One: type = SpellModifierType.EffectValue2; break; case EffectIndex.Two: type = SpellModifierType.EffectValue3; break; default: type = SpellModifierType.EffectValue4AndBeyond; break; } value = caster.Auras.GetModifiedInt(type, Spell, value); value = caster.Auras.GetModifiedInt(SpellModifierType.AllEffectValues, Spell, value); return value; }
static float GetModifiedDamage(Unit unit, float dmg) { dmg += unit.GetDamageDoneMod(DamageSchool.Physical); return unit.GetDamageDoneFactor(DamageSchool.Physical) * dmg; }