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

Private Member Functions

 PrepareAuraScript (spell_warl_drain_soul)
 
bool Validate (SpellInfo const *) override
 
void RemoveEffect (AuraEffect const *, AuraEffectHandleModes)
 
bool CheckProc (ProcEventInfo &eventInfo)
 
void HandleProc (AuraEffect const *aurEff, ProcEventInfo &eventInfo)
 
void HandleTick (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
 
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

◆ CheckProc()

bool spell_warl_drain_soul::CheckProc ( ProcEventInfo eventInfo)
inlineprivate
1149 {
1150 // Drain Soul's proc tries to happen each time the warlock lands a killing blow on a unit while channeling.
1151 // Make sure that the dying unit is afflicted by the caster's Drain Soul debuff in order to avoid a false positive.
1152
1153 Unit* caster = GetCaster();
1154 Unit* victim = eventInfo.GetProcTarget();
1155
1156 if (caster && victim)
1157 {
1159 }
1160
1161 return false;
1162 }
@ SPELL_WARLOCK_DRAIN_SOUL_R1
Definition: spell_warlock.cpp:35
static ObjectGuid GetGUID(Object const *o)
Definition: Object.h:106
Unit * GetProcTarget() const
Definition: Unit.h:860
Definition: Unit.h:1290
AuraApplication * GetAuraApplicationOfRankedSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0, AuraApplication *except=nullptr) const
Definition: Unit.cpp:5505
Unit * GetCaster() const
Definition: SpellScript.cpp:1020

References Unit::GetAuraApplicationOfRankedSpell(), AuraScript::GetCaster(), Object::GetGUID(), ProcEventInfo::GetProcTarget(), and SPELL_WARLOCK_DRAIN_SOUL_R1.

Referenced by Register().

◆ HandleProc()

void spell_warl_drain_soul::HandleProc ( AuraEffect const *  aurEff,
ProcEventInfo eventInfo 
)
inlineprivate
1165 {
1167
1168 if (Unit* caster = eventInfo.GetActor())
1169 {
1170 // Improved Drain Soul.
1171 if (Aura const* impDrainSoul = caster->GetAuraOfRankedSpell(SPELL_WARLOCK_IMPROVED_DRAIN_SOUL_R1, caster->GetGUID()))
1172 {
1173 int32 amount = CalculatePct(caster->GetMaxPower(POWER_MANA), impDrainSoul->GetSpellInfo()->Effects[EFFECT_2].CalcValue());
1174 caster->CastCustomSpell(SPELL_WARLOCK_IMPROVED_DRAIN_SOUL_PROC, SPELLVALUE_BASE_POINT0, amount, caster, true, nullptr, aurEff, caster->GetGUID());
1175 }
1176 }
1177 }
std::int32_t int32
Definition: Define.h:104
T CalculatePct(T base, U pct)
Definition: Util.h:61
@ SPELLVALUE_BASE_POINT0
Definition: SpellDefines.h:114
@ SPELL_WARLOCK_IMPROVED_DRAIN_SOUL_R1
Definition: spell_warlock.cpp:64
@ SPELL_WARLOCK_IMPROVED_DRAIN_SOUL_PROC
Definition: spell_warlock.cpp:65
@ EFFECT_2
Definition: SharedDefines.h:32
@ POWER_MANA
Definition: SharedDefines.h:241
Unit * GetActor()
Definition: Unit.h:858
Definition: SpellAuras.h:87
void PreventDefaultAction()
Definition: SpellScript.cpp:985

References CalculatePct(), EFFECT_2, ProcEventInfo::GetActor(), POWER_MANA, AuraScript::PreventDefaultAction(), SPELL_WARLOCK_IMPROVED_DRAIN_SOUL_PROC, SPELL_WARLOCK_IMPROVED_DRAIN_SOUL_R1, and SPELLVALUE_BASE_POINT0.

Referenced by Register().

◆ HandleTick()

void spell_warl_drain_soul::HandleTick ( AuraEffect const *  aurEff)
inlineprivate
1180 {
1181 Unit* caster = GetCaster();
1182 Unit* target = GetTarget();
1183
1184 if (caster && caster->GetTypeId() == TYPEID_PLAYER && caster->ToPlayer()->isHonorOrXPTarget(target))
1185 {
1186 if (roll_chance_i(20))
1187 {
1188 caster->CastSpell(caster, SPELL_WARLOCK_CREATE_SOULSHARD, aurEff);
1189 // Glyph of Drain Soul - chance to create an additional Soul Shard.
1191 {
1192 if (roll_chance_i(aur->GetMiscValue()))
1193 {
1194 caster->CastSpell(caster, SPELL_WARLOCK_CREATE_SOULSHARD, aur);
1195 }
1196 }
1197 }
1198 }
1199 }
bool roll_chance_i(int chance)
Definition: Random.h:59
@ TYPEID_PLAYER
Definition: ObjectGuid.h:38
@ SPELL_WARLOCK_GLYPH_OF_DRAIN_SOUL_AURA
Definition: spell_warlock.cpp:47
@ SPELL_WARLOCK_CREATE_SOULSHARD
Definition: spell_warlock.cpp:36
@ EFFECT_0
Definition: SharedDefines.h:30
Player * ToPlayer()
Definition: Object.h:195
TypeID GetTypeId() const
Definition: Object.h:121
bool isHonorOrXPTarget(Unit *victim) const
Definition: Player.cpp:12562
AuraEffect * GetAuraEffect(uint32 spellId, uint8 effIndex, ObjectGuid casterGUID=ObjectGuid::Empty) const
Definition: Unit.cpp:5412
SpellCastResult CastSpell(SpellCastTargets const &targets, SpellInfo const *spellInfo, CustomSpellValues const *value, TriggerCastFlags triggerFlags=TRIGGERED_NONE, Item *castItem=nullptr, AuraEffect const *triggeredByAura=nullptr, ObjectGuid originalCaster=ObjectGuid::Empty)
Definition: Unit.cpp:1169
Definition: SpellAuraEffects.h:39
Unit * GetTarget() const
Definition: SpellScript.cpp:1165

References Unit::CastSpell(), EFFECT_0, Unit::GetAuraEffect(), AuraScript::GetCaster(), AuraScript::GetTarget(), Object::GetTypeId(), Player::isHonorOrXPTarget(), roll_chance_i(), SPELL_WARLOCK_CREATE_SOULSHARD, SPELL_WARLOCK_GLYPH_OF_DRAIN_SOUL_AURA, Object::ToPlayer(), and TYPEID_PLAYER.

Referenced by Register().

◆ PrepareAuraScript()

spell_warl_drain_soul::PrepareAuraScript ( spell_warl_drain_soul  )
private

◆ Register()

void spell_warl_drain_soul::Register ( )
inlineoverrideprivatevirtual

Implements _SpellScript.

1202 {
1207 }
@ SPELL_AURA_CHANNEL_DEATH_ITEM
Definition: SpellAuraDefines.h:149
@ SPELL_AURA_PERIODIC_DAMAGE
Definition: SpellAuraDefines.h:66
@ SPELL_AURA_PROC_TRIGGER_SPELL
Definition: SpellAuraDefines.h:105
@ AURA_EFFECT_HANDLE_REAL
Definition: SpellAuraDefines.h:42
#define AuraEffectProcFn(F, I, N)
Definition: SpellScript.h:847
#define AuraEffectPeriodicFn(F, I, N)
Definition: SpellScript.h:760
#define AuraCheckProcFn(F)
Definition: SpellScript.h:818
#define AuraEffectRemoveFn(F, I, N, M)
Definition: SpellScript.h:754
@ EFFECT_1
Definition: SharedDefines.h:31
HookList< EffectPeriodicHandler > OnEffectPeriodic
Definition: SpellScript.h:759
HookList< CheckProcHandler > DoCheckProc
Definition: SpellScript.h:817
HookList< EffectApplyHandler > OnEffectRemove
Definition: SpellScript.h:749
HookList< EffectProcHandler > OnEffectProc
Definition: SpellScript.h:842
bool CheckProc(ProcEventInfo &eventInfo)
Definition: spell_warlock.cpp:1148
void RemoveEffect(AuraEffect const *, AuraEffectHandleModes)
Definition: spell_warlock.cpp:1138
void HandleTick(AuraEffect const *aurEff)
Definition: spell_warlock.cpp:1179
void HandleProc(AuraEffect const *aurEff, ProcEventInfo &eventInfo)
Definition: spell_warlock.cpp:1164

References AURA_EFFECT_HANDLE_REAL, AuraCheckProcFn, AuraEffectPeriodicFn, AuraEffectProcFn, AuraEffectRemoveFn, CheckProc(), AuraScript::DoCheckProc, EFFECT_0, EFFECT_1, EFFECT_2, HandleProc(), HandleTick(), AuraScript::OnEffectPeriodic, AuraScript::OnEffectProc, AuraScript::OnEffectRemove, RemoveEffect(), SPELL_AURA_CHANNEL_DEATH_ITEM, SPELL_AURA_PERIODIC_DAMAGE, and SPELL_AURA_PROC_TRIGGER_SPELL.

◆ RemoveEffect()

void spell_warl_drain_soul::RemoveEffect ( AuraEffect const *  ,
AuraEffectHandleModes   
)
inlineprivate
1139 {
1140 Unit* caster = GetCaster();
1141 Unit* target = GetTarget();
1142 if (!(GetTargetApplication()->GetRemoveMode() == AURA_REMOVE_BY_DEATH && caster && target && caster->IsPlayer() && caster->ToPlayer()->isHonorOrXPTarget(target)))
1143 {
1145 }
1146 }
@ AURA_REMOVE_BY_DEATH
Definition: SpellAuraDefines.h:396
bool IsPlayer() const
Definition: Object.h:194
AuraApplication const * GetTargetApplication() const
Definition: SpellScript.cpp:1194

References AURA_REMOVE_BY_DEATH, AuraScript::GetCaster(), AuraScript::GetTarget(), AuraScript::GetTargetApplication(), Player::isHonorOrXPTarget(), Object::IsPlayer(), AuraScript::PreventDefaultAction(), and Object::ToPlayer().

Referenced by Register().

◆ Validate()

bool spell_warl_drain_soul::Validate ( SpellInfo const *  )
inlineoverrideprivatevirtual