diff --git a/Source/Game/Scripting/SpellScript.cs b/Source/Game/Scripting/SpellScript.cs index fa9147c74..31fd13676 100644 --- a/Source/Game/Scripting/SpellScript.cs +++ b/Source/Game/Scripting/SpellScript.cs @@ -797,6 +797,29 @@ namespace Game.Scripting } void PreventHitHeal() { SetHitHeal(0); } public Spell GetSpell() { return m_spell; } + + /// + /// + /// + /// true if spell critically hits current HitUnit + public bool IsHitCrit() + { + if (!IsInTargetHook()) + { + Log.outError(LogFilter.Scripts, $"Script: `{m_scriptName}` Spell: `{m_scriptSpellId}`: function SpellScript::IsHitCrit was called, but function has no effect in current hook!"); + return false; + } + + Unit hitUnit = GetHitUnit(); + if (hitUnit != null) + { + var targetInfo = m_spell.m_UniqueTargetInfo.Find(targetInfo => targetInfo.TargetGUID == hitUnit.GetGUID()); + Cypher.Assert(targetInfo != null); + return targetInfo.IsCrit; + } + return false; + } + // returns current spell hit target aura public Aura GetHitAura(bool dynObjAura = false) { @@ -815,6 +838,7 @@ namespace Game.Scripting return aura; } + // prevents applying aura on current spell hit target public void PreventHitAura() { diff --git a/Source/Game/Spells/Spell.cs b/Source/Game/Spells/Spell.cs index bf39d0d5b..dd29d1384 100644 --- a/Source/Game/Spells/Spell.cs +++ b/Source/Game/Spells/Spell.cs @@ -7802,7 +7802,7 @@ namespace Game.Spells // Spell target subsystem // ***************************************** // Targets store structures and data - List m_UniqueTargetInfo = new(); + public List m_UniqueTargetInfo = new(); uint m_channelTargetEffectMask; // Mask req. alive targets List m_UniqueGOTargetInfo = new();