diff options
| author | Shauren <shauren.trinity@gmail.com> | 2016-06-13 21:00:25 +0200 |
|---|---|---|
| committer | Shauren <shauren.trinity@gmail.com> | 2016-06-13 21:00:25 +0200 |
| commit | d2733eb6f1f9a550ec6511b5fa696b67b11044b3 (patch) | |
| tree | 92e101dba7e48661de4a02c93bfba5700a6f1bdf /src/server/game/Spells/Spell.cpp | |
| parent | 3903482eb810625fce64c616a4edca3f06975e94 (diff) | |
| parent | 2fe6fc63d79655a96ee2135a6b380ce353729088 (diff) | |
Merge branch '6.x' of https://github.com/TrinityCore/TrinityCore into legion
Diffstat (limited to 'src/server/game/Spells/Spell.cpp')
| -rw-r--r-- | src/server/game/Spells/Spell.cpp | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index 005d15d8291..d109667cd85 100644 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -4187,13 +4187,11 @@ void Spell::UpdateSpellCastDataAmmo(WorldPackets::Spells::SpellAmmo& ammo) void Spell::SendSpellExecuteLog() { WorldPackets::CombatLog::SpellExecuteLog spellExecuteLog; - spellExecuteLog.Caster = m_caster->GetGUID(); spellExecuteLog.SpellID = m_spellInfo->Id; for (SpellEffectInfo const* effect : GetEffects()) { - WorldPackets::CombatLog::SpellExecuteLog::SpellLogEffect spellLogEffect; if (!effect) continue; @@ -4202,6 +4200,9 @@ void Spell::SendSpellExecuteLog() _tradeSkillTargets[effect->EffectIndex].empty() && _feedPetTargets[effect->EffectIndex].empty()) continue; + spellExecuteLog.Effects.emplace_back(); + + WorldPackets::CombatLog::SpellExecuteLog::SpellLogEffect& spellLogEffect = spellExecuteLog.Effects.back(); spellLogEffect.Effect = effect->Effect; spellLogEffect.PowerDrainTargets = std::move(_powerDrainTargets[effect->EffectIndex]); spellLogEffect.ExtraAttacksTargets = std::move(_extraAttacksTargets[effect->EffectIndex]); @@ -4209,8 +4210,6 @@ void Spell::SendSpellExecuteLog() spellLogEffect.GenericVictimTargets = std::move(_genericVictimTargets[effect->EffectIndex]); spellLogEffect.TradeSkillTargets = std::move(_tradeSkillTargets[effect->EffectIndex]); spellLogEffect.FeedPetTargets = std::move(_feedPetTargets[effect->EffectIndex]); - - spellExecuteLog.Effects.push_back(spellLogEffect); } if (!spellExecuteLog.Effects.empty()) @@ -7346,7 +7345,7 @@ bool Spell::HasGlobalCooldown() const void Spell::TriggerGlobalCooldown() { int32 gcd = m_spellInfo->StartRecoveryTime; - if (!gcd) + if (!gcd || !m_spellInfo->StartRecoveryCategory) return; // Only players or controlled units have global cooldown @@ -7366,12 +7365,17 @@ void Spell::TriggerGlobalCooldown() if (m_caster->GetTypeId() == TYPEID_PLAYER) m_caster->ToPlayer()->ApplySpellMod(m_spellInfo->Id, SPELLMOD_GLOBAL_COOLDOWN, gcd, this); + bool isMeleeOrRangedSpell = m_spellInfo->DmgClass == SPELL_DAMAGE_CLASS_MELEE || + m_spellInfo->DmgClass == SPELL_DAMAGE_CLASS_RANGED || + m_spellInfo->HasAttribute(SPELL_ATTR0_REQ_AMMO) || + m_spellInfo->HasAttribute(SPELL_ATTR0_ABILITY); + // Apply haste rating - gcd = int32(float(gcd) * m_caster->GetFloatValue(UNIT_MOD_CAST_SPEED)); - if (gcd < MIN_GCD) - gcd = MIN_GCD; - else if (gcd > MAX_GCD) - gcd = MAX_GCD; + if (gcd > MIN_GCD && ((m_spellInfo->StartRecoveryCategory == 133 && !isMeleeOrRangedSpell) || m_caster->HasAuraTypeWithAffectMask(SPELL_AURA_MOD_GLOBAL_COOLDOWN_BY_HASTE, m_spellInfo))) + gcd = std::min<int32>(std::max<int32>(int32(float(gcd) * m_caster->GetFloatValue(UNIT_MOD_CAST_HASTE)), MIN_GCD), MAX_GCD); + + if (gcd > MIN_GCD && m_caster->HasAuraTypeWithAffectMask(SPELL_AURA_MOD_GLOBAL_COOLDOWN_BY_HASTE_REGEN, m_spellInfo)) + gcd = std::min<int32>(std::max<int32>(int32(float(gcd) * m_caster->GetFloatValue(UNIT_FIELD_MOD_HASTE_REGEN)), MIN_GCD), MAX_GCD); } m_caster->GetSpellHistory()->AddGlobalCooldown(m_spellInfo, gcd); |
