mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-22 02:04:52 +01:00
Implement Global Cooldown (originaly written for TC2 v2.4.3).
Thanks eugen.rivniy for the port. Fixes issue #67. --HG-- branch : trunk
This commit is contained in:
@@ -2756,6 +2756,9 @@ void Spell::prepare(SpellCastTargets const* targets, AuraEffect const * triggere
|
||||
m_caster->SetCurrentCastedSpell(this);
|
||||
SendSpellStart();
|
||||
|
||||
if (m_caster->GetTypeId() == TYPEID_PLAYER)
|
||||
m_caster->ToPlayer()->AddGlobalCooldown(m_spellInfo,this);
|
||||
|
||||
if (!m_casttime && !m_spellInfo->StartRecoveryTime
|
||||
&& !m_castItemGUID //item: first cast may destroy item and second cast causes crash
|
||||
&& GetCurrentContainer() == CURRENT_GENERIC_SPELL)
|
||||
@@ -2798,7 +2801,10 @@ void Spell::cancel()
|
||||
|
||||
// spell is canceled-take mods and clear list
|
||||
if (m_caster->GetTypeId() == TYPEID_PLAYER)
|
||||
{
|
||||
m_caster->ToPlayer()->RemoveGlobalCooldown(m_spellInfo);
|
||||
m_caster->ToPlayer()->RemoveSpellMods(this);
|
||||
}
|
||||
|
||||
m_appliedMods.clear();
|
||||
} break;
|
||||
@@ -4415,7 +4421,8 @@ SpellCastResult Spell::CheckCast(bool strict)
|
||||
if (!m_IsTriggeredSpell && m_caster->ToPlayer()->HasFlag(PLAYER_FLAGS, PLAYER_ALLOW_ONLY_ABILITY))
|
||||
return SPELL_FAILED_SPELL_IN_PROGRESS;
|
||||
|
||||
if (m_caster->ToPlayer()->HasSpellCooldown(m_spellInfo->Id))
|
||||
if (m_caster->ToPlayer()->HasSpellCooldown(m_spellInfo->Id) ||
|
||||
(strict && !m_IsTriggeredSpell && m_caster->ToPlayer()->HasGlobalCooldown(m_spellInfo)))
|
||||
{
|
||||
if (m_triggeredByAuraSpell)
|
||||
return SPELL_FAILED_DONT_REPORT;
|
||||
|
||||
Reference in New Issue
Block a user