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 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
 
- 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
402 {
403 Unit* caster = GetCaster();
404 if (Unit* target = GetHitUnit())
405 {
406 SpellInfo const* spellInfo = GetSpellInfo();
407 int32 rageUsed = std::min<int32>(300 - spellInfo->CalcPowerCost(caster, SpellSchoolMask(spellInfo->SchoolMask)), caster->GetPower(POWER_RAGE));
408 int32 newRage = std::max<int32>(0, caster->GetPower(POWER_RAGE) - rageUsed);
409
410 // Sudden Death rage save
412 {
413 int32 ragesave = aurEff->GetSpellInfo()->Effects[EFFECT_1].CalcValue() * 10;
414 newRage = std::max(newRage, ragesave);
415 }
416
417 caster->SetPower(POWER_RAGE, uint32(newRage));
418 // Glyph of Execution bonus
420 rageUsed += aurEff->GetAmount() * 10;
421
422 int32 bp = GetEffectValue() + int32(rageUsed * spellInfo->Effects[effIndex].DamageMultiplier + caster->GetTotalAttackPowerValue(BASE_ATTACK) * 0.2f);
423 caster->CastCustomSpell(target, SPELL_WARRIOR_EXECUTE, &bp, nullptr, nullptr, true, nullptr, nullptr, GetOriginalCaster()->GetGUID());
424 }
425 }
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:270
@ SPELLFAMILY_GENERIC
Definition SharedDefines.h:3528
SpellSchoolMask
Definition SharedDefines.h:295
@ SPELL_AURA_PROC_TRIGGER_SPELL
Definition SpellAuraDefines.h:105
@ BASE_ATTACK
Definition Unit.h:209
Definition SpellAuraEffects.h:39
Definition SpellInfo.h:316
uint32 SchoolMask
Definition SpellInfo.h:392
std::array< SpellEffectInfo, MAX_SPELL_EFFECTS > Effects
Definition SpellInfo.h:393
int32 CalcPowerCost(Unit const *caster, SpellSchoolMask schoolMask, Spell *spell=nullptr) const
Definition SpellInfo.cpp:2401
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
Definition Unit.h:636
float GetTotalAttackPowerValue(WeaponAttackType attType, Unit *pVictim=nullptr) const
Definition Unit.cpp:15480
void SetPower(Powers power, uint32 val, bool withPowerUpdate=true, bool fromRegenerate=false)
Definition Unit.cpp:15618
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:1235
AuraEffect * GetAuraEffect(uint32 spellId, uint8 effIndex, ObjectGuid casterGUID=ObjectGuid::Empty) const
Definition Unit.cpp:5526
uint32 GetPower(Powers power) const
Definition Unit.h:1065
@ 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:68

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.

428 {
431 }
@ SPELL_EFFECT_DUMMY
Definition SharedDefines.h:781
#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:401
void SendMiss(SpellMissInfo missInfo)
Definition spell_warrior.cpp:387

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

◆ SendMiss()

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

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.

383 {
385 }
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: