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 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
 
- 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
1307 {
1308 // Drain Soul's proc tries to happen each time the warlock lands a killing blow on a unit while channeling.
1309 // Make sure that the dying unit is afflicted by the caster's Drain Soul debuff in order to avoid a false positive.
1310
1311 Unit* caster = GetCaster();
1312 Unit* victim = eventInfo.GetProcTarget();
1313
1314 if (caster && victim)
1315 {
1317 }
1318
1319 return false;
1320 }
Unit * GetCaster() const
Definition SpellScript.cpp:1020
static ObjectGuid GetGUID(Object const *o)
Definition Object.h:113
Unit * GetProcTarget() const
Definition Unit.h:448
Definition Unit.h:655
AuraApplication * GetAuraApplicationOfRankedSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0, AuraApplication *except=nullptr) const
Definition Unit.cpp:5706
@ SPELL_WARLOCK_DRAIN_SOUL_R1
Definition spell_warlock.cpp:39

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
1323 {
1325
1326 if (Unit* caster = eventInfo.GetActor())
1327 {
1328 // Improved Drain Soul.
1329 if (Aura const* impDrainSoul = caster->GetAuraOfRankedSpell(SPELL_WARLOCK_IMPROVED_DRAIN_SOUL_R1, caster->GetGUID()))
1330 {
1331 int32 amount = CalculatePct(caster->GetMaxPower(POWER_MANA), impDrainSoul->GetSpellInfo()->Effects[EFFECT_2].CalcValue());
1332 caster->CastCustomSpell(SPELL_WARLOCK_IMPROVED_DRAIN_SOUL_PROC, SPELLVALUE_BASE_POINT0, amount, caster, true, nullptr, aurEff, caster->GetGUID());
1333 }
1334 }
1335 }
std::int32_t int32
Definition Define.h:103
@ EFFECT_2
Definition SharedDefines.h:33
@ POWER_MANA
Definition SharedDefines.h:280
@ SPELLVALUE_BASE_POINT0
Definition SpellDefines.h:113
T CalculatePct(T base, U pct)
Definition Util.h:52
void PreventDefaultAction()
Definition SpellScript.cpp:985
Definition SpellAuras.h:87
Unit * GetActor()
Definition Unit.h:446
@ SPELL_WARLOCK_IMPROVED_DRAIN_SOUL_R1
Definition spell_warlock.cpp:74
@ SPELL_WARLOCK_IMPROVED_DRAIN_SOUL_PROC
Definition spell_warlock.cpp:75

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
1338 {
1339 Unit* caster = GetCaster();
1340 Unit* target = GetTarget();
1341
1342 if (caster && caster->IsPlayer() && caster->ToPlayer()->isHonorOrXPTarget(target))
1343 {
1344 if (roll_chance_i(20))
1345 {
1346 caster->CastSpell(caster, SPELL_WARLOCK_CREATE_SOULSHARD, aurEff);
1347 // Glyph of Drain Soul - chance to create an additional Soul Shard.
1349 {
1350 if (roll_chance_i(aur->GetMiscValue()))
1351 {
1352 caster->CastSpell(caster, SPELL_WARLOCK_CREATE_SOULSHARD, aur);
1353 }
1354 }
1355 }
1356 }
1357 }
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:1165
bool IsPlayer() const
Definition Object.h:200
Player * ToPlayer()
Definition Object.h:201
bool isHonorOrXPTarget(Unit *victim) const
Definition Player.cpp:12728
AuraEffect * GetAuraEffect(uint32 spellId, uint8 effIndex, ObjectGuid casterGUID=ObjectGuid::Empty) const
Definition Unit.cpp:5613
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:1194
@ SPELL_WARLOCK_GLYPH_OF_DRAIN_SOUL_AURA
Definition spell_warlock.cpp:51
@ SPELL_WARLOCK_CREATE_SOULSHARD
Definition spell_warlock.cpp:40

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.

1360 {
1365 }
@ 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: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
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:1306
void RemoveEffect(AuraEffect const *, AuraEffectHandleModes)
Definition spell_warlock.cpp:1296
void HandleTick(AuraEffect const *aurEff)
Definition spell_warlock.cpp:1337
void HandleProc(AuraEffect const *aurEff, ProcEventInfo &eventInfo)
Definition spell_warlock.cpp:1322

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
1297 {
1298 Unit* caster = GetCaster();
1299 Unit* target = GetTarget();
1300 if (!(GetTargetApplication()->GetRemoveMode() == AURA_REMOVE_BY_DEATH && caster && target && caster->IsPlayer() && caster->ToPlayer()->isHonorOrXPTarget(target)))
1301 {
1303 }
1304 }
@ AURA_REMOVE_BY_DEATH
Definition SpellAuraDefines.h:396
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

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