mirror of
https://github.com/araxiaonline/TrinityCore.git
synced 2026-06-21 15:27:47 -04:00
Core/Creatures: port power type updates from master branch
Core/Misc: Added helper function Unit::SetFullPower Cherry-picked from8199eef81cCore/Creatures: Updated power type handling (#20981) Cherry-picked from16a7a414ab
This commit is contained in:
@@ -326,7 +326,7 @@ void Player::UpdateMaxPower(Powers power)
|
||||
value += GetFlatModifierValue(unitMod, TOTAL_VALUE) + bonusPower;
|
||||
value *= GetPctModifierValue(unitMod, TOTAL_PCT);
|
||||
|
||||
SetMaxPower(power, uint32(value));
|
||||
SetMaxPower(power, uint32(std::lroundf(value)));
|
||||
}
|
||||
|
||||
void Player::ApplyFeralAPBonus(int32 amount, bool apply)
|
||||
@@ -1029,8 +1029,12 @@ void Creature::UpdateMaxPower(Powers power)
|
||||
{
|
||||
UnitMods unitMod = UnitMods(UNIT_MOD_POWER_START + power);
|
||||
|
||||
float value = GetTotalAuraModValue(unitMod);
|
||||
SetMaxPower(power, uint32(value));
|
||||
float value = GetFlatModifierValue(unitMod, BASE_VALUE) + GetCreatePowers(power);
|
||||
value *= GetPctModifierValue(unitMod, BASE_PCT);
|
||||
value += GetFlatModifierValue(unitMod, TOTAL_VALUE);
|
||||
value *= GetPctModifierValue(unitMod, TOTAL_PCT);
|
||||
|
||||
SetMaxPower(power, uint32(std::lroundf(value)));
|
||||
}
|
||||
|
||||
void Creature::UpdateAttackPowerAndDamage(bool ranged)
|
||||
@@ -1237,6 +1241,8 @@ bool Guardian::UpdateStats(Stats stat)
|
||||
|
||||
bool Guardian::UpdateAllStats()
|
||||
{
|
||||
UpdateMaxHealth();
|
||||
|
||||
for (uint8 i = STAT_STRENGTH; i < MAX_STATS; ++i)
|
||||
UpdateStats(Stats(i));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user