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

Private Member Functions

 PrepareSpellScript (spell_thaddius_pos_neg_charge)
 
bool Validate (SpellInfo const *) override
 
void HandleTargets (std::list< WorldObject * > &targets)
 
void HandleDamage (SpellEffIndex)
 
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
 
Unit * GetCaster ()
 
GameObject * GetGObjCaster ()
 
Unit * GetOriginalCaster ()
 
SpellInfo const * GetSpellInfo ()
 
SpellValue const * GetSpellValue ()
 
WorldLocation const * GetExplTargetDest ()
 
void SetExplTargetDest (WorldLocation &loc)
 
WorldObject * GetExplTargetWorldObject ()
 
Unit * GetExplTargetUnit ()
 
GameObject * GetExplTargetGObj ()
 
Item * GetExplTargetItem ()
 
Unit * GetHitUnit ()
 
Creature * GetHitCreature ()
 
Player * GetHitPlayer ()
 
Item * GetHitItem ()
 
GameObject * GetHitGObj ()
 
WorldLocation * GetHitDest ()
 
int32 GetHitDamage ()
 
void SetHitDamage (int32 damage)
 
void PreventHitDamage ()
 
int32 GetHitHeal ()
 
void SetHitHeal (int32 heal)
 
void PreventHitHeal ()
 
Spell * GetSpell ()
 
Aura * GetHitAura ()
 
void PreventHitAura ()
 
void PreventHitEffect (SpellEffIndex effIndex)
 
void PreventHitDefaultEffect (SpellEffIndex effIndex)
 
int32 GetEffectValue () const
 
void SetEffectValue (int32 value)
 
Item * GetCastItem ()
 
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< CastHandler > BeforeCast
 
HookList< CastHandler > OnCast
 
HookList< CastHandler > AfterCast
 
HookList< CheckCastHandler > OnCheckCast
 
HookList< EffectHandler > OnEffectLaunch
 
HookList< EffectHandler > OnEffectLaunchTarget
 
HookList< EffectHandler > OnEffectHit
 
HookList< EffectHandler > OnEffectHitTarget
 
HookList< BeforeHitHandler > BeforeHit
 
HookList< HitHandler > OnHit
 
HookList< HitHandler > AfterHit
 
HookList< ObjectAreaTargetSelectHandler > OnObjectAreaTargetSelect
 
HookList< ObjectTargetSelectHandler > OnObjectTargetSelect
 
HookList< DestinationTargetSelectHandler > OnDestinationTargetSelect
 
- Protected Attributes inherited from _SpellScript
uint8 m_currentScriptState
 
std::string const * m_scriptName
 
uint32 m_scriptSpellId
 

Detailed Description

Member Function Documentation

◆ HandleDamage()

void spell_thaddius_pos_neg_charge::HandleDamage ( SpellEffIndex  )
inlineprivate
655 {
656 if (!GetTriggeringSpell())
657 return;
658
659 Unit* target = GetHitUnit();
660 if (!target)
661 return;
662
663 if (target->HasAura(GetTriggeringSpell()->Id) || !target->IsPlayer())
664 {
665 SetHitDamage(0);
666 }
667 else if (InstanceScript* instance = target->GetInstanceScript())
668 {
669 instance->SetData(DATA_CHARGES_CROSSED, 0);
670 }
671 }
Definition InstanceScript.h:143
bool IsPlayer() const
Definition Object.h:207
Unit * GetHitUnit()
Definition SpellScript.cpp:453
SpellInfo const * GetTriggeringSpell()
Definition SpellScript.cpp:635
void SetHitDamage(int32 damage)
Definition SpellScript.cpp:529
Definition Unit.h:665
bool HasAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0) const
Definition Unit.cpp:5764
InstanceScript * GetInstanceScript() const
Definition Object.cpp:1247
@ DATA_CHARGES_CROSSED
Definition naxxramas.h:79

References DATA_CHARGES_CROSSED, SpellScript::GetHitUnit(), WorldObject::GetInstanceScript(), SpellScript::GetTriggeringSpell(), Unit::HasAura(), Object::IsPlayer(), and SpellScript::SetHitDamage().

Referenced by Register().

◆ HandleTargets()

void spell_thaddius_pos_neg_charge::HandleTargets ( std::list< WorldObject * > &  targets)
inlineprivate
631 {
632 uint8 count = 0;
633 for (auto& ihit : targets)
634 {
635 if (ihit->GetGUID() != GetCaster()->GetGUID())
636 {
637 if (Player* target = ihit->ToPlayer())
638 {
639 if (target->HasAura(GetTriggeringSpell()->Id))
640 {
641 ++count;
642 }
643 }
644 }
645 }
646
647 if (count)
648 {
650 GetCaster()->SetAuraStack(spellId, GetCaster(), count);
651 }
652 }
std::uint8_t uint8
Definition Define.h:109
std::uint32_t uint32
Definition Define.h:107
@ SPELL_POSITIVE_CHARGE
Definition boss_thaddius.cpp:77
@ SPELL_POSITIVE_CHARGE_STACK
Definition boss_thaddius.cpp:78
@ SPELL_NEGATIVE_CHARGE_STACK
Definition boss_thaddius.cpp:80
Player * ToPlayer()
Definition Object.h:208
Definition Player.h:1086
uint32 Id
Definition SpellInfo.h:344
SpellInfo const * GetSpellInfo()
Definition SpellScript.cpp:416
Unit * GetCaster()
Definition SpellScript.cpp:401
void SetAuraStack(uint32 spellId, Unit *target, uint32 stack)
Definition Unit.cpp:14786

References SpellScript::GetCaster(), Object::GetGUID(), SpellScript::GetSpellInfo(), SpellScript::GetTriggeringSpell(), SpellInfo::Id, Unit::SetAuraStack(), SPELL_NEGATIVE_CHARGE_STACK, SPELL_POSITIVE_CHARGE, SPELL_POSITIVE_CHARGE_STACK, and Object::ToPlayer().

Referenced by Register().

◆ PrepareSpellScript()

spell_thaddius_pos_neg_charge::PrepareSpellScript ( spell_thaddius_pos_neg_charge  )
private

◆ Register()

void spell_thaddius_pos_neg_charge::Register ( )
inlineoverrideprivatevirtual

Implements _SpellScript.

674 {
677 }
@ EFFECT_0
Definition SharedDefines.h:31
@ SPELL_EFFECT_SCHOOL_DAMAGE
Definition SharedDefines.h:768
@ TARGET_UNIT_SRC_AREA_ALLY
Definition SharedDefines.h:1438
#define SpellEffectFn(F, I, N)
Definition SpellScript.h:337
#define SpellObjectAreaTargetSelectFn(F, I, N)
Definition SpellScript.h:354
HookList< EffectHandler > OnEffectHitTarget
Definition SpellScript.h:336
HookList< ObjectAreaTargetSelectHandler > OnObjectAreaTargetSelect
Definition SpellScript.h:353
void HandleDamage(SpellEffIndex)
Definition boss_thaddius.cpp:654
void HandleTargets(std::list< WorldObject * > &targets)
Definition boss_thaddius.cpp:630

References EFFECT_0, HandleDamage(), HandleTargets(), SpellScript::OnEffectHitTarget, SpellScript::OnObjectAreaTargetSelect, SPELL_EFFECT_SCHOOL_DAMAGE, SpellEffectFn, SpellObjectAreaTargetSelectFn, and TARGET_UNIT_SRC_AREA_ALLY.

◆ Validate()

bool spell_thaddius_pos_neg_charge::Validate ( SpellInfo const *  )
inlineoverrideprivatevirtual

Reimplemented from _SpellScript.

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

References SPELL_POSITIVE_CHARGE, SPELL_POSITIVE_CHARGE_STACK, and _SpellScript::ValidateSpellInfo().


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