TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
spell_dk_death_coil::spell_dk_death_coil_SpellScript Class Reference

Private Member Functions

 PrepareSpellScript (spell_dk_death_coil_SpellScript)
 
bool Validate (SpellInfo const *) override
 
void HandleDummy (SpellEffIndex)
 
SpellCastResult CheckCast ()
 
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 constGetSpellInfo ()
 
SpellValue constGetSpellValue ()
 
SpellEffectInfo constGetEffectInfo (SpellEffIndex) const
 
WorldLocation constGetExplTargetDest ()
 
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)
 
SpellEffectInfo constGetEffectInfo () const
 
int32 GetEffectValue () const
 
void SetEffectValue (int32 value)
 
ItemGetCastItem ()
 
void CreateItem (uint32 effIndex, uint32 itemId)
 
SpellInfo constGetTriggeringSpell ()
 
void FinishCast (SpellCastResult result)
 
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 ()
 
- Public Attributes inherited from SpellScript
HookList< CastHandlerBeforeCast
 
HookList< CastHandlerOnCast
 
HookList< CastHandlerAfterCast
 
HookList< CheckCastHandlerOnCheckCast
 
HookList< EffectHandlerOnEffectLaunch
 
HookList< EffectHandlerOnEffectLaunchTarget
 
HookList< EffectHandlerOnEffectHit
 
HookList< EffectHandlerOnEffectHitTarget
 
HookList< EffectHandlerOnEffectSuccessfulDispel
 
HookList< HitHandlerBeforeHit
 
HookList< HitHandlerOnHit
 
HookList< HitHandlerAfterHit
 
HookList
< ObjectAreaTargetSelectHandler
OnObjectAreaTargetSelect
 
HookList
< ObjectTargetSelectHandler
OnObjectTargetSelect
 
HookList
< DestinationTargetSelectHandler
OnDestinationTargetSelect
 
- Protected Attributes inherited from _SpellScript
uint8 m_currentScriptState
 
std::string constm_scriptName
 
uint32 m_scriptSpellId
 

Member Function Documentation

SpellCastResult spell_dk_death_coil::spell_dk_death_coil_SpellScript::CheckCast ( )
inlineprivate
473  {
474  Unit* caster = GetCaster();
475  if (Unit* target = GetExplTargetUnit())
476  {
477  if (!caster->IsFriendlyTo(target) && !caster->isInFront(target))
479 
480  if (target->IsFriendlyTo(caster) && target->GetCreatureType() != CREATURE_TYPE_UNDEAD && !caster->HasAura(SPELL_DK_GLYPH_OF_DEATH_COIL))
482  }
483  else
485 
486  return SPELL_CAST_OK;
487  }
Definition: SharedDefines.h:1421
bool HasAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint32 reqEffMask=0) const
Definition: Unit.cpp:4240
Unit * GetExplTargetUnit()
Definition: SpellScript.cpp:426
Definition: SharedDefines.h:3559
Definition: spell_dk.cpp:58
Definition: SharedDefines.h:1280
bool IsFriendlyTo(Unit const *unit) const
Definition: Unit.cpp:7170
bool isInFront(WorldObject const *target, float arc=float(M_PI)) const
Definition: Object.cpp:1789
Unit * GetCaster()
Definition: SpellScript.cpp:394
Definition: Unit.h:1305
Definition: SharedDefines.h:1538

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void spell_dk_death_coil::spell_dk_death_coil_SpellScript::HandleDummy ( SpellEffIndex  )
inlineprivate
443  {
444  Unit* caster = GetCaster();
445  if (Unit* target = GetHitUnit())
446  {
447  if (caster->IsFriendlyTo(target))
448  {
449  if (target->GetCreatureType() == CREATURE_TYPE_UNDEAD) // Any undead ally, including caster if he has lichborne.
450  {
451  caster->CastSpell(target, SPELL_DK_DEATH_COIL_HEAL, true);
452  }
453  else if (target != caster) // Any non undead ally except caster and only if caster has glyph of death coil.
454  {
455  SpellInfo const* DCD = sSpellMgr->AssertSpellInfo(SPELL_DK_DEATH_COIL_DAMAGE);
456  SpellEffectInfo const* eff = DCD->GetEffect(EFFECT_0);
457  int32 bp = caster->SpellDamageBonusDone(target, DCD, eff->CalcValue(caster), SPELL_DIRECT_DAMAGE, eff);
458 
459  caster->CastCustomSpell(target, SPELL_DK_DEATH_COIL_BARRIER, &bp, nullptr, nullptr, true);
460  }
461  }
462  else // Any enemy target.
463  {
464  caster->CastSpell(target, SPELL_DK_DEATH_COIL_DAMAGE, true);
465  }
466  }
467 
469  caster->CastSpell(caster, SPELL_DK_SHADOW_OF_DEATH, true);
470  }
bool HasAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint32 reqEffMask=0) const
Definition: Unit.cpp:4240
Definition: SpellInfo.h:326
Definition: SharedDefines.h:28
Definition: SharedDefines.h:3559
Definition: spell_dk.cpp:72
Definition: spell_dk.cpp:49
uint32 SpellDamageBonusDone(Unit *victim, SpellInfo const *spellProto, uint32 pdamage, DamageEffectType damagetype, SpellEffectInfo const *effect, uint32 stack=1) const
Definition: Unit.cpp:8212
#define sSpellMgr
Definition: SpellMgr.h:756
Definition: SpellInfo.h:238
Definition: spell_dk.cpp:48
int32_t int32
Definition: Define.h:146
bool IsFriendlyTo(Unit const *unit) const
Definition: Unit.cpp:7170
SpellEffectInfo const * GetEffect(uint32 difficulty, uint32 index) const
Definition: SpellInfo.cpp:3348
int32 CalcValue(Unit const *caster=nullptr, int32 const *basePoints=nullptr, Unit const *target=nullptr, float *variance=nullptr, int32 itemLevel=-1) const
Definition: SpellInfo.cpp:455
Unit * GetCaster()
Definition: SpellScript.cpp:394
Definition: spell_dk.cpp:52
Unit * GetHitUnit()
Definition: SpellScript.cpp:441
Definition: Unit.h:663
Definition: Unit.h:1305
void CastSpell(SpellCastTargets const &targets, SpellInfo const *spellInfo, CustomSpellValues const *value, TriggerCastFlags triggerFlags=TRIGGERED_NONE, Item *castItem=NULL, AuraEffect const *triggeredByAura=NULL, ObjectGuid originalCaster=ObjectGuid::Empty)
Definition: Unit.cpp:869
Definition: spell_dk.cpp:47
void CastCustomSpell(Unit *victim, uint32 spellId, int32 const *bp0, int32 const *bp1, int32 const *bp2, bool triggered, Item *castItem=NULL, AuraEffect const *triggeredByAura=NULL, ObjectGuid originalCaster=ObjectGuid::Empty)
Definition: Unit.cpp:920

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

spell_dk_death_coil::spell_dk_death_coil_SpellScript::PrepareSpellScript ( spell_dk_death_coil_SpellScript  )
private
void spell_dk_death_coil::spell_dk_death_coil_SpellScript::Register ( )
inlineoverrideprivatevirtual

Implements _SpellScript.

490  {
493  }
void HandleDummy(SpellEffIndex)
Definition: spell_dk.cpp:442
Definition: SharedDefines.h:28
SpellCastResult CheckCast()
Definition: spell_dk.cpp:472
#define SpellEffectFn(F, I, N)
Definition: SpellScript.h:297
HookList< EffectHandler > OnEffectHitTarget
Definition: SpellScript.h:295
HookList< CheckCastHandler > OnCheckCast
Definition: SpellScript.h:287
Definition: SharedDefines.h:1013
#define SpellCheckCastFn(F)
Definition: SpellScript.h:288

+ Here is the call graph for this function:

bool spell_dk_death_coil::spell_dk_death_coil_SpellScript::Validate ( SpellInfo const )
inlineoverrideprivatevirtual

Reimplemented from _SpellScript.

436  {
437  if (!sSpellMgr->GetSpellInfo(SPELL_DK_DEATH_COIL_DAMAGE) || !sSpellMgr->GetSpellInfo(SPELL_DK_DEATH_COIL_HEAL) || !sSpellMgr->GetSpellInfo(SPELL_DK_GLYPH_OF_DEATH_COIL))
438  return false;
439  return true;
440  }
Definition: spell_dk.cpp:58
Definition: spell_dk.cpp:49
#define sSpellMgr
Definition: SpellMgr.h:756
Definition: spell_dk.cpp:48

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