aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorShauren <shauren.trinity@gmail.com>2022-07-15 18:31:54 +0200
committerShauren <shauren.trinity@gmail.com>2022-07-15 18:31:54 +0200
commit701532f9f033547a5fc2d0b594d04f6349cb441b (patch)
tree383d886e641f14df0ad0570fa1d4bfee2055b4bc /src
parente487d78ba7b37c35ede36c554169d26afeac88b0 (diff)
Core/Scripts: Expose calculated spell value variance to scripts
Diffstat (limited to 'src')
-rw-r--r--src/server/game/Spells/SpellScript.cpp22
-rw-r--r--src/server/game/Spells/SpellScript.h2
2 files changed, 24 insertions, 0 deletions
diff --git a/src/server/game/Spells/SpellScript.cpp b/src/server/game/Spells/SpellScript.cpp
index 25d1f6ffcb7..100ea02fbe5 100644
--- a/src/server/game/Spells/SpellScript.cpp
+++ b/src/server/game/Spells/SpellScript.cpp
@@ -849,6 +849,28 @@ void SpellScript::SetEffectValue(int32 value)
m_spell->damage = value;
}
+float SpellScript::GetEffectVariance() const
+{
+ if (!IsInEffectHook())
+ {
+ TC_LOG_ERROR("scripts", "Script: `%s` Spell: `%u`: function SpellScript::GetEffectVariance was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId);
+ return 0.0f;
+ }
+
+ return m_spell->variance;
+}
+
+void SpellScript::SetEffectVariance(float variance)
+{
+ if (!IsInEffectHook())
+ {
+ TC_LOG_ERROR("scripts", "Script: `%s` Spell: `%u`: function SpellScript::SetEffectVariance was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId);
+ return;
+ }
+
+ m_spell->variance = variance;
+}
+
Item* SpellScript::GetCastItem() const
{
return m_spell->m_CastItem;
diff --git a/src/server/game/Spells/SpellScript.h b/src/server/game/Spells/SpellScript.h
index b415be64c24..7cbb3a5121b 100644
--- a/src/server/game/Spells/SpellScript.h
+++ b/src/server/game/Spells/SpellScript.h
@@ -614,6 +614,8 @@ class TC_GAME_API SpellScript : public _SpellScript
SpellEffectInfo const& GetEffectInfo() const;
int32 GetEffectValue() const;
void SetEffectValue(int32 value);
+ float GetEffectVariance() const;
+ void SetEffectVariance(float variance);
// returns: cast item if present.
Item* GetCastItem() const;