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

◆ CheckCast()

SpellCastResult spell_dk_death_grip::CheckCast ( )
inlineprivate
1272 {
1273 Unit* caster = GetCaster();
1274 Unit* target = GetExplTargetUnit();
1275
1276 if (target->GetTypeId() == TYPEID_PLAYER && caster->GetExactDist(target) < 8.0f) // xinef: should be 8.0f, but we have to add target size (1.5f)
1278
1280 return SPELL_FAILED_MOVING;
1281
1282 return SPELL_CAST_OK;
1283 }
@ TYPEID_PLAYER
Definition: ObjectGuid.h:38
@ MOVEMENTFLAG_FALLING
Definition: Unit.h:564
@ UNIT_STATE_JUMPING
Definition: Unit.h:343
@ SPELL_FAILED_MOVING
Definition: SharedDefines.h:972
@ SPELL_FAILED_TOO_CLOSE
Definition: SharedDefines.h:1049
@ SPELL_CAST_OK
Definition: SharedDefines.h:1110
TypeID GetTypeId() const
Definition: Object.h:121
float GetExactDist(float x, float y, float z) const
Definition: Position.h:178
Definition: Unit.h:1290
bool HasUnitMovementFlag(uint32 f) const
Definition: Unit.h:2274
bool HasUnitState(const uint32 f) const
Definition: Unit.h:1398
Unit * GetExplTargetUnit()
Definition: SpellScript.cpp:433
Unit * GetCaster()
Definition: SpellScript.cpp:401

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

Referenced by Register().

◆ EntryCheck()

uint32 spell_dk_death_grip::EntryCheck ( uint32  entry)
inlineprivate
1286 {
1287 Creature* targetCreature = GetHitCreature();
1288
1289 switch (targetCreature->GetEntry())
1290 {
1291 //Alliance Faction Champions
1292 case 34461:
1293 case 34460:
1294 case 34469:
1295 case 34467:
1296 case 34468:
1297 case 34465:
1298 case 34471:
1299 case 34466:
1300 case 34473:
1301 case 34472:
1302 case 34470:
1303 case 34463:
1304 case 34474:
1305 case 34475:
1306
1307 //Horde Faction Champions
1308 case 34458:
1309 case 34451:
1310 case 34459:
1311 case 34448:
1312 case 34449:
1313 case 34445:
1314 case 34456:
1315 case 34447:
1316 case 34441:
1317 case 34454:
1318 case 34444:
1319 case 34455:
1320 case 34450:
1321 case 34453:
1322 return entry;
1323 break;
1324 }
1325 return 0;
1326 }
Definition: Creature.h:46
uint32 GetEntry() const
Definition: Object.h:109
Creature * GetHitCreature()
Definition: SpellScript.cpp:458

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

Referenced by HandleBaseDummy().

◆ HandleBaseDummy()

void spell_dk_death_grip::HandleBaseDummy ( SpellEffIndex  )
inlineprivate
1329 {
1330 Unit* caster = GetCaster();
1331 Unit* target = GetHitUnit();
1332 Unit* baseTarget = GetExplTargetUnit();
1333 Creature* targetCreature = GetHitCreature();
1334
1335 if (caster != target)
1336 {
1337 if (targetCreature && (targetCreature->isWorldBoss() || targetCreature->IsDungeonBoss()) && targetCreature->GetEntry() != EntryCheck(targetCreature->GetEntry()))
1338 {
1339 return;
1340 }
1341 else
1342 {
1343 caster->CastSpell(target, 49560, true);
1344 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(1766); // Rogue kick
1345 if (!target->IsImmunedToSpellEffect(spellInfo, EFFECT_0))
1346 target->InterruptNonMeleeSpells(true);
1347 }
1348 }
1349 else
1350 baseTarget->CastSpell(caster, 49560, true);
1351 }
#define sSpellMgr
Definition: SpellMgr.h:818
@ EFFECT_0
Definition: SharedDefines.h:30
bool IsDungeonBoss() const
Definition: Creature.cpp:3063
bool isWorldBoss() const
Definition: Creature.h:115
void InterruptNonMeleeSpells(bool withDelayed, uint32 spellid=0, bool withInstant=true, bool bySelf=false)
Definition: Unit.cpp:4069
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
virtual bool IsImmunedToSpellEffect(SpellInfo const *spellInfo, uint32 index) const
Definition: Unit.cpp:12917
Definition: SpellInfo.h:314
Unit * GetHitUnit()
Definition: SpellScript.cpp:448
uint32 EntryCheck(uint32 entry)
Definition: spell_dk.cpp:1285

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
1354 {
1355 float casterZ = GetCaster()->GetPositionZ(); // for Ring of Valor
1356 WorldLocation gripPos = *GetExplTargetDest();
1357 if (Unit* target = GetHitUnit())
1358 if (!target->HasAuraType(SPELL_AURA_DEFLECT_SPELLS) || target->HasUnitState(UNIT_STATE_STUNNED)) // Deterrence
1359 {
1360 if (target != GetCaster())
1361 {
1362 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(1766); // Rogue kick
1363 if (!target->IsImmunedToSpellEffect(spellInfo, EFFECT_0))
1364 target->InterruptNonMeleeSpells(false, 0, false);
1365 }
1366
1367 if (target->GetMapId() == 618) // for Ring of Valor
1368 gripPos.m_positionZ = std::max(casterZ + 0.2f, 28.5f);
1369
1370 target->CastSpell(gripPos.GetPositionX(), gripPos.GetPositionY(), gripPos.GetPositionZ(), 57604, true);
1371 }
1372 }
@ UNIT_STATE_STUNNED
Definition: Unit.h:328
@ SPELL_AURA_DEFLECT_SPELLS
Definition: SpellAuraDefines.h:350
float m_positionZ
Definition: Position.h:58
float GetPositionZ() const
Definition: Position.h:119
float GetPositionX() const
Definition: Position.h:117
float GetPositionY() const
Definition: Position.h:118
Definition: Position.h:251
WorldLocation const * GetExplTargetDest()
Definition: SpellScript.cpp:416

References EFFECT_0, SpellScript::GetCaster(), SpellScript::GetExplTargetDest(), SpellScript::GetHitUnit(), Position::GetPositionX(), Position::GetPositionY(), Position::GetPositionZ(), Position::m_positionZ, SPELL_AURA_DEFLECT_SPELLS, 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.

1375 {
1376 if (m_scriptSpellId == 49576) // xinef: base death grip, add pvp range restriction
1377 {
1380 }
1381 else
1383 }
#define SpellCheckCastFn(F)
Definition: SpellScript.h:329
#define SpellEffectFn(F, I, N)
Definition: SpellScript.h:337
@ SPELL_EFFECT_DUMMY
Definition: SharedDefines.h:753
uint32 m_scriptSpellId
Definition: SpellScript.h:107
HookList< CheckCastHandler > OnCheckCast
Definition: SpellScript.h:328
HookList< EffectHandler > OnEffectHitTarget
Definition: SpellScript.h:336
void HandleDummy(SpellEffIndex)
Definition: spell_dk.cpp:1353
void HandleBaseDummy(SpellEffIndex)
Definition: spell_dk.cpp:1328
SpellCastResult CheckCast()
Definition: spell_dk.cpp:1271

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