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

Private Member Functions

 PrepareAuraScript (spell_sha_feral_spirit_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 CalcPeriodic (AuraEffect const *, bool &isPeriodic, int32 &amplitude)
 
void HandlePeriodic (AuraEffect const *aurEff)
 
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 (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

◆ CalcPeriodic()

void spell_sha_feral_spirit_scaling::CalcPeriodic ( AuraEffect const *  ,
bool &  isPeriodic,
int32 amplitude 
)
inlineprivate
272 {
273 isPeriodic = true;
274 amplitude = 1 * IN_MILLISECONDS;
275 }
constexpr auto IN_MILLISECONDS
Definition Common.h:53

References IN_MILLISECONDS.

Referenced by Register().

◆ CalculateAPAmount()

void spell_sha_feral_spirit_scaling::CalculateAPAmount ( AuraEffect const *  ,
int32 amount,
bool &   
)
inlineprivate
233 {
234 // xinef: by default feral spirit inherits 30% of AP
235 if (Unit* owner = GetUnitOwner()->GetOwner())
236 {
237 int32 modifier = 30;
238 if (AuraEffect const* gofsEff = owner->GetAuraEffect(SPELL_SHAMAN_GLYPH_OF_FERAL_SPIRIT, EFFECT_0))
239 modifier += gofsEff->GetAmount();
240
241 amount = CalculatePct(std::max<int32>(0, owner->GetTotalAttackPowerValue(BASE_ATTACK)), modifier);
242 }
243 }
std::int32_t int32
Definition Define.h:103
@ EFFECT_0
Definition SharedDefines.h:31
@ BASE_ATTACK
Definition Unit.h:215
T CalculatePct(T base, U pct)
Definition Util.h:52
Definition SpellAuraEffects.h:39
WorldObject * GetOwner() const
Definition SpellScript.cpp:1040
Unit * GetUnitOwner() const
Definition SpellScript.cpp:1045
Definition Unit.h:664
@ SPELL_SHAMAN_GLYPH_OF_FERAL_SPIRIT
Definition spell_shaman.cpp:34

References BASE_ATTACK, CalculatePct(), EFFECT_0, AuraScript::GetOwner(), AuraScript::GetUnitOwner(), and SPELL_SHAMAN_GLYPH_OF_FERAL_SPIRIT.

Referenced by Register().

◆ CalculateResistanceAmount()

void spell_sha_feral_spirit_scaling::CalculateResistanceAmount ( AuraEffect const *  aurEff,
int32 amount,
bool &   
)
inlineprivate
212 {
213 // xinef: feral spirit inherits 40% of resistance from owner and 35% of armor
214 if (Unit* owner = GetUnitOwner()->GetOwner())
215 {
216 SpellSchoolMask schoolMask = SpellSchoolMask(aurEff->GetSpellInfo()->Effects[aurEff->GetEffIndex()].MiscValue);
217 int32 modifier = schoolMask == SPELL_SCHOOL_MASK_NORMAL ? 35 : 40;
218 amount = CalculatePct(std::max<int32>(0, owner->GetResistance(schoolMask)), modifier);
219 }
220 }
SpellSchoolMask
Definition SharedDefines.h:283
@ SPELL_SCHOOL_MASK_NORMAL
Definition SharedDefines.h:285

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

Referenced by Register().

◆ CalculateSPAmount()

void spell_sha_feral_spirit_scaling::CalculateSPAmount ( AuraEffect const *  ,
int32 amount,
bool &   
)
inlineprivate
246 {
247 // xinef: by default feral spirit inherits 30% of AP as SP
248 if (Unit* owner = GetUnitOwner()->GetOwner())
249 {
250 int32 modifier = 30;
251 if (AuraEffect const* gofsEff = owner->GetAuraEffect(SPELL_SHAMAN_GLYPH_OF_FERAL_SPIRIT, EFFECT_0))
252 modifier += gofsEff->GetAmount();
253
254 amount = CalculatePct(std::max<int32>(0, owner->GetTotalAttackPowerValue(BASE_ATTACK)), modifier);
255
256 // xinef: Update appropriate player field
257 if (owner->IsPlayer())
258 owner->SetUInt32Value(PLAYER_PET_SPELL_POWER, (uint32)amount);
259 }
260 }
std::uint32_t uint32
Definition Define.h:107
@ PLAYER_PET_SPELL_POWER
Definition UpdateFields.h:391

References BASE_ATTACK, CalculatePct(), EFFECT_0, AuraScript::GetOwner(), AuraScript::GetUnitOwner(), PLAYER_PET_SPELL_POWER, and SPELL_SHAMAN_GLYPH_OF_FERAL_SPIRIT.

Referenced by Register().

◆ CalculateStatAmount()

void spell_sha_feral_spirit_scaling::CalculateStatAmount ( AuraEffect const *  aurEff,
int32 amount,
bool &   
)
inlineprivate
223 {
224 // xinef: by default feral spirit inherits 30% of stamina
225 if (Unit* owner = GetUnitOwner()->GetOwner())
226 {
227 Stats stat = Stats(aurEff->GetSpellInfo()->Effects[aurEff->GetEffIndex()].MiscValue);
228 amount = CalculatePct(std::max<int32>(0, owner->GetStat(stat)), 30);
229 }
230 }
Stats
Definition SharedDefines.h:245

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

Referenced by Register().

◆ HandleEffectApply()

void spell_sha_feral_spirit_scaling::HandleEffectApply ( AuraEffect const *  aurEff,
AuraEffectHandleModes   
)
inlineprivate
263 {
264 GetUnitOwner()->ApplySpellImmune(0, IMMUNITY_STATE, aurEff->GetAuraType(), true, SPELL_BLOCK_TYPE_POSITIVE);
265 if (aurEff->GetAuraType() == SPELL_AURA_MOD_ATTACK_POWER)
267 else if (aurEff->GetAuraType() == SPELL_AURA_MOD_STAT)
269 }
@ IMMUNITY_STATE
Definition SharedDefines.h:1401
@ 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:160
void ApplySpellImmune(uint32 spellId, uint32 op, uint32 type, bool apply, SpellImmuneBlockType blockType=SPELL_BLOCK_TYPE_ALL)
Definition Unit.cpp:10437

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().

◆ HandlePeriodic()

void spell_sha_feral_spirit_scaling::HandlePeriodic ( AuraEffect const *  aurEff)
inlineprivate
278 {
280 if (aurEff->GetAuraType() == SPELL_AURA_MOD_STAT && (aurEff->GetMiscValue() == STAT_STAMINA || aurEff->GetMiscValue() == STAT_INTELLECT))
281 {
282 int32 currentAmount = aurEff->GetAmount();
283 int32 newAmount = GetEffect(aurEff->GetEffIndex())->CalculateAmount(GetCaster());
284 if (newAmount != currentAmount)
285 {
286 if (aurEff->GetMiscValue() == STAT_STAMINA)
287 {
288 uint32 actStat = GetUnitOwner()->GetHealth();
289 GetEffect(aurEff->GetEffIndex())->ChangeAmount(newAmount, false);
290 GetUnitOwner()->SetHealth(std::min<uint32>(GetUnitOwner()->GetMaxHealth(), actStat));
291 }
292 else
293 {
295 GetEffect(aurEff->GetEffIndex())->ChangeAmount(newAmount, false);
296 GetUnitOwner()->SetPower(POWER_MANA, std::min<uint32>(GetUnitOwner()->GetMaxPower(POWER_MANA), actStat));
297 }
298 }
299 }
300 else
301 GetEffect(aurEff->GetEffIndex())->RecalculateAmount();
302 }
@ POWER_MANA
Definition SharedDefines.h:257
@ STAT_INTELLECT
Definition SharedDefines.h:249
@ STAT_STAMINA
Definition SharedDefines.h:248
void ChangeAmount(int32 newAmount, bool mark=true, bool onStackOrReapply=false)
Definition SpellAuraEffects.cpp:713
int32 CalculateAmount(Unit *caster)
Definition SpellAuraEffects.cpp:452
void RecalculateAmount()
Definition SpellAuraEffects.h:76
void PreventDefaultAction()
Definition SpellScript.cpp:1000
Unit * GetCaster() const
Definition SpellScript.cpp:1035
AuraEffect * GetEffect(uint8 effIndex) const
Definition SpellScript.cpp:1170
void SetPower(Powers power, uint32 val, bool withPowerUpdate=true, bool fromRegenerate=false)
Definition Unit.cpp:12403
void SetHealth(uint32 val)
Definition Unit.cpp:12315
uint32 GetHealth() const
Definition Unit.h:1108
uint32 GetPower(Powers power) const
Definition Unit.h:1135

References AuraEffect::CalculateAmount(), AuraEffect::ChangeAmount(), AuraEffect::GetAmount(), AuraEffect::GetAuraType(), AuraScript::GetCaster(), AuraScript::GetEffect(), AuraEffect::GetEffIndex(), Unit::GetHealth(), AuraEffect::GetMiscValue(), Unit::GetPower(), AuraScript::GetUnitOwner(), POWER_MANA, AuraScript::PreventDefaultAction(), AuraEffect::RecalculateAmount(), Unit::SetHealth(), Unit::SetPower(), SPELL_AURA_MOD_STAT, STAT_INTELLECT, and STAT_STAMINA.

Referenced by Register().

◆ PrepareAuraScript()

spell_sha_feral_spirit_scaling::PrepareAuraScript ( spell_sha_feral_spirit_scaling  )
private

◆ Register()

void spell_sha_feral_spirit_scaling::Register ( )
inlineoverrideprivatevirtual

Implements _SpellScript.

305 {
306 if (m_scriptSpellId == 35675)
308
309 if (m_scriptSpellId == 35674)
310 {
314 }
315
319 }
#define EFFECT_ALL
Definition SharedDefines.h:38
@ 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:783
#define AuraEffectPeriodicFn(F, I, N)
Definition SpellScript.h:771
#define AuraEffectCalcPeriodicFn(F, I, N)
Definition SpellScript.h:789
#define AuraEffectApplyFn(F, I, N, M)
Definition SpellScript.h:754
#define SPELL_AURA_ANY
Definition SpellScript.h:43
HookList< EffectCalcPeriodicHandler > DoEffectCalcPeriodic
Definition SpellScript.h:788
HookList< EffectPeriodicHandler > OnEffectPeriodic
Definition SpellScript.h:770
HookList< EffectCalcAmountHandler > DoEffectCalcAmount
Definition SpellScript.h:782
HookList< EffectApplyHandler > OnEffectApply
Definition SpellScript.h:749
uint32 m_scriptSpellId
Definition SpellScript.h:107
void CalcPeriodic(AuraEffect const *, bool &isPeriodic, int32 &amplitude)
Definition spell_shaman.cpp:271
void CalculateSPAmount(AuraEffect const *, int32 &amount, bool &)
Definition spell_shaman.cpp:245
void CalculateResistanceAmount(AuraEffect const *aurEff, int32 &amount, bool &)
Definition spell_shaman.cpp:211
void HandleEffectApply(AuraEffect const *aurEff, AuraEffectHandleModes)
Definition spell_shaman.cpp:262
void CalculateAPAmount(AuraEffect const *, int32 &amount, bool &)
Definition spell_shaman.cpp:232
void CalculateStatAmount(AuraEffect const *aurEff, int32 &amount, bool &)
Definition spell_shaman.cpp:222
void HandlePeriodic(AuraEffect const *aurEff)
Definition spell_shaman.cpp:277

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


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