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

◆ HandleAfterHit()

void spell_dk_scourge_strike::HandleAfterHit ( )
inlineprivate
2274 {
2275 Unit* caster = GetCaster();
2276 if (Unit* unitTarget = ObjectAccessor::GetUnit(*caster, guid))
2277 {
2278 int32 bp = GetHitDamage() * multiplier;
2279 caster->CastCustomSpell(unitTarget, SPELL_DK_SCOURGE_STRIKE_TRIGGERED, &bp, nullptr, nullptr, true);
2280
2281 // Xinef: Shadowmourne hack (scourge strike trigger proc disabled...)
2282 if (roll_chance_i(75) && caster->FindMap() && !caster->FindMap()->IsBattlegroundOrArena() && caster->HasAura(71903) && !caster->HasAura(SPELL_SHADOWMOURNE_CHAOS_BANE_BUFF))
2283 {
2284 caster->CastSpell(caster, SPELL_SHADOWMOURNE_SOUL_FRAGMENT, true);
2285
2286 // this can't be handled in AuraScript of SoulFragments because we need to know victim
2287 if (Aura* soulFragments = caster->GetAura(SPELL_SHADOWMOURNE_SOUL_FRAGMENT))
2288 {
2289 if (soulFragments->GetStackAmount() >= 10)
2290 {
2291 caster->CastSpell(caster, SPELL_SHADOWMOURNE_CHAOS_BANE_DAMAGE, true, nullptr);
2292 soulFragments->Remove();
2293 }
2294 }
2295 }
2296 }
2297 }
std::int32_t int32
Definition Define.h:103
bool roll_chance_i(int chance)
Definition Random.h:63
Definition SpellAuras.h:88
bool IsBattlegroundOrArena() const
Definition Map.h:307
Unit * GetCaster()
Definition SpellScript.cpp:401
int32 GetHitDamage()
Definition SpellScript.cpp:519
Definition Unit.h:667
Aura * GetAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0) const
Definition Unit.cpp:5624
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:1429
bool HasAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0) const
Definition Unit.cpp:5764
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:1372
Map * FindMap() const
Definition Object.h:638
float multiplier
Definition spell_dk.cpp:2241
ObjectGuid guid
Definition spell_dk.cpp:2242
Unit * GetUnit(WorldObject const &, ObjectGuid const &guid)
Definition ObjectAccessor.cpp:223
@ SPELL_DK_SCOURGE_STRIKE_TRIGGERED
Definition spell_dk.cpp:72
@ 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

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
2257 {
2258 Unit* caster = GetCaster();
2259 if (Unit* unitTarget = GetHitUnit())
2260 {
2262 float disease_amt = GetEffectValue();
2263
2264 // Death Knight T8 Melee 4P Bonus
2266 AddPct(disease_amt, aurEff->GetAmount());
2267
2268 multiplier = disease_amt * unitTarget->GetDiseasesByCaster(caster->GetGUID(), mode) / 100.0f;
2269 guid = unitTarget->GetGUID();
2270 }
2271 }
std::uint8_t uint8
Definition Define.h:109
@ EFFECT_0
Definition SharedDefines.h:31
T AddPct(T &base, U pct)
Definition Util.h:58
Definition SpellAuraEffects.h:39
static ObjectGuid GetGUID(Object const *o)
Definition Object.h:120
int32 GetEffectValue() const
Definition SpellScript.cpp:605
Unit * GetHitUnit()
Definition SpellScript.cpp:453
AuraEffect * GetAuraEffect(uint32 spellId, uint8 effIndex, ObjectGuid casterGUID=ObjectGuid::Empty) const
Definition Unit.cpp:5537
AuraEffect * GetAuraEffectDummy(uint32 spellid) const
Definition Unit.cpp:5593
@ SPELL_DK_GLYPH_OF_SCOURGE_STRIKE
Definition spell_dk.cpp:37
@ SPELL_DK_ITEM_T8_MELEE_4P_BONUS
Definition spell_dk.cpp:66

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.

2245 {
2246 multiplier = 1.0f;
2247 guid.Clear();
2248 return true;
2249 }
void Clear()
Definition ObjectGuid.h:141

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.

2300 {
2303 }
@ EFFECT_2
Definition SharedDefines.h:33
@ SPELL_EFFECT_DUMMY
Definition SharedDefines.h:769
#define SpellEffectFn(F, I, N)
Definition SpellScript.h:337
#define SpellHitFn(F)
Definition SpellScript.h:349
HookList< HitHandler > AfterHit
Definition SpellScript.h:347
HookList< EffectHandler > OnEffectHitTarget
Definition SpellScript.h:336
void HandleAfterHit()
Definition spell_dk.cpp:2273
void HandleDummy(SpellEffIndex)
Definition spell_dk.cpp:2256

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.

2252 {
2254 }
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().


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