Core/Scripts: Expose calculated spell value variance to scripts

Port From (https://github.com/TrinityCore/TrinityCore/commit/701532f9f033547a5fc2d0b594d04f6349cb441b)
This commit is contained in:
hondacrx
2022-07-16 19:31:17 -04:00
parent e521433e38
commit 8673a45f08
3 changed files with 29 additions and 7 deletions
+22
View File
@@ -914,6 +914,28 @@ namespace Game.Scripting
m_spell.damage = value;
}
public float GetEffectVariance()
{
if (!IsInEffectHook())
{
Log.outError(LogFilter.Scripts, $"Script: `{m_scriptName}` Spell: `{m_scriptSpellId}`: function SpellScript::GetEffectVariance was called, but function has no effect in current hook!");
return 0.0f;
}
return m_spell.variance;
}
public void SetEffectVariance(float variance)
{
if (!IsInEffectHook())
{
Log.outError(LogFilter.Scripts, $"Script: `{m_scriptName}` Spell: `{m_scriptSpellId}`: function SpellScript::SetEffectVariance was called, but function has no effect in current hook!");
return;
}
m_spell.variance = variance;
}
// returns: cast item if present.
public Item GetCastItem() { return m_spell.m_CastItem; }