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
1410 {
1411 // Check if we have valid targets, otherwise skip spell casting here
1412 if (Player* player = GetCaster()->ToPlayer())
1413 for (Unit::ControlSet::const_iterator itr = player->m_Controlled.begin(); itr != player->m_Controlled.end(); ++itr)
1414 if (Creature* undeadPet = (*itr)->ToCreature())
1415 if (undeadPet->IsAlive() &&
1416 undeadPet->GetOwnerGUID() == player->GetGUID() &&
1417 undeadPet->GetCreatureType() == CREATURE_TYPE_UNDEAD &&
1418 undeadPet->IsWithinDist(player, 100.0f, false))
1419 return SPELL_CAST_OK;
1420
1421 return SPELL_FAILED_NO_PET;
1422 }
@ CREATURE_TYPE_UNDEAD
Definition: SharedDefines.h:2633
@ SPELL_CAST_OK
Definition: SharedDefines.h:1138
@ SPELL_FAILED_NO_PET
Definition: SharedDefines.h:1033
Definition: Creature.h:46
Creature * ToCreature()
Definition: Object.h:197
Definition: Player.h:1056
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
1425 {
1426 Unit* target = nullptr;
1427 for (std::list<WorldObject*>::iterator itr = targetList.begin(); itr != targetList.end(); ++itr)
1428 {
1429 if (Unit* unit = (*itr)->ToUnit())
1430 if (unit->GetOwnerGUID() == GetCaster()->GetGUID() && unit->GetCreatureType() == CREATURE_TYPE_UNDEAD)
1431 {
1432 target = unit;
1433 break;
1434 }
1435 }
1436
1437 targetList.clear();
1438 if (target)
1439 {
1440 // xinef: remove all auras preventing effect execution
1441 target->RemoveAllAurasOnDeath();
1442 targetList.push_back(target);
1443 }
1444 }
Unit * ToUnit()
Definition: Object.h:200
Definition: Unit.h:1302
void RemoveAllAurasOnDeath()
Definition: Unit.cpp:5289
uint32 GetCreatureType() const
Definition: Unit.cpp:15168

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.

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

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