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
801 {
802 if ((int32(GetCaster()->GetHealth()) > int32(GetSpellInfo()->Effects[EFFECT_0].CalcValue())))
803 return SPELL_CAST_OK;
804 return SPELL_FAILED_FIZZLE;
805 }
std::int32_t int32
Definition: Define.h:104
@ EFFECT_0
Definition: SharedDefines.h:30
@ SPELL_FAILED_FIZZLE
Definition: SharedDefines.h:954
@ SPELL_CAST_OK
Definition: SharedDefines.h:1110
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
771 {
772 Player* caster = GetCaster()->ToPlayer();
773 if (Unit* target = GetHitUnit())
774 {
775 int32 spellEffect = GetEffectValue();
776 int32 mana = int32(spellEffect + (caster->SpellBaseDamageBonusDone(SPELL_SCHOOL_MASK_SHADOW) * 0.5f));
777
778 // Shouldn't Appear in Combat Log
779 target->ModifyHealth(-spellEffect);
780
781 // Improved Life Tap mod
783 AddPct(mana, aurEff->GetAmount());
784
785 caster->CastCustomSpell(target, SPELL_WARLOCK_LIFE_TAP_ENERGIZE, &mana, nullptr, nullptr, false);
786
787 // Mana Feed
788 int32 manaFeedVal = 0;
790 manaFeedVal = aurEff->GetAmount();
791
792 if (manaFeedVal > 0)
793 {
794 ApplyPct(manaFeedVal, mana);
795 caster->CastCustomSpell(caster, SPELL_WARLOCK_LIFE_TAP_ENERGIZE_2, &manaFeedVal, nullptr, nullptr, true, nullptr);
796 }
797 }
798 }
T AddPct(T &base, U pct)
Definition: Util.h:67
T ApplyPct(T &base, U pct)
Definition: Util.h:73
@ SPELL_AURA_ADD_FLAT_MODIFIER
Definition: SpellAuraDefines.h:170
@ 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:72
@ WARLOCK_ICON_ID_IMPROVED_LIFE_TAP
Definition: spell_warlock.cpp:71
@ SPELLFAMILY_WARLOCK
Definition: SharedDefines.h:3505
@ SPELL_SCHOOL_MASK_SHADOW
Definition: SharedDefines.h:274
Player * ToPlayer()
Definition: Object.h:195
Definition: Player.h:1046
Definition: Unit.h:1290
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:1226
AuraEffect * GetAuraEffect(uint32 spellId, uint8 effIndex, ObjectGuid casterGUID=ObjectGuid::Empty) const
Definition: Unit.cpp:5412
int32 SpellBaseDamageBonusDone(SpellSchoolMask schoolMask)
Definition: Unit.cpp:11855
AuraEffect * GetDummyAuraEffect(SpellFamilyNames name, uint32 iconId, uint8 effIndex) const
Definition: Unit.h:1976
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.

761 {
762 return GetCaster()->GetTypeId() == TYPEID_PLAYER;
763 }
@ TYPEID_PLAYER
Definition: ObjectGuid.h:38
TypeID GetTypeId() const
Definition: Object.h:121

References SpellScript::GetCaster(), Object::GetTypeId(), and TYPEID_PLAYER.

◆ PrepareSpellScript()

spell_warl_life_tap::PrepareSpellScript ( spell_warl_life_tap  )
private

◆ Register()

void spell_warl_life_tap::Register ( )
inlineoverrideprivatevirtual

Implements _SpellScript.

808 {
811 }
#define SpellCheckCastFn(F)
Definition: SpellScript.h:329
#define SpellEffectFn(F, I, N)
Definition: SpellScript.h:337
@ SPELL_EFFECT_DUMMY
Definition: SharedDefines.h:753
HookList< CheckCastHandler > OnCheckCast
Definition: SpellScript.h:328
HookList< EffectHandler > OnEffectHitTarget
Definition: SpellScript.h:336
SpellCastResult CheckCast()
Definition: spell_warlock.cpp:800
void HandleDummy(SpellEffIndex)
Definition: spell_warlock.cpp:770

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.

766 {
768 }
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().