diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index 48f75777cb26f..7919e3f94a8bd 100644 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -2408,7 +2408,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) @@ -3796,7 +3800,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())/* xinef: we dont need this shit || m_spellInfo->Id == 14157*/) + if (((m_spellInfo->Speed > 0.0f || GetCCDelay(m_spellInfo) > 0) && !m_spellInfo->IsChanneled())) { // 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 @@ -6397,6 +6401,207 @@ SpellCastResult Spell::CheckPetCast(Unit* target) return CheckCast(true); } +uint32 Spell::GetCCDelay(SpellInfo const* _spell) +{ + const uint32 delayForRoots = 70; + const uint32 delayForStuns = 130; + const uint32 delayForDisarms = 70; + const uint32 delayForDisorients = 130; + const uint32 delayForFears = 130; + const uint32 delayForHorrors = 130; + const uint32 delayForOpenerStuns = 100; + const uint32 delayForBanishes = 130; + const uint32 delayForSilences = 130; + const uint32 delayForInstantSpells = 100; + + // CCDelay for spell with auras + uint8 CCDArraySize = 7; + AuraType auraWithCCD[] = + { + SPELL_AURA_MOD_STUN, // 130 + SPELL_AURA_MOD_CONFUSE, // 130 + SPELL_AURA_MOD_FEAR, // 130 + SPELL_AURA_MOD_SILENCE, // 130 + SPELL_AURA_MOD_DISARM, // 70 + SPELL_AURA_MOD_ROOT, // 70 + SPELL_AURA_MOD_POSSESS // 130 + }; + + uint32 auraCCDelay[] = + { + 130, + 130, + 130, + 130, + 70, + 70, + 130 + }; + + // Cases for specific race/class spells + switch (_spell->Id) + { + case 11578: // Warrior - Charge + case 7922: + case 1833: // Rogue - CheapShot + case 9005: // Druid - Pounce + case 9823: + case 9827: + case 27006: + case 49803: + return delayForOpenerStuns; + case 20252: // Warrior - Intercept + case 20253: // Warrior - Intercept + case 65929: // Warrior - Charge triggered + case 12809: // Warrior - Concussion Blow + case 46968: // Warrior - Shockwave + case 853: // Paladin - Hammer of Justice + case 5588: + case 5589: + case 10308: + case 20170: // Paladin - Seal of justice stun proc + case 24394: // Hunter - Pet - Intimidation + case 408: // Rogue - Kidney Shot + case 8643: + case 64044: // Priest - Psychic Horror + case 47481: // DK - Pet - Gnaw (ghoul's stun) + case 58861: // Shaman - Feral bash + case 44572: // Mage - Deep Freeze + case 12355: // Mage - Talent - Impact + case 47996: // Warlock - Pet - Felguard's intercept + case 47995: // Warlock - Pet - Felguard intercept trigg. + case 60995: // Warlock - Demon charge + case 54785: + case 30283: // Warlock - Shadowfury + case 30413: + case 30414: + case 47846: + case 47847: + case 5211: // Druid - Bash + case 6798: + case 8983: + case 22570: // Druid - Maim + case 49802: + case 46026: // War Stomp - Tauren's racial + return delayForStuns; + case 5246: // Warrior - Intimidating Shout + case 20511: + case 10326: // Paladin - Turn Evil + case 1513: // Hunter - Scare beast + case 14326: + case 14327: + case 10890: // Priest - Psychic Scream + case 10888: + case 8124: + case 8122: + case 5782: // Warlock - Fear + case 6213: + case 6215: + case 5484: // Warlock - Howl of Terror + case 17928: + return delayForFears; + case 676: // Warrior - Disarm + case 51722: // Rogue - Dismantle + return delayForDisarms; + case 18498: // Warrior - Talent - Gag order proc + case 63529: // Paladin - Talent - Shield of the Templar proc + case 34490: // Hunter - Silencing shot + case 18425: // Rogue - Talent - Silenced - Improved Kick + case 1330: // Rogue - Garote silence + case 15487: // Priest - Silence + case 47476: // DK - Strangulate + case 18469: // Mage - Talent - Improved Counter spell silence + case 24259: // Warlock - Pet - Spell Lock - Silenced + return delayForSilences; + case 20066: // Paladin - Repentance + case 19503: // Hunter - Scatter Shot + case 19386: // Hunter - Wyvern Sting + case 24132: + case 24133: + case 27068: + case 49011: + case 49012: + case 2094: // Rogue - Blind + case 1776: // Rogue - Gouge + case 6770: // Rogue - Sap + case 2070: + case 11297: + case 51724: + case 10955: // Priest - Shackle Undead + case 9485: + case 9484: + case 49203: // DK - Hungering Cold + case 51514: // Shaman - Hex + case 42950: // Mage - Dragon Breath + case 42949: + case 33043: + case 33042: + case 33041: + case 31661: + case 12826: // Mage - Polymorph + case 12825: + case 12824: + case 118: + case 6358: // Warlock - Pet - Succubus - Seduction + case 2637: // Druid - Hibernate + case 18657: + case 18658: + return delayForDisorients; + case 36554: // Rogue - Shadowstep + case 49576: // DK - Death Grip + case 45334: // Druid - Feral charge - Bear + case 49376: // Druid - Feral charge - Cat + return delayForInstantSpells; + case 6789: // Warlock - DeathCoil + case 17925: + case 17926: + case 27223: + case 47859: + case 47860: + return delayForHorrors; + case 23694: // Warrior - Improved Hamstring + case 64695: // Shaman - Talent - Earth's Grasp root + case 12494: // Mage - Talent - Frostbite + case 122: // Mage - Frostnova + case 865: + case 6131: + case 10230: + case 27088: + case 42917: + case 33395: // Mage - Pet - Freeze + case 339: // Druid - Entangling roots + case 1062: + case 5195: + case 5196: + case 9852: + case 9853: + case 26989: + case 53308: + return delayForRoots; + case 710: // Warlock - Banish + case 18647: + case 33786: // Druid - Cyclone + return delayForBanishes; + case 605: // Priest - Mind Control + case 19185: // Entrapment + case 64803: + case 64804: + case 3355: // Freezing trap + case 14308: + case 14309: + return 0; + + default: + // Other spells with mechanics + for (uint8 i = 0; i < CCDArraySize; ++i) + if (_spell->HasAura(auraWithCCD[i])) + return auraCCDelay[i]; + break; + } + + return 0; +} + SpellCastResult Spell::CheckCasterAuras(bool preventionOnly) 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 020e6a78c1ef0..6dd9b19b1d7a9 100644 --- a/src/server/game/Spells/Spell.h +++ b/src/server/game/Spells/Spell.h @@ -413,6 +413,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);