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

Private Member Functions

 PrepareAuraScript (spell_pal_sacred_shield_base)
 
void CalculateAmount (AuraEffect const *aurEff, int32 &amount, bool &)
 
bool CheckProc (ProcEventInfo &eventInfo)
 
void HandleProc (AuraEffect const *aurEff, ProcEventInfo &eventInfo)
 
void Register () override
 

Additional Inherited Members

- Public Member Functions inherited from AuraScript
 AuraScript ()
 
bool _Validate (SpellInfo const *entry) override
 
bool _Load (Aura *aura)
 
void _PrepareScriptCall (AuraScriptHookType hookType, AuraApplication const *aurApp=nullptr)
 
void _FinishScriptCall ()
 
bool _IsDefaultActionPrevented ()
 
void PreventDefaultAction ()
 
SpellInfo const * GetSpellInfo () const
 
uint32 GetId () const
 
ObjectGuid GetCasterGUID () const
 
UnitGetCaster () const
 
WorldObjectGetOwner () const
 
UnitGetUnitOwner () const
 
DynamicObjectGetDynobjOwner () const
 
void Remove (uint32 removeMode=0)
 
AuraGetAura () const
 
AuraObjectType GetType () const
 
int32 GetDuration () const
 
void SetDuration (int32 duration, bool withMods=false)
 
void RefreshDuration ()
 
time_t GetApplyTime () const
 
int32 GetMaxDuration () const
 
void SetMaxDuration (int32 duration)
 
int32 CalcMaxDuration () const
 
bool IsExpired () const
 
bool IsPermanent () const
 
uint8 GetCharges () const
 
void SetCharges (uint8 charges)
 
uint8 CalcMaxCharges () const
 
bool ModCharges (int8 num, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
 
bool DropCharge (AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
 
uint8 GetStackAmount () const
 
void SetStackAmount (uint8 num)
 
bool ModStackAmount (int32 num, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
 
bool IsPassive () const
 
bool IsDeathPersistent () const
 
bool HasEffect (uint8 effIndex) const
 
AuraEffectGetEffect (uint8 effIndex) const
 
bool HasEffectType (AuraType type) const
 
UnitGetTarget () const
 
AuraApplication const * GetTargetApplication () const
 
- 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 AuraScript
HookList< CheckAreaTargetHandlerDoCheckAreaTarget
 
HookList< AuraDispelHandlerOnDispel
 
HookList< AuraDispelHandlerAfterDispel
 
HookList< EffectApplyHandlerOnEffectApply
 
HookList< EffectApplyHandlerAfterEffectApply
 
HookList< EffectApplyHandlerOnEffectRemove
 
HookList< EffectApplyHandlerAfterEffectRemove
 
HookList< EffectPeriodicHandlerOnEffectPeriodic
 
HookList< EffectUpdatePeriodicHandlerOnEffectUpdatePeriodic
 
HookList< EffectCalcAmountHandlerDoEffectCalcAmount
 
HookList< EffectCalcPeriodicHandlerDoEffectCalcPeriodic
 
HookList< EffectCalcSpellModHandlerDoEffectCalcSpellMod
 
HookList< EffectAbsorbHandlerOnEffectAbsorb
 
HookList< EffectAbsorbHandlerAfterEffectAbsorb
 
HookList< EffectManaShieldHandlerOnEffectManaShield
 
HookList< EffectManaShieldHandlerAfterEffectManaShield
 
HookList< EffectSplitHandlerOnEffectSplit
 
HookList< CheckProcHandlerDoCheckProc
 
HookList< AfterCheckProcHandlerDoAfterCheckProc
 
HookList< AuraProcHandlerDoPrepareProc
 
HookList< AuraProcHandlerOnProc
 
HookList< AuraProcHandlerAfterProc
 
HookList< EffectProcHandlerOnEffectProc
 
HookList< EffectProcHandlerAfterEffectProc
 
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

◆ CalculateAmount()

void spell_pal_sacred_shield_base::CalculateAmount ( AuraEffect const *  aurEff,
int32 amount,
bool &   
)
inlineprivate
198 {
199 if (Unit* caster = GetCaster())
200 {
201 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(GetSpellInfo()->Effects[aurEff->GetEffIndex()].TriggerSpell);
202 amount = spellInfo->Effects[EFFECT_0].CalcValue();
203
204 // +75.00% from sp bonus
205 amount += CalculatePct(caster->SpellBaseDamageBonusDone(spellInfo->GetSchoolMask()), 75.0f);
206
207 // Xinef: removed divine guardian because it will affect triggered spell with increased amount
208 // Arena - Dampening
209 if (AuraEffect const* dampening = caster->GetAuraEffect(SPELL_GENERIC_ARENA_DAMPENING, EFFECT_0))
210 {
211 AddPct(amount, dampening->GetAmount());
212 }
213 // Battleground - Dampening
214 else if (AuraEffect const* dampening2 = caster->GetAuraEffect(SPELL_GENERIC_BATTLEGROUND_DAMPENING, EFFECT_0))
215 {
216 AddPct(amount, dampening2->GetAmount());
217 }
218 }
219 }
T AddPct(T &base, U pct)
Definition: Util.h:67
T CalculatePct(T base, U pct)
Definition: Util.h:61
#define sSpellMgr
Definition: SpellMgr.h:818
@ SPELL_GENERIC_ARENA_DAMPENING
Definition: spell_paladin.cpp:83
@ SPELL_GENERIC_BATTLEGROUND_DAMPENING
Definition: spell_paladin.cpp:84
@ EFFECT_0
Definition: SharedDefines.h:30
Definition: Unit.h:1290
Definition: SpellAuraEffects.h:39
Definition: SpellInfo.h:314
SpellSchoolMask GetSchoolMask() const
Definition: SpellInfo.cpp:1972
std::array< SpellEffectInfo, MAX_SPELL_EFFECTS > Effects
Definition: SpellInfo.h:391
SpellInfo const * GetSpellInfo() const
Definition: SpellScript.cpp:1005
Unit * GetCaster() const
Definition: SpellScript.cpp:1020

References AddPct(), CalculatePct(), EFFECT_0, SpellInfo::Effects, AuraScript::GetCaster(), AuraEffect::GetEffIndex(), SpellInfo::GetSchoolMask(), AuraScript::GetSpellInfo(), SPELL_GENERIC_ARENA_DAMPENING, SPELL_GENERIC_BATTLEGROUND_DAMPENING, and sSpellMgr.

Referenced by Register().

◆ CheckProc()

bool spell_pal_sacred_shield_base::CheckProc ( ProcEventInfo eventInfo)
inlineprivate
222 {
223 HealInfo* healinfo = eventInfo.GetHealInfo();
224 DamageInfo* damageinfo = eventInfo.GetDamageInfo();
225 return !(eventInfo.GetHitMask() & PROC_EX_INTERNAL_HOT) && ((healinfo && healinfo->GetHeal() > 0) || (damageinfo && damageinfo->GetDamage() > 0));
226 }
@ PROC_EX_INTERNAL_HOT
Definition: SpellMgr.h:220
Definition: Unit.h:761
uint32 GetDamage() const
Definition: Unit.h:795
Definition: Unit.h:804
uint32 GetHeal() const
Definition: Unit.h:832
uint32 GetHitMask() const
Definition: Unit.h:864
HealInfo * GetHealInfo() const
Definition: Unit.h:869
DamageInfo * GetDamageInfo() const
Definition: Unit.h:868

References DamageInfo::GetDamage(), ProcEventInfo::GetDamageInfo(), HealInfo::GetHeal(), ProcEventInfo::GetHealInfo(), ProcEventInfo::GetHitMask(), and PROC_EX_INTERNAL_HOT.

Referenced by Register().

◆ HandleProc()

void spell_pal_sacred_shield_base::HandleProc ( AuraEffect const *  aurEff,
ProcEventInfo eventInfo 
)
inlineprivate
229 {
231
233 {
234 Unit* caster = eventInfo.GetActor();
235
236 HealInfo* healinfo = eventInfo.GetHealInfo();
237
238 if (!healinfo || !healinfo->GetHeal())
239 {
240 return;
241 }
242
243 SpellInfo const* procSpell = healinfo->GetSpellInfo();
244 if (!procSpell)
245 {
246 return;
247 }
248
249 if (caster && procSpell->SpellFamilyName == SPELLFAMILY_PALADIN &&
250 procSpell->SpellFamilyFlags.HasFlag(0x40000000) && caster->GetAuraEffect(SPELL_AURA_PROC_TRIGGER_SPELL, SPELLFAMILY_PALADIN, 3021, 0)) // need infusion of light
251 {
252 int32 basepoints = int32(float(healinfo->GetHeal()) / 12.0f);
253 // Item - Paladin T9 Holy 4P Bonus (Flash of Light)
254 if (AuraEffect const* aurEffect = caster->GetAuraEffect(67191, EFFECT_0))
255 AddPct(basepoints, aurEffect->GetAmount());
256
257 caster->CastCustomSpell(eventInfo.GetActionTarget(), 66922, &basepoints, nullptr, nullptr, true, nullptr, aurEff, caster->GetGUID());
258 return;
259 }
260
261 return;
262 }
263
264 uint32 triggered_spell_id = GetSpellInfo()->Effects[aurEff->GetEffIndex()].TriggerSpell;
265 if (eventInfo.GetActionTarget()->HasSpellCooldown(triggered_spell_id))
266 return;
267
268 uint32 cooldown = eventInfo.GetProcCooldown();
269 int32 basepoints = aurEff->GetAmount();
270
271 // Item - Paladin T8 Holy 4P Bonus
272 if (Unit* caster = aurEff->GetCaster())
273 if (AuraEffect const* aurEffect = caster->GetAuraEffect(64895, 0))
274 cooldown = aurEffect->GetAmount() * IN_MILLISECONDS;
275
276 eventInfo.GetActionTarget()->AddSpellCooldown(triggered_spell_id, 0, cooldown);
277 eventInfo.GetActionTarget()->CastCustomSpell(eventInfo.GetActionTarget(), triggered_spell_id, &basepoints, nullptr, nullptr, true, nullptr, aurEff, eventInfo.GetActionTarget()->GetGUID());
278 }
constexpr auto IN_MILLISECONDS
Definition: Common.h:62
std::int32_t int32
Definition: Define.h:104
std::uint32_t uint32
Definition: Define.h:108
@ SPELL_AURA_PROC_TRIGGER_SPELL
Definition: SpellAuraDefines.h:105
@ PROC_FLAG_TAKEN_SPELL_MAGIC_DMG_CLASS_POS
Definition: SpellMgr.h:129
@ SPELLFAMILY_PALADIN
Definition: SharedDefines.h:3510
bool HasFlag(uint32 p1=0, uint32 p2=0, uint32 p3=0) const
Definition: Util.h:463
static ObjectGuid GetGUID(Object const *o)
Definition: Object.h:106
SpellInfo const * GetSpellInfo() const
Definition: Unit.h:834
Unit * GetActionTarget() const
Definition: Unit.h:859
uint32 GetTypeMask() const
Definition: Unit.h:861
Unit * GetActor()
Definition: Unit.h:858
uint32 GetProcCooldown() const
Definition: Unit.h:872
virtual bool HasSpellCooldown(uint32) const
Definition: Unit.h:2418
SpellCastResult CastCustomSpell(Unit *victim, uint32 spellId, int32 const *bp0, int32 const *bp1, int32 const *bp2, bool triggered, Item *castItem=nullptr, AuraEffect const *triggeredByAura=nullptr, ObjectGuid originalCaster=ObjectGuid::Empty)
Definition: Unit.cpp:1226
AuraEffect * GetAuraEffect(uint32 spellId, uint8 effIndex, ObjectGuid casterGUID=ObjectGuid::Empty) const
Definition: Unit.cpp:5412
virtual void AddSpellCooldown(uint32, uint32, uint32, bool needSendToClient=false, bool forceSendToSpectator=false)
Definition: Unit.h:2420
flag96 SpellFamilyFlags
Definition: SpellInfo.h:386
uint32 SpellFamilyName
Definition: SpellInfo.h:385
void PreventDefaultAction()
Definition: SpellScript.cpp:985

References AddPct(), Unit::AddSpellCooldown(), Unit::CastCustomSpell(), EFFECT_0, SpellInfo::Effects, ProcEventInfo::GetActionTarget(), ProcEventInfo::GetActor(), AuraEffect::GetAmount(), Unit::GetAuraEffect(), AuraEffect::GetCaster(), AuraEffect::GetEffIndex(), Object::GetGUID(), HealInfo::GetHeal(), ProcEventInfo::GetHealInfo(), ProcEventInfo::GetProcCooldown(), HealInfo::GetSpellInfo(), AuraScript::GetSpellInfo(), ProcEventInfo::GetTypeMask(), flag96::HasFlag(), Unit::HasSpellCooldown(), IN_MILLISECONDS, AuraScript::PreventDefaultAction(), PROC_FLAG_TAKEN_SPELL_MAGIC_DMG_CLASS_POS, SPELL_AURA_PROC_TRIGGER_SPELL, SPELLFAMILY_PALADIN, SpellInfo::SpellFamilyFlags, and SpellInfo::SpellFamilyName.

Referenced by Register().

◆ PrepareAuraScript()

spell_pal_sacred_shield_base::PrepareAuraScript ( spell_pal_sacred_shield_base  )
private

◆ Register()

void spell_pal_sacred_shield_base::Register ( )
inlineoverrideprivatevirtual

Implements _SpellScript.

281 {
285 }
@ SPELL_AURA_DUMMY
Definition: SpellAuraDefines.h:67
#define AuraEffectProcFn(F, I, N)
Definition: SpellScript.h:847
#define AuraEffectCalcAmountFn(F, I, N)
Definition: SpellScript.h:772
#define AuraCheckProcFn(F)
Definition: SpellScript.h:818
HookList< EffectCalcAmountHandler > DoEffectCalcAmount
Definition: SpellScript.h:771
HookList< CheckProcHandler > DoCheckProc
Definition: SpellScript.h:817
HookList< EffectProcHandler > OnEffectProc
Definition: SpellScript.h:842
bool CheckProc(ProcEventInfo &eventInfo)
Definition: spell_paladin.cpp:221
void CalculateAmount(AuraEffect const *aurEff, int32 &amount, bool &)
Definition: spell_paladin.cpp:197
void HandleProc(AuraEffect const *aurEff, ProcEventInfo &eventInfo)
Definition: spell_paladin.cpp:228

References AuraCheckProcFn, AuraEffectCalcAmountFn, AuraEffectProcFn, CalculateAmount(), CheckProc(), AuraScript::DoCheckProc, AuraScript::DoEffectCalcAmount, EFFECT_0, HandleProc(), AuraScript::OnEffectProc, and SPELL_AURA_DUMMY.