Restore previous commits. Includes rage decay changes.

This commit is contained in:
Kel 2017-02-15 01:05:37 +00:00 committed by Antz
parent fbbc0a72e5
commit d63a3f066f
3 changed files with 31 additions and 15 deletions

View File

@ -412,6 +412,10 @@ Player::Player(WorldSession* session): Unit(), m_mover(this), m_camera(this), m_
m_modManaRegen = 0;
m_modManaRegenInterrupt = 0;
m_rageDecayRate = 1.25f;
m_rageDecayMultiplier = 19.50f;
for (int s = 0; s < MAX_SPELL_SCHOOL; s++)
{ m_SpellCritPercentage[s] = 0.0f; }
m_regenTimer = 0;
@ -1924,16 +1928,22 @@ void Player::RewardRage(uint32 damage, bool attacker)
void Player::RegenerateAll()
{
if (m_regenTimer != 0)
{ return; }
if (
m_regenTimer != 0
|| GetPower(POWER_RAGE) < 1
&& GetPowerType() == POWER_RAGE
)
{
return;
}
// 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())
HasAuraType(SPELL_AURA_MOD_HEALTH_REGEN_IN_COMBAT) || IsPolymorphed() || HasAuraType(SPELL_AURA_MOD_POWER_REGEN))
{
RegenerateHealth();
if (!IsInCombat() && !HasAuraType(SPELL_AURA_INTERRUPT_REGEN))
{ Regenerate(POWER_RAGE); }
if ((!IsInCombat() && !HasAuraType(SPELL_AURA_INTERRUPT_REGEN)) || HasAuraType(SPELL_AURA_MOD_POWER_REGEN))
Regenerate(POWER_RAGE);
}
Regenerate(POWER_ENERGY);
@ -1968,8 +1978,7 @@ void Player::Regenerate(Powers power)
} break;
case POWER_RAGE: // Regenerate rage
{
float RageDecreaseRate = sWorld.getConfig(CONFIG_FLOAT_RATE_POWER_RAGE_LOSS);
addvalue = 20 * RageDecreaseRate; // 2 rage by tick (= 2 seconds => 1 rage/sec)
addvalue = (m_rageDecayRate * m_rageDecayMultiplier);
} break;
case POWER_ENERGY: // Regenerate energy (rogue)
{
@ -1998,15 +2007,20 @@ void Player::Regenerate(Powers power)
{
curValue += uint32(addvalue);
if (curValue > maxValue)
{ curValue = maxValue; }
{
curValue = maxValue;
}
}
else
else if (!IsInCombat())
{
if (curValue <= uint32(addvalue))
{ curValue = 0; }
else
{ curValue -= uint32(addvalue); }
}
else
{ return; }
SetPower(power, curValue);
}

View File

@ -2176,6 +2176,10 @@ class Player : public Unit
/*********************************************************/
float m_modManaRegen;
float m_modManaRegenInterrupt;
float m_rageDecayRate;
float m_rageDecayMultiplier;
float m_SpellCritPercentage[MAX_SPELL_SCHOOL];
bool HasMovementFlag(MovementFlags f) const; // for script access to m_movementInfo.HasMovementFlag
void UpdateFallInformationIfNeed(MovementInfo const& minfo, uint16 opcode);

View File

@ -4745,7 +4745,7 @@ void Aura::PeriodicTick()
{ return; }
Powers powerType = target->GetPowerType();
if (int32(powerType) != m_modifier.m_miscvalue)
if (int32(powerType) != m_modifier.m_miscvalue) // spell's power is not the same as of the player's
{ return; }
if (spellProto->AuraInterruptFlags & AURA_INTERRUPT_FLAG_NOT_SEATED)
@ -4754,11 +4754,9 @@ void Aura::PeriodicTick()
target->HandleEmoteCommand(EMOTE_ONESHOT_EAT);
}
// Anger Management
// amount = 1+ 16 = 17 = 3,4*5 = 10,2*5/3
// so 17 is rounded amount for 5 sec tick grow ~ 1 range grow in 3 sec
if (powerType == POWER_RAGE && !target->IsInCombat())
{ target->ModifyPower(powerType, m_modifier.m_amount * 1 / 5); }
// Setting the rage decay rate to the value of the spell/aura. Currently only works on players.
if (powerType == POWER_RAGE)
{ target->ToPlayer()->m_rageDecayMultiplier = m_modifier.m_amount; }
break;
}
// Here tick dummy auras