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
 

Private Attributes

uint32 _cooldownEnd = 0
 

Static Private Attributes

static constexpr uint32 SACRED_SHIELD_ICD = 6 * IN_MILLISECONDS
 

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 (AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
 
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 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< CheckEffectProcHandlerDoCheckEffectProc
 
HookList< AfterCheckProcHandlerDoAfterCheckProc
 
HookList< AuraProcHandlerDoPrepareProc
 
HookList< AuraProcHandlerOnProc
 
HookList< AuraProcHandlerAfterProc
 
HookList< EffectProcHandlerOnEffectProc
 
HookList< EffectProcHandlerAfterEffectProc
 
- 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
299 {
300 if (Unit* caster = GetCaster())
301 {
302 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(GetSpellInfo()->Effects[aurEff->GetEffIndex()].TriggerSpell);
303 amount = spellInfo->Effects[EFFECT_0].CalcValue();
304
305 // +75.00% from sp bonus
306 amount += CalculatePct(caster->SpellBaseDamageBonusDone(spellInfo->GetSchoolMask()), 75.0f);
307
308 // Xinef: removed divine guardian because it will affect triggered spell with increased amount
309 // Arena - Dampening
310 if (AuraEffect const* dampening = caster->GetAuraEffect(SPELL_GENERIC_ARENA_DAMPENING, EFFECT_0))
311 {
312 AddPct(amount, dampening->GetAmount());
313 }
314 // Battleground - Dampening
315 else if (AuraEffect const* dampening2 = caster->GetAuraEffect(SPELL_GENERIC_BATTLEGROUND_DAMPENING, EFFECT_0))
316 {
317 AddPct(amount, dampening2->GetAmount());
318 }
319 }
320 }
@ EFFECT_0
Definition SharedDefines.h:31
#define sSpellMgr
Definition SpellMgr.h:814
T AddPct(T &base, U pct)
Definition Util.h:58
T CalculatePct(T base, U pct)
Definition Util.h:52
Definition SpellAuraEffects.h:39
SpellInfo const * GetSpellInfo() const
Definition SpellScript.cpp:1020
Unit * GetCaster() const
Definition SpellScript.cpp:1035
Definition SpellInfo.h:316
SpellSchoolMask GetSchoolMask() const
Definition SpellInfo.cpp:1877
std::array< SpellEffectInfo, MAX_SPELL_EFFECTS > Effects
Definition SpellInfo.h:393
Definition Unit.h:658
@ SPELL_GENERIC_ARENA_DAMPENING
Definition spell_paladin.cpp:89
@ SPELL_GENERIC_BATTLEGROUND_DAMPENING
Definition spell_paladin.cpp:90

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
323 {
324 HealInfo* healinfo = eventInfo.GetHealInfo();
325 DamageInfo* damageinfo = eventInfo.GetDamageInfo();
326 return !(eventInfo.GetHitMask() & PROC_EX_INTERNAL_HOT) && ((healinfo && healinfo->GetHeal() > 0) || (damageinfo && damageinfo->GetDamage() > 0));
327 }
@ PROC_EX_INTERNAL_HOT
Definition SpellMgr.h:222
Definition Unit.h:337
uint32 GetDamage() const
Definition Unit.h:373
Definition Unit.h:384
uint32 GetHeal() const
Definition Unit.h:424
uint32 GetHitMask() const
Definition Unit.h:459
HealInfo * GetHealInfo() const
Definition Unit.h:464
DamageInfo * GetDamageInfo() const
Definition Unit.h:463

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
330 {
332
334 {
335 Unit* caster = eventInfo.GetActor();
336
337 HealInfo* healinfo = eventInfo.GetHealInfo();
338
339 if (!healinfo || !healinfo->GetHeal())
340 {
341 return;
342 }
343
344 SpellInfo const* procSpell = healinfo->GetSpellInfo();
345 if (!procSpell)
346 {
347 return;
348 }
349
350 if (caster && procSpell->SpellFamilyName == SPELLFAMILY_PALADIN &&
351 procSpell->SpellFamilyFlags.HasFlag(0x40000000) && caster->GetAuraEffect(SPELL_AURA_PROC_TRIGGER_SPELL, SPELLFAMILY_PALADIN, 3021, 0)) // need infusion of light
352 {
353 int32 basepoints = int32(float(healinfo->GetHeal()) / 12.0f);
354 // Item - Paladin T9 Holy 4P Bonus (Flash of Light)
355 if (AuraEffect const* aurEffect = caster->GetAuraEffect(67191, EFFECT_0))
356 AddPct(basepoints, aurEffect->GetAmount());
357
358 caster->CastCustomSpell(eventInfo.GetActionTarget(), 66922, &basepoints, nullptr, nullptr, true, nullptr, aurEff, caster->GetGUID());
359 return;
360 }
361
362 return;
363 }
364
365 uint32 now = GameTime::GetGameTimeMS().count();
366 if (_cooldownEnd > now)
367 return;
368
369 uint32 cooldown = SACRED_SHIELD_ICD;
370
371 // Item - Paladin T8 Holy 4P Bonus
372 if (Unit* caster = aurEff->GetCaster())
373 if (AuraEffect const* aurEffect = caster->GetAuraEffect(64895, 0))
374 cooldown = aurEffect->GetAmount() * IN_MILLISECONDS;
375
376 _cooldownEnd = now + cooldown;
377
378 uint32 triggered_spell_id = GetSpellInfo()->Effects[aurEff->GetEffIndex()].TriggerSpell;
379 int32 basepoints = aurEff->GetAmount();
380 eventInfo.GetActionTarget()->CastCustomSpell(eventInfo.GetActionTarget(), triggered_spell_id, &basepoints, nullptr, nullptr, true, nullptr, aurEff, eventInfo.GetActionTarget()->GetGUID());
381 }
constexpr auto IN_MILLISECONDS
Definition Common.h:53
std::int32_t int32
Definition Define.h:103
std::uint32_t uint32
Definition Define.h:107
@ SPELLFAMILY_PALADIN
Definition SharedDefines.h:3794
@ SPELL_AURA_PROC_TRIGGER_SPELL
Definition SpellAuraDefines.h:105
@ PROC_FLAG_TAKEN_SPELL_MAGIC_DMG_CLASS_POS
Definition SpellMgr.h:129
void PreventDefaultAction()
Definition SpellScript.cpp:1000
SpellInfo const * GetSpellInfo() const
Definition Unit.h:427
static ObjectGuid GetGUID(Object const *o)
Definition Object.h:113
Unit * GetActionTarget() const
Definition Unit.h:454
uint32 GetTypeMask() const
Definition Unit.h:456
Unit * GetActor()
Definition Unit.h:453
flag96 SpellFamilyFlags
Definition SpellInfo.h:388
uint32 SpellFamilyName
Definition SpellInfo.h:387
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:1359
AuraEffect * GetAuraEffect(uint32 spellId, uint8 effIndex, ObjectGuid casterGUID=ObjectGuid::Empty) const
Definition Unit.cpp:5719
bool HasFlag(uint32 p1=0, uint32 p2=0, uint32 p3=0) const
Definition Util.h:459
static constexpr uint32 SACRED_SHIELD_ICD
Definition spell_paladin.cpp:295
uint32 _cooldownEnd
Definition spell_paladin.cpp:296
Milliseconds GetGameTimeMS()
Definition GameTime.cpp:43

References _cooldownEnd, AddPct(), Unit::CastCustomSpell(), EFFECT_0, SpellInfo::Effects, ProcEventInfo::GetActionTarget(), ProcEventInfo::GetActor(), AuraEffect::GetAmount(), Unit::GetAuraEffect(), AuraEffect::GetCaster(), AuraEffect::GetEffIndex(), GameTime::GetGameTimeMS(), Object::GetGUID(), HealInfo::GetHeal(), ProcEventInfo::GetHealInfo(), HealInfo::GetSpellInfo(), AuraScript::GetSpellInfo(), ProcEventInfo::GetTypeMask(), flag96::HasFlag(), IN_MILLISECONDS, AuraScript::PreventDefaultAction(), PROC_FLAG_TAKEN_SPELL_MAGIC_DMG_CLASS_POS, SACRED_SHIELD_ICD, 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.

384 {
388 }
@ SPELL_AURA_DUMMY
Definition SpellAuraDefines.h:67
#define AuraEffectProcFn(F, I, N)
Definition SpellScript.h:865
#define AuraEffectCalcAmountFn(F, I, N)
Definition SpellScript.h:783
#define AuraCheckProcFn(F)
Definition SpellScript.h:829
HookList< EffectCalcAmountHandler > DoEffectCalcAmount
Definition SpellScript.h:782
HookList< CheckProcHandler > DoCheckProc
Definition SpellScript.h:828
HookList< EffectProcHandler > OnEffectProc
Definition SpellScript.h:860
bool CheckProc(ProcEventInfo &eventInfo)
Definition spell_paladin.cpp:322
void CalculateAmount(AuraEffect const *aurEff, int32 &amount, bool &)
Definition spell_paladin.cpp:298
void HandleProc(AuraEffect const *aurEff, ProcEventInfo &eventInfo)
Definition spell_paladin.cpp:329

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

Member Data Documentation

◆ _cooldownEnd

uint32 spell_pal_sacred_shield_base::_cooldownEnd = 0
private

Referenced by HandleProc().

◆ SACRED_SHIELD_ICD

constexpr uint32 spell_pal_sacred_shield_base::SACRED_SHIELD_ICD = 6 * IN_MILLISECONDS
staticconstexprprivate

Referenced by HandleProc().


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