mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-18 00:18:43 +01:00
Core/Player: fixed logic for determining fully depleted runes - these are runes at max cooldown that hasn't started recovering yet
This commit is contained in:
@@ -25306,13 +25306,26 @@ Powers Player::GetPowerTypeForBaseRune(uint8 index) const
|
||||
}
|
||||
}
|
||||
|
||||
bool Player::IsRuneFullyDepleted(RuneType runeType) const
|
||||
bool Player::IsRuneFullyDepleted(uint8 index) const
|
||||
{
|
||||
for (uint8 i = 0; i < MAX_RUNES; ++i)
|
||||
if (GetBaseRune(i) == runeType && G3D::fuzzyEq(GetRuneCooldown(i), 0.0f))
|
||||
return false;
|
||||
return G3D::fuzzyEq(GetRuneCooldown(index), RUNE_BASE_COOLDOWN);
|
||||
}
|
||||
|
||||
return true;
|
||||
bool Player::HasFullyDepletedRune(RuneType runeType) const
|
||||
{
|
||||
if (!m_runes)
|
||||
return false;
|
||||
|
||||
for (uint8 i = 0; i < MAX_RUNES; ++i)
|
||||
{
|
||||
if (GetBaseRune(i) != runeType)
|
||||
continue;
|
||||
|
||||
if (IsRuneFullyDepleted(i))
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void Player::SetRuneConvertAura(uint8 index, AuraEffect const* aura, AuraType auraType, SpellInfo const* spellInfo)
|
||||
|
||||
@@ -412,6 +412,8 @@ struct RuneInfo
|
||||
AuraEffect const* ConvertAura;
|
||||
AuraType ConvertAuraType;
|
||||
SpellInfo const* ConvertAuraInfo;
|
||||
|
||||
bool IsFullyDepleted() const;
|
||||
};
|
||||
|
||||
struct Runes
|
||||
@@ -2604,12 +2606,13 @@ class TC_GAME_API Player final : public Unit, public GridObject<Player>
|
||||
RuneType GetCurrentRune(uint8 index) const { return RuneType(m_runes->_Runes[index].CurrentRune); }
|
||||
Powers GetPowerTypeForBaseRune(uint8 index) const;
|
||||
float GetRuneCooldown(uint8 index) const { return m_runes->_Runes[index].Cooldown; }
|
||||
bool IsRuneFullyDepleted(uint8 index) const;
|
||||
/// <summary>
|
||||
/// Iterates over all player runes and checks if all base runes of the specified type are on cooldown.
|
||||
/// Checks if there is a fully depleted rune. A rune is considered fully depleted when it's on cooldown and isn't recovering yet ('waiting' for another rune to finish regenerating)
|
||||
/// </summary>
|
||||
/// <param name="runeType">The kind of base rune that is being checked (Blood, Unholy, Frost). Death Runes are no base rune and can't be checked with this method. Use the underlying base rune instead.</param>
|
||||
/// <returns>true when all base runes of the specified type are on cooldown</returns>
|
||||
bool IsRuneFullyDepleted(RuneType runeType) const;
|
||||
/// <returns>true when there is a fully depleted rune</returns>
|
||||
bool HasFullyDepletedRune(RuneType runeType) const;
|
||||
RuneType GetLastUsedRune() { return m_runes->LastUsedRune; }
|
||||
uint8 GetLastUsedRuneMask() { return m_runes->LastUsedRuneMask; }
|
||||
void ClearLastUsedRuneMask() { m_runes->LastUsedRuneMask = 0; }
|
||||
|
||||
@@ -5946,7 +5946,10 @@ void Spell::EffectActivateRune()
|
||||
for (uint32 i = 0; i < MAX_RUNES && count > 0; ++i)
|
||||
{
|
||||
// We will check for base and current rune because some spell effects also activate Death Runes while specifying Blood Runes in their misc value
|
||||
if ((player->GetBaseRune(i) == runeType || player->GetCurrentRune(i) == runeType) && G3D::fuzzyNe(player->GetRuneCooldown(i), 0.0f))
|
||||
if (player->GetBaseRune(i) != runeType && player->GetCurrentRune(i) != runeType)
|
||||
continue;
|
||||
|
||||
if (player->IsRuneFullyDepleted(i))
|
||||
{
|
||||
player->SetRuneCooldown(i, 0.0f);
|
||||
--count;
|
||||
|
||||
@@ -128,7 +128,7 @@ class spell_dk_runic_empowerment : public AuraScript
|
||||
|
||||
for (RuneType runeType : { RuneType::Blood, RuneType::Unholy, RuneType::Frost })
|
||||
{
|
||||
if (player->IsRuneFullyDepleted(runeType))
|
||||
if (player->HasFullyDepletedRune(runeType))
|
||||
{
|
||||
switch (runeType)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user