AzeorthCore 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
1999 {
2000 Unit* caster = GetCaster();
2001 if (Unit* unitTarget = ObjectAccessor::GetUnit(*caster, guid))
2002 {
2003 int32 bp = GetHitDamage() * multiplier;
2004 caster->CastCustomSpell(unitTarget, SPELL_DK_SCOURGE_STRIKE_TRIGGERED, &bp, nullptr, nullptr, true);
2005
2006 // Xinef: Shadowmourne hack (scourge strike trigger proc disabled...)
2007 if (roll_chance_i(75) && caster->FindMap() && !caster->FindMap()->IsBattlegroundOrArena() && caster->HasAura(71903) && !caster->HasAura(SPELL_SHADOWMOURNE_CHAOS_BANE_BUFF))
2008 {
2009 caster->CastSpell(caster, SPELL_SHADOWMOURNE_SOUL_FRAGMENT, true);
2010
2011 // this can't be handled in AuraScript of SoulFragments because we need to know victim
2012 if (Aura* soulFragments = caster->GetAura(SPELL_SHADOWMOURNE_SOUL_FRAGMENT))
2013 {
2014 if (soulFragments->GetStackAmount() >= 10)
2015 {
2016 caster->CastSpell(caster, SPELL_SHADOWMOURNE_CHAOS_BANE_DAMAGE, true, nullptr);
2017 soulFragments->Remove();
2018 }
2019 }
2020 }
2021 }
2022 }
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:204
Map * FindMap() const
Definition: Object.h:518
Definition: Unit.h:1290
Aura * GetAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0) const
Definition: Unit.cpp:6343
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:1521
bool HasAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0) const
Definition: Unit.cpp:6454
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:1428
bool IsBattlegroundOrArena() const
Definition: Map.h:455
Definition: SpellAuras.h:87
Unit * GetCaster()
Definition: SpellScript.cpp:401
int32 GetHitDamage()
Definition: SpellScript.cpp:514
float multiplier
Definition: spell_dk.cpp:1966
ObjectGuid guid
Definition: spell_dk.cpp:1967

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
1982 {
1983 Unit* caster = GetCaster();
1984 if (Unit* unitTarget = GetHitUnit())
1985 {
1987 float disease_amt = GetEffectValue();
1988
1989 // Death Knight T8 Melee 4P Bonus
1991 AddPct(disease_amt, aurEff->GetAmount());
1992
1993 multiplier = disease_amt * unitTarget->GetDiseasesByCaster(caster->GetGUID(), mode) / 100.0f;
1994 guid = unitTarget->GetGUID();
1995 }
1996 }
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:30
static ObjectGuid GetGUID(Object const *o)
Definition: Object.h:106
AuraEffect * GetAuraEffect(uint32 spellId, uint8 effIndex, ObjectGuid casterGUID=ObjectGuid::Empty) const
Definition: Unit.cpp:6256
AuraEffect * GetAuraEffectDummy(uint32 spellid) const
Definition: Unit.cpp:6312
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.

1970 {
1971 multiplier = 1.0f;
1972 guid.Clear();
1973 return true;
1974 }
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.

2025 {
2028 }
#define SpellEffectFn(F, I, N)
Definition: SpellScript.h:337
#define SpellHitFn(F)
Definition: SpellScript.h:349
@ EFFECT_2
Definition: SharedDefines.h:32
@ SPELL_EFFECT_DUMMY
Definition: SharedDefines.h:753
HookList< HitHandler > AfterHit
Definition: SpellScript.h:347
HookList< EffectHandler > OnEffectHitTarget
Definition: SpellScript.h:336
void HandleAfterHit()
Definition: spell_dk.cpp:1998
void HandleDummy(SpellEffIndex)
Definition: spell_dk.cpp:1981

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.

1977 {
1979 }
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().