mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-15 23:20:36 +01:00
Core/Spells: corrected refunding runes - they don't get put on a cooldown and don't send cooldowns for spells which had their runes refunded
(cherry picked from commit dbe2f1ee7e)
This commit is contained in:
@@ -410,8 +410,7 @@ struct Areas
|
||||
|
||||
enum RuneCooldowns
|
||||
{
|
||||
RUNE_BASE_COOLDOWN = 10000,
|
||||
RUNE_MISS_COOLDOWN = 1500 // cooldown applied on runes when the spell misses
|
||||
RUNE_BASE_COOLDOWN = 10000
|
||||
};
|
||||
|
||||
struct Runes
|
||||
|
||||
@@ -4909,8 +4909,11 @@ void Spell::SendSpellGo()
|
||||
&& HasPowerTypeCost(POWER_RUNES)
|
||||
&& !(_triggeredCastFlags & TRIGGERED_IGNORE_POWER_COST))
|
||||
{
|
||||
castFlags |= CAST_FLAG_NO_GCD; // not needed, but Blizzard sends it
|
||||
castFlags |= CAST_FLAG_RUNE_LIST; // rune cooldowns list
|
||||
castFlags |= CAST_FLAG_NO_GCD; // not needed, but it's being sent according to sniffs
|
||||
|
||||
// Only send rune cooldowns when there has been a change
|
||||
if (m_runesState != m_caster->ToPlayer()->GetRunesState())
|
||||
castFlags |= CAST_FLAG_RUNE_LIST; // rune cooldowns list
|
||||
}
|
||||
|
||||
if (m_targets.HasTraj())
|
||||
@@ -5677,6 +5680,9 @@ void Spell::TakeRunePower(bool didHit)
|
||||
Player* player = m_caster->ToPlayer();
|
||||
m_runesState = player->GetRunesState(); // store previous state
|
||||
|
||||
if (!didHit)
|
||||
return;
|
||||
|
||||
int32 runeCost = std::accumulate(m_powerCost.begin(), m_powerCost.end(), 0, [](int32 totalCost, SpellPowerCost const& cost)
|
||||
{
|
||||
return totalCost + (cost.Power == POWER_RUNES ? cost.Amount : 0);
|
||||
@@ -5686,7 +5692,7 @@ void Spell::TakeRunePower(bool didHit)
|
||||
{
|
||||
if (!player->GetRuneCooldown(i) && runeCost > 0)
|
||||
{
|
||||
player->SetRuneCooldown(i, didHit ? player->GetRuneBaseCooldown() : uint32(RUNE_MISS_COOLDOWN));
|
||||
player->SetRuneCooldown(i, player->GetRuneBaseCooldown());
|
||||
--runeCost;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user