TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
spell_warl_pet_scaling_01::spell_warl_pet_scaling_01_AuraScript Class Reference

Public Member Functions

 spell_warl_pet_scaling_01_AuraScript ()
 
- Public Member Functions inherited from AuraScript
 AuraScript ()
 
bool _Validate (SpellInfo const *entry) override
 
bool _Load (Aura *aura)
 
void _PrepareScriptCall (AuraScriptHookType hookType, AuraApplication const *aurApp=NULL)
 
void _FinishScriptCall ()
 
bool _IsDefaultActionPrevented ()
 
void PreventDefaultAction ()
 
SpellInfo constGetSpellInfo () 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 constGetTargetApplication () 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 void Unload ()
 

Private Member Functions

 PrepareAuraScript (spell_warl_pet_scaling_01_AuraScript)
 
bool Load () override
 
void CalculateStaminaAmount (AuraEffect const *, int32 &amount, bool &)
 
void ApplyEffect (AuraEffect const *, AuraEffectHandleModes)
 
void RemoveEffect (AuraEffect const *, AuraEffectHandleModes)
 
void CalculateAttackPowerAmount (AuraEffect const *, int32 &amount, bool &)
 
void CalculateDamageDoneAmount (AuraEffect const *, int32 &amount, bool &)
 
void Register () override
 

Private Attributes

uint32 _tempBonus
 

Additional Inherited Members

- Public Attributes inherited from AuraScript
HookList< CheckAreaTargetHandlerDoCheckAreaTarget
 
HookList< AuraDispelHandlerOnDispel
 
HookList< AuraDispelHandlerAfterDispel
 
HookList< EffectApplyHandlerOnEffectApply
 
HookList< EffectApplyHandlerAfterEffectApply
 
HookList< EffectApplyHandlerOnEffectRemove
 
HookList< EffectApplyHandlerAfterEffectRemove
 
HookList< EffectPeriodicHandlerOnEffectPeriodic
 
HookList
< EffectUpdatePeriodicHandler
OnEffectUpdatePeriodic
 
HookList< EffectCalcAmountHandlerDoEffectCalcAmount
 
HookList
< EffectCalcPeriodicHandler
DoEffectCalcPeriodic
 
HookList
< EffectCalcSpellModHandler
DoEffectCalcSpellMod
 
HookList< EffectAbsorbHandlerOnEffectAbsorb
 
HookList< EffectAbsorbHandlerAfterEffectAbsorb
 
HookList< EffectManaShieldHandlerOnEffectManaShield
 
HookList< EffectManaShieldHandlerAfterEffectManaShield
 
HookList< EffectSplitHandlerOnEffectSplit
 
HookList< CheckProcHandlerDoCheckProc
 
HookList< AuraProcHandlerDoPrepareProc
 
HookList< AuraProcHandlerOnProc
 
HookList< AuraProcHandlerAfterProc
 
HookList< EffectProcHandlerOnEffectProc
 
HookList< EffectProcHandlerAfterEffectProc
 
- Protected Attributes inherited from _SpellScript
uint8 m_currentScriptState
 
std::string constm_scriptName
 
uint32 m_scriptSpellId
 

Constructor & Destructor Documentation

spell_warl_pet_scaling_01::spell_warl_pet_scaling_01_AuraScript::spell_warl_pet_scaling_01_AuraScript ( )
inline
234  {
235  _tempBonus = 0;
236  }

Member Function Documentation

void spell_warl_pet_scaling_01::spell_warl_pet_scaling_01_AuraScript::ApplyEffect ( AuraEffect const ,
AuraEffectHandleModes   
)
inlineprivate
259  {
260  if (Unit* pet = GetUnitOwner())
261  if (_tempBonus)
262  {
263  PetLevelInfo const* pInfo = sObjectMgr->GetPetLevelInfo(pet->GetEntry(), pet->getLevel());
264  uint32 healthMod = 0;
265  uint32 baseHealth = pInfo->health;
266  switch (pet->GetEntry())
267  {
268  case ENTRY_IMP:
269  healthMod = uint32(_tempBonus * 8.4f);
270  break;
271  case ENTRY_FELGUARD:
272  case ENTRY_VOIDWALKER:
273  healthMod = _tempBonus * 11;
274  break;
275  case ENTRY_SUCCUBUS:
276  healthMod = uint32(_tempBonus * 9.1f);
277  break;
278  case ENTRY_FELHUNTER:
279  healthMod = uint32(_tempBonus * 9.5f);
280  break;
281  default:
282  healthMod = 0;
283  break;
284  }
285  if (healthMod)
286  pet->ToPet()->SetCreateHealth(baseHealth + healthMod);
287  }
288  }
Definition: ObjectMgr.h:445
Unit * GetUnitOwner() const
Definition: SpellScript.cpp:1016
Definition: spell_pet.cpp:56
Definition: spell_pet.cpp:58
Definition: spell_pet.cpp:57
#define sObjectMgr
Definition: ObjectMgr.h:1567
uint32_t uint32
Definition: Define.h:150
Definition: spell_pet.cpp:54
Definition: spell_pet.cpp:55
uint32_t uint32
Definition: g3dmath.h:168
uint16 health
Definition: ObjectMgr.h:450
Definition: Unit.h:1305

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void spell_warl_pet_scaling_01::spell_warl_pet_scaling_01_AuraScript::CalculateAttackPowerAmount ( AuraEffect const ,
int32 amount,
bool  
)
inlineprivate
301  {
302  if (Unit* pet = GetUnitOwner())
303  if (pet->IsPet())
304 
305  if (Unit* owner = pet->ToPet()->GetOwner())
306  {
307  int32 fire = int32(owner->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS + SPELL_SCHOOL_FIRE)) - owner->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_NEG + SPELL_SCHOOL_FIRE);
308  int32 shadow = int32(owner->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS + SPELL_SCHOOL_SHADOW)) - owner->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_NEG + SPELL_SCHOOL_SHADOW);
309  int32 maximum = (fire > shadow) ? fire : shadow;
310  if (maximum < 0)
311  maximum = 0;
312  float bonusAP = maximum * 0.57f;
313 
314  amount += bonusAP;
315 
316  // Glyph of felguard
317  if (pet->GetEntry() == ENTRY_FELGUARD)
318  {
319  if (AuraEffect* /* aurEff */ect = owner->GetAuraEffect(56246, EFFECT_0))
320  {
321  float base_attPower = pet->GetModifierValue(UNIT_MOD_ATTACK_POWER, BASE_VALUE) * pet->GetModifierValue(UNIT_MOD_ATTACK_POWER, BASE_PCT);
322  amount += CalculatePct(amount+base_attPower, /* aurEff */ect->GetAmount());
323  }
324  }
325  }
326  }
Definition: SpellAuraEffects.h:30
Player * GetOwner() const
Definition: Pet.cpp:1913
Definition: SharedDefines.h:28
Pet * ToPet()
Definition: Unit.h:2200
Unit * GetUnitOwner() const
Definition: SpellScript.cpp:1016
Definition: Unit.h:434
Definition: Unit.h:508
Definition: SharedDefines.h:276
int32_t int32
Definition: Define.h:146
Definition: UpdateFields.h:252
T CalculatePct(T base, U pct)
Definition: Util.h:92
Definition: SharedDefines.h:279
Definition: spell_pet.cpp:54
Definition: UpdateFields.h:251
int32_t int32
Definition: g3dmath.h:167
Definition: Unit.h:436
Definition: Unit.h:1305

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void spell_warl_pet_scaling_01::spell_warl_pet_scaling_01_AuraScript::CalculateDamageDoneAmount ( AuraEffect const ,
int32 amount,
bool  
)
inlineprivate
329  {
330  if (Unit* pet = GetUnitOwner())
331  if (pet->IsPet())
332  if (Unit* owner = pet->ToPet()->GetOwner())
333  {
334  //the damage bonus used for pets is either fire or shadow damage, whatever is higher
335  int32 fire = int32(owner->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS + SPELL_SCHOOL_FIRE)) - owner->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_NEG + SPELL_SCHOOL_FIRE);
336  int32 shadow = int32(owner->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS + SPELL_SCHOOL_SHADOW)) - owner->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_NEG + SPELL_SCHOOL_SHADOW);
337  int32 maximum = (fire > shadow) ? fire : shadow;
338  float bonusDamage = 0.0f;
339 
340  if (maximum > 0)
341  bonusDamage = maximum * 0.15f;
342 
343  amount += bonusDamage;
344  }
345  }
Player * GetOwner() const
Definition: Pet.cpp:1913
Pet * ToPet()
Definition: Unit.h:2200
Unit * GetUnitOwner() const
Definition: SpellScript.cpp:1016
Definition: SharedDefines.h:276
int32_t int32
Definition: Define.h:146
Definition: UpdateFields.h:252
Definition: SharedDefines.h:279
Definition: UpdateFields.h:251
int32_t int32
Definition: g3dmath.h:167
Definition: Unit.h:1305

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void spell_warl_pet_scaling_01::spell_warl_pet_scaling_01_AuraScript::CalculateStaminaAmount ( AuraEffect const ,
int32 amount,
bool  
)
inlineprivate
247  {
248  if (Unit* pet = GetUnitOwner())
249  if (pet->IsPet())
250  if (Unit* owner = pet->ToPet()->GetOwner())
251  {
252  float ownerBonus = CalculatePct(owner->GetStat(STAT_STAMINA), 75);
253 
254  amount += ownerBonus;
255  }
256  }
Player * GetOwner() const
Definition: Pet.cpp:1913
Pet * ToPet()
Definition: Unit.h:2200
Definition: SharedDefines.h:239
Unit * GetUnitOwner() const
Definition: SpellScript.cpp:1016
T CalculatePct(T base, U pct)
Definition: Util.h:92
Definition: Unit.h:1305

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool spell_warl_pet_scaling_01::spell_warl_pet_scaling_01_AuraScript::Load ( )
inlineoverrideprivatevirtual

Reimplemented from _SpellScript.

240  {
241  if (!GetCaster() || !GetCaster()->GetOwner() || GetCaster()->GetOwner()->GetTypeId() != TYPEID_PLAYER)
242  return false;
243  return true;
244  }
WorldObject * GetOwner() const
Definition: SpellScript.cpp:1011
Definition: ObjectGuid.h:33
Unit * GetCaster() const
Definition: SpellScript.cpp:1006

+ Here is the call graph for this function:

spell_warl_pet_scaling_01::spell_warl_pet_scaling_01_AuraScript::PrepareAuraScript ( spell_warl_pet_scaling_01_AuraScript  )
private
void spell_warl_pet_scaling_01::spell_warl_pet_scaling_01_AuraScript::Register ( )
inlineoverrideprivatevirtual

Implements _SpellScript.

348  {
354  }
void CalculateDamageDoneAmount(AuraEffect const *, int32 &amount, bool &)
Definition: spell_pet.cpp:328
HookList< EffectApplyHandler > AfterEffectApply
Definition: SpellScript.h:692
Definition: SharedDefines.h:29
Definition: SpellAuraDefines.h:159
Definition: SharedDefines.h:28
#define AuraEffectCalcAmountFn(F, I, N)
Definition: SpellScript.h:722
#define AuraEffectRemoveFn(F, I, N, M)
Definition: SpellScript.h:704
HookList< EffectApplyHandler > OnEffectRemove
Definition: SpellScript.h:699
void ApplyEffect(AuraEffect const *, AuraEffectHandleModes)
Definition: spell_pet.cpp:258
void CalculateStaminaAmount(AuraEffect const *, int32 &amount, bool &)
Definition: spell_pet.cpp:246
Definition: SpellAuraDefines.h:73
Definition: SpellAuraDefines.h:89
void RemoveEffect(AuraEffect const *, AuraEffectHandleModes)
Definition: spell_pet.cpp:290
#define AuraEffectApplyFn(F, I, N, M)
Definition: SpellScript.h:693
Definition: SharedDefines.h:30
HookList< EffectCalcAmountHandler > DoEffectCalcAmount
Definition: SpellScript.h:721
Definition: SpellAuraDefines.h:46
void CalculateAttackPowerAmount(AuraEffect const *, int32 &amount, bool &)
Definition: spell_pet.cpp:300

+ Here is the call graph for this function:

void spell_warl_pet_scaling_01::spell_warl_pet_scaling_01_AuraScript::RemoveEffect ( AuraEffect const ,
AuraEffectHandleModes   
)
inlineprivate
291  {
292  if (Unit* pet = GetUnitOwner())
293  if (pet->IsPet())
294  {
295  PetLevelInfo const* pInfo = sObjectMgr->GetPetLevelInfo(pet->GetEntry(), pet->getLevel());
296  pet->ToPet()->SetCreateHealth(pInfo->health);
297  }
298  }
Definition: ObjectMgr.h:445
Unit * GetUnitOwner() const
Definition: SpellScript.cpp:1016
#define sObjectMgr
Definition: ObjectMgr.h:1567
uint16 health
Definition: ObjectMgr.h:450
Definition: Unit.h:1305

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Member Data Documentation

uint32 spell_warl_pet_scaling_01::spell_warl_pet_scaling_01_AuraScript::_tempBonus
private

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