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
208 {
209 if (Unit* caster = GetCaster())
210 {
211 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(GetSpellInfo()->Effects[aurEff->GetEffIndex()].TriggerSpell);
212 amount = spellInfo->Effects[EFFECT_0].CalcValue();
213
214 // +75.00% from sp bonus
215 amount += CalculatePct(caster->SpellBaseDamageBonusDone(spellInfo->GetSchoolMask()), 75.0f);
216
217 // Xinef: removed divine guardian because it will affect triggered spell with increased amount
218 // Arena - Dampening
219 if (AuraEffect const* dampening = caster->GetAuraEffect(SPELL_GENERIC_ARENA_DAMPENING, EFFECT_0))
220 {
221 AddPct(amount, dampening->GetAmount());
222 }
223 // Battleground - Dampening
224 else if (AuraEffect const* dampening2 = caster->GetAuraEffect(SPELL_GENERIC_BATTLEGROUND_DAMPENING, EFFECT_0))
225 {
226 AddPct(amount, dampening2->GetAmount());
227 }
228 }
229 }
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:825
@ SPELL_GENERIC_ARENA_DAMPENING
Definition: spell_paladin.cpp:89
@ SPELL_GENERIC_BATTLEGROUND_DAMPENING
Definition: spell_paladin.cpp:90
@ EFFECT_0
Definition: SharedDefines.h:31
Definition: Unit.h:1302
Definition: SpellAuraEffects.h:39
Definition: SpellInfo.h:314
SpellSchoolMask GetSchoolMask() const
Definition: SpellInfo.cpp:1974
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
232 {
233 HealInfo* healinfo = eventInfo.GetHealInfo();
234 DamageInfo* damageinfo = eventInfo.GetDamageInfo();
235 return !(eventInfo.GetHitMask() & PROC_EX_INTERNAL_HOT) && ((healinfo && healinfo->GetHeal() > 0) || (damageinfo && damageinfo->GetDamage() > 0));
236 }
@ 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:843
uint32 GetHitMask() const
Definition: Unit.h:876
HealInfo * GetHealInfo() const
Definition: Unit.h:881
DamageInfo * GetDamageInfo() const
Definition: Unit.h:880

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
239 {
241
243 {
244 Unit* caster = eventInfo.GetActor();
245
246 HealInfo* healinfo = eventInfo.GetHealInfo();
247
248 if (!healinfo || !healinfo->GetHeal())
249 {
250 return;
251 }
252
253 SpellInfo const* procSpell = healinfo->GetSpellInfo();
254 if (!procSpell)
255 {
256 return;
257 }
258
259 if (caster && procSpell->SpellFamilyName == SPELLFAMILY_PALADIN &&
260 procSpell->SpellFamilyFlags.HasFlag(0x40000000) && caster->GetAuraEffect(SPELL_AURA_PROC_TRIGGER_SPELL, SPELLFAMILY_PALADIN, 3021, 0)) // need infusion of light
261 {
262 int32 basepoints = int32(float(healinfo->GetHeal()) / 12.0f);
263 // Item - Paladin T9 Holy 4P Bonus (Flash of Light)
264 if (AuraEffect const* aurEffect = caster->GetAuraEffect(67191, EFFECT_0))
265 AddPct(basepoints, aurEffect->GetAmount());
266
267 caster->CastCustomSpell(eventInfo.GetActionTarget(), 66922, &basepoints, nullptr, nullptr, true, nullptr, aurEff, caster->GetGUID());
268 return;
269 }
270
271 return;
272 }
273
274 uint32 triggered_spell_id = GetSpellInfo()->Effects[aurEff->GetEffIndex()].TriggerSpell;
275 if (eventInfo.GetActionTarget()->HasSpellCooldown(triggered_spell_id))
276 return;
277
278 uint32 cooldown = eventInfo.GetProcCooldown();
279 int32 basepoints = aurEff->GetAmount();
280
281 // Item - Paladin T8 Holy 4P Bonus
282 if (Unit* caster = aurEff->GetCaster())
283 if (AuraEffect const* aurEffect = caster->GetAuraEffect(64895, 0))
284 cooldown = aurEffect->GetAmount() * IN_MILLISECONDS;
285
286 eventInfo.GetActionTarget()->AddSpellCooldown(triggered_spell_id, 0, cooldown);
287 eventInfo.GetActionTarget()->CastCustomSpell(eventInfo.GetActionTarget(), triggered_spell_id, &basepoints, nullptr, nullptr, true, nullptr, aurEff, eventInfo.GetActionTarget()->GetGUID());
288 }
constexpr auto IN_MILLISECONDS
Definition: Common.h:55
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:3538
bool HasFlag(uint32 p1=0, uint32 p2=0, uint32 p3=0) const
Definition: Util.h:468
static ObjectGuid GetGUID(Object const *o)
Definition: Object.h:106
SpellInfo const * GetSpellInfo() const
Definition: Unit.h:846
Unit * GetActionTarget() const
Definition: Unit.h:871
uint32 GetTypeMask() const
Definition: Unit.h:873
Unit * GetActor()
Definition: Unit.h:870
uint32 GetProcCooldown() const
Definition: Unit.h:884
virtual bool HasSpellCooldown(uint32) const
Definition: Unit.h:2432
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:5432
virtual void AddSpellCooldown(uint32, uint32, uint32, bool needSendToClient=false, bool forceSendToSpectator=false)
Definition: Unit.h:2434
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.

291 {
295 }
@ 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:231
void CalculateAmount(AuraEffect const *aurEff, int32 &amount, bool &)
Definition: spell_paladin.cpp:207
void HandleProc(AuraEffect const *aurEff, ProcEventInfo &eventInfo)
Definition: spell_paladin.cpp:238

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