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

Private Member Functions

 PrepareSpellScript (spell_warl_life_tap)
 
bool Load () override
 
bool Validate (SpellInfo const *) override
 
void HandleDummy (SpellEffIndex)
 
SpellCastResult CheckCast ()
 
void Register () override
 

Additional Inherited Members

- Public Member Functions inherited from SpellScript
bool _Validate (SpellInfo const *entry) override
 
bool _Load (Spell *spell)
 
void _InitHit ()
 
bool _IsEffectPrevented (SpellEffIndex effIndex)
 
bool _IsDefaultEffectPrevented (SpellEffIndex effIndex)
 
void _PrepareScriptCall (SpellScriptHookType hookType)
 
void _FinishScriptCall ()
 
bool IsInCheckCastHook () const
 
bool IsInTargetHook () const
 
bool IsInHitPhase () const
 
bool IsInEffectHook () const
 
UnitGetCaster ()
 
UnitGetOriginalCaster ()
 
SpellInfo const * GetSpellInfo ()
 
SpellValue const * GetSpellValue ()
 
WorldLocation const * GetExplTargetDest ()
 
void SetExplTargetDest (WorldLocation &loc)
 
WorldObjectGetExplTargetWorldObject ()
 
UnitGetExplTargetUnit ()
 
GameObjectGetExplTargetGObj ()
 
ItemGetExplTargetItem ()
 
UnitGetHitUnit ()
 
CreatureGetHitCreature ()
 
PlayerGetHitPlayer ()
 
ItemGetHitItem ()
 
GameObjectGetHitGObj ()
 
WorldLocationGetHitDest ()
 
int32 GetHitDamage ()
 
void SetHitDamage (int32 damage)
 
void PreventHitDamage ()
 
int32 GetHitHeal ()
 
void SetHitHeal (int32 heal)
 
void PreventHitHeal ()
 
SpellGetSpell ()
 
AuraGetHitAura ()
 
void PreventHitAura ()
 
void PreventHitEffect (SpellEffIndex effIndex)
 
void PreventHitDefaultEffect (SpellEffIndex effIndex)
 
int32 GetEffectValue () const
 
void SetEffectValue (int32 value)
 
ItemGetCastItem ()
 
void CreateItem (uint32 effIndex, uint32 itemId)
 
SpellInfo const * GetTriggeringSpell ()
 
void FinishCast (SpellCastResult result)
 
void Cancel ()
 
void SetCustomCastResultMessage (SpellCustomErrors result)
 
- 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 SpellScript
HookList< CastHandlerBeforeCast
 
HookList< CastHandlerOnCast
 
HookList< CastHandlerAfterCast
 
HookList< CheckCastHandlerOnCheckCast
 
HookList< EffectHandlerOnEffectLaunch
 
HookList< EffectHandlerOnEffectLaunchTarget
 
HookList< EffectHandlerOnEffectHit
 
HookList< EffectHandlerOnEffectHitTarget
 
HookList< BeforeHitHandlerBeforeHit
 
HookList< HitHandlerOnHit
 
HookList< HitHandlerAfterHit
 
HookList< ObjectAreaTargetSelectHandlerOnObjectAreaTargetSelect
 
HookList< ObjectTargetSelectHandlerOnObjectTargetSelect
 
HookList< DestinationTargetSelectHandlerOnDestinationTargetSelect
 
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

◆ CheckCast()

SpellCastResult spell_warl_life_tap::CheckCast ( )
inlineprivate
942 {
943 if ((int32(GetCaster()->GetHealth()) > int32(GetSpellInfo()->Effects[EFFECT_0].CalcValue())))
944 return SPELL_CAST_OK;
945 return SPELL_FAILED_FIZZLE;
946 }
std::int32_t int32
Definition: Define.h:103
@ EFFECT_0
Definition: SharedDefines.h:31
@ SPELL_FAILED_FIZZLE
Definition: SharedDefines.h:982
@ SPELL_CAST_OK
Definition: SharedDefines.h:1138
SpellInfo const * GetSpellInfo()
Definition: SpellScript.cpp:411
Unit * GetCaster()
Definition: SpellScript.cpp:401

References EFFECT_0, SpellScript::GetCaster(), SpellScript::GetSpellInfo(), SPELL_CAST_OK, and SPELL_FAILED_FIZZLE.

Referenced by Register().

◆ HandleDummy()

void spell_warl_life_tap::HandleDummy ( SpellEffIndex  )
inlineprivate
912 {
913 Player* caster = GetCaster()->ToPlayer();
914 if (Unit* target = GetHitUnit())
915 {
916 int32 spellEffect = GetEffectValue();
917 int32 mana = int32(spellEffect + (caster->SpellBaseDamageBonusDone(SPELL_SCHOOL_MASK_SHADOW) * 0.5f));
918
919 // Shouldn't Appear in Combat Log
920 target->ModifyHealth(-spellEffect);
921
922 // Improved Life Tap mod
924 AddPct(mana, aurEff->GetAmount());
925
926 caster->CastCustomSpell(target, SPELL_WARLOCK_LIFE_TAP_ENERGIZE, &mana, nullptr, nullptr, false);
927
928 // Mana Feed
929 int32 manaFeedVal = 0;
931 manaFeedVal = aurEff->GetAmount();
932
933 if (manaFeedVal > 0)
934 {
935 ApplyPct(manaFeedVal, mana);
936 caster->CastCustomSpell(caster, SPELL_WARLOCK_LIFE_TAP_ENERGIZE_2, &manaFeedVal, nullptr, nullptr, true, nullptr);
937 }
938 }
939 }
T AddPct(T &base, U pct)
Definition: Util.h:67
T ApplyPct(T &base, U pct)
Definition: Util.h:73
@ SPELL_WARLOCK_LIFE_TAP_ENERGIZE_2
Definition: spell_warlock.cpp:60
@ SPELL_WARLOCK_LIFE_TAP_ENERGIZE
Definition: spell_warlock.cpp:59
@ WARLOCK_ICON_ID_MANA_FEED
Definition: spell_warlock.cpp:80
@ WARLOCK_ICON_ID_IMPROVED_LIFE_TAP
Definition: spell_warlock.cpp:79
@ SPELLFAMILY_WARLOCK
Definition: SharedDefines.h:3533
@ SPELL_SCHOOL_MASK_SHADOW
Definition: SharedDefines.h:302
@ SPELL_AURA_ADD_FLAT_MODIFIER
Definition: SpellAuraDefines.h:170
Player * ToPlayer()
Definition: Object.h:201
Definition: Player.h:1081
Definition: Unit.h:630
SpellCastResult CastCustomSpell(Unit *victim, uint32 spellId, int32 const *bp0, int32 const *bp1, int32 const *bp2, bool triggered, Item *castItem=nullptr, AuraEffect const *triggeredByAura=nullptr, ObjectGuid originalCaster=ObjectGuid::Empty)
Definition: Unit.cpp:1224
AuraEffect * GetAuraEffect(uint32 spellId, uint8 effIndex, ObjectGuid casterGUID=ObjectGuid::Empty) const
Definition: Unit.cpp:5494
int32 SpellBaseDamageBonusDone(SpellSchoolMask schoolMask)
Definition: Unit.cpp:11937
AuraEffect * GetDummyAuraEffect(SpellFamilyNames name, uint32 iconId, uint8 effIndex) const
Definition: Unit.h:1358
Definition: SpellAuraEffects.h:39
int32 GetEffectValue() const
Definition: SpellScript.cpp:600
Unit * GetHitUnit()
Definition: SpellScript.cpp:448

References AddPct(), ApplyPct(), Unit::CastCustomSpell(), Unit::GetAuraEffect(), SpellScript::GetCaster(), Unit::GetDummyAuraEffect(), SpellScript::GetEffectValue(), SpellScript::GetHitUnit(), SPELL_AURA_ADD_FLAT_MODIFIER, SPELL_SCHOOL_MASK_SHADOW, SPELL_WARLOCK_LIFE_TAP_ENERGIZE, SPELL_WARLOCK_LIFE_TAP_ENERGIZE_2, Unit::SpellBaseDamageBonusDone(), SPELLFAMILY_WARLOCK, Object::ToPlayer(), WARLOCK_ICON_ID_IMPROVED_LIFE_TAP, and WARLOCK_ICON_ID_MANA_FEED.

Referenced by Register().

◆ Load()

bool spell_warl_life_tap::Load ( )
inlineoverrideprivatevirtual

Reimplemented from _SpellScript.

902 {
903 return GetCaster()->IsPlayer();
904 }
bool IsPlayer() const
Definition: Object.h:200

References SpellScript::GetCaster(), and Object::IsPlayer().

◆ PrepareSpellScript()

spell_warl_life_tap::PrepareSpellScript ( spell_warl_life_tap  )
private

◆ Register()

void spell_warl_life_tap::Register ( )
inlineoverrideprivatevirtual

Implements _SpellScript.

949 {
952 }
@ SPELL_EFFECT_DUMMY
Definition: SharedDefines.h:781
#define SpellCheckCastFn(F)
Definition: SpellScript.h:329
#define SpellEffectFn(F, I, N)
Definition: SpellScript.h:337
HookList< CheckCastHandler > OnCheckCast
Definition: SpellScript.h:328
HookList< EffectHandler > OnEffectHitTarget
Definition: SpellScript.h:336
SpellCastResult CheckCast()
Definition: spell_warlock.cpp:941
void HandleDummy(SpellEffIndex)
Definition: spell_warlock.cpp:911

References CheckCast(), EFFECT_0, HandleDummy(), SpellScript::OnCheckCast, SpellScript::OnEffectHitTarget, SPELL_EFFECT_DUMMY, SpellCheckCastFn, and SpellEffectFn.

◆ Validate()

bool spell_warl_life_tap::Validate ( SpellInfo const *  )
inlineoverrideprivatevirtual

Reimplemented from _SpellScript.

907 {
909 }
static bool ValidateSpellInfo(std::initializer_list< uint32 > spellIds)
Definition: SpellScript.h:125

References SPELL_WARLOCK_LIFE_TAP_ENERGIZE, SPELL_WARLOCK_LIFE_TAP_ENERGIZE_2, and _SpellScript::ValidateSpellInfo().