Esempio n. 1
0
void Player::UpdateManaRegen()
{
    if (GetPowerIndex(POWER_MANA) == MAX_POWERS)
        return;

    // Mana regen from spirit
    float spirit_regen = OCTRegenMPPerSpirit();
    float pctPerSec = 0.004f;
    float netherBonus = 1.0f; 
    float regenRate = 1.0f;
    uint32 baseMana = GetCreateMana();

    // CombatRegen = 2-5% of Base Mana depending on class
    // Warlock and Mage have 5% default regen
    switch (getClass())
    {
        case CLASS_MAGE:
            // According to reports by QA, Nether Attunement should give a 65% regen boost
            if (HasAura(117957))
                netherBonus = 1.13f;

        case CLASS_WARLOCK:
            // Base percent per second is higher for mages and warlocks
            pctPerSec = 0.01f;

            // Additionally add haste to the mana regen for Warlocks and Mages
            if (HasAuraType(SPELL_AURA_MOD_MANA_REGEN_BY_HASTE))
                regenRate = GetFloatValue(UNIT_MOD_HASTE_REGEN);
            break;
        case CLASS_DRUID:
            // Druids should be calculated based off their mana pool after they gain Natural Insight
            if (HasAura(112857))
                baseMana *= 5;
            break;
        case CLASS_PALADIN:
            // Paladins should be calculated based off their mana pool after they gain Holy Insight
            if (HasAura(112859))
                baseMana *= 5;
            break;
        case CLASS_SHAMAN:
            // Shamans should be calculated based off their mana pool after they gain Spiritual Insight (also elemental shamans)
            if (HasAura(112858) || HasAura(123099))
                baseMana *= 5;
            break;
        default:
            break;
    }

    float base_regen = (baseMana * pctPerSec * netherBonus) / regenRate + (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);

    // Questionable
    base_regen *= GetTotalAuraMultiplierByMiscValue(SPELL_AURA_MOD_POWER_REGEN_PERCENT, POWER_MANA);

    SetStatFloatValue(UNIT_FIELD_POWER_REGEN_INTERRUPTED_FLAT_MODIFIER + GetPowerIndex(POWER_MANA), base_regen + CalculatePct(spirit_regen, modManaRegenInterrupt));
    SetStatFloatValue(UNIT_FIELD_POWER_REGEN_FLAT_MODIFIER + GetPowerIndex(POWER_MANA), 0.001f + spirit_regen + base_regen);
}
Esempio n. 2
0
void Player::UpdateAllRunesRegen()
{
    if (getClass() != CLASS_DEATH_KNIGHT)
        return;

    uint32 runeIndex = GetPowerIndex(POWER_RUNES);
    if (runeIndex == MAX_POWERS)
        return;

    PowerTypeEntry const* runeEntry = sDB2Manager.GetPowerTypeEntry(POWER_RUNES);

    uint32 cooldown = GetRuneBaseCooldown();
    SetStatFloatValue(UNIT_FIELD_POWER_REGEN_FLAT_MODIFIER + runeIndex, float(1 * IN_MILLISECONDS) / float(cooldown) - runeEntry->RegenerationPeace);
    SetStatFloatValue(UNIT_FIELD_POWER_REGEN_INTERRUPTED_FLAT_MODIFIER + runeIndex, float(1 * IN_MILLISECONDS) / float(cooldown) - runeEntry->RegenerationCombat);
}
Esempio n. 3
0
void Player::UpdateManaRegen()
{
    uint32 manaIndex = GetPowerIndex(POWER_MANA);
    if (manaIndex == MAX_POWERS)
        return;

    // Mana regen from spirit
    float spirit_regen = 0.0f;
    // Apply PCT bonus from SPELL_AURA_MOD_POWER_REGEN_PERCENT aura on spirit base regen
    spirit_regen *= GetTotalAuraMultiplierByMiscValue(SPELL_AURA_MOD_POWER_REGEN_PERCENT, POWER_MANA);

    // CombatRegen = 5% of Base Mana
    float base_regen = GetCreateMana() * 0.02f + 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);

    SetStatFloatValue(UNIT_FIELD_POWER_REGEN_INTERRUPTED_FLAT_MODIFIER + manaIndex, base_regen + CalculatePct(spirit_regen, modManaRegenInterrupt));
    SetStatFloatValue(UNIT_FIELD_POWER_REGEN_FLAT_MODIFIER + manaIndex, 0.001f + spirit_regen + base_regen);
}