Core/Units: Updated mana regen and removed 5 second rule
This commit is contained in:
1 parent
41cf99f1d9
commit
8fe7fd4bd5
6 files changed
+15
-32
No files matched your search
@@ -616,13 +616,10 @@ void Creature::RegenerateMana()
|
||||
// Combat and any controlled creature
|
||||
if (isInCombat() || GetCharmerOrOwnerGUID())
|
||||
{
|
||||
if (!IsUnderLastManaUseEffect())
|
||||
{
|
||||
float ManaIncreaseRate = sWorld->getRate(RATE_POWER_MANA);
|
||||
float Spirit = GetStat(STAT_SPIRIT);
|
||||
float ManaIncreaseRate = sWorld->getRate(RATE_POWER_MANA);
|
||||
float Spirit = GetStat(STAT_SPIRIT);
|
||||
|
||||
addvalue = uint32((Spirit / 5.0f + 17.0f) * ManaIncreaseRate);
|
||||
}
|
||||
addvalue = uint32((Spirit / 5.0f + 17.0f) * ManaIncreaseRate);
|
||||
}
|
||||
else
|
||||
addvalue = maxValue / 3;
|
||||
|
||||
@@ -2577,10 +2577,9 @@ void Player::Regenerate(Powers power)
|
||||
{
|
||||
case POWER_MANA:
|
||||
{
|
||||
bool recentCast = IsUnderLastManaUseEffect();
|
||||
float ManaIncreaseRate = sWorld->getRate(RATE_POWER_MANA);
|
||||
|
||||
if (recentCast) // Trinity Updates Mana in intervals of 2s, which is correct
|
||||
if (isInCombat()) // Trinity Updates Mana in intervals of 2s, which is correct
|
||||
addvalue += GetFloatValue(UNIT_FIELD_POWER_REGEN_INTERRUPTED_FLAT_MODIFIER) * ManaIncreaseRate * ((0.001f * m_regenTimer) + CalculatePctF(0.001f, spellHaste));
|
||||
else
|
||||
addvalue += GetFloatValue(UNIT_FIELD_POWER_REGEN_FLAT_MODIFIER) * ManaIncreaseRate * ((0.001f * m_regenTimer) + CalculatePctF(0.001f, spellHaste));
|
||||
|
||||
@@ -686,21 +686,22 @@ void Player::ApplyHealthRegenBonus(int32 amount, bool apply)
|
||||
void Player::UpdateManaRegen()
|
||||
{
|
||||
// Mana regen from spirit
|
||||
float power_regen = OCTRegenMPPerSpirit();
|
||||
float spirit_regen = OCTRegenMPPerSpirit();
|
||||
// Apply PCT bonus from SPELL_AURA_MOD_POWER_REGEN_PERCENT aura on spirit base regen
|
||||
power_regen *= GetTotalAuraMultiplierByMiscValue(SPELL_AURA_MOD_POWER_REGEN_PERCENT, POWER_MANA);
|
||||
spirit_regen *= GetTotalAuraMultiplierByMiscValue(SPELL_AURA_MOD_POWER_REGEN_PERCENT, POWER_MANA);
|
||||
|
||||
// SpiritRegen(SPI,INT,LEVEL) = (0.001 + (SPI x sqrt(INT) x BASE_REGEN[LEVEL])) x 5
|
||||
if (GetStat(STAT_INTELLECT) > 0.0f)
|
||||
spirit_regen *= sqrt(GetStat(STAT_INTELLECT));
|
||||
|
||||
// CombatRegen = 5% of Base Mana
|
||||
float base_regen = GetCreateMana() * 0.01f + GetTotalAuraModifierByMiscValue(SPELL_AURA_MOD_POWER_REGEN, POWER_MANA) / 5.0f;
|
||||
|
||||
// Set regen rate in cast state apply only on spirit based regen
|
||||
int32 modManaRegenInterrupt = GetTotalAuraModifier(SPELL_AURA_MOD_MANA_REGEN_INTERRUPT);
|
||||
if (!modManaRegenInterrupt || modManaRegenInterrupt > 100)
|
||||
modManaRegenInterrupt = 100;
|
||||
//From WowWiki: CombatRegen = 5% of Base Mana
|
||||
float combat_regen = GetCreateMana() * 0.01f + GetTotalAuraModifierByMiscValue(SPELL_AURA_MOD_POWER_REGEN, POWER_MANA) / 5.0f;
|
||||
SetStatFloatValue(UNIT_FIELD_POWER_REGEN_INTERRUPTED_FLAT_MODIFIER, CalculatePctN(combat_regen, modManaRegenInterrupt));
|
||||
|
||||
// SpiritRegen(SPI,INT,LEVEL) = (0.001 + (SPI x sqrt(INT) x BASE_REGEN[LEVEL])) x 5
|
||||
float sqint = sqrt(GetStat(STAT_INTELLECT));
|
||||
SetStatFloatValue(UNIT_FIELD_POWER_REGEN_FLAT_MODIFIER, 0.001f + power_regen * sqint);
|
||||
SetStatFloatValue(UNIT_FIELD_POWER_REGEN_INTERRUPTED_FLAT_MODIFIER, base_regen + CalculatePctN(spirit_regen, modManaRegenInterrupt));
|
||||
SetStatFloatValue(UNIT_FIELD_POWER_REGEN_FLAT_MODIFIER, 0.001f + spirit_regen + base_regen);
|
||||
}
|
||||
|
||||
void Player::UpdateRuneRegen(RuneType rune)
|
||||
|
||||
@@ -230,7 +230,6 @@ m_HostileRefManager(this), m_TempSpeed(0.0f), m_AutoRepeatFirstCast(false)
|
||||
m_baseSpellCritChance = 5;
|
||||
|
||||
m_CombatTimer = 0;
|
||||
m_lastManaUse = 0;
|
||||
|
||||
for (uint8 i = 0; i < MAX_SPELL_SCHOOL; ++i)
|
||||
m_threatModifier[i] = 1.0f;
|
||||
@@ -14325,11 +14324,6 @@ float Unit::GetAPMultiplier(WeaponAttackType attType, bool normalized)
|
||||
}
|
||||
}
|
||||
|
||||
bool Unit::IsUnderLastManaUseEffect() const
|
||||
{
|
||||
return getMSTimeDiff(m_lastManaUse, getMSTime()) < 5000;
|
||||
}
|
||||
|
||||
void Unit::SetContestedPvP(Player* attackedPlayer)
|
||||
{
|
||||
Player* player = GetCharmerOrOwnerPlayerOrPlayerItself();
|
||||
|
||||
@@ -2030,9 +2030,6 @@ class Unit : public WorldObject
|
||||
uint32 SpellCriticalDamageBonus(SpellInfo const* spellProto, uint32 damage, Unit* victim);
|
||||
uint32 SpellCriticalHealingBonus(SpellInfo const* spellProto, uint32 damage, Unit* victim);
|
||||
|
||||
void SetLastManaUse(uint32 spellCastTime) { m_lastManaUse = spellCastTime; }
|
||||
bool IsUnderLastManaUseEffect() const;
|
||||
|
||||
void SetContestedPvP(Player* attackedPlayer = NULL);
|
||||
|
||||
uint32 GetCastingTimeForBonus(SpellInfo const* spellProto, DamageEffectType damagetype, uint32 CastingTime) const;
|
||||
@@ -2349,7 +2346,6 @@ class Unit : public WorldObject
|
||||
|
||||
uint32 m_state; // Even derived shouldn't modify
|
||||
uint32 m_CombatTimer;
|
||||
uint32 m_lastManaUse; // msecs
|
||||
TimeTrackerSmall m_movesplineTimer;
|
||||
|
||||
Diminishing m_Diminishing;
|
||||
|
||||
@@ -4408,10 +4408,6 @@ void Spell::TakePower()
|
||||
m_caster->ModifyPower(powerType, -m_powerCost);
|
||||
else
|
||||
m_caster->ModifyPower(powerType, -irand(0, m_powerCost/4));
|
||||
|
||||
// Set the five second timer
|
||||
if (powerType == POWER_MANA && m_powerCost > 0)
|
||||
m_caster->SetLastManaUse(getMSTime());
|
||||
}
|
||||
|
||||
void Spell::TakeAmmo()
|
||||
|
||||
Reference in new issue
Block a user