示例#1
0
void Pet::UpdateMaxPower(Powers power)
{
    if (!CanModifyStats())
        return;

    UnitMods unitMod = UnitMods(UNIT_MOD_POWER_START + power);

    float intellectBonus = (power == POWER_MANA) ? (GetStat(STAT_INTELLECT) - GetCreateStat(STAT_INTELLECT))*(CalculateScalingData()->powerScale / 100.0f) : 0.0f;

    float value  = GetModifierValue(unitMod, BASE_VALUE) + GetCreatePowers(power) + intellectBonus;
    value *= GetModifierValue(unitMod, BASE_PCT);
    value += GetModifierValue(unitMod, TOTAL_VALUE);
    value *= GetModifierValue(unitMod, TOTAL_PCT);

    SetMaxPower(power, uint32(value));
}
示例#2
0
void Guardian::UpdateMaxHealth()
{
    UnitMods unitMod = UNIT_MOD_HEALTH;
    float stamina = GetStat(STAT_STAMINA) - GetCreateStat(STAT_STAMINA);

    float multiplicator;
    switch (GetEntry())
    {
        case ENTRY_IMP:
            multiplicator = 8.4f;
            break;
        case ENTRY_VOIDWALKER:
        case ENTRY_FELGUARD:
            multiplicator = 11.0f;
            break;
        case ENTRY_SUCCUBUS:
            multiplicator = 9.1f;
            break;
        case ENTRY_FELHUNTER:
            multiplicator = 9.5f;
            break;
        case ENTRY_GHOUL:
        case ENTRY_GARGOYLE:
            multiplicator = 15.0f;
            break;
        case ENTRY_WATER_ELEMENTAL:
            multiplicator = 1.0f;
            stamina = 0.0f;
            break;
        case ENTRY_BLOODWORM:
            SetMaxHealth(GetCreateHealth());
            return;
        default:
            multiplicator = 10.0f;
            break;
    }

    float value = GetModifierValue(unitMod, BASE_VALUE) + GetCreateHealth();
    value *= GetModifierValue(unitMod, BASE_PCT);
    value += GetModifierValue(unitMod, TOTAL_VALUE) + stamina * multiplicator;
    value *= GetModifierValue(unitMod, TOTAL_PCT);

    SetMaxHealth((uint32)value);
}
void Player::UpdateDodgePercentage()
{
    // Base dodge
    float value = (getClass() < MAX_CLASSES) ? PLAYER_BASE_DODGE[getClass()] : 0.0f;
    // Dodge from agility
    value += GetDodgeFromAgility(GetStat(STAT_AGILITY));
    // Dodge from SPELL_AURA_MOD_DODGE_PERCENT aura
    value += GetTotalAuraModifier(SPELL_AURA_MOD_DODGE_PERCENT);
    // Dodge from rating
    value += GetRatingBonusValue(CR_DODGE);
    // Set current dodge chance
    m_modDodgeChance = value;
    // Set value for diminishing when in combat
    m_modDodgeChanceDiminishing = GetDodgeFromAgility((GetStat(STAT_AGILITY) - (GetCreateStat(STAT_AGILITY) * m_auraModifiersGroup[UNIT_MOD_STAT_START + STAT_AGILITY][BASE_PCT])));
    m_modDodgeChanceDiminishing += GetRatingBonusValue(CR_DODGE);
    // Set UI display value: modify value from defense skill against same level target
    value += (int32(GetDefenseSkillValue()) - int32(GetMaxSkillValueForLevel())) * 0.04f;
    SetStatFloatValue(PLAYER_DODGE_PERCENTAGE, std::max(0.0f, std::min(value, 100.0f)));
}
示例#4
0
void Guardian::UpdateMaxHealth()
{
    UnitMods unitMod = UNIT_MOD_HEALTH;
    float stamina = GetStat(STAT_STAMINA) - GetCreateStat(STAT_STAMINA);

    float multiplicator;
    switch (GetEntry())
    {
        case ENTRY_BLOODWORM:       multiplicator = 1.0f;   break;
        case ENTRY_WATER_ELEMENTAL: multiplicator = 7.5;  break;
        default:                    multiplicator = 14.0f;  break;
    }

    float value = GetModifierValue(unitMod, BASE_VALUE) + GetCreateHealth();
    value *= GetModifierValue(unitMod, BASE_PCT);
    value += GetModifierValue(unitMod, TOTAL_VALUE) + stamina * multiplicator;
    value *= GetModifierValue(unitMod, TOTAL_PCT);

    SetMaxHealth((uint32)value);
}
示例#5
0
void Guardian::UpdateMaxHealth()
{
    UnitMods unitMod = UNIT_MOD_HEALTH;
    float stamina = GetStat(STAT_STAMINA) - GetCreateStat(STAT_STAMINA);

    uint32 basehealth = 0;
    if (Unit* owner = GetCharmerOrOwner())
        basehealth = owner->GetMaxHealth();

    float multiplicator;
    switch (GetEntry())
    {
        case ENTRY_IMP:                 multiplicator = 0.30f;   break;
        case ENTRY_VOIDWALKER:          multiplicator = 0.50f;  break;
        case ENTRY_SUCCUBUS:            multiplicator = 0.45f;   break;
        case ENTRY_FELHUNTER:           multiplicator = 0.70f; break;
        case ENTRY_FELGUARD:            multiplicator = 0.75f;  break;
        case ENTRY_BLOODWORM:           multiplicator = 0.10f;   break;
        case ENTRY_GHOUL:               multiplicator = 0.75f;  break;
        case ENTRY_GARGOYLE:            multiplicator = 0.75f;  break;
        case ENTRY_WATER_ELEMENTAL:     multiplicator = 0.50f;  break;
        default:                        multiplicator = 0.70f;  break;
    }

    basehealth *= multiplicator;

    float value = GetModifierValue(unitMod, BASE_VALUE) + basehealth;
    value *= GetModifierValue(unitMod, BASE_PCT);
    value += GetModifierValue(unitMod, TOTAL_VALUE) + stamina * 10;
    value *= GetModifierValue(unitMod, TOTAL_PCT);

    // Glyph of Voidwalker
    if (GetEntry() == ENTRY_VOIDWALKER)
    {
        if (Player * owner = GetSpellModOwner())
            if (AuraEffect * auraEff = owner->GetAuraEffect(56247, 0))
                AddPct(value, auraEff->GetAmount());
    }

    SetMaxHealth((uint32)value);
}
示例#6
0
void Guardian::UpdateMaxHealth()
{
    UnitMods unitMod = UNIT_MOD_HEALTH;
    //Ghouls have no base hp. only the one gained from stamina
    float stamina = GetStat(STAT_STAMINA) - (GetEntry()==ENTRY_GHOUL ? 0.0f : GetCreateStat(STAT_STAMINA));

    float multiplicator;
    switch(GetEntry())
    {
        case ENTRY_IMP:         multiplicator = 8.4f;   break;
        case ENTRY_VOIDWALKER:  multiplicator = 11.0f;  break;
        case ENTRY_SUCCUBUS:    multiplicator = 9.1f;   break;
        case ENTRY_FELHUNTER:   multiplicator = 9.5f;   break;
        case ENTRY_FELGUARD:    multiplicator = 11.0f;  break;
        case ENTRY_GHOUL:       multiplicator = 10.0f;   break;
		case ENTRY_FIRE_ELEMENTAL:       multiplicator = 1.0f;  break;
		case ENTRY_EARTH_ELEMENTAL:       multiplicator = 20.0f;  break;
		default:
			{
			if (isGuardian() || isTotem())
				multiplicator = 0.0f;                 // Guardians and Totems gain no hp from the owner
			else
			    multiplicator = 10.0f;                // Pets, and Minions do get health from stamina
			break;
			}
    }
	if (isHunterPet())
		multiplicator = 10.0f;
    
	//Ghouls have no base hp. only the one gained from stamina
	float value   = (GetEntry()==ENTRY_GHOUL ? 0 : GetModifierValue(unitMod, BASE_VALUE) + GetCreateHealth());
    value  *= GetModifierValue(unitMod, BASE_PCT);
    value  += GetModifierValue(unitMod, TOTAL_VALUE) + stamina * multiplicator;
    value  *= GetModifierValue(unitMod, TOTAL_PCT);

    SetMaxHealth((uint32)value);
}
示例#7
0
void Guardian::UpdateMaxPower(Powers power)
{
    UnitMods unitMod = UnitMods(UNIT_MOD_POWER_START + power);

    float addValue = (power == POWER_MANA) ? GetStat(STAT_INTELLECT) - GetCreateStat(STAT_INTELLECT) : 0.0f;
    float multiplicator = 15.0f;

    switch (GetEntry())
    {
        case ENTRY_IMP:         multiplicator = 4.95f;  break;
        case ENTRY_VOIDWALKER:
        case ENTRY_SUCCUBUS:
        case ENTRY_FELHUNTER:
        case ENTRY_FELGUARD:    multiplicator = 11.5f;  break;
        default:                multiplicator = 15.0f;  break;
    }

    float value  = GetModifierValue(unitMod, BASE_VALUE) + GetCreatePowers(power);
    value *= GetModifierValue(unitMod, BASE_PCT);
    value += GetModifierValue(unitMod, TOTAL_VALUE) + addValue * multiplicator;
    value *= GetModifierValue(unitMod, TOTAL_PCT);

    SetMaxPower(power, uint32(value));
}
示例#8
0
void Pet::UpdateMaxHealth()
{
    UnitMods unitMod = UNIT_MOD_HEALTH;
    float stamina = GetStat(STAT_STAMINA) - GetCreateStat(STAT_STAMINA);
    float multiplicator;

    // nesocips warlock pet stats calculation
    switch(GetEntry())
    {
        case 416:   multiplicator = 8.4f;  break; // imp
        case 1860:                                // voidwalker
        case 17252: multiplicator = 11.0f; break; // felguard
        case 1863:  multiplicator = 9.1f;  break; // succubus
        case 417:   multiplicator = 9.5f;  break; // felhunter
        default:    multiplicator = 10.0f; break;
    }

    float value   = GetModifierValue(unitMod, BASE_VALUE) + GetCreateHealth();
    value  *= GetModifierValue(unitMod, BASE_PCT);
    value  += GetModifierValue(unitMod, TOTAL_VALUE) + stamina * multiplicator;
    value  *= GetModifierValue(unitMod, TOTAL_PCT);

    SetMaxHealth((uint32)value);
}
示例#9
0
void Player::UpdateDodgePercentage()
{
    // Table for base dodge values
    const int dodge_base[MAX_CLASSES] =
    {
        3, // Warrior
        3, // Paladin
        3, // Hunter
        3, // Rogue
        3, // Priest
        5, // DK
        3, // Shaman
        3, // Mage
        3, // Warlock
        3, // Monk
        5  // Druid
    };
    // Table for dodge cap values
    const float dodge_cap[MAX_CLASSES] =
    {
        90.6425f,       // Warrior
        66.567f,        // Paladin
        145.560408f,    // Hunter
        145.560408f,    // Rogue
        150.375940f,    // Priest
        90.6426f,       // DK
        66.567f,        // Shaman
        150.375940f,    // Mage
        150.375940f,    // Warlock
        501.253f,       // Monk
        150.375940f     // Druid
    };

    float diminishing = 0.0f, nondiminishing = 0.0f;
    uint32 pclass = getClass() - 1;
    // Warriors, Death Knights and Paladins no longer gain dodge from agility
    if (getClass() != CLASS_WARRIOR && getClass() != CLASS_DEATH_KNIGHT && getClass() != CLASS_PALADIN)
    {
        // TODO: research if talents/effects that increase total agility by x% should increase non-diminishing part
        float base_agility = GetCreateStat(STAT_AGILITY) * m_auraModifiersGroup[UNIT_MOD_STAT_START + STAT_AGILITY][BASE_PCT];
        float bonus_agility = GetTotalStatValue(STAT_AGILITY) - base_agility;
        float perc_cap = sObjectMgr->GetDodgeCapForClassLevel(pclass * GT_MAX_LEVEL + getLevel() - 1);

        // calculate diminishing (green in char screen) and non-diminishing (white) contribution
        diminishing = (bonus_agility / perc_cap) / ((bonus_agility / perc_cap) / dodge_cap[pclass] + m_diminishing_k[pclass]);
        nondiminishing = dodge_base[pclass] + base_agility / perc_cap;
    }
    else
        nondiminishing = dodge_base[pclass];

    // Dodge from SPELL_AURA_MOD_DODGE_PERCENT aura
    nondiminishing += GetTotalAuraModifier(SPELL_AURA_MOD_DODGE_PERCENT);
    // Dodge from rating
    diminishing += GetRatingBonusValue(CR_DODGE);
    // apply diminishing formula to diminishing dodge chance
    float value = nondiminishing + diminishing;

    if (sWorld->getBoolConfig(CONFIG_STATS_LIMITS_ENABLE))
        value = value > sWorld->getFloatConfig(CONFIG_STATS_LIMITS_DODGE) ? sWorld->getFloatConfig(CONFIG_STATS_LIMITS_DODGE) : value;

    value = value < 0.0f ? 0.0f : value;
    SetStatFloatValue(PLAYER_DODGE_PERCENTAGE, value);
}
示例#10
0
void Player::UpdateParryPercentage()
{
    // Table for base parry values
    const int parry_base[MAX_CLASSES] =
    {
        3, // Warrior
        3, // Paladin
        0, // Hunter
        3, // Rogue
        0, // Priest
        3, // DK
        0, // Shaman
        0, // Mage
        0, // Warlock
        3, // Monk
        0  // Druid
    };

    const float parry_cap[MAX_CLASSES] =
    {
        237.186f,       // Warrior
        237.186f,       // Paladin
        0.0f,           // Hunter
        90.6424f,       // Rogue
        0.0f,           // Priest
        237.186f,       // DK
        0.0f,           // Shaman
        0.0f,           // Mage
        0.0f,           // Warlock
        90.6424f,       // Monk
        0.0f            // Druid
    };

    // No parry
    float value = 0.0f;
    uint32 pclass = getClass()-1;
    if (CanParry() && parry_cap[pclass] > 0.0f)
    {
        float nondiminishing = parry_base[pclass];
        // Parry from rating
        float diminishing = GetRatingBonusValue(CR_PARRY);
        // TODO: research if talents/effects that increase total parry by x% should increase non-diminishing part
        float base_strength = GetCreateStat(STAT_STRENGTH) * m_auraModifiersGroup[UNIT_MOD_STAT_START + STAT_STRENGTH][BASE_PCT];
        float bonus_strength = GetTotalStatValue(STAT_STRENGTH) - base_strength;
        float perc_cap = sObjectMgr->GetParryCapForClassLevel(pclass * GT_MAX_LEVEL + getLevel() - 1);

        // calculate diminishing (green in char screen) and non-diminishing (white) contribution
        diminishing += (bonus_strength / perc_cap) / ((bonus_strength / perc_cap) / parry_cap[pclass] + m_diminishing_k[pclass]);
        nondiminishing += base_strength / perc_cap;
        // Parry from SPELL_AURA_MOD_PARRY_PERCENT aura
        nondiminishing += GetTotalAuraModifier(SPELL_AURA_MOD_PARRY_PERCENT);
        // apply diminishing formula to diminishing parry chance
        value = nondiminishing + diminishing;

        if (sWorld->getBoolConfig(CONFIG_STATS_LIMITS_ENABLE))
            value = value > sWorld->getFloatConfig(CONFIG_STATS_LIMITS_PARRY) ? sWorld->getFloatConfig(CONFIG_STATS_LIMITS_PARRY) : value;

        value = value < 0.0f ? 0.0f : value;
    }
    SetStatFloatValue(PLAYER_PARRY_PERCENTAGE, value);
}