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

Private Member Functions

 PrepareSpellScript (spell_warr_execute)
 
bool Validate (SpellInfo const *) override
 
void SendMiss (SpellMissInfo missInfo)
 
void HandleEffect (SpellEffIndex effIndex)
 
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
 
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 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< 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

◆ HandleEffect()

void spell_warr_execute::HandleEffect ( SpellEffIndex  effIndex)
inlineprivate
405 {
406 Unit* caster = GetCaster();
407 if (Unit* target = GetHitUnit())
408 {
409 SpellInfo const* spellInfo = GetSpellInfo();
410 int32 rageUsed = std::min<int32>(300 - spellInfo->CalcPowerCost(caster, SpellSchoolMask(spellInfo->SchoolMask)), caster->GetPower(POWER_RAGE));
411 int32 newRage = std::max<int32>(0, caster->GetPower(POWER_RAGE) - rageUsed);
412
413 // Sudden Death rage save
415 {
416 int32 ragesave = aurEff->GetSpellInfo()->Effects[EFFECT_1].CalcValue() * 10;
417 newRage = std::max(newRage, ragesave);
418 }
419
420 caster->SetPower(POWER_RAGE, uint32(newRage));
421 // Glyph of Execution bonus
423 rageUsed += aurEff->GetAmount() * 10;
424
425 int32 bp = GetEffectValue() + int32(rageUsed * spellInfo->Effects[effIndex].DamageMultiplier + caster->GetTotalAttackPowerValue(BASE_ATTACK) * 0.2f);
426 caster->CastCustomSpell(target, SPELL_WARRIOR_EXECUTE, &bp, nullptr, nullptr, true, nullptr, nullptr, GetOriginalCaster()->GetGUID());
427 }
428 }
std::int32_t int32
Definition Define.h:103
std::uint32_t uint32
Definition Define.h:107
@ EFFECT_1
Definition SharedDefines.h:32
@ EFFECT_0
Definition SharedDefines.h:31
@ POWER_RAGE
Definition SharedDefines.h:258
@ SPELLFAMILY_GENERIC
Definition SharedDefines.h:3784
SpellSchoolMask
Definition SharedDefines.h:283
@ SPELL_AURA_PROC_TRIGGER_SPELL
Definition SpellAuraDefines.h:105
@ BASE_ATTACK
Definition Unit.h:218
Definition SpellAuraEffects.h:39
Definition SpellInfo.h:340
uint32 SchoolMask
Definition SpellInfo.h:416
int32 CalcPowerCost(WorldObject const *caster, SpellSchoolMask schoolMask, Spell *spell=nullptr) const
Definition SpellInfo.cpp:2829
std::array< SpellEffectInfo, MAX_SPELL_EFFECTS > Effects
Definition SpellInfo.h:417
SpellInfo const * GetSpellInfo()
Definition SpellScript.cpp:416
int32 GetEffectValue() const
Definition SpellScript.cpp:605
Unit * GetHitUnit()
Definition SpellScript.cpp:453
Unit * GetOriginalCaster()
Definition SpellScript.cpp:411
Unit * GetCaster()
Definition SpellScript.cpp:401
Definition Unit.h:667
float GetTotalAttackPowerValue(WeaponAttackType attType, Unit *pVictim=nullptr) const
Definition Unit.cpp:11904
void SetPower(Powers power, uint32 val, bool withPowerUpdate=true, bool fromRegenerate=false)
Definition Unit.cpp:12042
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
AuraEffect * GetAuraEffect(uint32 spellId, uint8 effIndex, ObjectGuid casterGUID=ObjectGuid::Empty) const
Definition Unit.cpp:5537
uint32 GetPower(Powers power) const
Definition Unit.h:1143
@ SPELL_WARRIOR_GLYPH_OF_EXECUTION
Definition spell_warrior.cpp:44
@ SPELL_WARRIOR_EXECUTE
Definition spell_warrior.cpp:43
@ WARRIOR_ICON_ID_SUDDEN_DEATH
Definition spell_warrior.cpp:78

References BASE_ATTACK, SpellInfo::CalcPowerCost(), Unit::CastCustomSpell(), EFFECT_0, EFFECT_1, SpellInfo::Effects, Unit::GetAuraEffect(), SpellScript::GetCaster(), SpellScript::GetEffectValue(), SpellScript::GetHitUnit(), SpellScript::GetOriginalCaster(), Unit::GetPower(), SpellScript::GetSpellInfo(), Unit::GetTotalAttackPowerValue(), POWER_RAGE, SpellInfo::SchoolMask, Unit::SetPower(), SPELL_AURA_PROC_TRIGGER_SPELL, SPELL_WARRIOR_EXECUTE, SPELL_WARRIOR_GLYPH_OF_EXECUTION, SPELLFAMILY_GENERIC, and WARRIOR_ICON_ID_SUDDEN_DEATH.

Referenced by Register().

◆ PrepareSpellScript()

spell_warr_execute::PrepareSpellScript ( spell_warr_execute  )
private

◆ Register()

void spell_warr_execute::Register ( )
inlineoverrideprivatevirtual

Implements _SpellScript.

431 {
434 }
@ SPELL_EFFECT_DUMMY
Definition SharedDefines.h:769
#define BeforeSpellHitFn(F)
Definition SpellScript.h:342
#define SpellEffectFn(F, I, N)
Definition SpellScript.h:337
HookList< EffectHandler > OnEffectHitTarget
Definition SpellScript.h:336
HookList< BeforeHitHandler > BeforeHit
Definition SpellScript.h:341
void HandleEffect(SpellEffIndex effIndex)
Definition spell_warrior.cpp:404
void SendMiss(SpellMissInfo missInfo)
Definition spell_warrior.cpp:390

References SpellScript::BeforeHit, BeforeSpellHitFn, EFFECT_0, HandleEffect(), SpellScript::OnEffectHitTarget, SendMiss(), SPELL_EFFECT_DUMMY, and SpellEffectFn.

◆ SendMiss()

void spell_warr_execute::SendMiss ( SpellMissInfo  missInfo)
inlineprivate
391 {
392 if (missInfo != SPELL_MISS_NONE)
393 {
394 if (Unit* caster = GetCaster())
395 {
396 if (Unit* target = GetHitUnit())
397 {
398 caster->SendSpellMiss(target, SPELL_WARRIOR_EXECUTE, missInfo);
399 }
400 }
401 }
402 }
@ SPELL_MISS_NONE
Definition SharedDefines.h:1523

References SpellScript::GetCaster(), SpellScript::GetHitUnit(), SPELL_MISS_NONE, and SPELL_WARRIOR_EXECUTE.

Referenced by Register().

◆ Validate()

bool spell_warr_execute::Validate ( SpellInfo const *  )
inlineoverrideprivatevirtual

Reimplemented from _SpellScript.

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

References SPELL_WARRIOR_EXECUTE, SPELL_WARRIOR_GLYPH_OF_EXECUTION, and _SpellScript::ValidateSpellInfo().


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