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 Types

enum  Spells {
  SPELL_DRUID_AURA_OF_DESPAIR_1 = 62692 ,
  SPELL_DRUID_AURA_OF_DESPAIR_2 = 64848
}
 

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
 
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 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 Enumeration Documentation

◆ Spells

Enumerator
SPELL_DRUID_AURA_OF_DESPAIR_1 
SPELL_DRUID_AURA_OF_DESPAIR_2 
643 {
646 };
@ SPELL_DRUID_AURA_OF_DESPAIR_2
Definition spell_druid.cpp:645
@ SPELL_DRUID_AURA_OF_DESPAIR_1
Definition spell_druid.cpp:644

Member Function Documentation

◆ AfterRemove()

void spell_dru_lifebloom::AfterRemove ( AuraEffect const *  aurEff,
AuraEffectHandleModes   
)
inlineprivate
654 {
655 // Final heal only on duration end
656 if (GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_EXPIRE)
657 return;
658
659 // final heal
660 int32 stack = GetStackAmount();
661 int32 healAmount = aurEff->GetAmount();
662 SpellInfo const* finalHeal = sSpellMgr->GetSpellInfo(SPELL_DRUID_LIFEBLOOM_FINAL_HEAL);
663
664 if (Unit* caster = GetCaster())
665 {
666 healAmount = caster->SpellHealingBonusDone(GetTarget(), finalHeal, healAmount, HEAL, aurEff->GetEffIndex(), 0.0f, stack);
667 healAmount = GetTarget()->SpellHealingBonusTaken(caster, finalHeal, healAmount, HEAL, stack);
668
669 // restore mana
670 int32 returnmana = GetSpellInfo()->ManaCostPercentage * caster->GetCreateMana() * stack / 100 / 2;
672 returnmana /= 2;
673
674 caster->CastCustomSpell(caster, SPELL_DRUID_LIFEBLOOM_ENERGIZE, &returnmana, nullptr, nullptr, true, nullptr, aurEff, GetCasterGUID());
675 }
676 GetTarget()->CastCustomSpell(GetTarget(), SPELL_DRUID_LIFEBLOOM_FINAL_HEAL, &healAmount, nullptr, nullptr, true, nullptr, aurEff, GetCasterGUID());
677 }
std::int32_t int32
Definition Define.h:103
@ AURA_REMOVE_BY_EXPIRE
Definition SpellAuraDefines.h:395
#define sSpellMgr
Definition SpellMgr.h:851
@ HEAL
Definition Unit.h:265
AuraApplication const * GetTargetApplication() const
Definition SpellScript.cpp:1207
SpellInfo const * GetSpellInfo() const
Definition SpellScript.cpp:1011
Unit * GetCaster() const
Definition SpellScript.cpp:1026
Unit * GetTarget() const
Definition SpellScript.cpp:1178
ObjectGuid GetCasterGUID() const
Definition SpellScript.cpp:1021
uint8 GetStackAmount() const
Definition SpellScript.cpp:1138
Definition SpellInfo.h:340
uint32 ManaCostPercentage
Definition SpellInfo.h:391
Definition Unit.h:670
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:1435
uint32 SpellHealingBonusTaken(Unit *caster, SpellInfo const *spellProto, uint32 healamount, DamageEffectType damagetype, uint32 stack=1)
Definition Unit.cpp:9485
@ 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_AURA_OF_DESPAIR_1, SPELL_DRUID_AURA_OF_DESPAIR_2, 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
680 {
681 if (Unit* target = GetUnitOwner())
682 {
683 if (GetEffect(EFFECT_1))
684 {
685 Unit* caster = GetCaster();
686 int32 healAmount = GetSpellInfo()->Effects[EFFECT_1].CalcValue(caster ? caster : target, 0, target) * dispelInfo->GetRemovedCharges();
687 SpellInfo const* finalHeal = sSpellMgr->GetSpellInfo(SPELL_DRUID_LIFEBLOOM_FINAL_HEAL);
688 if (caster)
689 {
690 // healing with bonus
691 healAmount = caster->SpellHealingBonusDone(target, finalHeal, healAmount, HEAL, EFFECT_1, 0.0f, dispelInfo->GetRemovedCharges());
692 healAmount = target->SpellHealingBonusTaken(caster, finalHeal, healAmount, HEAL, dispelInfo->GetRemovedCharges());
693
694 // mana amount
695 int32 mana = CalculatePct(caster->GetCreateMana(), GetSpellInfo()->ManaCostPercentage) * dispelInfo->GetRemovedCharges() / 2;
697 mana /= 2;
698
699 caster->CastCustomSpell(caster, SPELL_DRUID_LIFEBLOOM_ENERGIZE, &mana, nullptr, nullptr, true, nullptr, nullptr, GetCasterGUID());
700 }
701 target->CastCustomSpell(target, SPELL_DRUID_LIFEBLOOM_FINAL_HEAL, &healAmount, nullptr, nullptr, true, nullptr, nullptr, GetCasterGUID());
702 }
703 }
704 }
@ EFFECT_1
Definition SharedDefines.h:32
T CalculatePct(T base, U pct)
Definition Util.h:52
AuraEffect * GetEffect(uint8 effIndex) const
Definition SpellScript.cpp:1168
Unit * GetUnitOwner() const
Definition SpellScript.cpp:1043
uint8 GetRemovedCharges() const
Definition Unit.h:317
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:9365
bool HasAnyAuras(Auras... spellIds) const
Checks if the unit has ANY specified auras.
Definition Unit.h:1489
uint32 GetCreateMana() const
Definition Unit.h:1162

References CalculatePct(), Unit::CastCustomSpell(), EFFECT_1, SpellInfo::Effects, AuraScript::GetCaster(), AuraScript::GetCasterGUID(), Unit::GetCreateMana(), AuraScript::GetEffect(), DispelInfo::GetRemovedCharges(), AuraScript::GetSpellInfo(), AuraScript::GetUnitOwner(), Unit::HasAnyAuras(), HEAL, SPELL_DRUID_AURA_OF_DESPAIR_1, SPELL_DRUID_AURA_OF_DESPAIR_2, 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.

707 {
710 }
@ SPELL_AURA_DUMMY
Definition SpellAuraDefines.h:67
@ AURA_EFFECT_HANDLE_REAL
Definition SpellAuraDefines.h:42
#define AuraDispelFn(F)
Definition SpellScript.h:733
#define AuraEffectRemoveFn(F, I, N, M)
Definition SpellScript.h:755
HookList< EffectApplyHandler > AfterEffectRemove
Definition SpellScript.h:754
HookList< AuraDispelHandler > AfterDispel
Definition SpellScript.h:732
void HandleDispel(DispelInfo *dispelInfo)
Definition spell_druid.cpp:679
void AfterRemove(AuraEffect const *aurEff, AuraEffectHandleModes)
Definition spell_druid.cpp:653

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.

649 {
651 }
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: