mirror of
https://github.com/ornfelt/azerothcore_lua_scripts
synced 2026-08-22 06:26:03 -04:00
252 lines
8.9 KiB
Diff
252 lines
8.9 KiB
Diff
From fcfbfbc9a30cb3e678d6c2adfaf0e1b09f6b5727 Mon Sep 17 00:00:00 2001
|
|
From: Vstar <vstar0v0@hotmail.com>
|
|
Date: Sun, 10 Nov 2013 09:48:32 +0800
|
|
Subject: [PATCH 2/2] Gary cc delay
|
|
|
|
---
|
|
src/server/game/Spells/Spell.cpp | 201 ++++++++++++++++++++++++++++++++++++++-
|
|
src/server/game/Spells/Spell.h | 2 +
|
|
2 files changed, 201 insertions(+), 2 deletions(-)
|
|
|
|
diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp
|
|
index a28d4d8..290abac 100644
|
|
--- a/src/server/game/Spells/Spell.cpp
|
|
+++ b/src/server/game/Spells/Spell.cpp
|
|
@@ -2215,7 +2215,11 @@ void Spell::AddUnitTarget(Unit* target, uint32 effectMask, bool checkIfValid /*=
|
|
m_delayMoment = targetInfo.timeDelay;
|
|
}
|
|
else
|
|
- targetInfo.timeDelay = 0LL;
|
|
+ {
|
|
+ targetInfo.timeDelay = GetCCDelay(m_spellInfo);
|
|
+ if (m_delayMoment == 0 || m_delayMoment > targetInfo.timeDelay)
|
|
+ m_delayMoment = targetInfo.timeDelay;
|
|
+ }
|
|
|
|
// If target reflect spell back to caster
|
|
if (targetInfo.missCondition == SPELL_MISS_REFLECT)
|
|
@@ -3315,7 +3319,7 @@ void Spell::cast(bool skipCheck)
|
|
SendSpellGo();
|
|
|
|
// Okay, everything is prepared. Now we need to distinguish between immediate and evented delayed spells
|
|
- if ((m_spellInfo->Speed > 0.0f && !m_spellInfo->IsChanneled()) || m_spellInfo->AttributesEx4 & SPELL_ATTR4_UNK4)
|
|
+ if (((m_spellInfo->Speed > 0.0f || GetCCDelay(m_spellInfo) > 0) && !m_spellInfo->IsChanneled()) || m_spellInfo->Id == 14157 || m_spellInfo->Id == 70802)
|
|
{
|
|
// Remove used for cast item if need (it can be already NULL after TakeReagents call
|
|
// in case delayed spell remove item at cast delay start
|
|
@@ -5593,6 +5597,199 @@ SpellCastResult Spell::CheckPetCast(Unit* target)
|
|
return CheckCast(true);
|
|
}
|
|
|
|
+uint32 Spell::GetCCDelay(SpellInfo const* _spell)
|
|
+{
|
|
+ // CCD for spell with auras
|
|
+ AuraType auraWithCCD[] =
|
|
+ {
|
|
+ SPELL_AURA_MOD_STUN,
|
|
+ SPELL_AURA_MOD_CONFUSE,
|
|
+ SPELL_AURA_MOD_FEAR,
|
|
+ SPELL_AURA_MOD_SILENCE,
|
|
+ SPELL_AURA_MOD_DISARM,
|
|
+ SPELL_AURA_MOD_ROOT,
|
|
+ SPELL_AURA_MOD_POSSESS
|
|
+ };
|
|
+ uint8 CCDArraySize = 7;
|
|
+
|
|
+ const uint32 delayForRoots = 0; // currently unused
|
|
+ const uint32 delayForStuns = 50;
|
|
+ const uint32 delayForDisarms = 0; // currently unused
|
|
+ const uint32 delayForDisorients = 100;
|
|
+ const uint32 delayForFears = 100;
|
|
+ const uint32 delayForHorrors = 50;
|
|
+ const uint32 delayForOpenerStuns = 70;
|
|
+ const uint32 delayForScatters = 100;
|
|
+ const uint32 delayForBanishes = 50;
|
|
+ const uint32 NOdelayForInstantSpells = 0;
|
|
+
|
|
+ switch(_spell->SpellFamilyName)
|
|
+ {
|
|
+ case SPELLFAMILY_DEATHKNIGHT:
|
|
+ // Death Grip
|
|
+ if (_spell->Id == 49576)
|
|
+ return NOdelayForInstantSpells;
|
|
+ // Hungering Cold
|
|
+ if (_spell->Id == 49203)
|
|
+ return delayForDisorients;
|
|
+ // Gnaw (ghoul's stun)
|
|
+ if (_spell->Id == 47481)
|
|
+ return delayForStuns;
|
|
+ break;
|
|
+ case SPELLFAMILY_DRUID:
|
|
+ // Bash
|
|
+ if (_spell->Id == 5211)
|
|
+ return delayForStuns;
|
|
+ // Cyclone
|
|
+ if (_spell->Id == 33786)
|
|
+ return delayForBanishes;
|
|
+ // Hibernate
|
|
+ if (_spell->Id == 2637)
|
|
+ return delayForDisorients;
|
|
+ // Feral charge
|
|
+ if (_spell->Id == 45334)
|
|
+ return NOdelayForInstantSpells;
|
|
+ // Maim
|
|
+ if (_spell->Id == 22570)
|
|
+ return delayForStuns;
|
|
+ // Pounce
|
|
+ if (_spell->Id == 9005)
|
|
+ return delayForOpenerStuns;
|
|
+ break;
|
|
+ case SPELLFAMILY_HUNTER: // TODO all pet's cc
|
|
+ // Traps
|
|
+ if (_spell->SpellFamilyFlags[0] & 0x8 || // Frozen trap
|
|
+ _spell->Id == 57879 || // Snake Trap
|
|
+ _spell->SpellFamilyFlags[2] & 0x00024000) // Explosive and Immolation Trap
|
|
+ return 0;
|
|
+ // Entrapment
|
|
+ if (_spell->SpellIconID == 20)
|
|
+ return 0;
|
|
+ // Scatter Shot
|
|
+ if (_spell->Id == 19503)
|
|
+ return delayForScatters;
|
|
+ // Wyvern Sting
|
|
+ if (_spell->Id == 19386)
|
|
+ return delayForDisorients;
|
|
+ break;
|
|
+ case SPELLFAMILY_MAGE:
|
|
+ // Deep Freeze
|
|
+ if (_spell->Id == 44572)
|
|
+ return delayForStuns;
|
|
+ // Dragon Breath
|
|
+ if (_spell->Id == 42950)
|
|
+ return delayForDisorients;
|
|
+ // Impact
|
|
+ if (_spell->Id == 64343)
|
|
+ return delayForStuns;
|
|
+ // Polymorph
|
|
+ if (_spell->Id == 12826)
|
|
+ return delayForDisorients;
|
|
+ break;
|
|
+ case SPELLFAMILY_PALADIN:
|
|
+ // Hammer of Justice
|
|
+ if (_spell->Id == 853)
|
|
+ return delayForStuns;
|
|
+ // Repentance
|
|
+ if (_spell->Id == 20066)
|
|
+ return delayForDisorients;
|
|
+ // Turn Evil
|
|
+ if (_spell->Id == 10326)
|
|
+ return delayForFears;
|
|
+ break;
|
|
+ case SPELLFAMILY_PRIEST:
|
|
+ // Psychic Scream
|
|
+ if (_spell->Id == 10890)
|
|
+ return delayForFears;
|
|
+ // Mind Control
|
|
+ if (_spell->Id == 605)
|
|
+ return delayForBanishes;
|
|
+ // Psychic Horror
|
|
+ if (_spell->Id == 64044)
|
|
+ return delayForHorrors;
|
|
+ // Shackle Undead
|
|
+ if (_spell->Id == 9484)
|
|
+ return delayForDisorients;
|
|
+ break;
|
|
+ case SPELLFAMILY_ROGUE:
|
|
+ // Blind
|
|
+ if (_spell->Id == 2094)
|
|
+ return delayForDisorients;
|
|
+ // CheapShot
|
|
+ if (_spell->Id == 1833)
|
|
+ return delayForOpenerStuns;
|
|
+ // Gouge
|
|
+ if (_spell->Id == 1776)
|
|
+ return delayForDisorients;
|
|
+ // Kidney Shot
|
|
+ if (_spell->Id == 408)
|
|
+ return delayForStuns;
|
|
+ // Sap
|
|
+ if (_spell->Id == 6770)
|
|
+ return delayForDisorients;
|
|
+ break;
|
|
+ case SPELLFAMILY_SHAMAN:
|
|
+ // Hex
|
|
+ if (_spell->Id == 51514)
|
|
+ return delayForDisorients;
|
|
+ break;
|
|
+ case SPELLFAMILY_WARLOCK: // TODO felguard's intercept(27826?), seduction
|
|
+ // Banish
|
|
+ if (_spell->Id == 710)
|
|
+ return delayForBanishes;
|
|
+ // DeathCoil
|
|
+ if (_spell->Id == 27223)
|
|
+ return delayForHorrors;
|
|
+ // Demon charge
|
|
+ if (_spell->Id == 60995) // might use 54785 - req testing
|
|
+ return delayForStuns;
|
|
+ // Fear
|
|
+ if (_spell->Id == 5782)
|
|
+ return delayForFears;
|
|
+ // Howl of Terror
|
|
+ if (_spell->Id == 5484)
|
|
+ return delayForFears;
|
|
+ // Shadowfury
|
|
+ if (_spell->Id == 30283)
|
|
+ return delayForStuns;
|
|
+ // Spell Lock - Debuff
|
|
+ if (_spell->Id == 24259)
|
|
+ return NOdelayForInstantSpells;
|
|
+ break;
|
|
+ case SPELLFAMILY_WARRIOR:
|
|
+ // Charge
|
|
+ if (_spell->Id == 7922)
|
|
+ return delayForOpenerStuns;
|
|
+ // Charge trig.
|
|
+ if (_spell->Id == 65929)
|
|
+ return delayForStuns;
|
|
+ // Concussion Blow
|
|
+ if (_spell->Id == 12809)
|
|
+ return delayForStuns;
|
|
+ // Intercept
|
|
+ if (_spell->Id == 20253)
|
|
+ return delayForStuns;
|
|
+ // Intimidating Shout
|
|
+ if (_spell->Id == 20511)
|
|
+ return delayForFears;
|
|
+ // Shockwave
|
|
+ if (_spell->Id == 46968)
|
|
+ return delayForStuns;
|
|
+ break;
|
|
+ case SPELLFAMILY_GENERIC: // is that ok?!
|
|
+ // War Stomp - Tauren's racial
|
|
+ if (_spell->Id == 46026)
|
|
+ return delayForStuns;
|
|
+ break;
|
|
+ }
|
|
+
|
|
+ for (uint8 i = 0; i < CCDArraySize; ++i)
|
|
+ if (_spell->HasAura(auraWithCCD[i]))
|
|
+ return NOdelayForInstantSpells;
|
|
+
|
|
+ return 0;
|
|
+}
|
|
+
|
|
SpellCastResult Spell::CheckCasterAuras() const
|
|
{
|
|
// spells totally immuned to caster auras (wsg flag drop, give marks etc)
|
|
diff --git a/src/server/game/Spells/Spell.h b/src/server/game/Spells/Spell.h
|
|
index 927ecd3..37b00b4 100644
|
|
--- a/src/server/game/Spells/Spell.h
|
|
+++ b/src/server/game/Spells/Spell.h
|
|
@@ -387,6 +387,8 @@ class Spell
|
|
SpellCastResult CheckCast(bool strict);
|
|
SpellCastResult CheckPetCast(Unit* target);
|
|
|
|
+ static uint32 GetCCDelay(SpellInfo const* _spell);
|
|
+
|
|
// handlers
|
|
void handle_immediate();
|
|
uint64 handle_delayed(uint64 t_offset);
|
|
--
|
|
1.8.3.msysgit.0
|
|
|