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

Private Member Functions

 PrepareAuraScript (spell_hun_generic_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 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 (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 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
 
- Protected Attributes inherited from _SpellScript
uint8 m_currentScriptState
 
std::string const * m_scriptName
 
uint32 m_scriptSpellId
 

Detailed Description

Member Function Documentation

◆ CalcPeriodic()

void spell_hun_generic_scaling::CalcPeriodic ( AuraEffect const *  ,
bool &  isPeriodic,
int32 amplitude 
)
inlineprivate
237 {
238 isPeriodic = true;
239 amplitude = 2 * IN_MILLISECONDS;
240 }
constexpr auto IN_MILLISECONDS
Definition Common.h:53

References IN_MILLISECONDS.

Referenced by Register().

◆ CalculateAPAmount()

void spell_hun_generic_scaling::CalculateAPAmount ( AuraEffect const *  ,
int32 amount,
bool &   
)
inlineprivate
193 {
194 if (Unit* owner = GetUnitOwner()->GetOwner())
195 {
196 // xinef: by default 22% of RAP
197 int32 modifier = 22;
198
199 // xinef: Wild Hunt bonus for AP
200 if (AuraEffect* wildHuntEff = GetUnitOwner()->GetDummyAuraEffect(SPELLFAMILY_PET, 3748, EFFECT_1))
201 AddPct(modifier, wildHuntEff->GetAmount());
202
203 float ownerAP = owner->GetTotalAttackPowerValue(RANGED_ATTACK);
204
205 // Xinef: Hunter vs. Wild
206 if (AuraEffect* HvWEff = owner->GetAuraEffect(SPELL_AURA_MOD_ATTACK_POWER_OF_STAT_PERCENT, SPELLFAMILY_HUNTER, 3647, EFFECT_0))
207 ownerAP += CalculatePct(owner->GetStat(STAT_STAMINA), HvWEff->GetAmount());
208
209 amount = CalculatePct(std::max<int32>(0, ownerAP), modifier);
211 {
212 amount += 70;
213 }
214 }
215 }
std::int32_t int32
Definition Define.h:103
@ EFFECT_1
Definition SharedDefines.h:32
@ EFFECT_0
Definition SharedDefines.h:31
@ SPELLFAMILY_HUNTER
Definition SharedDefines.h:3553
@ SPELLFAMILY_PET
Definition SharedDefines.h:3561
@ STAT_STAMINA
Definition SharedDefines.h:260
@ SPELL_AURA_MOD_ATTACK_POWER_OF_STAT_PERCENT
Definition SpellAuraDefines.h:331
@ RANGED_ATTACK
Definition Unit.h:212
T AddPct(T &base, U pct)
Definition Util.h:67
T CalculatePct(T base, U pct)
Definition Util.h:61
Definition SpellAuraEffects.h:39
WorldObject * GetOwner() const
Definition SpellScript.cpp:1025
Unit * GetUnitOwner() const
Definition SpellScript.cpp:1030
Definition Unit.h:620
@ SPELL_HUNTER_PET_LEGGINGS_OF_BEAST_MASTERY
Definition spell_hunter.cpp:70

References AddPct(), CalculatePct(), EFFECT_0, EFFECT_1, AuraScript::GetOwner(), AuraScript::GetUnitOwner(), RANGED_ATTACK, SPELL_AURA_MOD_ATTACK_POWER_OF_STAT_PERCENT, SPELL_HUNTER_PET_LEGGINGS_OF_BEAST_MASTERY, SPELLFAMILY_HUNTER, SPELLFAMILY_PET, and STAT_STAMINA.

Referenced by Register().

◆ CalculateResistanceAmount()

void spell_hun_generic_scaling::CalculateResistanceAmount ( AuraEffect const *  aurEff,
int32 amount,
bool &   
)
inlineprivate
159 {
160 // xinef: pet inherits 40% of resistance from owner and 35% of armor
161 if (Unit* owner = GetUnitOwner()->GetOwner())
162 {
163 SpellSchoolMask schoolMask = SpellSchoolMask(aurEff->GetSpellInfo()->Effects[aurEff->GetEffIndex()].MiscValue);
164 int32 modifier = schoolMask == SPELL_SCHOOL_MASK_NORMAL ? 35 : 40;
165 amount = CalculatePct(std::max<int32>(0, owner->GetResistance(schoolMask)), modifier);
166 if (owner->HasAura(SPELL_HUNTER_PET_LEGGINGS_OF_BEAST_MASTERY) && schoolMask == SPELL_SCHOOL_MASK_NORMAL)
167 {
168 amount += 490;
169 }
170 }
171 }
SpellSchoolMask
Definition SharedDefines.h:295
@ SPELL_SCHOOL_MASK_NORMAL
Definition SharedDefines.h:297

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

Referenced by Register().

◆ CalculateSPAmount()

void spell_hun_generic_scaling::CalculateSPAmount ( AuraEffect const *  ,
int32 amount,
bool &   
)
inlineprivate
218 {
219 if (Unit* owner = GetUnitOwner()->GetOwner())
220 {
221 // xinef: by default 12.87% of RAP
222 float modifier = 12.87f;
223
224 // xinef: Wild Hunt bonus for AP
225 if (AuraEffect* wildHuntEff = GetUnitOwner()->GetDummyAuraEffect(SPELLFAMILY_PET, 3748, EFFECT_1))
226 AddPct(modifier, wildHuntEff->GetAmount());
227
228 amount = CalculatePct(std::max<int32>(0, owner->GetTotalAttackPowerValue(RANGED_ATTACK)), modifier);
229
230 // xinef: Update appropriate player field
231 if (owner->IsPlayer())
232 owner->SetUInt32Value(PLAYER_PET_SPELL_POWER, (uint32)amount);
233 }
234 }
std::uint32_t uint32
Definition Define.h:107
@ PLAYER_PET_SPELL_POWER
Definition UpdateFields.h:391

References AddPct(), CalculatePct(), EFFECT_1, AuraScript::GetOwner(), AuraScript::GetUnitOwner(), PLAYER_PET_SPELL_POWER, RANGED_ATTACK, and SPELLFAMILY_PET.

Referenced by Register().

◆ CalculateStatAmount()

void spell_hun_generic_scaling::CalculateStatAmount ( AuraEffect const *  aurEff,
int32 amount,
bool &   
)
inlineprivate
174 {
175 if (Unit* owner = GetUnitOwner()->GetOwner())
176 {
177 // xinef: by default pet inherits 45% of stamina
178 int32 modifier = 45;
179
180 // xinef: Wild Hunt bonus for stamina
181 if (AuraEffect* wildHuntEff = GetUnitOwner()->GetDummyAuraEffect(SPELLFAMILY_PET, 3748, EFFECT_0))
182 AddPct(modifier, wildHuntEff->GetAmount());
183
184 amount = CalculatePct(std::max<int32>(0, owner->GetStat(Stats(aurEff->GetSpellInfo()->Effects[aurEff->GetEffIndex()].MiscValue))), modifier);
186 {
187 amount += 52;
188 }
189 }
190 }
Stats
Definition SharedDefines.h:257

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

Referenced by Register().

◆ HandlePeriodic()

void spell_hun_generic_scaling::HandlePeriodic ( AuraEffect const *  aurEff)
inlineprivate
243 {
245 if (aurEff->GetAuraType() == SPELL_AURA_MOD_STAT && (aurEff->GetMiscValue() == STAT_STAMINA || aurEff->GetMiscValue() == STAT_INTELLECT))
246 {
247 int32 currentAmount = aurEff->GetAmount();
248 int32 newAmount = GetEffect(aurEff->GetEffIndex())->CalculateAmount(GetCaster());
249 if (newAmount != currentAmount)
250 {
251 if (aurEff->GetMiscValue() == STAT_STAMINA)
252 {
253 uint32 actStat = GetUnitOwner()->GetHealth();
254 GetEffect(aurEff->GetEffIndex())->ChangeAmount(newAmount, false);
255 GetUnitOwner()->SetHealth(std::min<uint32>(GetUnitOwner()->GetMaxHealth(), actStat));
256 }
257 else
258 {
260 GetEffect(aurEff->GetEffIndex())->ChangeAmount(newAmount, false);
261 GetUnitOwner()->SetPower(POWER_MANA, std::min<uint32>(GetUnitOwner()->GetMaxPower(POWER_MANA), actStat));
262 }
263 }
264 }
265 else
266 GetEffect(aurEff->GetEffIndex())->RecalculateAmount();
267 }
@ POWER_MANA
Definition SharedDefines.h:269
@ STAT_INTELLECT
Definition SharedDefines.h:261
@ SPELL_AURA_MOD_STAT
Definition SpellAuraDefines.h:92
void ChangeAmount(int32 newAmount, bool mark=true, bool onStackOrReapply=false)
Definition SpellAuraEffects.cpp:715
int32 CalculateAmount(Unit *caster)
Definition SpellAuraEffects.cpp:453
void RecalculateAmount()
Definition SpellAuraEffects.h:76
void PreventDefaultAction()
Definition SpellScript.cpp:985
Unit * GetCaster() const
Definition SpellScript.cpp:1020
AuraEffect * GetEffect(uint8 effIndex) const
Definition SpellScript.cpp:1155
void SetPower(Powers power, uint32 val, bool withPowerUpdate=true, bool fromRegenerate=false)
Definition Unit.cpp:15617
void SetHealth(uint32 val)
Definition Unit.cpp:15529
uint32 GetHealth() const
Definition Unit.h:1029
uint32 GetPower(Powers power) const
Definition Unit.h:1056

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_hun_generic_scaling::PrepareAuraScript ( spell_hun_generic_scaling  )
private

◆ Register()

void spell_hun_generic_scaling::Register ( )
inlineoverrideprivatevirtual

Implements _SpellScript.

270 {
271 if (m_scriptSpellId != 34902)
273 else
274 {
278 }
279
282 }
#define EFFECT_ALL
Definition SharedDefines.h:38
@ SPELL_AURA_MOD_ATTACK_POWER
Definition SpellAuraDefines.h:162
@ SPELL_AURA_MOD_RESISTANCE
Definition SpellAuraDefines.h:85
@ SPELL_AURA_MOD_DAMAGE_DONE
Definition SpellAuraDefines.h:76
#define AuraEffectCalcAmountFn(F, I, N)
Definition SpellScript.h:772
#define AuraEffectPeriodicFn(F, I, N)
Definition SpellScript.h:760
#define AuraEffectCalcPeriodicFn(F, I, N)
Definition SpellScript.h:778
#define SPELL_AURA_ANY
Definition SpellScript.h:43
HookList< EffectCalcPeriodicHandler > DoEffectCalcPeriodic
Definition SpellScript.h:777
HookList< EffectPeriodicHandler > OnEffectPeriodic
Definition SpellScript.h:759
HookList< EffectCalcAmountHandler > DoEffectCalcAmount
Definition SpellScript.h:771
uint32 m_scriptSpellId
Definition SpellScript.h:107
void HandlePeriodic(AuraEffect const *aurEff)
Definition spell_hunter.cpp:242
void CalculateSPAmount(AuraEffect const *, int32 &amount, bool &)
Definition spell_hunter.cpp:217
void CalculateResistanceAmount(AuraEffect const *aurEff, int32 &amount, bool &)
Definition spell_hunter.cpp:158
void CalcPeriodic(AuraEffect const *, bool &isPeriodic, int32 &amplitude)
Definition spell_hunter.cpp:236
void CalculateStatAmount(AuraEffect const *aurEff, int32 &amount, bool &)
Definition spell_hunter.cpp:173
void CalculateAPAmount(AuraEffect const *, int32 &amount, bool &)
Definition spell_hunter.cpp:192

References AuraEffectCalcAmountFn, AuraEffectCalcPeriodicFn, AuraEffectPeriodicFn, CalcPeriodic(), CalculateAPAmount(), CalculateResistanceAmount(), CalculateSPAmount(), CalculateStatAmount(), AuraScript::DoEffectCalcAmount, AuraScript::DoEffectCalcPeriodic, EFFECT_ALL, HandlePeriodic(), _SpellScript::m_scriptSpellId, 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: