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

◆ HandleEffect()

void spell_warr_execute::HandleEffect ( SpellEffIndex  effIndex)
inlineprivate
401 {
402 Unit* caster = GetCaster();
403 if (Unit* target = GetHitUnit())
404 {
405 SpellInfo const* spellInfo = GetSpellInfo();
406 int32 rageUsed = std::min<int32>(300 - spellInfo->CalcPowerCost(caster, SpellSchoolMask(spellInfo->SchoolMask)), caster->GetPower(POWER_RAGE));
407 int32 newRage = std::max<int32>(0, caster->GetPower(POWER_RAGE) - rageUsed);
408
409 // Sudden Death rage save
411 {
412 int32 ragesave = aurEff->GetSpellInfo()->Effects[EFFECT_1].CalcValue() * 10;
413 newRage = std::max(newRage, ragesave);
414 }
415
416 caster->SetPower(POWER_RAGE, uint32(newRage));
417 // Glyph of Execution bonus
419 rageUsed += aurEff->GetAmount() * 10;
420
421 int32 bp = GetEffectValue() + int32(rageUsed * spellInfo->Effects[effIndex].DamageMultiplier + caster->GetTotalAttackPowerValue(BASE_ATTACK) * 0.2f);
422 caster->CastCustomSpell(target, SPELL_WARRIOR_EXECUTE, &bp, nullptr, nullptr, true, nullptr, nullptr, GetOriginalCaster()->GetGUID());
423 }
424 }
std::int32_t int32
Definition: Define.h:104
std::uint32_t uint32
Definition: Define.h:108
@ BASE_ATTACK
Definition: Unit.h:396
@ SPELL_AURA_PROC_TRIGGER_SPELL
Definition: SpellAuraDefines.h:105
@ SPELL_WARRIOR_GLYPH_OF_EXECUTION
Definition: spell_warrior.cpp:45
@ SPELL_WARRIOR_EXECUTE
Definition: spell_warrior.cpp:44
@ WARRIOR_ICON_ID_SUDDEN_DEATH
Definition: spell_warrior.cpp:67
@ EFFECT_1
Definition: SharedDefines.h:31
@ EFFECT_0
Definition: SharedDefines.h:30
@ POWER_RAGE
Definition: SharedDefines.h:242
@ SPELLFAMILY_GENERIC
Definition: SharedDefines.h:3500
SpellSchoolMask
Definition: SharedDefines.h:267
Definition: Unit.h:1290
float GetTotalAttackPowerValue(WeaponAttackType attType, Unit *pVictim=nullptr) const
Definition: Unit.cpp:15320
void SetPower(Powers power, uint32 val, bool withPowerUpdate=true, bool fromRegenerate=false)
Definition: Unit.cpp:15458
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
uint32 GetPower(Powers power) const
Definition: Unit.h:1461
Definition: SpellAuraEffects.h:39
Definition: SpellInfo.h:314
uint32 SchoolMask
Definition: SpellInfo.h:390
std::array< SpellEffectInfo, MAX_SPELL_EFFECTS > Effects
Definition: SpellInfo.h:391
int32 CalcPowerCost(Unit const *caster, SpellSchoolMask schoolMask, Spell *spell=nullptr) const
Definition: SpellInfo.cpp:2384
SpellInfo const * GetSpellInfo()
Definition: SpellScript.cpp:411
int32 GetEffectValue() const
Definition: SpellScript.cpp:600
Unit * GetHitUnit()
Definition: SpellScript.cpp:448
Unit * GetOriginalCaster()
Definition: SpellScript.cpp:406
Unit * GetCaster()
Definition: SpellScript.cpp:401

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.

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

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

◆ SendMiss()

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

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.

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

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