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

Private Member Functions

 PrepareAuraScript (spell_warl_infernal_scaling)
 
void CalculateResistanceAmount (AuraEffect const *aurEff, int32 &amount, bool &)
 
void CalculateStatAmount (AuraEffect const *aurEff, int32 &amount, bool &)
 
void CalculateAPAmount (AuraEffect const *, int32 &amount, bool &)
 
void CalculateSPAmount (AuraEffect const *, int32 &amount, bool &)
 
void HandleEffectApply (AuraEffect const *aurEff, AuraEffectHandleModes)
 
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

◆ CalculateAPAmount()

void spell_warl_infernal_scaling::CalculateAPAmount ( AuraEffect const *  ,
int32 amount,
bool &   
)
inlineprivate
408 {
409 // xinef: by default warlock pet inherits 57% of max(SP FIRE, SP SHADOW) as AP
410 if (Unit* owner = GetUnitOwner()->GetOwner())
411 {
412 int32 fire = owner->SpellBaseDamageBonusDone(SPELL_SCHOOL_MASK_FIRE);
413 int32 shadow = owner->SpellBaseDamageBonusDone(SPELL_SCHOOL_MASK_SHADOW);
414 int32 maximum = (fire > shadow) ? fire : shadow;
415 amount = CalculatePct(std::max<int32>(0, maximum), 57);
416 }
417 }
std::int32_t int32
Definition: Define.h:104
T CalculatePct(T base, U pct)
Definition: Util.h:61
@ SPELL_SCHOOL_MASK_SHADOW
Definition: SharedDefines.h:274
@ SPELL_SCHOOL_MASK_FIRE
Definition: SharedDefines.h:271
Definition: Unit.h:1290
WorldObject * GetOwner() const
Definition: SpellScript.cpp:1025
Unit * GetUnitOwner() const
Definition: SpellScript.cpp:1030

References CalculatePct(), AuraScript::GetOwner(), AuraScript::GetUnitOwner(), SPELL_SCHOOL_MASK_FIRE, and SPELL_SCHOOL_MASK_SHADOW.

Referenced by Register().

◆ CalculateResistanceAmount()

void spell_warl_infernal_scaling::CalculateResistanceAmount ( AuraEffect const *  aurEff,
int32 amount,
bool &   
)
inlineprivate
386 {
387 // xinef: pet inherits 40% of resistance from owner and 35% of armor
388 if (Unit* owner = GetUnitOwner()->GetOwner())
389 {
390 SpellSchoolMask schoolMask = SpellSchoolMask(aurEff->GetSpellInfo()->Effects[aurEff->GetEffIndex()].MiscValue);
391 int32 modifier = schoolMask == SPELL_SCHOOL_MASK_NORMAL ? 35 : 40;
392 amount = CalculatePct(std::max<int32>(0, owner->GetResistance(schoolMask)), modifier);
393 }
394 }
SpellSchoolMask
Definition: SharedDefines.h:267
@ SPELL_SCHOOL_MASK_NORMAL
Definition: SharedDefines.h:269

References CalculatePct(), SpellInfo::Effects, AuraEffect::GetEffIndex(), AuraScript::GetOwner(), AuraEffect::GetSpellInfo(), AuraScript::GetUnitOwner(), and SPELL_SCHOOL_MASK_NORMAL.

Referenced by Register().

◆ CalculateSPAmount()

void spell_warl_infernal_scaling::CalculateSPAmount ( AuraEffect const *  ,
int32 amount,
bool &   
)
inlineprivate
420 {
421 // xinef: by default warlock pet inherits 15% of max(SP FIRE, SP SHADOW) as SP
422 if (Unit* owner = GetUnitOwner()->GetOwner())
423 {
424 int32 fire = owner->SpellBaseDamageBonusDone(SPELL_SCHOOL_MASK_FIRE);
425 int32 shadow = owner->SpellBaseDamageBonusDone(SPELL_SCHOOL_MASK_SHADOW);
426 int32 maximum = (fire > shadow) ? fire : shadow;
427 amount = CalculatePct(std::max<int32>(0, maximum), 15);
428
429 // xinef: Update appropriate player field
430 if (owner->GetTypeId() == TYPEID_PLAYER)
431 owner->SetUInt32Value(PLAYER_PET_SPELL_POWER, (uint32)amount);
432 }
433 }
std::uint32_t uint32
Definition: Define.h:108
@ TYPEID_PLAYER
Definition: ObjectGuid.h:38
@ PLAYER_PET_SPELL_POWER
Definition: UpdateFields.h:391

References CalculatePct(), AuraScript::GetOwner(), AuraScript::GetUnitOwner(), PLAYER_PET_SPELL_POWER, SPELL_SCHOOL_MASK_FIRE, SPELL_SCHOOL_MASK_SHADOW, and TYPEID_PLAYER.

Referenced by Register().

◆ CalculateStatAmount()

void spell_warl_infernal_scaling::CalculateStatAmount ( AuraEffect const *  aurEff,
int32 amount,
bool &   
)
inlineprivate
397 {
398 // xinef: by default warlock pet inherits 75% of stamina and 30% of intellect
399 if (Unit* owner = GetUnitOwner()->GetOwner())
400 {
401 Stats stat = Stats(aurEff->GetSpellInfo()->Effects[aurEff->GetEffIndex()].MiscValue);
402 int32 modifier = stat == STAT_STAMINA ? 75 : 30;
403 amount = CalculatePct(std::max<int32>(0, owner->GetStat(stat)), modifier);
404 }
405 }
Stats
Definition: SharedDefines.h:229
@ STAT_STAMINA
Definition: SharedDefines.h:232

References CalculatePct(), SpellInfo::Effects, AuraEffect::GetEffIndex(), AuraScript::GetOwner(), AuraEffect::GetSpellInfo(), AuraScript::GetUnitOwner(), and STAT_STAMINA.

Referenced by Register().

◆ HandleEffectApply()

void spell_warl_infernal_scaling::HandleEffectApply ( AuraEffect const *  aurEff,
AuraEffectHandleModes   
)
inlineprivate
436 {
437 GetUnitOwner()->ApplySpellImmune(0, IMMUNITY_STATE, aurEff->GetAuraType(), true, SPELL_BLOCK_TYPE_POSITIVE);
438 if (aurEff->GetAuraType() == SPELL_AURA_MOD_ATTACK_POWER)
440 else if (aurEff->GetAuraType() == SPELL_AURA_MOD_STAT)
442 }
@ SPELL_AURA_MOD_TOTAL_STAT_PERCENTAGE
Definition: SpellAuraDefines.h:200
@ SPELL_AURA_MOD_ATTACK_POWER
Definition: SpellAuraDefines.h:162
@ SPELL_AURA_MOD_STAT
Definition: SpellAuraDefines.h:92
@ SPELL_AURA_MOD_ATTACK_POWER_PCT
Definition: SpellAuraDefines.h:229
@ SPELL_BLOCK_TYPE_POSITIVE
Definition: SpellDefines.h:157
@ IMMUNITY_STATE
Definition: SharedDefines.h:1367
void ApplySpellImmune(uint32 spellId, uint32 op, uint32 type, bool apply, SpellImmuneBlockType blockType=SPELL_BLOCK_TYPE_ALL)
Definition: Unit.cpp:13300

References Unit::ApplySpellImmune(), AuraEffect::GetAuraType(), AuraScript::GetUnitOwner(), IMMUNITY_STATE, SPELL_AURA_MOD_ATTACK_POWER, SPELL_AURA_MOD_ATTACK_POWER_PCT, SPELL_AURA_MOD_STAT, SPELL_AURA_MOD_TOTAL_STAT_PERCENTAGE, and SPELL_BLOCK_TYPE_POSITIVE.

Referenced by Register().

◆ PrepareAuraScript()

spell_warl_infernal_scaling::PrepareAuraScript ( spell_warl_infernal_scaling  )
private

◆ Register()

void spell_warl_infernal_scaling::Register ( )
inlineoverrideprivatevirtual

Implements _SpellScript.

445 {
446 if (m_scriptSpellId != 36186)
448
449 if (m_scriptSpellId == 36186 || m_scriptSpellId == 36188)
451
452 if (m_scriptSpellId == 36186)
453 {
456 }
457
459 }
@ SPELL_AURA_MOD_RESISTANCE
Definition: SpellAuraDefines.h:85
@ SPELL_AURA_MOD_DAMAGE_DONE
Definition: SpellAuraDefines.h:76
@ AURA_EFFECT_HANDLE_REAL
Definition: SpellAuraDefines.h:42
#define AuraEffectCalcAmountFn(F, I, N)
Definition: SpellScript.h:772
#define AuraEffectApplyFn(F, I, N, M)
Definition: SpellScript.h:743
#define SPELL_AURA_ANY
Definition: SpellScript.h:43
#define EFFECT_ALL
Definition: SharedDefines.h:37
uint32 m_scriptSpellId
Definition: SpellScript.h:107
HookList< EffectCalcAmountHandler > DoEffectCalcAmount
Definition: SpellScript.h:771
HookList< EffectApplyHandler > OnEffectApply
Definition: SpellScript.h:738
void HandleEffectApply(AuraEffect const *aurEff, AuraEffectHandleModes)
Definition: spell_warlock.cpp:435
void CalculateSPAmount(AuraEffect const *, int32 &amount, bool &)
Definition: spell_warlock.cpp:419
void CalculateResistanceAmount(AuraEffect const *aurEff, int32 &amount, bool &)
Definition: spell_warlock.cpp:385
void CalculateStatAmount(AuraEffect const *aurEff, int32 &amount, bool &)
Definition: spell_warlock.cpp:396
void CalculateAPAmount(AuraEffect const *, int32 &amount, bool &)
Definition: spell_warlock.cpp:407

References AURA_EFFECT_HANDLE_REAL, AuraEffectApplyFn, AuraEffectCalcAmountFn, CalculateAPAmount(), CalculateResistanceAmount(), CalculateSPAmount(), CalculateStatAmount(), AuraScript::DoEffectCalcAmount, EFFECT_ALL, HandleEffectApply(), _SpellScript::m_scriptSpellId, AuraScript::OnEffectApply, SPELL_AURA_ANY, SPELL_AURA_MOD_ATTACK_POWER, SPELL_AURA_MOD_DAMAGE_DONE, SPELL_AURA_MOD_RESISTANCE, and SPELL_AURA_MOD_STAT.