diff --git a/Source/Game/Entities/Object/WorldObject.cs b/Source/Game/Entities/Object/WorldObject.cs index f668d413c..0a5f0da59 100644 --- a/Source/Game/Entities/Object/WorldObject.cs +++ b/Source/Game/Entities/Object/WorldObject.cs @@ -1827,7 +1827,7 @@ namespace Game.Entities return spellInfo.GetMinRange(!IsHostileTo(target)); } - public float ApplyEffectModifiers(SpellInfo spellInfo, uint effIndex, float value) + public double ApplyEffectModifiers(SpellInfo spellInfo, uint effIndex, double value) { Player modOwner = GetSpellModOwner(); if (modOwner != null) diff --git a/Source/Game/Entities/Player/Player.Spells.cs b/Source/Game/Entities/Player/Player.Spells.cs index addb93506..049f1fcbe 100644 --- a/Source/Game/Entities/Player/Player.Spells.cs +++ b/Source/Game/Entities/Player/Player.Spells.cs @@ -2765,6 +2765,16 @@ namespace Game.Entities basevalue = (float)(basevalue + totalflat) * totalmul; } + public void ApplySpellMod(SpellInfo spellInfo, SpellModOp op, ref double basevalue, Spell spell = null) + { + float totalmul = 1.0f; + int totalflat = 0; + + GetSpellModValues(spellInfo, op, spell, basevalue, ref totalflat, ref totalmul); + + basevalue = (double)(basevalue + totalflat) * totalmul; + } + public void GetSpellModValues(SpellInfo spellInfo, SpellModOp op, Spell spell, T baseValue, ref int flat, ref float pct) where T : IComparable { flat = 0; diff --git a/Source/Game/Spells/SpellInfo.cs b/Source/Game/Spells/SpellInfo.cs index cbcf6798a..9417d5d13 100644 --- a/Source/Game/Spells/SpellInfo.cs +++ b/Source/Game/Spells/SpellInfo.cs @@ -4171,11 +4171,11 @@ namespace Game.Spells public int CalcValue(out float variance, WorldObject caster = null, int? bp = null, Unit target = null, uint castItemId = 0, int itemLevel = -1) { variance = 0.0f; - float basePointsPerLevel = RealPointsPerLevel; + double basePointsPerLevel = RealPointsPerLevel; // TODO: this needs to be a float, not rounded int basePoints = CalcBaseValue(caster, target, castItemId, itemLevel); - float value = bp.HasValue ? bp.Value : basePoints; - float comboDamage = PointsPerResource; + double value = bp.HasValue ? bp.Value : basePoints; + double comboDamage = PointsPerResource; Unit casterUnit = null; if (caster != null) @@ -4184,9 +4184,9 @@ namespace Game.Spells if (Scaling.Variance != 0) { float delta = Math.Abs(Scaling.Variance * 0.5f); - float valueVariance = RandomHelper.FRand(-delta, delta); - value += basePoints * valueVariance; - variance = valueVariance; + double valueVariance = RandomHelper.FRand(-delta, delta); + value += (double)basePoints * valueVariance; + variance = (float)valueVariance; } // base amount modification based on spell lvl vs caster lvl