AzerothCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
spell_dk_death_pact Class Reference
Inheritance diagram for spell_dk_death_pact:
SpellScript _SpellScript

Private Member Functions

 PrepareSpellScript (spell_dk_death_pact)
 
SpellCastResult CheckCast ()
 
void FilterTargets (std::list< WorldObject * > &targetList)
 
void Register () override
 

Additional Inherited Members

- Public Member Functions inherited from SpellScript
bool _Validate (SpellInfo const *entry) override
 
bool _Load (Spell *spell)
 
void _InitHit ()
 
bool _IsEffectPrevented (SpellEffIndex effIndex)
 
bool _IsDefaultEffectPrevented (SpellEffIndex effIndex)
 
void _PrepareScriptCall (SpellScriptHookType hookType)
 
void _FinishScriptCall ()
 
bool IsInCheckCastHook () const
 
bool IsInTargetHook () const
 
bool IsInHitPhase () const
 
bool IsInEffectHook () const
 
Unit * GetCaster ()
 
GameObject * GetGObjCaster ()
 
Unit * GetOriginalCaster ()
 
SpellInfo const * GetSpellInfo ()
 
SpellValue const * GetSpellValue ()
 
WorldLocation const * GetExplTargetDest ()
 
void SetExplTargetDest (WorldLocation &loc)
 
WorldObject * GetExplTargetWorldObject ()
 
Unit * GetExplTargetUnit ()
 
GameObject * GetExplTargetGObj ()
 
Item * GetExplTargetItem ()
 
Unit * GetHitUnit ()
 
Creature * GetHitCreature ()
 
Player * GetHitPlayer ()
 
Item * GetHitItem ()
 
GameObject * GetHitGObj ()
 
WorldLocation * GetHitDest ()
 
int32 GetHitDamage ()
 
void SetHitDamage (int32 damage)
 
void PreventHitDamage ()
 
int32 GetHitHeal ()
 
void SetHitHeal (int32 heal)
 
void PreventHitHeal ()
 
Spell * GetSpell ()
 
Aura * GetHitAura ()
 
void PreventHitAura ()
 
void PreventHitEffect (SpellEffIndex effIndex)
 
void PreventHitDefaultEffect (SpellEffIndex effIndex)
 
int32 GetEffectValue () const
 
void SetEffectValue (int32 value)
 
Item * GetCastItem ()
 
void CreateItem (uint32 effIndex, uint32 itemId)
 
SpellInfo const * GetTriggeringSpell ()
 
void FinishCast (SpellCastResult result)
 
void Cancel ()
 
void SetCustomCastResultMessage (SpellCustomErrors result)
 
- Public Member Functions inherited from _SpellScript
 _SpellScript ()
 
virtual ~_SpellScript ()
 
virtual void _Register ()
 
virtual void _Unload ()
 
virtual void _Init (std::string const *scriptname, uint32 spellId)
 
std::string const * _GetScriptName () const
 
virtual bool Validate (SpellInfo const *)
 
virtual bool Load ()
 
virtual void Unload ()
 
- Static Public Member Functions inherited from _SpellScript
static bool ValidateSpellInfo (std::initializer_list< uint32 > spellIds)
 
template<class T >
static bool ValidateSpellInfo (T const &spellIds)
 
- Public Attributes inherited from SpellScript
HookList< CastHandler > BeforeCast
 
HookList< CastHandler > OnCast
 
HookList< CastHandler > AfterCast
 
HookList< CheckCastHandler > OnCheckCast
 
HookList< EffectHandler > OnEffectLaunch
 
HookList< EffectHandler > OnEffectLaunchTarget
 
HookList< EffectHandler > OnEffectHit
 
HookList< EffectHandler > OnEffectHitTarget
 
HookList< BeforeHitHandler > BeforeHit
 
HookList< HitHandler > OnHit
 
HookList< HitHandler > AfterHit
 
HookList< ObjectAreaTargetSelectHandler > OnObjectAreaTargetSelect
 
HookList< ObjectTargetSelectHandler > OnObjectTargetSelect
 
HookList< DestinationTargetSelectHandler > OnDestinationTargetSelect
 
- Protected Attributes inherited from _SpellScript
uint8 m_currentScriptState
 
std::string const * m_scriptName
 
uint32 m_scriptSpellId
 

Detailed Description

Member Function Documentation

◆ CheckCast()

SpellCastResult spell_dk_death_pact::CheckCast ( )
inlineprivate
1592 {
1593 // Check if we have valid targets, otherwise skip spell casting here
1594 if (Player* player = GetCaster()->ToPlayer())
1595 for (Unit::ControlSet::const_iterator itr = player->m_Controlled.begin(); itr != player->m_Controlled.end(); ++itr)
1596 if (Creature* undeadPet = (*itr)->ToCreature())
1597 if (undeadPet->IsAlive() &&
1598 undeadPet->GetOwnerGUID() == player->GetGUID() &&
1599 undeadPet->GetCreatureType() == CREATURE_TYPE_UNDEAD &&
1600 undeadPet->IsWithinDist(player, 100.0f, false))
1601 return SPELL_CAST_OK;
1602
1603 return SPELL_FAILED_NO_PET;
1604 }
@ CREATURE_TYPE_UNDEAD
Definition SharedDefines.h:2627
@ SPELL_CAST_OK
Definition SharedDefines.h:1126
@ SPELL_FAILED_NO_PET
Definition SharedDefines.h:1021
Definition Creature.h:47
Creature * ToCreature()
Definition Object.h:212
Definition Player.h:1086
Unit * GetCaster()
Definition SpellScript.cpp:401

References CREATURE_TYPE_UNDEAD, SpellScript::GetCaster(), SPELL_CAST_OK, SPELL_FAILED_NO_PET, and Object::ToCreature().

Referenced by Register().

◆ FilterTargets()

void spell_dk_death_pact::FilterTargets ( std::list< WorldObject * > &  targetList)
inlineprivate
1607 {
1608 Unit* target = nullptr;
1609 for (std::list<WorldObject*>::iterator itr = targetList.begin(); itr != targetList.end(); ++itr)
1610 {
1611 if (Unit* unit = (*itr)->ToUnit())
1612 if (unit->GetOwnerGUID() == GetCaster()->GetGUID() && unit->GetCreatureType() == CREATURE_TYPE_UNDEAD)
1613 {
1614 target = unit;
1615 break;
1616 }
1617 }
1618
1619 targetList.clear();
1620 if (target)
1621 {
1622 // xinef: remove all auras preventing effect execution
1623 target->RemoveAllAurasOnDeath();
1624 targetList.push_back(target);
1625 }
1626 }
static ObjectGuid GetGUID(Object const *o)
Definition Object.h:120
Unit * ToUnit()
Definition Object.h:216
Definition Unit.h:667
void RemoveAllAurasOnDeath()
Definition Unit.cpp:5389

References CREATURE_TYPE_UNDEAD, SpellScript::GetCaster(), Object::GetGUID(), Unit::RemoveAllAurasOnDeath(), and Object::ToUnit().

Referenced by Register().

◆ PrepareSpellScript()

spell_dk_death_pact::PrepareSpellScript ( spell_dk_death_pact  )
private

◆ Register()

void spell_dk_death_pact::Register ( )
inlineoverrideprivatevirtual

Implements _SpellScript.

1629 {
1632 }
@ EFFECT_1
Definition SharedDefines.h:32
@ TARGET_UNIT_DEST_AREA_ALLY
Definition SharedDefines.h:1439
#define SpellCheckCastFn(F)
Definition SpellScript.h:329
#define SpellObjectAreaTargetSelectFn(F, I, N)
Definition SpellScript.h:354
HookList< CheckCastHandler > OnCheckCast
Definition SpellScript.h:328
HookList< ObjectAreaTargetSelectHandler > OnObjectAreaTargetSelect
Definition SpellScript.h:353
void FilterTargets(std::list< WorldObject * > &targetList)
Definition spell_dk.cpp:1606
SpellCastResult CheckCast()
Definition spell_dk.cpp:1591

References CheckCast(), EFFECT_1, FilterTargets(), SpellScript::OnCheckCast, SpellScript::OnObjectAreaTargetSelect, SpellCheckCastFn, SpellObjectAreaTargetSelectFn, and TARGET_UNIT_DEST_AREA_ALLY.


The documentation for this class was generated from the following file: