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
411 {
412 Unit* caster = GetCaster();
413 if (Unit* target = GetHitUnit())
414 {
415 SpellInfo const* spellInfo = GetSpellInfo();
416 int32 rageUsed = std::min<int32>(300 - spellInfo->CalcPowerCost(caster, SpellSchoolMask(spellInfo->SchoolMask)), caster->GetPower(POWER_RAGE));
417 int32 newRage = std::max<int32>(0, caster->GetPower(POWER_RAGE) - rageUsed);
418
419 // Sudden Death rage retention applies only while its proc buff is up, not merely because
420 // the talent is learned
422 if (Aura* suddenDeath = caster->GetAuraOfRankedSpell(SPELL_WARRIOR_SUDDEN_DEATH_R1))
423 {
424 int32 ragesave = suddenDeath->GetSpellInfo()->Effects[EFFECT_1].CalcValue() * 10;
425 newRage = std::max(newRage, ragesave);
426 }
427
428 caster->SetPower(POWER_RAGE, uint32(newRage));
429 // Glyph of Execution bonus
431 rageUsed += aurEff->GetAmount() * 10;
432
433 int32 bp = GetEffectValue() + int32(rageUsed * spellInfo->Effects[effIndex].DamageMultiplier + caster->GetTotalAttackPowerValue(BASE_ATTACK) * 0.2f);
434 caster->CastCustomSpell(target, SPELL_WARRIOR_EXECUTE, &bp, nullptr, nullptr, true, nullptr, nullptr, GetOriginalCaster()->GetGUID());
435 }
436 }
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
SpellSchoolMask
Definition SharedDefines.h:283
@ BASE_ATTACK
Definition Unit.h:223
Definition SpellAuraEffects.h:39
Definition SpellAuras.h:88
Definition SpellInfo.h:340
uint32 SchoolMask
Definition SpellInfo.h:416
int32 CalcPowerCost(WorldObject const *caster, SpellSchoolMask schoolMask, Spell *spell=nullptr) const
Definition SpellInfo.cpp:2843
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:670
Aura * GetAuraOfRankedSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0) const
Definition Unit.cpp:5676
float GetTotalAttackPowerValue(WeaponAttackType attType, Unit *pVictim=nullptr) const
Definition Unit.cpp:11970
void SetPower(Powers power, uint32 val, bool withPowerUpdate=true, bool fromRegenerate=false)
Definition Unit.cpp:12108
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:1435
AuraEffect * GetAuraEffect(uint32 spellId, uint8 effIndex, ObjectGuid casterGUID=ObjectGuid::Empty) const
Definition Unit.cpp:5571
bool HasAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0) const
Definition Unit.cpp:5798
uint32 GetPower(Powers power) const
Definition Unit.h:1149
@ SPELL_WARRIOR_SUDDEN_DEATH
Definition spell_warrior.cpp:51
@ SPELL_WARRIOR_GLYPH_OF_EXECUTION
Definition spell_warrior.cpp:44
@ SPELL_WARRIOR_SUDDEN_DEATH_R1
Definition spell_warrior.cpp:52
@ SPELL_WARRIOR_EXECUTE
Definition spell_warrior.cpp:43

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

Referenced by Register().

◆ PrepareSpellScript()

spell_warr_execute::PrepareSpellScript ( spell_warr_execute  )
private

◆ Register()

void spell_warr_execute::Register ( )
inlineoverrideprivatevirtual

Implements _SpellScript.

439 {
442 }
@ 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:410
void SendMiss(SpellMissInfo missInfo)
Definition spell_warrior.cpp:396

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

◆ SendMiss()

void spell_warr_execute::SendMiss ( SpellMissInfo  missInfo)
inlineprivate
397 {
398 if (missInfo != SPELL_MISS_NONE)
399 {
400 if (Unit* caster = GetCaster())
401 {
402 if (Unit* target = GetHitUnit())
403 {
404 caster->SendSpellMiss(target, SPELL_WARRIOR_EXECUTE, missInfo);
405 }
406 }
407 }
408 }
@ 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

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