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

Private Member Functions

 PrepareAuraScript (spell_dru_lifebloom)
 
bool Validate (SpellInfo const *) override
 
void AfterRemove (AuraEffect const *aurEff, AuraEffectHandleModes)
 
void HandleDispel (DispelInfo *dispelInfo)
 
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

◆ AfterRemove()

void spell_dru_lifebloom::AfterRemove ( AuraEffect const *  aurEff,
AuraEffectHandleModes   
)
inlineprivate
577 {
578 // Final heal only on duration end
579 if (GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_EXPIRE)
580 return;
581
582 // final heal
583 int32 stack = GetStackAmount();
584 int32 healAmount = aurEff->GetAmount();
585 SpellInfo const* finalHeal = sSpellMgr->GetSpellInfo(SPELL_DRUID_LIFEBLOOM_FINAL_HEAL);
586
587 if (Unit* caster = GetCaster())
588 {
589 healAmount = caster->SpellHealingBonusDone(GetTarget(), finalHeal, healAmount, HEAL, aurEff->GetEffIndex(), 0.0f, stack);
590 healAmount = GetTarget()->SpellHealingBonusTaken(caster, finalHeal, healAmount, HEAL, stack);
591 // restore mana
592 int32 returnmana = (GetSpellInfo()->ManaCostPercentage * caster->GetCreateMana() / 100) * stack / 2;
593 caster->CastCustomSpell(caster, SPELL_DRUID_LIFEBLOOM_ENERGIZE, &returnmana, nullptr, nullptr, true, nullptr, aurEff, GetCasterGUID());
594 }
595 GetTarget()->CastCustomSpell(GetTarget(), SPELL_DRUID_LIFEBLOOM_FINAL_HEAL, &healAmount, nullptr, nullptr, true, nullptr, aurEff, GetCasterGUID());
596 }
std::int32_t int32
Definition: Define.h:104
@ HEAL
Definition: Unit.h:438
@ AURA_REMOVE_BY_EXPIRE
Definition: SpellAuraDefines.h:395
#define sSpellMgr
Definition: SpellMgr.h:818
@ SPELL_DRUID_LIFEBLOOM_ENERGIZE
Definition: spell_druid.cpp:50
@ SPELL_DRUID_LIFEBLOOM_FINAL_HEAL
Definition: spell_druid.cpp:51
Definition: Unit.h:1290
SpellCastResult CastCustomSpell(Unit *victim, uint32 spellId, int32 const *bp0, int32 const *bp1, int32 const *bp2, bool triggered, Item *castItem=nullptr, AuraEffect const *triggeredByAura=nullptr, ObjectGuid originalCaster=ObjectGuid::Empty)
Definition: Unit.cpp:1226
uint32 SpellHealingBonusTaken(Unit *caster, SpellInfo const *spellProto, uint32 healamount, DamageEffectType damagetype, uint32 stack=1)
Definition: Unit.cpp:12481
Definition: SpellInfo.h:314
uint32 ManaCostPercentage
Definition: SpellInfo.h:365
AuraApplication const * GetTargetApplication() const
Definition: SpellScript.cpp:1194
SpellInfo const * GetSpellInfo() const
Definition: SpellScript.cpp:1005
Unit * GetCaster() const
Definition: SpellScript.cpp:1020
Unit * GetTarget() const
Definition: SpellScript.cpp:1165
ObjectGuid GetCasterGUID() const
Definition: SpellScript.cpp:1015
uint8 GetStackAmount() const
Definition: SpellScript.cpp:1125

References AURA_REMOVE_BY_EXPIRE, Unit::CastCustomSpell(), AuraEffect::GetAmount(), AuraScript::GetCaster(), AuraScript::GetCasterGUID(), AuraEffect::GetEffIndex(), AuraScript::GetSpellInfo(), AuraScript::GetStackAmount(), AuraScript::GetTarget(), AuraScript::GetTargetApplication(), HEAL, SpellInfo::ManaCostPercentage, SPELL_DRUID_LIFEBLOOM_ENERGIZE, SPELL_DRUID_LIFEBLOOM_FINAL_HEAL, Unit::SpellHealingBonusTaken(), and sSpellMgr.

Referenced by Register().

◆ HandleDispel()

void spell_dru_lifebloom::HandleDispel ( DispelInfo dispelInfo)
inlineprivate
599 {
600 if (Unit* target = GetUnitOwner())
601 {
602 if (GetEffect(EFFECT_1))
603 {
604 Unit* caster = GetCaster();
605 int32 healAmount = GetSpellInfo()->Effects[EFFECT_1].CalcValue(caster ? caster : target, 0, target) * dispelInfo->GetRemovedCharges();
606 SpellInfo const* finalHeal = sSpellMgr->GetSpellInfo(SPELL_DRUID_LIFEBLOOM_FINAL_HEAL);
607 if (caster)
608 {
609 // healing with bonus
610 healAmount = caster->SpellHealingBonusDone(target, finalHeal, healAmount, HEAL, EFFECT_1, 0.0f, dispelInfo->GetRemovedCharges());
611 healAmount = target->SpellHealingBonusTaken(caster, finalHeal, healAmount, HEAL, dispelInfo->GetRemovedCharges());
612
613 // mana amount
614 int32 mana = CalculatePct(caster->GetCreateMana(), GetSpellInfo()->ManaCostPercentage) * dispelInfo->GetRemovedCharges() / 2;
615 caster->CastCustomSpell(caster, SPELL_DRUID_LIFEBLOOM_ENERGIZE, &mana, nullptr, nullptr, true, nullptr, nullptr, GetCasterGUID());
616 }
617 target->CastCustomSpell(target, SPELL_DRUID_LIFEBLOOM_FINAL_HEAL, &healAmount, nullptr, nullptr, true, nullptr, nullptr, GetCasterGUID());
618 }
619 }
620 }
T CalculatePct(T base, U pct)
Definition: Util.h:61
@ EFFECT_1
Definition: SharedDefines.h:31
uint8 GetRemovedCharges() const
Definition: Unit.h:734
uint32 SpellHealingBonusDone(Unit *victim, SpellInfo const *spellProto, uint32 healamount, DamageEffectType damagetype, uint8 effIndex, float TotalMod=0.0f, uint32 stack=1)
Definition: Unit.cpp:12370
uint32 GetCreateMana() const
Definition: Unit.h:2041
std::array< SpellEffectInfo, MAX_SPELL_EFFECTS > Effects
Definition: SpellInfo.h:391
AuraEffect * GetEffect(uint8 effIndex) const
Definition: SpellScript.cpp:1155
Unit * GetUnitOwner() const
Definition: SpellScript.cpp:1030

References CalculatePct(), Unit::CastCustomSpell(), EFFECT_1, SpellInfo::Effects, AuraScript::GetCaster(), AuraScript::GetCasterGUID(), Unit::GetCreateMana(), AuraScript::GetEffect(), DispelInfo::GetRemovedCharges(), AuraScript::GetSpellInfo(), AuraScript::GetUnitOwner(), HEAL, SPELL_DRUID_LIFEBLOOM_ENERGIZE, SPELL_DRUID_LIFEBLOOM_FINAL_HEAL, Unit::SpellHealingBonusDone(), and sSpellMgr.

Referenced by Register().

◆ PrepareAuraScript()

spell_dru_lifebloom::PrepareAuraScript ( spell_dru_lifebloom  )
private

◆ Register()

void spell_dru_lifebloom::Register ( )
inlineoverrideprivatevirtual

Implements _SpellScript.

623 {
626 }
@ SPELL_AURA_DUMMY
Definition: SpellAuraDefines.h:67
@ AURA_EFFECT_HANDLE_REAL
Definition: SpellAuraDefines.h:42
#define AuraDispelFn(F)
Definition: SpellScript.h:732
#define AuraEffectRemoveFn(F, I, N, M)
Definition: SpellScript.h:754
HookList< EffectApplyHandler > AfterEffectRemove
Definition: SpellScript.h:753
HookList< AuraDispelHandler > AfterDispel
Definition: SpellScript.h:731
void HandleDispel(DispelInfo *dispelInfo)
Definition: spell_druid.cpp:598
void AfterRemove(AuraEffect const *aurEff, AuraEffectHandleModes)
Definition: spell_druid.cpp:576

References AuraScript::AfterDispel, AuraScript::AfterEffectRemove, AfterRemove(), AURA_EFFECT_HANDLE_REAL, AuraDispelFn, AuraEffectRemoveFn, EFFECT_1, HandleDispel(), and SPELL_AURA_DUMMY.

◆ Validate()

bool spell_dru_lifebloom::Validate ( SpellInfo const *  )
inlineoverrideprivatevirtual

Reimplemented from _SpellScript.

572 {
574 }
static bool ValidateSpellInfo(std::initializer_list< uint32 > spellIds)
Definition: SpellScript.h:125

References SPELL_DRUID_LIFEBLOOM_ENERGIZE, SPELL_DRUID_LIFEBLOOM_FINAL_HEAL, and _SpellScript::ValidateSpellInfo().