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
212 {
213 if (Unit* caster = GetCaster())
214 {
215 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(GetSpellInfo()->Effects[aurEff->GetEffIndex()].TriggerSpell);
216 amount = spellInfo->Effects[EFFECT_0].CalcValue();
217
218 // +75.00% from sp bonus
219 amount += CalculatePct(caster->SpellBaseDamageBonusDone(spellInfo->GetSchoolMask()), 75.0f);
220
221 // Xinef: removed divine guardian because it will affect triggered spell with increased amount
222 // Arena - Dampening
223 if (AuraEffect const* dampening = caster->GetAuraEffect(SPELL_GENERIC_ARENA_DAMPENING, EFFECT_0))
224 {
225 AddPct(amount, dampening->GetAmount());
226 }
227 // Battleground - Dampening
228 else if (AuraEffect const* dampening2 = caster->GetAuraEffect(SPELL_GENERIC_BATTLEGROUND_DAMPENING, EFFECT_0))
229 {
230 AddPct(amount, dampening2->GetAmount());
231 }
232 }
233 }
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:88
@ SPELL_GENERIC_BATTLEGROUND_DAMPENING
Definition: spell_paladin.cpp:89
@ EFFECT_0
Definition: SharedDefines.h:31
Definition: Unit.h:630
Definition: SpellAuraEffects.h:39
Definition: SpellInfo.h:316
SpellSchoolMask GetSchoolMask() const
Definition: SpellInfo.cpp:1986
std::array< SpellEffectInfo, MAX_SPELL_EFFECTS > Effects
Definition: SpellInfo.h:393
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
236 {
237 HealInfo* healinfo = eventInfo.GetHealInfo();
238 DamageInfo* damageinfo = eventInfo.GetDamageInfo();
239 return !(eventInfo.GetHitMask() & PROC_EX_INTERNAL_HOT) && ((healinfo && healinfo->GetHeal() > 0) || (damageinfo && damageinfo->GetDamage() > 0));
240 }
@ PROC_EX_INTERNAL_HOT
Definition: SpellMgr.h:220
Definition: Unit.h:330
uint32 GetDamage() const
Definition: Unit.h:364
Definition: Unit.h:373
uint32 GetHeal() const
Definition: Unit.h:412
uint32 GetHitMask() const
Definition: Unit.h:445
HealInfo * GetHealInfo() const
Definition: Unit.h:450
DamageInfo * GetDamageInfo() const
Definition: Unit.h:449

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
243 {
245
247 {
248 Unit* caster = eventInfo.GetActor();
249
250 HealInfo* healinfo = eventInfo.GetHealInfo();
251
252 if (!healinfo || !healinfo->GetHeal())
253 {
254 return;
255 }
256
257 SpellInfo const* procSpell = healinfo->GetSpellInfo();
258 if (!procSpell)
259 {
260 return;
261 }
262
263 if (caster && procSpell->SpellFamilyName == SPELLFAMILY_PALADIN &&
264 procSpell->SpellFamilyFlags.HasFlag(0x40000000) && caster->GetAuraEffect(SPELL_AURA_PROC_TRIGGER_SPELL, SPELLFAMILY_PALADIN, 3021, 0)) // need infusion of light
265 {
266 int32 basepoints = int32(float(healinfo->GetHeal()) / 12.0f);
267 // Item - Paladin T9 Holy 4P Bonus (Flash of Light)
268 if (AuraEffect const* aurEffect = caster->GetAuraEffect(67191, EFFECT_0))
269 AddPct(basepoints, aurEffect->GetAmount());
270
271 caster->CastCustomSpell(eventInfo.GetActionTarget(), 66922, &basepoints, nullptr, nullptr, true, nullptr, aurEff, caster->GetGUID());
272 return;
273 }
274
275 return;
276 }
277
278 uint32 triggered_spell_id = GetSpellInfo()->Effects[aurEff->GetEffIndex()].TriggerSpell;
279 if (eventInfo.GetActionTarget()->HasSpellCooldown(triggered_spell_id))
280 return;
281
282 uint32 cooldown = eventInfo.GetProcCooldown();
283 int32 basepoints = aurEff->GetAmount();
284
285 // Item - Paladin T8 Holy 4P Bonus
286 if (Unit* caster = aurEff->GetCaster())
287 if (AuraEffect const* aurEffect = caster->GetAuraEffect(64895, 0))
288 cooldown = aurEffect->GetAmount() * IN_MILLISECONDS;
289
290 eventInfo.GetActionTarget()->AddSpellCooldown(triggered_spell_id, 0, cooldown);
291 eventInfo.GetActionTarget()->CastCustomSpell(eventInfo.GetActionTarget(), triggered_spell_id, &basepoints, nullptr, nullptr, true, nullptr, aurEff, eventInfo.GetActionTarget()->GetGUID());
292 }
constexpr auto IN_MILLISECONDS
Definition: Common.h:53
std::int32_t int32
Definition: Define.h:103
std::uint32_t uint32
Definition: Define.h:107
@ 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:109
SpellInfo const * GetSpellInfo() const
Definition: Unit.h:415
Unit * GetActionTarget() const
Definition: Unit.h:440
uint32 GetTypeMask() const
Definition: Unit.h:442
Unit * GetActor()
Definition: Unit.h:439
uint32 GetProcCooldown() const
Definition: Unit.h:453
virtual bool HasSpellCooldown(uint32) const
Definition: Unit.h:1727
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:1225
AuraEffect * GetAuraEffect(uint32 spellId, uint8 effIndex, ObjectGuid casterGUID=ObjectGuid::Empty) const
Definition: Unit.cpp:5465
virtual void AddSpellCooldown(uint32, uint32, uint32, bool needSendToClient=false, bool forceSendToSpectator=false)
Definition: Unit.h:1729
flag96 SpellFamilyFlags
Definition: SpellInfo.h:388
uint32 SpellFamilyName
Definition: SpellInfo.h:387
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.

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

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