Core/Spells: Expose corpseTarget to spell scripts with SpellScript::GetHitCorpse() (#24981)

Closes #24945
This commit is contained in:
Ovah
2020-07-09 20:03:40 +02:00
committed by GitHub
parent f99a79cb43
commit 94a4404e7e
2 changed files with 13 additions and 0 deletions

View File

@@ -552,6 +552,16 @@ GameObject* SpellScript::GetHitGObj() const
return m_spell->gameObjTarget;
}
Corpse* SpellScript::GetHitCorpse() const
{
if (!IsInTargetHook())
{
TC_LOG_ERROR("scripts", "Script: `%s` Spell: `%u`: function SpellScript::GetHitCorpse was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId);
return nullptr;
}
return m_spell->corpseTarget;
}
WorldLocation* SpellScript::GetHitDest() const
{
if (!IsInEffectHook())

View File

@@ -29,6 +29,7 @@ class Aura;
class AuraApplication;
class AuraEffect;
class Creature;
class Corpse;
class DamageInfo;
class DispelInfo;
class DynamicObject;
@@ -453,6 +454,8 @@ class TC_GAME_API SpellScript : public _SpellScript
Item* GetHitItem() const;
// returns: target of current effect if it was GameObject otherwise NULL
GameObject* GetHitGObj() const;
// returns: target of current effect if it was Corpse otherwise nullptr
Corpse* GetHitCorpse() const;
// returns: destination of current effect
WorldLocation* GetHitDest() const;
// setter/getter for for damage done by spell to target of spell hit