Core/Units: fixed initializing stat multipliers and displaying positive and negative mods

This commit is contained in:
Ovahlord committed 2026-06-11 05:41:38 +02:00
1 parent 906c4ed081
commit d0b0f35a42
2 files changed
+3 -4

No files matched your search

+2 -2
View File
@@ -27,7 +27,7 @@ Stats::Stats(Unit* owner) : _owner(owner), _baseStats({ }), _baseStatModifiers({
_totalModifiers({ }), _totalPctMultipliers({ })
{
_basePctMultipliers.fill(1.0);
_totalModifiers.fill(1.0);
_totalPctMultipliers.fill(1.0);
}
/// Returns the unmodified base value of the specified stat.
@@ -255,7 +255,7 @@ void Stats::updateStat(StatType statType)
if (totalValue < statValue)
posStatValue += statValue - totalValue;
else
negStatValue += statValue - totalValue;
negStatValue += totalValue - statValue;
// ==== Apply the stats
_owner->SetInt32Value(UNIT_FIELD_STAT0 + AsUnderlyingType(statType), statValue);
+1 -2
View File
@@ -13631,8 +13631,7 @@ void Unit::BuildValuesUpdate(uint8 updateType, ByteBuffer* data, Player* target)
// there are some float values which may be negative or can't get negative due to other checks
else if ((index >= UNIT_FIELD_NEGSTAT0 && index <= UNIT_FIELD_NEGSTAT4) ||
(index >= UNIT_FIELD_RESISTANCEBUFFMODSPOSITIVE && index <= (UNIT_FIELD_RESISTANCEBUFFMODSPOSITIVE + 6)) ||
(index >= UNIT_FIELD_RESISTANCEBUFFMODSNEGATIVE && index <= (UNIT_FIELD_RESISTANCEBUFFMODSNEGATIVE + 6)) ||
(index >= UNIT_FIELD_POSSTAT0 && index <= UNIT_FIELD_POSSTAT4))
(index >= UNIT_FIELD_RESISTANCEBUFFMODSNEGATIVE && index <= (UNIT_FIELD_RESISTANCEBUFFMODSNEGATIVE + 6)))
{
fieldBuffer << uint32(m_floatValues[index]);
}