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

Private Member Functions

 PrepareSpellScript (spell_gen_break_shield) bool Validate(SpellInfo const *) override
 
void HandleScriptEffect (SpellEffIndex effIndex)
 
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

◆ HandleScriptEffect()

void spell_gen_break_shield::HandleScriptEffect ( SpellEffIndex  effIndex)
inlineprivate
2777 {
2778 Unit* target = GetHitUnit();
2779
2780 switch (effIndex)
2781 {
2782 case EFFECT_0: // On spells wich trigger the damaging spell (and also the visual)
2783 {
2784 uint32 spellId;
2785
2786 switch (GetSpellInfo()->Id)
2787 {
2791 break;
2795 break;
2796 default:
2797 return;
2798 }
2799
2800 if (Unit* rider = GetCaster()->GetCharmer())
2801 rider->CastSpell(target, spellId, false);
2802 else
2803 GetCaster()->CastSpell(target, spellId, false);
2804 break;
2805 }
2806 case EFFECT_1: // On damaging spells, for removing a defend layer
2807 {
2808 Unit::AuraApplicationMap const& auras = target->GetAppliedAuras();
2809 for (Unit::AuraApplicationMap::const_iterator itr = auras.begin(); itr != auras.end(); ++itr)
2810 {
2811 if (Aura* aura = itr->second->GetBase())
2812 {
2813 SpellInfo const* auraInfo = aura->GetSpellInfo();
2814 if (auraInfo && auraInfo->SpellIconID == 2007 && aura->HasEffectType(SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN))
2815 {
2816 aura->ModStackAmount(-1, AURA_REMOVE_BY_ENEMY_SPELL);
2817 // Remove dummys from rider (Necessary for updating visual shields)
2818 if (Unit* rider = target->GetCharmer())
2819 if (Aura* defend = rider->GetAura(aura->GetId()))
2820 defend->ModStackAmount(-1, AURA_REMOVE_BY_ENEMY_SPELL);
2821 break;
2822 }
2823 }
2824 }
2825 break;
2826 }
2827 default:
2828 break;
2829 }
2830 }
std::uint32_t uint32
Definition: Define.h:108
@ SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN
Definition: SpellAuraDefines.h:150
@ AURA_REMOVE_BY_ENEMY_SPELL
Definition: SpellAuraDefines.h:394
@ SPELL_BREAK_SHIELD_DAMAGE_10K
Definition: spell_generic.cpp:2747
@ SPELL_BREAK_SHIELD_TRIGGER_FACTION_MOUNTS
Definition: spell_generic.cpp:2749
@ SPELL_BREAK_SHIELD_TRIGGER_UNK
Definition: spell_generic.cpp:2751
@ SPELL_BREAK_SHIELD_DAMAGE_2K
Definition: spell_generic.cpp:2746
@ SPELL_BREAK_SHIELD_TRIGGER_SUNDERING_THURST
Definition: spell_generic.cpp:2752
@ SPELL_BREAK_SHIELD_TRIGGER_CAMPAING_WARHORSE
Definition: spell_generic.cpp:2750
@ EFFECT_1
Definition: SharedDefines.h:31
@ EFFECT_0
Definition: SharedDefines.h:30
Definition: Unit.h:1290
std::multimap< uint32, AuraApplication * > AuraApplicationMap
Definition: Unit.h:1299
Unit * GetCharmer() const
Definition: Unit.cpp:10568
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:1169
AuraApplicationMap & GetAppliedAuras()
Definition: Unit.h:1924
Definition: SpellAuras.h:87
Definition: SpellInfo.h:314
uint32 SpellIconID
Definition: SpellInfo.h:378
SpellInfo const * GetSpellInfo()
Definition: SpellScript.cpp:411
Unit * GetHitUnit()
Definition: SpellScript.cpp:448
Unit * GetCaster()
Definition: SpellScript.cpp:401

References AURA_REMOVE_BY_ENEMY_SPELL, Unit::CastSpell(), EFFECT_0, EFFECT_1, Unit::GetAppliedAuras(), SpellScript::GetCaster(), Unit::GetCharmer(), SpellScript::GetHitUnit(), SpellScript::GetSpellInfo(), SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN, SPELL_BREAK_SHIELD_DAMAGE_10K, SPELL_BREAK_SHIELD_DAMAGE_2K, SPELL_BREAK_SHIELD_TRIGGER_CAMPAING_WARHORSE, SPELL_BREAK_SHIELD_TRIGGER_FACTION_MOUNTS, SPELL_BREAK_SHIELD_TRIGGER_SUNDERING_THURST, SPELL_BREAK_SHIELD_TRIGGER_UNK, and SpellInfo::SpellIconID.

Referenced by Register().

◆ PrepareSpellScript()

◆ Register()

void spell_gen_break_shield::Register ( )
inlineoverrideprivatevirtual

Implements _SpellScript.

2833 {
2835 }
#define SpellEffectFn(F, I, N)
Definition: SpellScript.h:337
#define EFFECT_FIRST_FOUND
Definition: SharedDefines.h:36
@ SPELL_EFFECT_SCRIPT_EFFECT
Definition: SharedDefines.h:827
HookList< EffectHandler > OnEffectHitTarget
Definition: SpellScript.h:336
void HandleScriptEffect(SpellEffIndex effIndex)
Definition: spell_generic.cpp:2776

References EFFECT_FIRST_FOUND, HandleScriptEffect(), SpellScript::OnEffectHitTarget, SPELL_EFFECT_SCRIPT_EFFECT, and SpellEffectFn.