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

◆ AfterRemove()

void spell_dru_lifebloom::AfterRemove ( AuraEffect const *  aurEff,
AuraEffectHandleModes   
)
inlineprivate
648 {
649 // Final heal only on duration end
650 if (GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_EXPIRE)
651 return;
652
653 // final heal
654 int32 stack = GetStackAmount();
655 int32 healAmount = aurEff->GetAmount();
656 SpellInfo const* finalHeal = sSpellMgr->GetSpellInfo(SPELL_DRUID_LIFEBLOOM_FINAL_HEAL);
657
658 if (Unit* caster = GetCaster())
659 {
660 healAmount = caster->SpellHealingBonusDone(GetTarget(), finalHeal, healAmount, HEAL, aurEff->GetEffIndex(), 0.0f, stack);
661 healAmount = GetTarget()->SpellHealingBonusTaken(caster, finalHeal, healAmount, HEAL, stack);
662 // restore mana
663 int32 returnmana = (GetSpellInfo()->ManaCostPercentage * caster->GetCreateMana() / 100) * stack / 2;
664 caster->CastCustomSpell(caster, SPELL_DRUID_LIFEBLOOM_ENERGIZE, &returnmana, nullptr, nullptr, true, nullptr, aurEff, GetCasterGUID());
665 }
666 GetTarget()->CastCustomSpell(GetTarget(), SPELL_DRUID_LIFEBLOOM_FINAL_HEAL, &healAmount, nullptr, nullptr, true, nullptr, aurEff, GetCasterGUID());
667 }
std::int32_t int32
Definition Define.h:103
@ AURA_REMOVE_BY_EXPIRE
Definition SpellAuraDefines.h:395
#define sSpellMgr
Definition SpellMgr.h:836
@ HEAL
Definition Unit.h:257
AuraApplication const * GetTargetApplication() const
Definition SpellScript.cpp:1210
SpellInfo const * GetSpellInfo() const
Definition SpellScript.cpp:1020
Unit * GetCaster() const
Definition SpellScript.cpp:1035
Unit * GetTarget() const
Definition SpellScript.cpp:1180
ObjectGuid GetCasterGUID() const
Definition SpellScript.cpp:1030
uint8 GetStackAmount() const
Definition SpellScript.cpp:1140
Definition SpellInfo.h:340
uint32 ManaCostPercentage
Definition SpellInfo.h:391
Definition Unit.h:664
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:1407
uint32 SpellHealingBonusTaken(Unit *caster, SpellInfo const *spellProto, uint32 healamount, DamageEffectType damagetype, uint32 stack=1)
Definition Unit.cpp:9639
@ SPELL_DRUID_LIFEBLOOM_ENERGIZE
Definition spell_druid.cpp:50
@ SPELL_DRUID_LIFEBLOOM_FINAL_HEAL
Definition spell_druid.cpp:51

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
670 {
671 if (Unit* target = GetUnitOwner())
672 {
673 if (GetEffect(EFFECT_1))
674 {
675 Unit* caster = GetCaster();
676 int32 healAmount = GetSpellInfo()->Effects[EFFECT_1].CalcValue(caster ? caster : target, 0, target) * dispelInfo->GetRemovedCharges();
677 SpellInfo const* finalHeal = sSpellMgr->GetSpellInfo(SPELL_DRUID_LIFEBLOOM_FINAL_HEAL);
678 if (caster)
679 {
680 // healing with bonus
681 healAmount = caster->SpellHealingBonusDone(target, finalHeal, healAmount, HEAL, EFFECT_1, 0.0f, dispelInfo->GetRemovedCharges());
682 healAmount = target->SpellHealingBonusTaken(caster, finalHeal, healAmount, HEAL, dispelInfo->GetRemovedCharges());
683
684 // mana amount
685 int32 mana = CalculatePct(caster->GetCreateMana(), GetSpellInfo()->ManaCostPercentage) * dispelInfo->GetRemovedCharges() / 2;
686 caster->CastCustomSpell(caster, SPELL_DRUID_LIFEBLOOM_ENERGIZE, &mana, nullptr, nullptr, true, nullptr, nullptr, GetCasterGUID());
687 }
688 target->CastCustomSpell(target, SPELL_DRUID_LIFEBLOOM_FINAL_HEAL, &healAmount, nullptr, nullptr, true, nullptr, nullptr, GetCasterGUID());
689 }
690 }
691 }
@ EFFECT_1
Definition SharedDefines.h:32
T CalculatePct(T base, U pct)
Definition Util.h:52
AuraEffect * GetEffect(uint8 effIndex) const
Definition SpellScript.cpp:1170
Unit * GetUnitOwner() const
Definition SpellScript.cpp:1045
uint8 GetRemovedCharges() const
Definition Unit.h:309
std::array< SpellEffectInfo, MAX_SPELL_EFFECTS > Effects
Definition SpellInfo.h:417
uint32 SpellHealingBonusDone(Unit *victim, SpellInfo const *spellProto, uint32 healamount, DamageEffectType damagetype, uint8 effIndex, float TotalMod=0.0f, uint32 stack=1)
Definition Unit.cpp:9519
uint32 GetCreateMana() const
Definition Unit.h:1148

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.

694 {
697 }
@ SPELL_AURA_DUMMY
Definition SpellAuraDefines.h:67
@ AURA_EFFECT_HANDLE_REAL
Definition SpellAuraDefines.h:42
#define AuraDispelFn(F)
Definition SpellScript.h:743
#define AuraEffectRemoveFn(F, I, N, M)
Definition SpellScript.h:765
HookList< EffectApplyHandler > AfterEffectRemove
Definition SpellScript.h:764
HookList< AuraDispelHandler > AfterDispel
Definition SpellScript.h:742
void HandleDispel(DispelInfo *dispelInfo)
Definition spell_druid.cpp:669
void AfterRemove(AuraEffect const *aurEff, AuraEffectHandleModes)
Definition spell_druid.cpp:647

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.

643 {
645 }
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().


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