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

Private Member Functions

 PrepareSpellScript (spell_the_lich_king_valkyr_target_search_SpellScript)
 
bool Load () override
 
void SelectTarget (std::list< WorldObject * > &targets)
 
void ReplaceTarget (std::list< WorldObject * > &targets)
 
void HandleScript (SpellEffIndex effIndex)
 
void Register () override
 

Private Attributes

WorldObject_target
 

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

◆ HandleScript()

void spell_the_lich_king_valkyr_target_search::spell_the_lich_king_valkyr_target_search_SpellScript::HandleScript ( SpellEffIndex  effIndex)
inlineprivate
2856 {
2857 PreventHitDefaultEffect(effIndex);
2858 if (Unit* target = GetHitUnit())
2859 {
2860 GetCaster()->GetMotionMaster()->MoveCharge(target->GetPositionX(), target->GetPositionY(), target->GetPositionZ() + 4.0f, 42.0f, EVENT_CHARGE);
2861 GetCaster()->SetDisableGravity(true, true);
2862 }
2863 }
@ EVENT_CHARGE
Definition: SharedDefines.h:3311
Definition: Unit.h:1302
MotionMaster * GetMotionMaster()
Definition: Unit.h:2276
virtual bool SetDisableGravity(bool disable, bool packetOnly=false, bool updateAnimationTier=true)
Definition: Unit.cpp:20921
void MoveCharge(float x, float y, float z, float speed=SPEED_CHARGE, uint32 id=EVENT_CHARGE, const Movement::PointsArray *path=nullptr, bool generatePath=false, float orientation=0.0f, ObjectGuid targetGUID=ObjectGuid::Empty)
Definition: MotionMaster.cpp:628
void PreventHitDefaultEffect(SpellEffIndex effIndex)
Definition: SpellScript.cpp:590
Unit * GetHitUnit()
Definition: SpellScript.cpp:448
Unit * GetCaster()
Definition: SpellScript.cpp:401

References EVENT_CHARGE, SpellScript::GetCaster(), SpellScript::GetHitUnit(), Unit::GetMotionMaster(), MotionMaster::MoveCharge(), SpellScript::PreventHitDefaultEffect(), and Unit::SetDisableGravity().

Referenced by Register().

◆ Load()

bool spell_the_lich_king_valkyr_target_search::spell_the_lich_king_valkyr_target_search_SpellScript::Load ( )
inlineoverrideprivatevirtual

Reimplemented from _SpellScript.

2814 {
2815 _target = nullptr;
2816 return true;
2817 }

References _target.

◆ PrepareSpellScript()

spell_the_lich_king_valkyr_target_search::spell_the_lich_king_valkyr_target_search_SpellScript::PrepareSpellScript ( spell_the_lich_king_valkyr_target_search_SpellScript  )
private

◆ Register()

void spell_the_lich_king_valkyr_target_search::spell_the_lich_king_valkyr_target_search_SpellScript::Register ( )
inlineoverrideprivatevirtual

Implements _SpellScript.

2866 {
2870 }
#define SpellEffectFn(F, I, N)
Definition: SpellScript.h:337
#define SpellObjectAreaTargetSelectFn(F, I, N)
Definition: SpellScript.h:354
@ EFFECT_1
Definition: SharedDefines.h:32
@ EFFECT_0
Definition: SharedDefines.h:31
@ SPELL_EFFECT_SCRIPT_EFFECT
Definition: SharedDefines.h:855
@ TARGET_UNIT_SRC_AREA_ENEMY
Definition: SharedDefines.h:1420
HookList< EffectHandler > OnEffectHitTarget
Definition: SpellScript.h:336
HookList< ObjectAreaTargetSelectHandler > OnObjectAreaTargetSelect
Definition: SpellScript.h:353
void SelectTarget(std::list< WorldObject * > &targets)
Definition: boss_the_lich_king.cpp:2819
void HandleScript(SpellEffIndex effIndex)
Definition: boss_the_lich_king.cpp:2855
void ReplaceTarget(std::list< WorldObject * > &targets)
Definition: boss_the_lich_king.cpp:2848

References EFFECT_0, EFFECT_1, HandleScript(), SpellScript::OnEffectHitTarget, SpellScript::OnObjectAreaTargetSelect, ReplaceTarget(), SelectTarget(), SPELL_EFFECT_SCRIPT_EFFECT, SpellEffectFn, SpellObjectAreaTargetSelectFn, and TARGET_UNIT_SRC_AREA_ENEMY.

◆ ReplaceTarget()

void spell_the_lich_king_valkyr_target_search::spell_the_lich_king_valkyr_target_search_SpellScript::ReplaceTarget ( std::list< WorldObject * > &  targets)
inlineprivate
2849 {
2850 targets.clear();
2851 if (_target)
2852 targets.push_back(_target);
2853 }

References _target.

Referenced by Register().

◆ SelectTarget()

void spell_the_lich_king_valkyr_target_search::spell_the_lich_king_valkyr_target_search_SpellScript::SelectTarget ( std::list< WorldObject * > &  targets)
inlineprivate
2820 {
2821 if (targets.empty())
2822 return;
2823 Creature* caster = GetCaster()->ToCreature();
2824 if (!caster)
2825 {
2826 targets.clear();
2827 return;
2828 }
2829 targets.remove_if(Acore::UnitAuraCheck(true, GetSpellInfo()->Id));
2830 targets.remove_if(Acore::UnitAuraCheck(true, SPELL_BOSS_HITTIN_YA_AURA)); // done in dbc, but just to be sure xd
2831 targets.remove_if(Acore::UnitAuraCheck(true, SPELL_HARVEST_SOUL_VALKYR));
2832 if (InstanceScript* _instance = caster->GetInstanceScript())
2833 if (Creature* lichKing = ObjectAccessor::GetCreature(*caster, _instance->GetGuidData(DATA_THE_LICH_KING)))
2834 if (Spell* s = lichKing->GetCurrentSpell(CURRENT_GENERIC_SPELL))
2835 if (s->GetSpellInfo()->Id == SPELL_DEFILE && s->m_targets.GetUnitTarget())
2836 targets.remove(s->m_targets.GetUnitTarget());
2837
2838 if (targets.empty())
2839 return;
2840
2842 targets.clear();
2843 targets.push_back(_target);
2844 if (Creature* caster = GetCaster()->ToCreature())
2845 caster->AI()->SetGUID(_target->GetGUID());
2846 }
@ CURRENT_GENERIC_SPELL
Definition: Unit.h:991
@ SPELL_BOSS_HITTIN_YA_AURA
Definition: boss_the_lich_king.cpp:85
@ SPELL_DEFILE
Definition: boss_the_lich_king.cpp:137
@ SPELL_HARVEST_SOUL_VALKYR
Definition: boss_the_lich_king.cpp:146
@ DATA_THE_LICH_KING
Definition: icecrown_citadel.h:106
auto SelectRandomContainerElement(C const &container) -> typename std::add_const< decltype(*std::begin(container))>::type &
Definition: Containers.h:135
Creature * GetCreature(WorldObject const &u, ObjectGuid const guid)
Definition: ObjectAccessor.cpp:213
virtual void SetGUID(ObjectGuid, int32=0)
Definition: UnitAI.h:204
Definition: Creature.h:46
CreatureAI * AI() const
Definition: Creature.h:136
Creature * ToCreature()
Definition: Object.h:197
static ObjectGuid GetGUID(Object const *o)
Definition: Object.h:106
InstanceScript * GetInstanceScript() const
Definition: Object.cpp:1192
Definition: GridNotifiers.h:1623
Definition: InstanceScript.h:141
Definition: Spell.h:284
SpellInfo const * GetSpellInfo()
Definition: SpellScript.cpp:411

References _target, Creature::AI(), CURRENT_GENERIC_SPELL, DATA_THE_LICH_KING, SpellScript::GetCaster(), ObjectAccessor::GetCreature(), Object::GetGUID(), WorldObject::GetInstanceScript(), SpellScript::GetSpellInfo(), Acore::Containers::SelectRandomContainerElement(), UnitAI::SetGUID(), SPELL_BOSS_HITTIN_YA_AURA, SPELL_DEFILE, SPELL_HARVEST_SOUL_VALKYR, and Object::ToCreature().

Referenced by Register().

Member Data Documentation

◆ _target

WorldObject* spell_the_lich_king_valkyr_target_search::spell_the_lich_king_valkyr_target_search_SpellScript::_target
private

Referenced by Load(), ReplaceTarget(), and SelectTarget().