mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-19 08:55:32 +01:00
Core/Spells: relocated DieSides handling - fall back to DieSides when Variance is not provided
This commit is contained in:
@@ -504,7 +504,7 @@ int32 SpellEffectInfo::CalcValue(WorldObject const* caster /*= nullptr*/, int32
|
||||
if (caster)
|
||||
casterUnit = caster->ToUnit();
|
||||
|
||||
if (Scaling.Variance)
|
||||
if (Scaling.Variance != 0.0f)
|
||||
{
|
||||
float delta = fabs(Scaling.Variance * 0.5f);
|
||||
double valueVariance = frand(-delta, delta);
|
||||
@@ -513,6 +513,17 @@ int32 SpellEffectInfo::CalcValue(WorldObject const* caster /*= nullptr*/, int32
|
||||
if (variance)
|
||||
*variance = valueVariance;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (DieSides)
|
||||
{
|
||||
// roll in a range <1;EffectDieSides> as of patch 3.3.3
|
||||
if (DieSides == 1)
|
||||
value += DieSides;
|
||||
else
|
||||
value += (DieSides >= 1) ? irand(1, DieSides) : irand(DieSides, 1);
|
||||
}
|
||||
}
|
||||
|
||||
// base amount modification based on spell lvl vs caster lvl
|
||||
if (Scaling.Coefficient != 0.0f)
|
||||
@@ -534,15 +545,6 @@ int32 SpellEffectInfo::CalcValue(WorldObject const* caster /*= nullptr*/, int32
|
||||
level = 0;
|
||||
value += level * basePointsPerLevel;
|
||||
}
|
||||
|
||||
if (DieSides)
|
||||
{
|
||||
// roll in a range <1;EffectDieSides> as of patch 3.3.3
|
||||
if (DieSides == 1)
|
||||
value += DieSides;
|
||||
else
|
||||
value += (DieSides >= 1) ? irand(1, DieSides) : irand(DieSides, 1);
|
||||
}
|
||||
}
|
||||
|
||||
// random damage
|
||||
|
||||
Reference in New Issue
Block a user