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

Private Member Functions

 PrepareSpellScript (spell_dk_death_grip)
 
SpellCastResult CheckCast ()
 
uint32 EntryCheck (uint32 entry)
 
void HandleBaseDummy (SpellEffIndex)
 
void HandleDummy (SpellEffIndex)
 
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 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< 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

◆ CheckCast()

SpellCastResult spell_dk_death_grip::CheckCast ( )
inlineprivate
1472 {
1473 Unit* caster = GetCaster();
1474 Unit* target = GetExplTargetUnit();
1475
1476 if (target->IsPlayer() && caster->GetExactDist(target) < 8.0f) // xinef: should be 8.0f, but we have to add target size (1.5f)
1478
1480 return SPELL_FAILED_MOVING;
1481
1482 return SPELL_CAST_OK;
1483 }
@ SPELL_FAILED_MOVING
Definition SharedDefines.h:988
@ SPELL_FAILED_TOO_CLOSE
Definition SharedDefines.h:1065
@ SPELL_CAST_OK
Definition SharedDefines.h:1126
@ MOVEMENTFLAG_FALLING
Definition UnitDefines.h:384
@ UNIT_STATE_JUMPING
Definition UnitDefines.h:191
bool IsPlayer() const
Definition Object.h:207
Unit * GetExplTargetUnit()
Definition SpellScript.cpp:438
Unit * GetCaster()
Definition SpellScript.cpp:401
Definition Unit.h:667
bool HasUnitMovementFlag(uint32 f) const
Definition Unit.h:777
bool HasUnitState(const uint32 f) const
Definition Unit.h:739
float GetExactDist(float x, float y, float z) const
Definition Position.h:182

References SpellScript::GetCaster(), Position::GetExactDist(), SpellScript::GetExplTargetUnit(), Unit::HasUnitMovementFlag(), Unit::HasUnitState(), Object::IsPlayer(), MOVEMENTFLAG_FALLING, SPELL_CAST_OK, SPELL_FAILED_MOVING, SPELL_FAILED_TOO_CLOSE, and UNIT_STATE_JUMPING.

Referenced by Register().

◆ EntryCheck()

uint32 spell_dk_death_grip::EntryCheck ( uint32  entry)
inlineprivate
1486 {
1487 Creature* targetCreature = GetHitCreature();
1488
1489 switch (targetCreature->GetEntry())
1490 {
1491 //Alliance Faction Champions
1492 case 34461:
1493 case 34460:
1494 case 34469:
1495 case 34467:
1496 case 34468:
1497 case 34465:
1498 case 34471:
1499 case 34466:
1500 case 34473:
1501 case 34472:
1502 case 34470:
1503 case 34463:
1504 case 34474:
1505 case 34475:
1506
1507 //Horde Faction Champions
1508 case 34458:
1509 case 34451:
1510 case 34459:
1511 case 34448:
1512 case 34449:
1513 case 34445:
1514 case 34456:
1515 case 34447:
1516 case 34441:
1517 case 34454:
1518 case 34444:
1519 case 34455:
1520 case 34450:
1521 case 34453:
1522 return entry;
1523 break;
1524 }
1525 return 0;
1526 }
Definition Creature.h:47
uint32 GetEntry() const
Definition Object.h:123
Creature * GetHitCreature()
Definition SpellScript.cpp:463

References Object::GetEntry(), and SpellScript::GetHitCreature().

Referenced by HandleBaseDummy().

◆ HandleBaseDummy()

void spell_dk_death_grip::HandleBaseDummy ( SpellEffIndex  )
inlineprivate
1529 {
1530 Unit* caster = GetCaster();
1531 Unit* target = GetHitUnit();
1532 Unit* baseTarget = GetExplTargetUnit();
1533 Creature* targetCreature = GetHitCreature();
1534
1535 if (caster != target)
1536 {
1537 if (targetCreature && (targetCreature->isWorldBoss() || targetCreature->IsDungeonBoss()) && targetCreature->GetEntry() != EntryCheck(targetCreature->GetEntry()))
1538 {
1539 return;
1540 }
1541 else
1542 {
1543 caster->CastSpell(target, 49560, true);
1544 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(1766); // Rogue kick
1545 if (!target->IsImmunedToSpellEffect(spellInfo, EFFECT_0))
1546 target->InterruptNonMeleeSpells(true);
1547 }
1548 }
1549 else
1550 baseTarget->CastSpell(caster, 49560, true);
1551 }
@ EFFECT_0
Definition SharedDefines.h:31
#define sSpellMgr
Definition SpellMgr.h:847
bool IsDungeonBoss() const
Definition Creature.cpp:3356
bool isWorldBoss() const
Definition Creature.h:124
Definition SpellInfo.h:340
Unit * GetHitUnit()
Definition SpellScript.cpp:453
void InterruptNonMeleeSpells(bool withDelayed, uint32 spellid=0, bool withInstant=true, bool bySelf=false)
Definition Unit.cpp:4047
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
virtual bool IsImmunedToSpellEffect(SpellInfo const *spellInfo, uint32 index, WorldObject const *caster=nullptr) const
Definition Unit.cpp:9859
uint32 EntryCheck(uint32 entry)
Definition spell_dk.cpp:1485

References Unit::CastSpell(), EFFECT_0, EntryCheck(), SpellScript::GetCaster(), Object::GetEntry(), SpellScript::GetExplTargetUnit(), SpellScript::GetHitCreature(), SpellScript::GetHitUnit(), Unit::InterruptNonMeleeSpells(), Creature::IsDungeonBoss(), Unit::IsImmunedToSpellEffect(), Creature::isWorldBoss(), and sSpellMgr.

Referenced by Register().

◆ HandleDummy()

void spell_dk_death_grip::HandleDummy ( SpellEffIndex  )
inlineprivate
1554 {
1555 float casterZ = GetCaster()->GetPositionZ(); // for Ring of Valor
1556 WorldLocation gripPos = *GetExplTargetDest();
1557 if (Unit* target = GetHitUnit())
1558 if (!target->HasDetectSpellsAura() || target->HasUnitState(UNIT_STATE_STUNNED)) // Deterrence
1559 {
1560 if (target != GetCaster())
1561 {
1562 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(1766); // Rogue kick
1563 if (!target->IsImmunedToSpellEffect(spellInfo, EFFECT_0))
1564 target->InterruptNonMeleeSpells(false, 0, false);
1565 }
1566
1567 if (target->GetMapId() == MAP_THE_RING_OF_VALOR)
1568 gripPos.m_positionZ = std::max(casterZ + 0.2f, 28.5f);
1569
1570 target->CastSpell(gripPos.GetPositionX(), gripPos.GetPositionY(), gripPos.GetPositionZ(), 57604, true);
1571 }
1572 }
@ MAP_THE_RING_OF_VALOR
Definition AreaDefines.h:265
@ UNIT_STATE_STUNNED
Definition UnitDefines.h:176
WorldLocation const * GetExplTargetDest()
Definition SpellScript.cpp:421
Definition Position.h:256
float m_positionZ
Definition Position.h:57
float GetPositionZ() const
Definition Position.h:123
float GetPositionX() const
Definition Position.h:121
float GetPositionY() const
Definition Position.h:122

References EFFECT_0, SpellScript::GetCaster(), SpellScript::GetExplTargetDest(), SpellScript::GetHitUnit(), Position::GetPositionX(), Position::GetPositionY(), Position::GetPositionZ(), Position::m_positionZ, MAP_THE_RING_OF_VALOR, sSpellMgr, and UNIT_STATE_STUNNED.

Referenced by Register().

◆ PrepareSpellScript()

spell_dk_death_grip::PrepareSpellScript ( spell_dk_death_grip  )
private

◆ Register()

void spell_dk_death_grip::Register ( )
inlineoverrideprivatevirtual

Implements _SpellScript.

1575 {
1576 if (m_scriptSpellId == 49576) // xinef: base death grip, add pvp range restriction
1577 {
1580 }
1581 else
1583 }
@ SPELL_EFFECT_DUMMY
Definition SharedDefines.h:769
#define SpellCheckCastFn(F)
Definition SpellScript.h:329
#define SpellEffectFn(F, I, N)
Definition SpellScript.h:337
HookList< CheckCastHandler > OnCheckCast
Definition SpellScript.h:328
HookList< EffectHandler > OnEffectHitTarget
Definition SpellScript.h:336
uint32 m_scriptSpellId
Definition SpellScript.h:107
void HandleDummy(SpellEffIndex)
Definition spell_dk.cpp:1553
void HandleBaseDummy(SpellEffIndex)
Definition spell_dk.cpp:1528
SpellCastResult CheckCast()
Definition spell_dk.cpp:1471

References CheckCast(), EFFECT_0, HandleBaseDummy(), HandleDummy(), _SpellScript::m_scriptSpellId, SpellScript::OnCheckCast, SpellScript::OnEffectHitTarget, SPELL_EFFECT_DUMMY, SpellCheckCastFn, and SpellEffectFn.


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