mirror of
https://github.com/araxiaonline/TrinityCore2.git
synced 2026-06-19 22:39:39 -04:00
Treat rune cooldowns as timers and not as remaining tick counts
Implement support for modifiers changing rune regeneration rate Apply all spells from Improved Unholy Aura --HG-- branch : trunk
This commit is contained in:
+21
-8
@@ -2025,6 +2025,12 @@ void Player::RegenerateAll()
|
||||
|
||||
Regenerate(POWER_MANA);
|
||||
|
||||
// Runes act as cooldowns, and they don't need to send any data
|
||||
if(getClass() == CLASS_DEATH_KNIGHT)
|
||||
for (uint32 i = 0; i < MAX_RUNES; ++i)
|
||||
if(uint32 cd = GetRuneCooldown(i))
|
||||
SetRuneCooldown(i, (cd > m_regenTimer) ? cd - m_regenTimer : 0);
|
||||
|
||||
if (m_regenTimerCount >= 2000)
|
||||
{
|
||||
// Not in combat or they have regeneration
|
||||
@@ -2038,9 +2044,6 @@ void Player::RegenerateAll()
|
||||
if (getClass() == CLASS_DEATH_KNIGHT)
|
||||
Regenerate(POWER_RUNIC_POWER);
|
||||
|
||||
if(getClass() == CLASS_DEATH_KNIGHT)
|
||||
Regenerate(POWER_RUNE);
|
||||
|
||||
m_regenTimerCount -= 2000;
|
||||
}
|
||||
|
||||
@@ -2049,11 +2052,6 @@ void Player::RegenerateAll()
|
||||
|
||||
void Player::Regenerate(Powers power)
|
||||
{
|
||||
if (power == POWER_RUNE)
|
||||
for (uint32 i = 0; i < MAX_RUNES; ++i)
|
||||
if (uint8 cd = GetRuneCooldown(i)) // if we have cooldown, reduce it...
|
||||
SetRuneCooldown(i, cd - 1); // ... by 2 sec (because update is every 2 sec)
|
||||
|
||||
uint32 maxValue = GetMaxPower(power);
|
||||
if (!maxValue)
|
||||
return;
|
||||
@@ -21791,6 +21789,21 @@ void Player::UpdateCharmedAI()
|
||||
}
|
||||
}
|
||||
|
||||
uint32 Player::GetRuneBaseCooldown(uint8 index)
|
||||
{
|
||||
uint8 rune = GetBaseRune(index);
|
||||
uint32 cooldown = RUNE_COOLDOWN;
|
||||
|
||||
AuraEffectList const& regenAura = GetAuraEffectsByType(SPELL_AURA_MOD_POWER_REGEN_PERCENT);
|
||||
for(AuraEffectList::const_iterator i = regenAura.begin();i != regenAura.end(); ++i)
|
||||
{
|
||||
if((*i)->GetMiscValue() == POWER_RUNE && (*i)->GetMiscValueB() == rune)
|
||||
cooldown = cooldown*(100-(*i)->GetAmount())/100;
|
||||
}
|
||||
|
||||
return cooldown;
|
||||
}
|
||||
|
||||
void Player::RemoveRunesByAuraEffect(AuraEffect const * aura)
|
||||
{
|
||||
for(uint8 i = 0; i < MAX_RUNES; ++i)
|
||||
|
||||
+5
-4
@@ -281,7 +281,7 @@ struct Areas
|
||||
};
|
||||
|
||||
#define MAX_RUNES 6
|
||||
#define RUNE_COOLDOWN 5 // 5*2=10 sec
|
||||
#define RUNE_COOLDOWN 10000
|
||||
|
||||
enum RuneType
|
||||
{
|
||||
@@ -296,7 +296,7 @@ struct RuneInfo
|
||||
{
|
||||
uint8 BaseRune;
|
||||
uint8 CurrentRune;
|
||||
uint8 Cooldown;
|
||||
uint32 Cooldown;
|
||||
AuraEffect const * ConvertAura;
|
||||
};
|
||||
|
||||
@@ -2259,13 +2259,14 @@ class Player : public Unit, public GridObject<Player>
|
||||
uint8 GetRunesState() const { return m_runes->runeState; }
|
||||
RuneType GetBaseRune(uint8 index) const { return RuneType(m_runes->runes[index].BaseRune); }
|
||||
RuneType GetCurrentRune(uint8 index) const { return RuneType(m_runes->runes[index].CurrentRune); }
|
||||
uint8 GetRuneCooldown(uint8 index) const { return m_runes->runes[index].Cooldown; }
|
||||
uint32 GetRuneCooldown(uint8 index) const { return m_runes->runes[index].Cooldown; }
|
||||
uint32 GetRuneBaseCooldown(uint8 index);
|
||||
bool IsBaseRuneSlotsOnCooldown(RuneType runeType) const;
|
||||
RuneType GetLastUsedRune() { return m_runes->lastUsedRune; }
|
||||
void SetLastUsedRune(RuneType type) { m_runes->lastUsedRune = type; }
|
||||
void SetBaseRune(uint8 index, RuneType baseRune) { m_runes->runes[index].BaseRune = baseRune; }
|
||||
void SetCurrentRune(uint8 index, RuneType currentRune) { m_runes->runes[index].CurrentRune = currentRune; }
|
||||
void SetRuneCooldown(uint8 index, uint8 cooldown) { m_runes->runes[index].Cooldown = cooldown; m_runes->SetRuneState(index, (cooldown == 0) ? true : false); }
|
||||
void SetRuneCooldown(uint8 index, uint32 cooldown) { m_runes->runes[index].Cooldown = cooldown; m_runes->SetRuneState(index, (cooldown == 0) ? true : false); }
|
||||
void SetRuneConvertAura(uint8 index, AuraEffect const * aura) { m_runes->runes[index].ConvertAura = aura; }
|
||||
void AddRuneByAuraEffect(uint8 index, RuneType newType, AuraEffect const * aura) { SetRuneConvertAura(index, aura); ConvertRune(index, newType); }
|
||||
void RemoveRunesByAuraEffect(AuraEffect const * aura);
|
||||
|
||||
+2
-2
@@ -4229,7 +4229,7 @@ void Spell::TakeRunePower()
|
||||
RuneType rune = plr->GetCurrentRune(i);
|
||||
if((plr->GetRuneCooldown(i) == 0) && (runeCost[rune] > 0))
|
||||
{
|
||||
plr->SetRuneCooldown(i, RUNE_COOLDOWN); // 5*2=10 sec
|
||||
plr->SetRuneCooldown(i, plr->GetRuneBaseCooldown(i));
|
||||
plr->SetLastUsedRune(RuneType(rune));
|
||||
runeCost[rune]--;
|
||||
}
|
||||
@@ -4244,7 +4244,7 @@ void Spell::TakeRunePower()
|
||||
RuneType rune = plr->GetCurrentRune(i);
|
||||
if((plr->GetRuneCooldown(i) == 0) && (rune == RUNE_DEATH))
|
||||
{
|
||||
plr->SetRuneCooldown(i, RUNE_COOLDOWN); // 5*2=10 sec
|
||||
plr->SetRuneCooldown(i, plr->GetRuneBaseCooldown(i));
|
||||
plr->SetLastUsedRune(RuneType(rune));
|
||||
runeCost[rune]--;
|
||||
|
||||
|
||||
@@ -1381,7 +1381,7 @@ void Aura::HandleAuraSpecificMods(AuraApplication const * aurApp, Unit * caster,
|
||||
{
|
||||
// Not listed as any effect, only base points set
|
||||
int32 basePoints0 = unholyPresenceAura->GetSpellProto()->EffectBasePoints[1];
|
||||
//target->CastCustomSpell(target,63622,&basePoints0 ,NULL,NULL,true,0,unholyPresenceAura);
|
||||
target->CastCustomSpell(target,63622,&basePoints0 ,&basePoints0,&basePoints0,true,0,unholyPresenceAura);
|
||||
target->CastCustomSpell(target,65095,&basePoints0 ,NULL,NULL,true,0,unholyPresenceAura);
|
||||
}
|
||||
target->CastSpell(target,49772, true);
|
||||
@@ -1403,7 +1403,7 @@ void Aura::HandleAuraSpecificMods(AuraApplication const * aurApp, Unit * caster,
|
||||
{
|
||||
if(presence == 48265 && unholyPresenceAura)
|
||||
{
|
||||
//target->RemoveAurasDueToSpell(63622);
|
||||
target->RemoveAurasDueToSpell(63622);
|
||||
target->RemoveAurasDueToSpell(65095);
|
||||
}
|
||||
target->RemoveAurasDueToSpell(49772);
|
||||
|
||||
+1
-1
@@ -7723,7 +7723,7 @@ bool Unit::HandleAuraProc(Unit *pVictim, uint32 damage, Aura * triggeredByAura,
|
||||
((Player*)this)->GetBaseRune(i) != RUNE_BLOOD )
|
||||
continue;
|
||||
}
|
||||
if (((Player*)this)->GetRuneCooldown(i) != RUNE_COOLDOWN)
|
||||
if (((Player*)this)->GetRuneCooldown(i) != ((Player*)this)->GetRuneBaseCooldown(i))
|
||||
continue;
|
||||
|
||||
--runesLeft;
|
||||
|
||||
Reference in New Issue
Block a user