Created
May 21, 2012 15:47
-
-
Save walkline/2762988 to your computer and use it in GitHub Desktop.
CCD
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From 8134c487669745b74d09b2cc4333cdccc240d26f Mon Sep 17 00:00:00 2001 | |
From: walkline <walkline.ua@gmail.com> | |
Date: Mon, 21 May 2012 18:45:30 +0300 | |
Subject: [PATCH] Implemented Crowd Control Delay. | |
--- | |
src/server/game/Spells/Spell.cpp | 55 ++++++++++++++++++++++++++++++++++++- | |
src/server/game/Spells/Spell.h | 2 + | |
2 files changed, 55 insertions(+), 2 deletions(-) | |
diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp | |
index 1ecee94..322b497 100755 | |
--- a/src/server/game/Spells/Spell.cpp | |
+++ b/src/server/game/Spells/Spell.cpp | |
@@ -2165,7 +2165,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) | |
@@ -3246,7 +3250,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->Id == 14157) | |
+ if (((m_spellInfo->Speed > 0.0f || GetCCDelay(m_spellInfo) > 0) && !m_spellInfo->IsChanneled()) || m_spellInfo->Id == 14157) | |
{ | |
// 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 | |
@@ -5601,6 +5605,53 @@ 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_POSSESS | |
+ }; | |
+ uint8 CCDArraySize = 6; | |
+ | |
+ const uint32 delayForInstantSpells = 200; | |
+ | |
+ switch(_spell->SpellFamilyName) | |
+ { | |
+ case SPELLFAMILY_HUNTER: | |
+ // 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; | |
+ break; | |
+ case SPELLFAMILY_DEATHKNIGHT: | |
+ // Death Grip | |
+ if (_spell->Id == 49576) | |
+ return delayForInstantSpells; | |
+ break; | |
+ case SPELLFAMILY_ROGUE: | |
+ // Blind | |
+ if (_spell->Id == 2094) | |
+ return delayForInstantSpells; | |
+ break; | |
+ } | |
+ | |
+ for (uint8 i = 0; i < CCDArraySize; ++i) | |
+ if (_spell->HasAura(auraWithCCD[i])) | |
+ return delayForInstantSpells; | |
+ | |
+ 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 db2ad24..ac3e175 100755 | |
--- a/src/server/game/Spells/Spell.h | |
+++ b/src/server/game/Spells/Spell.h | |
@@ -384,6 +384,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.7.5.4 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment