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

Private Member Functions

 PrepareAuraScript (spell_warl_generic_scaling)
 
void CalculateResistanceAmount (AuraEffect const *aurEff, int32 &amount, bool &)
 
void CalculateStatAmount (AuraEffect const *aurEff, int32 &amount, bool &)
 
void CalculateAPAmount (AuraEffect const *aurEff, 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
 
Unit * GetCaster () const
 
GameObject * GetGObjCaster () const
 
WorldObject * GetOwner () const
 
Unit * GetUnitOwner () const
 
DynamicObject * GetDynobjOwner () const
 
void Remove (AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
 
Aura * GetAura () 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
 
AuraEffect * GetEffect (uint8 effIndex) const
 
bool HasEffectType (AuraType type) const
 
Unit * GetTarget () 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< CheckAreaTargetHandler > DoCheckAreaTarget
 
HookList< AuraDispelHandler > OnDispel
 
HookList< AuraDispelHandler > AfterDispel
 
HookList< EffectApplyHandler > OnEffectApply
 
HookList< EffectApplyHandler > AfterEffectApply
 
HookList< EffectApplyHandler > OnEffectRemove
 
HookList< EffectApplyHandler > AfterEffectRemove
 
HookList< EffectPeriodicHandler > OnEffectPeriodic
 
HookList< EffectUpdatePeriodicHandler > OnEffectUpdatePeriodic
 
HookList< EffectCalcAmountHandler > DoEffectCalcAmount
 
HookList< EffectCalcPeriodicHandler > DoEffectCalcPeriodic
 
HookList< EffectCalcSpellModHandler > DoEffectCalcSpellMod
 
HookList< EffectAbsorbHandler > OnEffectAbsorb
 
HookList< EffectAbsorbHandler > AfterEffectAbsorb
 
HookList< EffectManaShieldHandler > OnEffectManaShield
 
HookList< EffectManaShieldHandler > AfterEffectManaShield
 
HookList< EffectSplitHandler > OnEffectSplit
 
HookList< CheckProcHandler > DoCheckProc
 
HookList< CheckEffectProcHandler > DoCheckEffectProc
 
HookList< AuraProcHandler > DoPrepareProc
 
HookList< AuraProcHandler > OnProc
 
HookList< AuraProcHandler > AfterProc
 
HookList< EffectProcHandler > OnEffectProc
 
HookList< EffectProcHandler > AfterEffectProc
 
- Protected Attributes inherited from _SpellScript
uint8 m_currentScriptState
 
std::string const * m_scriptName
 
uint32 m_scriptSpellId
 

Detailed Description

Member Function Documentation

◆ CalcPeriodic()

void spell_warl_generic_scaling::CalcPeriodic ( AuraEffect const *  ,
bool &  isPeriodic,
int32 &  amplitude 
)
inlineprivate
379 {
380 isPeriodic = true;
381 amplitude = 2 * IN_MILLISECONDS;
382 }
constexpr auto IN_MILLISECONDS
Definition Common.h:53

References IN_MILLISECONDS.

Referenced by Register().

◆ CalculateAPAmount()

void spell_warl_generic_scaling::CalculateAPAmount ( AuraEffect const *  aurEff,
int32 &  amount,
bool &   
)
inlineprivate
339 {
340 if (Unit* pet = GetUnitOwner())
341 {
342 // by default warlock pet inherits 57% of max(SP FIRE, SP SHADOW) as AP
343 if (Unit* owner = pet->GetOwner())
344 {
345 int32 fire = owner->SpellBaseDamageBonusDone(SPELL_SCHOOL_MASK_FIRE);
346 int32 shadow = owner->SpellBaseDamageBonusDone(SPELL_SCHOOL_MASK_SHADOW);
347 int32 maximum = (fire > shadow) ? fire : shadow;
348 amount = CalculatePct(std::max<int32>(0, maximum), 57);
349
350 // Glyph of felguard, 99% sure this is a HACK
351 if (pet->GetEntry() == NPC_FELGUARD)
352 {
353 if (AuraEffect* glyph = owner->GetAuraEffect(SPELL_GLYPH_OF_FELGUARD, EFFECT_0))
354 {
355 amount += CalculatePct(pet->GetTotalAuraModValue(UNIT_MOD_ATTACK_POWER) - aurEff->GetAmount() + amount, glyph->GetAmount());
356 }
357 }
358 }
359 }
360 }
std::int32_t int32
Definition Define.h:103
@ SPELL_GLYPH_OF_FELGUARD
Definition PetDefines.h:153
@ NPC_FELGUARD
Definition PetDefines.h:101
@ EFFECT_0
Definition SharedDefines.h:31
@ SPELL_SCHOOL_MASK_SHADOW
Definition SharedDefines.h:290
@ SPELL_SCHOOL_MASK_FIRE
Definition SharedDefines.h:287
@ UNIT_MOD_ATTACK_POWER
Definition Unit.h:173
T CalculatePct(T base, U pct)
Definition Util.h:52
Definition SpellAuraEffects.h:39
Unit * GetUnitOwner() const
Definition SpellScript.cpp:1043
Definition Unit.h:670
Unit * GetOwner() const
Definition Unit.cpp:7517

References CalculatePct(), EFFECT_0, AuraEffect::GetAmount(), Unit::GetOwner(), AuraScript::GetUnitOwner(), NPC_FELGUARD, SPELL_GLYPH_OF_FELGUARD, SPELL_SCHOOL_MASK_FIRE, SPELL_SCHOOL_MASK_SHADOW, and UNIT_MOD_ATTACK_POWER.

Referenced by Register().

◆ CalculateResistanceAmount()

void spell_warl_generic_scaling::CalculateResistanceAmount ( AuraEffect const *  aurEff,
int32 &  amount,
bool &   
)
inlineprivate
312 {
313 // pet inherits 40% of resistance from owner and 35% of armor
314 if (Unit* owner = GetUnitOwner()->GetOwner())
315 {
316 SpellSchoolMask schoolMask = SpellSchoolMask(aurEff->GetSpellInfo()->Effects[aurEff->GetEffIndex()].MiscValue);
317 int32 modifier = schoolMask == SPELL_SCHOOL_MASK_NORMAL ? 35 : 40;
318 amount = CalculatePct(std::max<int32>(0, owner->GetResistance(schoolMask)), modifier);
319 if (owner->HasAura(SPELL_WARLOCK_PET_VOID_STAR_TALISMAN) && schoolMask != SPELL_SCHOOL_MASK_NORMAL)
320 {
321 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(SPELL_WARLOCK_PET_VOID_STAR_TALISMAN);
322 amount += spellInfo->Effects[EFFECT_0].CalcValue(); // 130
323 }
324 }
325 }
SpellSchoolMask
Definition SharedDefines.h:283
@ SPELL_SCHOOL_MASK_NORMAL
Definition SharedDefines.h:285
#define sSpellMgr
Definition SpellMgr.h:851
WorldObject * GetOwner() const
Definition SpellScript.cpp:1038
Definition SpellInfo.h:340
std::array< SpellEffectInfo, MAX_SPELL_EFFECTS > Effects
Definition SpellInfo.h:417
@ SPELL_WARLOCK_PET_VOID_STAR_TALISMAN
Definition spell_warlock.cpp:75

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

Referenced by Register().

◆ CalculateSPAmount()

void spell_warl_generic_scaling::CalculateSPAmount ( AuraEffect const *  ,
int32 &  amount,
bool &   
)
inlineprivate
363 {
364 // by default warlock pet inherits 15% of max(SP FIRE, SP SHADOW) as SP
365 if (Unit* owner = GetUnitOwner()->GetOwner())
366 {
367 int32 fire = owner->SpellBaseDamageBonusDone(SPELL_SCHOOL_MASK_FIRE);
368 int32 shadow = owner->SpellBaseDamageBonusDone(SPELL_SCHOOL_MASK_SHADOW);
369 int32 maximum = (fire > shadow) ? fire : shadow;
370 amount = CalculatePct(std::max<int32>(0, maximum), 15);
371
372 // Update appropriate player field
373 if (owner->IsPlayer())
374 owner->SetUInt32Value(PLAYER_PET_SPELL_POWER, (uint32)amount);
375 }
376 }
std::uint32_t uint32
Definition Define.h:107
@ PLAYER_PET_SPELL_POWER
Definition UpdateFields.h:391

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

Referenced by Register().

◆ CalculateStatAmount()

void spell_warl_generic_scaling::CalculateStatAmount ( AuraEffect const *  aurEff,
int32 &  amount,
bool &   
)
inlineprivate
328 {
329 // by default warlock pet inherits 75% of stamina and 30% of intellect
330 if (Unit* owner = GetUnitOwner()->GetOwner())
331 {
332 Stats stat = Stats(aurEff->GetSpellInfo()->Effects[aurEff->GetEffIndex()].MiscValue);
333 int32 modifier = stat == STAT_STAMINA ? 75 : 30;
334 amount = CalculatePct(std::max<int32>(0, owner->GetStat(stat)), modifier);
335 }
336 }
Stats
Definition SharedDefines.h:245
@ STAT_STAMINA
Definition SharedDefines.h:248

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

Referenced by Register().

◆ HandlePeriodic()

void spell_warl_generic_scaling::HandlePeriodic ( AuraEffect const *  aurEff)
inlineprivate
385 {
387 if (aurEff->GetAuraType() == SPELL_AURA_MOD_STAT && (aurEff->GetMiscValue() == STAT_STAMINA || aurEff->GetMiscValue() == STAT_INTELLECT))
388 {
389 int32 currentAmount = aurEff->GetAmount();
390 int32 newAmount = GetEffect(aurEff->GetEffIndex())->CalculateAmount(GetCaster());
391 if (newAmount != currentAmount)
392 {
393 if (aurEff->GetMiscValue() == STAT_STAMINA)
394 {
395 uint32 actStat = GetUnitOwner()->GetHealth();
396 GetEffect(aurEff->GetEffIndex())->ChangeAmount(newAmount, false);
397 GetUnitOwner()->SetHealth(std::min<uint32>(GetUnitOwner()->GetMaxHealth(), actStat));
398 }
399 else
400 {
402 GetEffect(aurEff->GetEffIndex())->ChangeAmount(newAmount, false);
403 GetUnitOwner()->SetPower(POWER_MANA, std::min<uint32>(GetUnitOwner()->GetMaxPower(POWER_MANA), actStat));
404 }
405 }
406 }
407 else
408 GetEffect(aurEff->GetEffIndex())->RecalculateAmount();
409 }
@ POWER_MANA
Definition SharedDefines.h:257
@ STAT_INTELLECT
Definition SharedDefines.h:249
@ SPELL_AURA_MOD_STAT
Definition SpellAuraDefines.h:92
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:991
Unit * GetCaster() const
Definition SpellScript.cpp:1026
AuraEffect * GetEffect(uint8 effIndex) const
Definition SpellScript.cpp:1168
void SetPower(Powers power, uint32 val, bool withPowerUpdate=true, bool fromRegenerate=false)
Definition Unit.cpp:12108
void SetHealth(uint32 val)
Definition Unit.cpp:12020
uint32 GetHealth() const
Definition Unit.h:1122
uint32 GetPower(Powers power) const
Definition Unit.h:1149

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_warl_generic_scaling::PrepareAuraScript ( spell_warl_generic_scaling  )
private

◆ Register()

void spell_warl_generic_scaling::Register ( )
inlineoverrideprivatevirtual

Implements _SpellScript.

412 {
413 if (m_scriptSpellId != 34947)
415
416 if (m_scriptSpellId == 34947 || m_scriptSpellId == 34956)
418
419 if (m_scriptSpellId == 34947)
420 {
423 }
424
427 }
#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:773
#define AuraEffectPeriodicFn(F, I, N)
Definition SpellScript.h:761
#define AuraEffectCalcPeriodicFn(F, I, N)
Definition SpellScript.h:779
#define SPELL_AURA_ANY
Definition SpellScript.h:43
HookList< EffectCalcPeriodicHandler > DoEffectCalcPeriodic
Definition SpellScript.h:778
HookList< EffectPeriodicHandler > OnEffectPeriodic
Definition SpellScript.h:760
HookList< EffectCalcAmountHandler > DoEffectCalcAmount
Definition SpellScript.h:772
uint32 m_scriptSpellId
Definition SpellScript.h:107
void CalculateSPAmount(AuraEffect const *, int32 &amount, bool &)
Definition spell_warlock.cpp:362
void CalculateResistanceAmount(AuraEffect const *aurEff, int32 &amount, bool &)
Definition spell_warlock.cpp:311
void CalculateAPAmount(AuraEffect const *aurEff, int32 &amount, bool &)
Definition spell_warlock.cpp:338
void CalculateStatAmount(AuraEffect const *aurEff, int32 &amount, bool &)
Definition spell_warlock.cpp:327
void CalcPeriodic(AuraEffect const *, bool &isPeriodic, int32 &amplitude)
Definition spell_warlock.cpp:378
void HandlePeriodic(AuraEffect const *aurEff)
Definition spell_warlock.cpp:384

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: