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

Private Member Functions

 PrepareSpellScript (spell_blade_dance_targeting)
 
bool Validate (SpellInfo const *) override
 
void FilterTargets (std::list< WorldObject * > &targets)
 
void HandleOnHit ()
 
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 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
 
- Protected Attributes inherited from _SpellScript
uint8 m_currentScriptState
 
std::string const * m_scriptName
 
uint32 m_scriptSpellId
 

Detailed Description

Member Function Documentation

◆ FilterTargets()

void spell_blade_dance_targeting::FilterTargets ( std::list< WorldObject * > &  targets)
inlineprivate
256 {
257 Unit* caster = GetCaster();
258 if (!caster)
259 return;
260
261 targets.remove_if([&](WorldObject* target) -> bool
262 {
263 float dist = caster->GetDistance2d(target);
264 // Do not target dummies that are too close or too far away
265 if (dist < 5.f || dist > 16.f)
266 return true;
267 // Do not target anything that is not a target dummy
268 if (target->GetEntry() != NPC_BLADE_DANCE_TARGET)
269 return true;
270
271 return false;
272 });
273
274 std::list<WorldObject*> targets2 = targets;
275
276 targets.remove_if([&](WorldObject* target) -> bool
277 {
278 if (target->SelectNearestPlayer(15.f))
279 return false;
280 return true;
281 });
282
284
285 if (urand(0, 2))
286 {
287 if (targets.empty())
288 targets = targets2;
289 else
291 }
292 else
293 targets = targets2;
294 }
uint32 urand(uint32 min, uint32 max)
Definition Random.cpp:44
@ NPC_BLADE_DANCE_TARGET
Definition boss_warchief_kargath_bladefist.cpp:49
uint32 GetEntry() const
Definition Object.h:117
Unit * GetCaster()
Definition SpellScript.cpp:401
Definition Unit.h:664
Definition Object.h:475
float GetDistance2d(WorldObject const *obj) const
Definition Object.cpp:1313
Player * SelectNearestPlayer(float distance=0) const
Definition Object.cpp:2526
void RandomResize(C &container, std::size_t requestedSize)
Definition Containers.h:79

References SpellScript::GetCaster(), WorldObject::GetDistance2d(), Object::GetEntry(), NPC_BLADE_DANCE_TARGET, Acore::Containers::RandomResize(), WorldObject::SelectNearestPlayer(), and urand().

Referenced by Register().

◆ HandleOnHit()

void spell_blade_dance_targeting::HandleOnHit ( )
inlineprivate
297 {
298 Unit* caster = GetCaster();
299 Unit* target = GetHitUnit();
300 if (!caster || !target)
301 return;
302
303 caster->CastSpell(target, SPELL_BLADE_DANCE_CHARGE, true);
304 caster->CastSpell(target, SPELL_BLADE_DANCE_DMG, true);
305 }
@ SPELL_BLADE_DANCE_DMG
Definition boss_warchief_kargath_bladefist.cpp:37
@ SPELL_BLADE_DANCE_CHARGE
Definition boss_warchief_kargath_bladefist.cpp:38
Unit * GetHitUnit()
Definition SpellScript.cpp:448
SpellCastResult CastSpell(SpellCastTargets const &targets, SpellInfo const *spellInfo, CustomSpellValues const *value, TriggerCastFlags triggerFlags=TRIGGERED_NONE, Item *castItem=nullptr, AuraEffect const *triggeredByAura=nullptr, ObjectGuid originalCaster=ObjectGuid::Empty)
Definition Unit.cpp:1350

References Unit::CastSpell(), SpellScript::GetCaster(), SpellScript::GetHitUnit(), SPELL_BLADE_DANCE_CHARGE, and SPELL_BLADE_DANCE_DMG.

Referenced by Register().

◆ PrepareSpellScript()

spell_blade_dance_targeting::PrepareSpellScript ( spell_blade_dance_targeting  )
private

◆ Register()

void spell_blade_dance_targeting::Register ( )
inlineoverrideprivatevirtual

Implements _SpellScript.

308 {
311 }
@ EFFECT_0
Definition SharedDefines.h:31
@ TARGET_UNIT_SRC_AREA_ENTRY
Definition SharedDefines.h:1422
#define SpellObjectAreaTargetSelectFn(F, I, N)
Definition SpellScript.h:354
#define SpellHitFn(F)
Definition SpellScript.h:349
HookList< HitHandler > OnHit
Definition SpellScript.h:345
HookList< ObjectAreaTargetSelectHandler > OnObjectAreaTargetSelect
Definition SpellScript.h:353
void HandleOnHit()
Definition boss_warchief_kargath_bladefist.cpp:296
void FilterTargets(std::list< WorldObject * > &targets)
Definition boss_warchief_kargath_bladefist.cpp:255

References EFFECT_0, FilterTargets(), HandleOnHit(), SpellScript::OnHit, SpellScript::OnObjectAreaTargetSelect, SpellHitFn, SpellObjectAreaTargetSelectFn, and TARGET_UNIT_SRC_AREA_ENTRY.

◆ Validate()

bool spell_blade_dance_targeting::Validate ( SpellInfo const *  )
inlineoverrideprivatevirtual

Reimplemented from _SpellScript.

251 {
253 }
static bool ValidateSpellInfo(std::initializer_list< uint32 > spellIds)
Definition SpellScript.h:125

References SPELL_BLADE_DANCE_CHARGE, SPELL_BLADE_DANCE_DMG, and _SpellScript::ValidateSpellInfo().


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