Core/Scripts: Expose IsCrit to hit hooks for spell scripts
Port From (https://github.com/TrinityCore/TrinityCore/commit/2cc652b305f31ebcc71680f314792d0d09c43bfe)
This commit is contained in:
@@ -797,6 +797,29 @@ namespace Game.Scripting
|
||||
}
|
||||
void PreventHitHeal() { SetHitHeal(0); }
|
||||
public Spell GetSpell() { return m_spell; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <returns>true if spell critically hits current HitUnit</returns>
|
||||
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()
|
||||
{
|
||||
|
||||
@@ -7802,7 +7802,7 @@ namespace Game.Spells
|
||||
// Spell target subsystem
|
||||
// *****************************************
|
||||
// Targets store structures and data
|
||||
List<TargetInfo> m_UniqueTargetInfo = new();
|
||||
public List<TargetInfo> m_UniqueTargetInfo = new();
|
||||
uint m_channelTargetEffectMask; // Mask req. alive targets
|
||||
|
||||
List<GOTargetInfo> m_UniqueGOTargetInfo = new();
|
||||
|
||||
Reference in New Issue
Block a user