aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/game/Object.cpp7
-rw-r--r--src/game/Object.h1
-rw-r--r--src/game/Player.cpp71
-rw-r--r--src/game/Player.h3
-rw-r--r--src/game/SpellAuras.cpp2
5 files changed, 50 insertions, 34 deletions
diff --git a/src/game/Object.cpp b/src/game/Object.cpp
index 5206a5a4219..6657cd91c27 100644
--- a/src/game/Object.cpp
+++ b/src/game/Object.cpp
@@ -799,6 +799,13 @@ void Object::SetUInt32Value( uint16 index, uint32 value )
}
}
+void Object::UpdateUInt32Value( uint16 index, uint32 value )
+{
+ ASSERT( index < m_valuesCount || PrintIndexError( index, true ) );
+
+ m_uint32Values[ index ] = value;
+}
+
void Object::SetUInt64Value( uint16 index, const uint64 &value )
{
ASSERT( index + 1 < m_valuesCount || PrintIndexError( index, true ) );
diff --git a/src/game/Object.h b/src/game/Object.h
index 761495b7f48..a2c8125b669 100644
--- a/src/game/Object.h
+++ b/src/game/Object.h
@@ -199,6 +199,7 @@ class TRINITY_DLL_SPEC Object
void SetInt32Value( uint16 index, int32 value );
void SetUInt32Value( uint16 index, uint32 value );
+ void UpdateUInt32Value( uint16 index, uint32 value );
void SetUInt64Value( uint16 index, const uint64 &value );
void SetFloatValue( uint16 index, float value );
void SetByteValue( uint16 index, uint8 offset, uint8 value );
diff --git a/src/game/Player.cpp b/src/game/Player.cpp
index f90b571a498..c69d9128106 100644
--- a/src/game/Player.cpp
+++ b/src/game/Player.cpp
@@ -308,6 +308,7 @@ Player::Player (WorldSession *session): Unit(), m_achievementMgr(this), m_reputa
m_questRewardTalentCount = 0;
m_regenTimer = 0;
+ m_regenTimerCount = 0;
m_weaponChangeTimer = 0;
m_zoneUpdateId = 0;
@@ -1276,15 +1277,7 @@ void Player::Update( uint32 p_time )
}
}
}
-
- if(m_regenTimer > 0)
- {
- if(p_time >= m_regenTimer)
- m_regenTimer = 0;
- else
- m_regenTimer -= p_time;
- }
-
+
if (m_weaponChangeTimer > 0)
{
if(p_time >= m_weaponChangeTimer)
@@ -1318,6 +1311,7 @@ void Player::Update( uint32 p_time )
if (isAlive())
{
+ m_regenTimer += p_time;
RegenerateAll();
}
@@ -2018,31 +2012,37 @@ void Player::RemoveFromWorld()
void Player::RegenerateAll()
{
- if (m_regenTimer != 0)
- return;
- uint32 regenDelay = 2000;
+ //if (m_regenTimer <= 500)
+ // return;
+
+ m_regenTimerCount += m_regenTimer;
+
+ Regenerate( POWER_ENERGY );
- // Not in combat or they have regeneration
- if( !isInCombat() || HasAuraType(SPELL_AURA_MOD_REGEN_DURING_COMBAT) ||
- HasAuraType(SPELL_AURA_MOD_HEALTH_REGEN_IN_COMBAT) || IsPolymorphed() )
+ Regenerate( POWER_MANA );
+
+ if(m_regenTimerCount >= 2000)
{
- RegenerateHealth();
- if (!isInCombat() && !HasAuraType(SPELL_AURA_INTERRUPT_REGEN))
+ // Not in combat or they have regeneration
+ if( !isInCombat() || HasAuraType(SPELL_AURA_MOD_REGEN_DURING_COMBAT) ||
+ HasAuraType(SPELL_AURA_MOD_HEALTH_REGEN_IN_COMBAT) || IsPolymorphed() )
{
- Regenerate(POWER_RAGE);
- if(getClass() == CLASS_DEATH_KNIGHT)
- Regenerate(POWER_RUNIC_POWER);
+ RegenerateHealth();
+ if (!isInCombat() && !HasAuraType(SPELL_AURA_INTERRUPT_REGEN))
+ {
+ Regenerate(POWER_RAGE);
+ if(getClass() == CLASS_DEATH_KNIGHT)
+ Regenerate(POWER_RUNIC_POWER);
+ }
}
- }
- Regenerate( POWER_ENERGY );
-
- Regenerate( POWER_MANA );
+ if(getClass() == CLASS_DEATH_KNIGHT)
+ Regenerate( POWER_RUNE );
- if(getClass() == CLASS_DEATH_KNIGHT)
- Regenerate( POWER_RUNE );
+ m_regenTimerCount -= 2000;
+ }
- m_regenTimer = regenDelay;
+ m_regenTimer = 0;
}
void Player::Regenerate(Powers power)
@@ -2064,11 +2064,11 @@ void Player::Regenerate(Powers power)
if (recentCast)
{
// Trinity Updates Mana in intervals of 2s, which is correct
- addvalue = GetFloatValue(UNIT_FIELD_POWER_REGEN_INTERRUPTED_FLAT_MODIFIER) * ManaIncreaseRate * 2.00f;
+ addvalue = GetFloatValue(UNIT_FIELD_POWER_REGEN_INTERRUPTED_FLAT_MODIFIER) * ManaIncreaseRate * 0.001f * m_regenTimer;
}
else
{
- addvalue = GetFloatValue(UNIT_FIELD_POWER_REGEN_FLAT_MODIFIER) * ManaIncreaseRate * 2.00f;
+ addvalue = GetFloatValue(UNIT_FIELD_POWER_REGEN_FLAT_MODIFIER) * ManaIncreaseRate * 0.001f * m_regenTimer;
}
} break;
case POWER_RAGE: // Regenerate rage
@@ -2077,7 +2077,7 @@ void Player::Regenerate(Powers power)
addvalue = 20 * RageDecreaseRate; // 2 rage by tick (= 2 seconds => 1 rage/sec)
} break;
case POWER_ENERGY: // Regenerate energy (rogue)
- addvalue = 20;
+ addvalue = 0.01f * m_regenTimer;
break;
case POWER_RUNIC_POWER:
{
@@ -2108,7 +2108,11 @@ void Player::Regenerate(Powers power)
if (power != POWER_RAGE && power != POWER_RUNIC_POWER)
{
- curValue += uint32(addvalue);
+ if((addvalue-uint32(addvalue)) >= 0.50f)
+ curValue += uint32(addvalue+1);
+ else
+ curValue += uint32(addvalue);
+
if (curValue > maxValue)
curValue = maxValue;
}
@@ -2119,7 +2123,10 @@ void Player::Regenerate(Powers power)
else
curValue -= uint32(addvalue);
}
- SetPower(power, curValue);
+ if(m_regenTimerCount >= 2000)
+ SetPower(power, curValue);
+ else
+ UpdateUInt32Value(UNIT_FIELD_POWER1 + power, curValue);
}
void Player::RegenerateHealth()
diff --git a/src/game/Player.h b/src/game/Player.h
index 1ad2d22554d..9a3821cc3e8 100644
--- a/src/game/Player.h
+++ b/src/game/Player.h
@@ -1359,7 +1359,7 @@ class MANGOS_DLL_SPEC Player : public Unit
void RegenerateAll();
void Regenerate(Powers power);
void RegenerateHealth();
- void setRegenTimer(uint32 time) {m_regenTimer = time;}
+ void setRegenTimerCount(uint32 time) {m_regenTimerCount = time;}
void setWeaponChangeTimer(uint32 time) {m_weaponChangeTimer = time;}
uint32 GetMoney() { return GetUInt32Value (PLAYER_FIELD_COINAGE); }
@@ -2222,6 +2222,7 @@ class MANGOS_DLL_SPEC Player : public Unit
Spell * m_spellModTakingSpell;
protected:
+ uint32 m_regenTimerCount;
uint32 m_contestedPvPTimer;
/*********************************************************/
diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp
index 217db41e297..bb6ed39a9a6 100644
--- a/src/game/SpellAuras.cpp
+++ b/src/game/SpellAuras.cpp
@@ -3671,7 +3671,7 @@ void AuraEffect::HandleAuraTransform(bool apply, bool Real, bool /*changeAmount*
// for players, start regeneration after 1s (in polymorph fast regeneration case)
// only if caster is Player (after patch 2.4.2)
if (IS_PLAYER_GUID(GetCasterGUID()) )
- ((Player*)m_target)->setRegenTimer(1*IN_MILISECONDS);
+ ((Player*)m_target)->setRegenTimerCount(1*IN_MILISECONDS);
//dismount polymorphed target (after patch 2.4.2)
if (m_target->IsMounted())