mirror of
https://github.com/araxiaonline/TrinityCore2.git
synced 2026-06-20 06:49:29 -04:00
[FIX] Energy/Mana Regeneration By HiZed
--HG-- branch : trunk
This commit is contained in:
@@ -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 ) );
|
||||
|
||||
@@ -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 );
|
||||
|
||||
+40
-33
@@ -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;
|
||||
|
||||
// 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() )
|
||||
{
|
||||
RegenerateHealth();
|
||||
if (!isInCombat() && !HasAuraType(SPELL_AURA_INTERRUPT_REGEN))
|
||||
{
|
||||
Regenerate(POWER_RAGE);
|
||||
if(getClass() == CLASS_DEATH_KNIGHT)
|
||||
Regenerate(POWER_RUNIC_POWER);
|
||||
}
|
||||
}
|
||||
//if (m_regenTimer <= 500)
|
||||
// return;
|
||||
|
||||
m_regenTimerCount += m_regenTimer;
|
||||
|
||||
Regenerate( POWER_ENERGY );
|
||||
|
||||
Regenerate( POWER_MANA );
|
||||
|
||||
if(m_regenTimerCount >= 2000)
|
||||
{
|
||||
// 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() )
|
||||
{
|
||||
RegenerateHealth();
|
||||
if (!isInCombat() && !HasAuraType(SPELL_AURA_INTERRUPT_REGEN))
|
||||
{
|
||||
Regenerate(POWER_RAGE);
|
||||
if(getClass() == CLASS_DEATH_KNIGHT)
|
||||
Regenerate(POWER_RUNIC_POWER);
|
||||
}
|
||||
}
|
||||
|
||||
if(getClass() == CLASS_DEATH_KNIGHT)
|
||||
Regenerate( POWER_RUNE );
|
||||
if(getClass() == CLASS_DEATH_KNIGHT)
|
||||
Regenerate( POWER_RUNE );
|
||||
|
||||
m_regenTimer = regenDelay;
|
||||
m_regenTimerCount -= 2000;
|
||||
}
|
||||
|
||||
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()
|
||||
|
||||
+2
-1
@@ -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;
|
||||
|
||||
/*********************************************************/
|
||||
|
||||
@@ -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())
|
||||
|
||||
Reference in New Issue
Block a user