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
 
UnitGetCaster ()
 
UnitGetOriginalCaster ()
 
SpellInfo const * GetSpellInfo ()
 
SpellValue const * GetSpellValue ()
 
WorldLocation const * GetExplTargetDest ()
 
void SetExplTargetDest (WorldLocation &loc)
 
WorldObjectGetExplTargetWorldObject ()
 
UnitGetExplTargetUnit ()
 
GameObjectGetExplTargetGObj ()
 
ItemGetExplTargetItem ()
 
UnitGetHitUnit ()
 
CreatureGetHitCreature ()
 
PlayerGetHitPlayer ()
 
ItemGetHitItem ()
 
GameObjectGetHitGObj ()
 
WorldLocationGetHitDest ()
 
int32 GetHitDamage ()
 
void SetHitDamage (int32 damage)
 
void PreventHitDamage ()
 
int32 GetHitHeal ()
 
void SetHitHeal (int32 heal)
 
void PreventHitHeal ()
 
SpellGetSpell ()
 
AuraGetHitAura ()
 
void PreventHitAura ()
 
void PreventHitEffect (SpellEffIndex effIndex)
 
void PreventHitDefaultEffect (SpellEffIndex effIndex)
 
int32 GetEffectValue () const
 
void SetEffectValue (int32 value)
 
ItemGetCastItem ()
 
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 void Register ()=0
 
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< CastHandlerBeforeCast
 
HookList< CastHandlerOnCast
 
HookList< CastHandlerAfterCast
 
HookList< CheckCastHandlerOnCheckCast
 
HookList< EffectHandlerOnEffectLaunch
 
HookList< EffectHandlerOnEffectLaunchTarget
 
HookList< EffectHandlerOnEffectHit
 
HookList< EffectHandlerOnEffectHitTarget
 
HookList< BeforeHitHandlerBeforeHit
 
HookList< HitHandlerOnHit
 
HookList< HitHandlerAfterHit
 
HookList< ObjectAreaTargetSelectHandlerOnObjectAreaTargetSelect
 
HookList< ObjectTargetSelectHandlerOnObjectTargetSelect
 
HookList< DestinationTargetSelectHandlerOnDestinationTargetSelect
 
virtual bool _Validate (SpellInfo const *entry)
 
- 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
1392 {
1393 // Check if we have valid targets, otherwise skip spell casting here
1394 if (Player* player = GetCaster()->ToPlayer())
1395 for (Unit::ControlSet::const_iterator itr = player->m_Controlled.begin(); itr != player->m_Controlled.end(); ++itr)
1396 if (Creature* undeadPet = (*itr)->ToCreature())
1397 if (undeadPet->IsAlive() &&
1398 undeadPet->GetOwnerGUID() == player->GetGUID() &&
1399 undeadPet->GetCreatureType() == CREATURE_TYPE_UNDEAD &&
1400 undeadPet->IsWithinDist(player, 100.0f, false))
1401 return SPELL_CAST_OK;
1402
1403 return SPELL_FAILED_NO_PET;
1404 }
@ CREATURE_TYPE_UNDEAD
Definition: SharedDefines.h:2605
@ SPELL_CAST_OK
Definition: SharedDefines.h:1110
@ SPELL_FAILED_NO_PET
Definition: SharedDefines.h:1005
Definition: Creature.h:46
Creature * ToCreature()
Definition: Object.h:197
Definition: Player.h:1046
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
1407 {
1408 Unit* target = nullptr;
1409 for (std::list<WorldObject*>::iterator itr = targetList.begin(); itr != targetList.end(); ++itr)
1410 {
1411 if (Unit* unit = (*itr)->ToUnit())
1412 if (unit->GetOwnerGUID() == GetCaster()->GetGUID() && unit->GetCreatureType() == CREATURE_TYPE_UNDEAD)
1413 {
1414 target = unit;
1415 break;
1416 }
1417 }
1418
1419 targetList.clear();
1420 if (target)
1421 {
1422 // xinef: remove all auras preventing effect execution
1423 target->RemoveAllAurasOnDeath();
1424 targetList.push_back(target);
1425 }
1426 }
Unit * ToUnit()
Definition: Object.h:200
Definition: Unit.h:1290
void RemoveAllAurasOnDeath()
Definition: Unit.cpp:5269
uint32 GetCreatureType() const
Definition: Unit.cpp:15074

References CREATURE_TYPE_UNDEAD, SpellScript::GetCaster(), Unit::GetCreatureType(), 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.

1429 {
1432 }
#define SpellCheckCastFn(F)
Definition: SpellScript.h:329
#define SpellObjectAreaTargetSelectFn(F, I, N)
Definition: SpellScript.h:354
@ EFFECT_1
Definition: SharedDefines.h:31
@ TARGET_UNIT_DEST_AREA_ALLY
Definition: SharedDefines.h:1407
HookList< CheckCastHandler > OnCheckCast
Definition: SpellScript.h:328
HookList< ObjectAreaTargetSelectHandler > OnObjectAreaTargetSelect
Definition: SpellScript.h:353
void FilterTargets(std::list< WorldObject * > &targetList)
Definition: spell_dk.cpp:1406
SpellCastResult CheckCast()
Definition: spell_dk.cpp:1391

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