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
1290 {
1291 // Drain Soul's proc tries to happen each time the warlock lands a killing blow on a unit while channeling.
1292 // Make sure that the dying unit is afflicted by the caster's Drain Soul debuff in order to avoid a false positive.
1293
1294 Unit* caster = GetCaster();
1295 Unit* victim = eventInfo.GetProcTarget();
1296
1297 if (caster && victim)
1298 {
1300 }
1301
1302 return false;
1303 }
Unit * GetCaster() const
Definition SpellScript.cpp:1020
static ObjectGuid GetGUID(Object const *o)
Definition Object.h:112
Unit * GetProcTarget() const
Definition Unit.h:441
Definition Unit.h:636
AuraApplication * GetAuraApplicationOfRankedSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0, AuraApplication *except=nullptr) const
Definition Unit.cpp:5619
@ SPELL_WARLOCK_DRAIN_SOUL_R1
Definition spell_warlock.cpp:35

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
1306 {
1308
1309 if (Unit* caster = eventInfo.GetActor())
1310 {
1311 // Improved Drain Soul.
1312 if (Aura const* impDrainSoul = caster->GetAuraOfRankedSpell(SPELL_WARLOCK_IMPROVED_DRAIN_SOUL_R1, caster->GetGUID()))
1313 {
1314 int32 amount = CalculatePct(caster->GetMaxPower(POWER_MANA), impDrainSoul->GetSpellInfo()->Effects[EFFECT_2].CalcValue());
1315 caster->CastCustomSpell(SPELL_WARLOCK_IMPROVED_DRAIN_SOUL_PROC, SPELLVALUE_BASE_POINT0, amount, caster, true, nullptr, aurEff, caster->GetGUID());
1316 }
1317 }
1318 }
std::int32_t int32
Definition Define.h:103
@ EFFECT_2
Definition SharedDefines.h:33
@ POWER_MANA
Definition SharedDefines.h:269
@ SPELLVALUE_BASE_POINT0
Definition SpellDefines.h:113
T CalculatePct(T base, U pct)
Definition Util.h:61
void PreventDefaultAction()
Definition SpellScript.cpp:985
Definition SpellAuras.h:87
Unit * GetActor()
Definition Unit.h:439
@ SPELL_WARLOCK_IMPROVED_DRAIN_SOUL_R1
Definition spell_warlock.cpp:70
@ SPELL_WARLOCK_IMPROVED_DRAIN_SOUL_PROC
Definition spell_warlock.cpp:71

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
1321 {
1322 Unit* caster = GetCaster();
1323 Unit* target = GetTarget();
1324
1325 if (caster && caster->IsPlayer() && caster->ToPlayer()->isHonorOrXPTarget(target))
1326 {
1327 if (roll_chance_i(20))
1328 {
1329 caster->CastSpell(caster, SPELL_WARLOCK_CREATE_SOULSHARD, aurEff);
1330 // Glyph of Drain Soul - chance to create an additional Soul Shard.
1332 {
1333 if (roll_chance_i(aur->GetMiscValue()))
1334 {
1335 caster->CastSpell(caster, SPELL_WARLOCK_CREATE_SOULSHARD, aur);
1336 }
1337 }
1338 }
1339 }
1340 }
bool roll_chance_i(int chance)
Definition Random.h:60
@ 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:12730
AuraEffect * GetAuraEffect(uint32 spellId, uint8 effIndex, ObjectGuid casterGUID=ObjectGuid::Empty) const
Definition Unit.cpp:5526
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:1178
@ SPELL_WARLOCK_GLYPH_OF_DRAIN_SOUL_AURA
Definition spell_warlock.cpp:47
@ SPELL_WARLOCK_CREATE_SOULSHARD
Definition spell_warlock.cpp:36

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.

1343 {
1348 }
@ 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:1289
void RemoveEffect(AuraEffect const *, AuraEffectHandleModes)
Definition spell_warlock.cpp:1279
void HandleTick(AuraEffect const *aurEff)
Definition spell_warlock.cpp:1320
void HandleProc(AuraEffect const *aurEff, ProcEventInfo &eventInfo)
Definition spell_warlock.cpp:1305

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
1280 {
1281 Unit* caster = GetCaster();
1282 Unit* target = GetTarget();
1283 if (!(GetTargetApplication()->GetRemoveMode() == AURA_REMOVE_BY_DEATH && caster && target && caster->IsPlayer() && caster->ToPlayer()->isHonorOrXPTarget(target)))
1284 {
1286 }
1287 }
@ 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: