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

◆ CheckProc()

bool spell_warl_drain_soul::CheckProc ( ProcEventInfo eventInfo)
inlineprivate
1203 {
1204 // Drain Soul's proc tries to happen each time the warlock lands a killing blow on a unit while channeling.
1205 // Make sure that the dying unit is afflicted by the caster's Drain Soul debuff in order to avoid a false positive.
1206
1207 Unit* caster = GetCaster();
1208 Unit* victim = eventInfo.GetProcTarget();
1209
1210 if (caster && victim)
1211 {
1213 }
1214
1215 return false;
1216 }
Unit * GetCaster() const
Definition SpellScript.cpp:1035
static ObjectGuid GetGUID(Object const *o)
Definition Object.h:114
Unit * GetProcTarget() const
Definition Unit.h:461
Definition Unit.h:664
AuraApplication * GetAuraApplicationOfRankedSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0, AuraApplication *except=nullptr) const
Definition Unit.cpp:5805
@ SPELL_WARLOCK_DRAIN_SOUL_R1
Definition spell_warlock.cpp:40

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
1219 {
1221
1222 if (Unit* caster = eventInfo.GetActor())
1223 {
1224 // Improved Drain Soul.
1225 if (Aura const* impDrainSoul = caster->GetAuraOfRankedSpell(SPELL_WARLOCK_IMPROVED_DRAIN_SOUL_R1, caster->GetGUID()))
1226 {
1227 int32 amount = CalculatePct(caster->GetMaxPower(POWER_MANA), impDrainSoul->GetSpellInfo()->Effects[EFFECT_2].CalcValue());
1228 caster->CastCustomSpell(SPELL_WARLOCK_IMPROVED_DRAIN_SOUL_PROC, SPELLVALUE_BASE_POINT0, amount, caster, true, nullptr, aurEff, caster->GetGUID());
1229 }
1230 }
1231 }
std::int32_t int32
Definition Define.h:103
@ EFFECT_2
Definition SharedDefines.h:33
@ POWER_MANA
Definition SharedDefines.h:257
@ SPELLVALUE_BASE_POINT0
Definition SpellDefines.h:113
T CalculatePct(T base, U pct)
Definition Util.h:52
void PreventDefaultAction()
Definition SpellScript.cpp:1000
Definition SpellAuras.h:87
Unit * GetActor()
Definition Unit.h:459
@ SPELL_WARLOCK_IMPROVED_DRAIN_SOUL_R1
Definition spell_warlock.cpp:71
@ SPELL_WARLOCK_IMPROVED_DRAIN_SOUL_PROC
Definition spell_warlock.cpp:72

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
1234 {
1235 Unit* caster = GetCaster();
1236 Unit* target = GetTarget();
1237
1238 if (caster && caster->IsPlayer() && caster->ToPlayer()->isHonorOrXPTarget(target))
1239 {
1240 if (roll_chance_i(20))
1241 {
1242 caster->CastSpell(caster, SPELL_WARLOCK_CREATE_SOULSHARD, aurEff);
1243 // Glyph of Drain Soul - chance to create an additional Soul Shard.
1245 {
1246 if (roll_chance_i(aur->GetMiscValue()))
1247 {
1248 caster->CastSpell(caster, SPELL_WARLOCK_CREATE_SOULSHARD, aur);
1249 }
1250 }
1251 }
1252 }
1253 }
bool roll_chance_i(int chance)
Definition Random.h:63
@ EFFECT_0
Definition SharedDefines.h:31
Definition SpellAuraEffects.h:39
Unit * GetTarget() const
Definition SpellScript.cpp:1180
bool IsPlayer() const
Definition Object.h:201
Player * ToPlayer()
Definition Object.h:202
bool isHonorOrXPTarget(Unit *victim) const
Definition Player.cpp:12653
AuraEffect * GetAuraEffect(uint32 spellId, uint8 effIndex, ObjectGuid casterGUID=ObjectGuid::Empty) const
Definition Unit.cpp:5712
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:1302
@ SPELL_WARLOCK_GLYPH_OF_DRAIN_SOUL_AURA
Definition spell_warlock.cpp:52
@ SPELL_WARLOCK_CREATE_SOULSHARD
Definition spell_warlock.cpp:41

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

Referenced by Register().

◆ PrepareAuraScript()

spell_warl_drain_soul::PrepareAuraScript ( spell_warl_drain_soul  )
private

◆ Register()

void spell_warl_drain_soul::Register ( )
inlineoverrideprivatevirtual

Implements _SpellScript.

1256 {
1261 }
@ EFFECT_1
Definition SharedDefines.h:32
@ 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:865
#define AuraEffectPeriodicFn(F, I, N)
Definition SpellScript.h:771
#define AuraCheckProcFn(F)
Definition SpellScript.h:829
#define AuraEffectRemoveFn(F, I, N, M)
Definition SpellScript.h:765
HookList< EffectPeriodicHandler > OnEffectPeriodic
Definition SpellScript.h:770
HookList< CheckProcHandler > DoCheckProc
Definition SpellScript.h:828
HookList< EffectApplyHandler > OnEffectRemove
Definition SpellScript.h:760
HookList< EffectProcHandler > OnEffectProc
Definition SpellScript.h:860
bool CheckProc(ProcEventInfo &eventInfo)
Definition spell_warlock.cpp:1202
void RemoveEffect(AuraEffect const *, AuraEffectHandleModes)
Definition spell_warlock.cpp:1192
void HandleTick(AuraEffect const *aurEff)
Definition spell_warlock.cpp:1233
void HandleProc(AuraEffect const *aurEff, ProcEventInfo &eventInfo)
Definition spell_warlock.cpp:1218

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
1193 {
1194 Unit* caster = GetCaster();
1195 Unit* target = GetTarget();
1196 if (!(GetTargetApplication()->GetRemoveMode() == AURA_REMOVE_BY_DEATH && caster && target && caster->IsPlayer() && caster->ToPlayer()->isHonorOrXPTarget(target)))
1197 {
1199 }
1200 }
@ AURA_REMOVE_BY_DEATH
Definition SpellAuraDefines.h:396
AuraApplication const * GetTargetApplication() const
Definition SpellScript.cpp:1210

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

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