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
261 {
262 Unit* caster = GetCaster();
263 if (!caster)
264 return;
265
266 targets.remove_if([&](WorldObject* target) -> bool
267 {
268 float dist = caster->GetDistance2d(target);
269 // Do not target dummies that are too close or too far away
270 if (dist < 5.f || dist > 16.f)
271 return true;
272 // Do not target anything that is not a target dummy
273 if (target->GetEntry() != NPC_BLADE_DANCE_TARGET)
274 return true;
275
276 return false;
277 });
278
279 std::list<WorldObject*> targets2 = targets;
280
281 targets.remove_if([&](WorldObject* target) -> bool
282 {
283 if (target->SelectNearestPlayer(15.f))
284 return false;
285 return true;
286 });
287
289
290 if (urand(0, 2))
291 {
292 if (targets.empty())
293 targets = targets2;
294 else
296 }
297 else
298 targets = targets2;
299 }
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:115
Unit * GetCaster()
Definition SpellScript.cpp:401
Definition Unit.h:636
Definition Object.h:410
float GetDistance2d(WorldObject const *obj) const
Definition Object.cpp:1274
Player * SelectNearestPlayer(float distance=0) const
Definition Object.cpp:2486
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
302 {
303 Unit* caster = GetCaster();
304 Unit* target = GetHitUnit();
305 if (!caster || !target)
306 return;
307
308 caster->CastSpell(target, SPELL_BLADE_DANCE_CHARGE, true);
309 caster->CastSpell(target, SPELL_BLADE_DANCE_DMG, true);
310 }
@ 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:1178

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.

313 {
316 }
@ EFFECT_0
Definition SharedDefines.h:31
@ TARGET_UNIT_SRC_AREA_ENTRY
Definition SharedDefines.h:1416
#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:301
void FilterTargets(std::list< WorldObject * > &targets)
Definition boss_warchief_kargath_bladefist.cpp:260

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.

256 {
258 }
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: