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

Private Member Functions

 PrepareSpellScript (spell_dk_scourge_strike)
 
bool Load () override
 
bool Validate (SpellInfo const *) override
 
void HandleDummy (SpellEffIndex)
 
void HandleAfterHit ()
 
void Register () override
 

Private Attributes

float multiplier
 
ObjectGuid guid
 

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

◆ HandleAfterHit()

void spell_dk_scourge_strike::HandleAfterHit ( )
inlineprivate
2064 {
2065 Unit* caster = GetCaster();
2066 if (Unit* unitTarget = ObjectAccessor::GetUnit(*caster, guid))
2067 {
2068 int32 bp = GetHitDamage() * multiplier;
2069 caster->CastCustomSpell(unitTarget, SPELL_DK_SCOURGE_STRIKE_TRIGGERED, &bp, nullptr, nullptr, true);
2070
2071 // Xinef: Shadowmourne hack (scourge strike trigger proc disabled...)
2072 if (roll_chance_i(75) && caster->FindMap() && !caster->FindMap()->IsBattlegroundOrArena() && caster->HasAura(71903) && !caster->HasAura(SPELL_SHADOWMOURNE_CHAOS_BANE_BUFF))
2073 {
2074 caster->CastSpell(caster, SPELL_SHADOWMOURNE_SOUL_FRAGMENT, true);
2075
2076 // this can't be handled in AuraScript of SoulFragments because we need to know victim
2077 if (Aura* soulFragments = caster->GetAura(SPELL_SHADOWMOURNE_SOUL_FRAGMENT))
2078 {
2079 if (soulFragments->GetStackAmount() >= 10)
2080 {
2081 caster->CastSpell(caster, SPELL_SHADOWMOURNE_CHAOS_BANE_DAMAGE, true, nullptr);
2082 soulFragments->Remove();
2083 }
2084 }
2085 }
2086 }
2087 }
std::int32_t int32
Definition: Define.h:104
bool roll_chance_i(int chance)
Definition: Random.h:59
@ SPELL_DK_SCOURGE_STRIKE_TRIGGERED
Definition: spell_dk.cpp:71
@ SPELL_SHADOWMOURNE_CHAOS_BANE_BUFF
Definition: spell_dk.cpp:42
@ SPELL_SHADOWMOURNE_SOUL_FRAGMENT
Definition: spell_dk.cpp:41
@ SPELL_SHADOWMOURNE_CHAOS_BANE_DAMAGE
Definition: spell_dk.cpp:40
Unit * GetUnit(WorldObject const &, ObjectGuid const guid)
Definition: ObjectAccessor.cpp:202
Map * FindMap() const
Definition: Object.h:518
Definition: Unit.h:1302
Aura * GetAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0) const
Definition: Unit.cpp:5519
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
bool HasAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0) const
Definition: Unit.cpp:5636
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:1169
bool IsBattlegroundOrArena() const
Definition: Map.h:456
Definition: SpellAuras.h:87
Unit * GetCaster()
Definition: SpellScript.cpp:401
int32 GetHitDamage()
Definition: SpellScript.cpp:514
float multiplier
Definition: spell_dk.cpp:2031
ObjectGuid guid
Definition: spell_dk.cpp:2032

References Unit::CastCustomSpell(), Unit::CastSpell(), WorldObject::FindMap(), Unit::GetAura(), SpellScript::GetCaster(), SpellScript::GetHitDamage(), ObjectAccessor::GetUnit(), guid, Unit::HasAura(), Map::IsBattlegroundOrArena(), multiplier, roll_chance_i(), SPELL_DK_SCOURGE_STRIKE_TRIGGERED, SPELL_SHADOWMOURNE_CHAOS_BANE_BUFF, SPELL_SHADOWMOURNE_CHAOS_BANE_DAMAGE, and SPELL_SHADOWMOURNE_SOUL_FRAGMENT.

Referenced by Register().

◆ HandleDummy()

void spell_dk_scourge_strike::HandleDummy ( SpellEffIndex  )
inlineprivate
2047 {
2048 Unit* caster = GetCaster();
2049 if (Unit* unitTarget = GetHitUnit())
2050 {
2052 float disease_amt = GetEffectValue();
2053
2054 // Death Knight T8 Melee 4P Bonus
2056 AddPct(disease_amt, aurEff->GetAmount());
2057
2058 multiplier = disease_amt * unitTarget->GetDiseasesByCaster(caster->GetGUID(), mode) / 100.0f;
2059 guid = unitTarget->GetGUID();
2060 }
2061 }
std::uint8_t uint8
Definition: Define.h:110
T AddPct(T &base, U pct)
Definition: Util.h:67
@ SPELL_DK_GLYPH_OF_SCOURGE_STRIKE
Definition: spell_dk.cpp:37
@ SPELL_DK_ITEM_T8_MELEE_4P_BONUS
Definition: spell_dk.cpp:65
@ EFFECT_0
Definition: SharedDefines.h:31
static ObjectGuid GetGUID(Object const *o)
Definition: Object.h:106
AuraEffect * GetAuraEffect(uint32 spellId, uint8 effIndex, ObjectGuid casterGUID=ObjectGuid::Empty) const
Definition: Unit.cpp:5432
AuraEffect * GetAuraEffectDummy(uint32 spellid) const
Definition: Unit.cpp:5488
Definition: SpellAuraEffects.h:39
int32 GetEffectValue() const
Definition: SpellScript.cpp:600
Unit * GetHitUnit()
Definition: SpellScript.cpp:448

References AddPct(), EFFECT_0, Unit::GetAuraEffect(), Unit::GetAuraEffectDummy(), SpellScript::GetCaster(), SpellScript::GetEffectValue(), Object::GetGUID(), SpellScript::GetHitUnit(), guid, multiplier, SPELL_DK_GLYPH_OF_SCOURGE_STRIKE, and SPELL_DK_ITEM_T8_MELEE_4P_BONUS.

Referenced by Register().

◆ Load()

bool spell_dk_scourge_strike::Load ( )
inlineoverrideprivatevirtual

Reimplemented from _SpellScript.

2035 {
2036 multiplier = 1.0f;
2037 guid.Clear();
2038 return true;
2039 }
void Clear()
Definition: ObjectGuid.h:140

References ObjectGuid::Clear(), guid, and multiplier.

◆ PrepareSpellScript()

spell_dk_scourge_strike::PrepareSpellScript ( spell_dk_scourge_strike  )
private

◆ Register()

void spell_dk_scourge_strike::Register ( )
inlineoverrideprivatevirtual

Implements _SpellScript.

2090 {
2093 }
#define SpellEffectFn(F, I, N)
Definition: SpellScript.h:337
#define SpellHitFn(F)
Definition: SpellScript.h:349
@ EFFECT_2
Definition: SharedDefines.h:33
@ SPELL_EFFECT_DUMMY
Definition: SharedDefines.h:781
HookList< HitHandler > AfterHit
Definition: SpellScript.h:347
HookList< EffectHandler > OnEffectHitTarget
Definition: SpellScript.h:336
void HandleAfterHit()
Definition: spell_dk.cpp:2063
void HandleDummy(SpellEffIndex)
Definition: spell_dk.cpp:2046

References SpellScript::AfterHit, EFFECT_2, HandleAfterHit(), HandleDummy(), SpellScript::OnEffectHitTarget, SPELL_EFFECT_DUMMY, SpellEffectFn, and SpellHitFn.

◆ Validate()

bool spell_dk_scourge_strike::Validate ( SpellInfo const *  )
inlineoverrideprivatevirtual

Reimplemented from _SpellScript.

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

References SPELL_DK_SCOURGE_STRIKE_TRIGGERED, and _SpellScript::ValidateSpellInfo().

Member Data Documentation

◆ guid

ObjectGuid spell_dk_scourge_strike::guid
private

Referenced by HandleAfterHit(), HandleDummy(), and Load().

◆ multiplier

float spell_dk_scourge_strike::multiplier
private

Referenced by HandleAfterHit(), HandleDummy(), and Load().