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

◆ CheckProc()

bool spell_warl_drain_soul::CheckProc ( ProcEventInfo &  eventInfo)
inlineprivate
1217 {
1218 // Drain Soul's proc tries to happen each time the warlock lands a killing blow on a unit while channeling.
1219 // Make sure that the dying unit is afflicted by the caster's Drain Soul debuff in order to avoid a false positive.
1220
1221 Unit* caster = GetCaster();
1222 Unit* victim = eventInfo.GetProcTarget();
1223
1224 if (caster && victim)
1225 {
1227 }
1228
1229 return false;
1230 }
Unit * GetCaster() const
Definition SpellScript.cpp:1026
static ObjectGuid GetGUID(Object const *o)
Definition Object.h:120
Unit * GetProcTarget() const
Definition Unit.h:470
Definition Unit.h:670
AuraApplication * GetAuraApplicationOfRankedSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0, AuraApplication *except=nullptr) const
Definition Unit.cpp:5664
@ 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
1233 {
1235
1236 if (Unit* caster = eventInfo.GetActor())
1237 {
1238 // Improved Drain Soul.
1239 if (Aura const* impDrainSoul = caster->GetAuraOfRankedSpell(SPELL_WARLOCK_IMPROVED_DRAIN_SOUL_R1, caster->GetGUID()))
1240 {
1241 int32 amount = CalculatePct(caster->GetMaxPower(POWER_MANA), impDrainSoul->GetSpellInfo()->Effects[EFFECT_2].CalcValue());
1242 caster->CastCustomSpell(SPELL_WARLOCK_IMPROVED_DRAIN_SOUL_PROC, SPELLVALUE_BASE_POINT0, amount, caster, true, nullptr, aurEff, caster->GetGUID());
1243 }
1244 }
1245 }
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:121
T CalculatePct(T base, U pct)
Definition Util.h:52
void PreventDefaultAction()
Definition SpellScript.cpp:991
Definition SpellAuras.h:88
Unit * GetActor()
Definition Unit.h:468
@ SPELL_WARLOCK_IMPROVED_DRAIN_SOUL_R1
Definition spell_warlock.cpp:72
@ SPELL_WARLOCK_IMPROVED_DRAIN_SOUL_PROC
Definition spell_warlock.cpp:73

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
1248 {
1249 Unit* caster = GetCaster();
1250 Unit* target = GetTarget();
1251
1252 if (caster && caster->IsPlayer() && caster->ToPlayer()->isHonorOrXPTarget(target))
1253 {
1254 if (roll_chance_i(20))
1255 {
1256 caster->CastSpell(caster, SPELL_WARLOCK_CREATE_SOULSHARD, aurEff);
1257 // Glyph of Drain Soul - chance to create an additional Soul Shard.
1259 {
1260 if (roll_chance_i(aur->GetMiscValue()))
1261 {
1262 caster->CastSpell(caster, SPELL_WARLOCK_CREATE_SOULSHARD, aur);
1263 }
1264 }
1265 }
1266 }
1267 }
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:1178
bool IsPlayer() const
Definition Object.h:207
Player * ToPlayer()
Definition Object.h:208
bool isHonorOrXPTarget(Unit *victim) const
Definition Player.cpp:13028
AuraEffect * GetAuraEffect(uint32 spellId, uint8 effIndex, ObjectGuid casterGUID=ObjectGuid::Empty) const
Definition Unit.cpp:5571
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:1378
@ 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.

1270 {
1275 }
@ 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:851
#define AuraEffectPeriodicFn(F, I, N)
Definition SpellScript.h:761
#define AuraCheckProcFn(F)
Definition SpellScript.h:820
#define AuraEffectRemoveFn(F, I, N, M)
Definition SpellScript.h:755
HookList< EffectPeriodicHandler > OnEffectPeriodic
Definition SpellScript.h:760
HookList< CheckProcHandler > DoCheckProc
Definition SpellScript.h:819
HookList< EffectApplyHandler > OnEffectRemove
Definition SpellScript.h:750
HookList< EffectProcHandler > OnEffectProc
Definition SpellScript.h:846
bool CheckProc(ProcEventInfo &eventInfo)
Definition spell_warlock.cpp:1216
void RemoveEffect(AuraEffect const *, AuraEffectHandleModes)
Definition spell_warlock.cpp:1206
void HandleTick(AuraEffect const *aurEff)
Definition spell_warlock.cpp:1247
void HandleProc(AuraEffect const *aurEff, ProcEventInfo &eventInfo)
Definition spell_warlock.cpp:1232

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
1207 {
1208 Unit* caster = GetCaster();
1209 Unit* target = GetTarget();
1210 if (!(GetTargetApplication()->GetRemoveMode() == AURA_REMOVE_BY_DEATH && caster && target && caster->IsPlayer() && caster->ToPlayer()->isHonorOrXPTarget(target)))
1211 {
1213 }
1214 }
@ AURA_REMOVE_BY_DEATH
Definition SpellAuraDefines.h:396
AuraApplication const * GetTargetApplication() const
Definition SpellScript.cpp:1207

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: