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

Private Member Functions

 PrepareSpellScript (spell_pal_lay_on_hands)
 
bool Validate (SpellInfo const *) override
 
bool Load () override
 
void HandleMaxHealthHeal (SpellEffIndex)
 
SpellCastResult CheckCast ()
 
void HandleScript ()
 
void Register () override
 

Private Attributes

int32 _manaAmount
 

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
 
Unit * GetCaster ()
 
GameObject * GetGObjCaster ()
 
Unit * GetOriginalCaster ()
 
SpellInfo const * GetSpellInfo ()
 
SpellValue const * GetSpellValue ()
 
WorldLocation const * GetExplTargetDest ()
 
void SetExplTargetDest (WorldLocation &loc)
 
WorldObject * GetExplTargetWorldObject ()
 
Unit * GetExplTargetUnit ()
 
GameObject * GetExplTargetGObj ()
 
Item * GetExplTargetItem ()
 
Unit * GetHitUnit ()
 
Creature * GetHitCreature ()
 
Player * GetHitPlayer ()
 
Item * GetHitItem ()
 
GameObject * GetHitGObj ()
 
WorldLocation * GetHitDest ()
 
int32 GetHitDamage ()
 
void SetHitDamage (int32 damage)
 
void PreventHitDamage ()
 
int32 GetHitHeal ()
 
void SetHitHeal (int32 heal)
 
void PreventHitHeal ()
 
Spell * GetSpell ()
 
Aura * GetHitAura ()
 
void PreventHitAura ()
 
void PreventHitEffect (SpellEffIndex effIndex)
 
void PreventHitDefaultEffect (SpellEffIndex effIndex)
 
int32 GetEffectValue () const
 
void SetEffectValue (int32 value)
 
Item * GetCastItem ()
 
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 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< CastHandler > BeforeCast
 
HookList< CastHandler > OnCast
 
HookList< CastHandler > AfterCast
 
HookList< CheckCastHandler > OnCheckCast
 
HookList< EffectHandler > OnEffectLaunch
 
HookList< EffectHandler > OnEffectLaunchTarget
 
HookList< EffectHandler > OnEffectHit
 
HookList< EffectHandler > OnEffectHitTarget
 
HookList< BeforeHitHandler > BeforeHit
 
HookList< HitHandler > OnHit
 
HookList< HitHandler > AfterHit
 
HookList< ObjectAreaTargetSelectHandler > OnObjectAreaTargetSelect
 
HookList< ObjectTargetSelectHandler > OnObjectTargetSelect
 
HookList< DestinationTargetSelectHandler > OnDestinationTargetSelect
 
- Protected Attributes inherited from _SpellScript
uint8 m_currentScriptState
 
std::string const * m_scriptName
 
uint32 m_scriptSpellId
 

Detailed Description

Member Function Documentation

◆ CheckCast()

SpellCastResult spell_pal_lay_on_hands::CheckCast ( )
inlineprivate
1081 {
1082 Unit* caster = GetCaster();
1083 if (Unit* target = GetExplTargetUnit())
1084 if (caster == target)
1087
1088 // Xinef: Glyph of Divinity
1089 if (Unit* target = GetExplTargetUnit())
1090 if (target->HasActivePowerType(POWER_MANA))
1091 _manaAmount = target->GetPower(POWER_MANA);
1092
1093 return SPELL_CAST_OK;
1094 }
@ POWER_MANA
Definition SharedDefines.h:257
@ SPELL_FAILED_TARGET_AURASTATE
Definition SharedDefines.h:1048
@ SPELL_CAST_OK
Definition SharedDefines.h:1126
Unit * GetExplTargetUnit()
Definition SpellScript.cpp:438
Unit * GetCaster()
Definition SpellScript.cpp:401
Definition Unit.h:667
int32 _manaAmount
Definition spell_paladin.cpp:1123
@ SPELL_PALADIN_AVENGING_WRATH_MARKER
Definition spell_paladin.cpp:54
@ SPELL_PALADIN_FORBEARANCE
Definition spell_paladin.cpp:53
@ SPELL_PALADIN_IMMUNE_SHIELD_MARKER
Definition spell_paladin.cpp:55

References _manaAmount, SpellScript::GetCaster(), SpellScript::GetExplTargetUnit(), POWER_MANA, SPELL_CAST_OK, SPELL_FAILED_TARGET_AURASTATE, SPELL_PALADIN_AVENGING_WRATH_MARKER, SPELL_PALADIN_FORBEARANCE, and SPELL_PALADIN_IMMUNE_SHIELD_MARKER.

Referenced by Register().

◆ HandleMaxHealthHeal()

void spell_pal_lay_on_hands::HandleMaxHealthHeal ( SpellEffIndex  )
inlineprivate
1063 {
1064 Unit* caster = GetCaster();
1065 Unit* target = GetExplTargetUnit();
1066
1067 if (!target || !caster)
1068 return;
1069
1070 uint32 baseHeal = caster->GetMaxHealth();
1071 uint32 modifiedHeal = target->SpellHealingBonusTaken(caster, GetSpellInfo(), baseHeal, HEAL);
1072
1073 // EffectHealMaxHealth() ignores healing modifiers, so we pre-apply the
1074 // difference here; this delta will be added on top of the raw heal.
1075 int64 healAdjustment = int64(modifiedHeal) - int64(baseHeal);
1076
1077 SetHitHeal(healAdjustment);
1078 }
std::uint32_t uint32
Definition Define.h:107
std::int64_t int64
Definition Define.h:102
@ HEAL
Definition Unit.h:260
SpellInfo const * GetSpellInfo()
Definition SpellScript.cpp:416
void SetHitHeal(int32 heal)
Definition SpellScript.cpp:549
uint32 GetMaxHealth() const
Definition Unit.h:1117
uint32 SpellHealingBonusTaken(Unit *caster, SpellInfo const *spellProto, uint32 healamount, DamageEffectType damagetype, uint32 stack=1)
Definition Unit.cpp:9445

References SpellScript::GetCaster(), SpellScript::GetExplTargetUnit(), Unit::GetMaxHealth(), SpellScript::GetSpellInfo(), HEAL, SpellScript::SetHitHeal(), and Unit::SpellHealingBonusTaken().

Referenced by Register().

◆ HandleScript()

void spell_pal_lay_on_hands::HandleScript ( )
inlineprivate
1097 {
1098 Unit* caster = GetCaster();
1099 Unit* target = GetHitUnit();
1100 if (caster == target)
1101 {
1102 caster->CastSpell(caster, SPELL_PALADIN_FORBEARANCE, true);
1103 caster->CastSpell(caster, SPELL_PALADIN_AVENGING_WRATH_MARKER, true);
1104 caster->CastSpell(caster, SPELL_PALADIN_IMMUNE_SHIELD_MARKER, true);
1105 }
1106 // Xinef: Glyph of Divinity
1107 else if (target && caster->HasAura(SPELL_PALADIN_GLYPH_OF_DIVINITY) &&
1108 GetSpellInfo()->Id != SPELL_PALADIN_LAY_ON_HANDS_R1 && _manaAmount > 0) // excluding first rank
1109 {
1111 if (_manaAmount > 0)
1112 caster->CastCustomSpell(54986 /*Energize*/, SPELLVALUE_BASE_POINT1, _manaAmount, caster, true);
1113 }
1114 }
@ SPELLVALUE_BASE_POINT1
Definition SpellDefines.h:122
Unit * GetHitUnit()
Definition SpellScript.cpp:453
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:1429
bool HasAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0) const
Definition Unit.cpp:5764
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:1372
uint32 GetPower(Powers power) const
Definition Unit.h:1143
@ SPELL_PALADIN_GLYPH_OF_DIVINITY
Definition spell_paladin.cpp:156
@ SPELL_PALADIN_LAY_ON_HANDS_R1
Definition spell_paladin.cpp:142

References _manaAmount, Unit::CastCustomSpell(), Unit::CastSpell(), SpellScript::GetCaster(), SpellScript::GetHitUnit(), Unit::GetPower(), SpellScript::GetSpellInfo(), Unit::HasAura(), POWER_MANA, SPELL_PALADIN_AVENGING_WRATH_MARKER, SPELL_PALADIN_FORBEARANCE, SPELL_PALADIN_GLYPH_OF_DIVINITY, SPELL_PALADIN_IMMUNE_SHIELD_MARKER, SPELL_PALADIN_LAY_ON_HANDS_R1, and SPELLVALUE_BASE_POINT1.

Referenced by Register().

◆ Load()

bool spell_pal_lay_on_hands::Load ( )
inlineoverrideprivatevirtual

Reimplemented from _SpellScript.

1057 {
1058 _manaAmount = 0;
1059 return true;
1060 }

References _manaAmount.

◆ PrepareSpellScript()

spell_pal_lay_on_hands::PrepareSpellScript ( spell_pal_lay_on_hands  )
private

◆ Register()

void spell_pal_lay_on_hands::Register ( )
inlineoverrideprivatevirtual

Implements _SpellScript.

1117 {
1121 }
@ EFFECT_0
Definition SharedDefines.h:31
@ SPELL_EFFECT_HEAL_MAX_HEALTH
Definition SharedDefines.h:833
#define SpellCheckCastFn(F)
Definition SpellScript.h:329
#define SpellEffectFn(F, I, N)
Definition SpellScript.h:337
#define SpellHitFn(F)
Definition SpellScript.h:349
HookList< CheckCastHandler > OnCheckCast
Definition SpellScript.h:328
HookList< HitHandler > AfterHit
Definition SpellScript.h:347
HookList< EffectHandler > OnEffectHitTarget
Definition SpellScript.h:336
void HandleMaxHealthHeal(SpellEffIndex)
Definition spell_paladin.cpp:1062
void HandleScript()
Definition spell_paladin.cpp:1096
SpellCastResult CheckCast()
Definition spell_paladin.cpp:1080

References SpellScript::AfterHit, CheckCast(), EFFECT_0, HandleMaxHealthHeal(), HandleScript(), SpellScript::OnCheckCast, SpellScript::OnEffectHitTarget, SPELL_EFFECT_HEAL_MAX_HEALTH, SpellCheckCastFn, SpellEffectFn, and SpellHitFn.

◆ Validate()

bool spell_pal_lay_on_hands::Validate ( SpellInfo const *  )
inlineoverrideprivatevirtual

Reimplemented from _SpellScript.

1047 {
1048 return ValidateSpellInfo(
1049 {
1053 });
1054 }
static bool ValidateSpellInfo(std::initializer_list< uint32 > spellIds)
Definition SpellScript.h:125

References SPELL_PALADIN_AVENGING_WRATH_MARKER, SPELL_PALADIN_FORBEARANCE, SPELL_PALADIN_IMMUNE_SHIELD_MARKER, and _SpellScript::ValidateSpellInfo().

Member Data Documentation

◆ _manaAmount

int32 spell_pal_lay_on_hands::_manaAmount
private

Referenced by CheckCast(), HandleScript(), and Load().


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