Exemple #1
0
        public int CalcEffectValue(int level, int comboPoints, bool useOverride)
        {
            if (EffectValueOverrideEffect != null && useOverride)
            {
                return(EffectValueOverrideEffect.CalcEffectValue(level, comboPoints, false));
            }

            // calculate effect value
            var value = BasePoints;

            // apply Unit boni
            value += (int)Math.Round(RealPointsPerLevel * Spell.GetMaxLevelDiff(level));
            value += (int)Math.Round(PointsPerComboPoint * comboPoints);

            // die += (uint)Math.Round(Effect.DicePerLevel * caster.Level);

            // dice bonus
            // see http://www.wowhead.com/spell=25269 for comparison
            if (DiceSides > 0)
            {
                value += Utility.Random(1, DiceSides);
            }

            return(value);
        }
Exemple #2
0
        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);
        }