aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorthenecromancer <none@none>2010-02-18 01:06:47 +0100
committerthenecromancer <none@none>2010-02-18 01:06:47 +0100
commitcedf706f29fa4fdaccd9d12ee88ac47e6b4a4f16 (patch)
tree330ac4db12021614960080eaee6be61301e5add0
parent54d8411eb950e68f2abee2be9f4491d368e024fe (diff)
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
-rw-r--r--src/game/Player.cpp29
-rw-r--r--src/game/Player.h9
-rw-r--r--src/game/Spell.cpp4
-rw-r--r--src/game/SpellAuras.cpp4
-rw-r--r--src/game/Unit.cpp2
5 files changed, 31 insertions, 17 deletions
diff --git a/src/game/Player.cpp b/src/game/Player.cpp
index f83fc526009..2c58e8cf9e7 100644
--- a/src/game/Player.cpp
+++ b/src/game/Player.cpp
@@ -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)
diff --git a/src/game/Player.h b/src/game/Player.h
index bfd9225947e..f76d58e3295 100644
--- a/src/game/Player.h
+++ b/src/game/Player.h
@@ -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);
diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp
index 229f40bb3c1..98ac23e69d5 100644
--- a/src/game/Spell.cpp
+++ b/src/game/Spell.cpp
@@ -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]--;
diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp
index cc768e7ad51..750cabdb28f 100644
--- a/src/game/SpellAuras.cpp
+++ b/src/game/SpellAuras.cpp
@@ -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);
diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp
index 12e8f1b37e6..ae5f50d3710 100644
--- a/src/game/Unit.cpp
+++ b/src/game/Unit.cpp
@@ -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;