Description
Description
After #31936 / commit e45b30bc681f, player base stats stack on every level-up until relog.
The regression appears to come from the new Unit::SetCreateStat implementation:
void Unit::SetCreateStat(Stats stat, float val) { UnitMods const unitMod = static_cast<UnitMods>(UNIT_MOD_STAT_START + AsUnderlyingType(stat)); HandleStatFlatModifier(unitMod, BASE_VALUE, val, true); }
must be void Unit::SetCreateStat(Stats stat, float val) { UnitMods const unitMod = static_cast<UnitMods>(UNIT_MOD_STAT_START + AsUnderlyingType(stat)); SetStatFlatModifier(unitMod, BASE_VALUE, val); }
Expected behaviour
SetCreateStat should replace the fixed create stat for the current level, not accumulate it across levels.
Steps to reproduce the problem
- Log in on a low-level character.
- Note the current level and max HP.
- Gain exactly one level using normal XP or
.levelup 1.
- Note max HP immediately after the level-up.
- Relog.
- Compare max HP before and after relog.
Observed:
Level 2 after relog: 321 HP
Level 3 immediately after level-up: 672 HP
Level 3 after relog: 351 HP
### Branch
master
### TC rev. hash/commit
-
### Operating system
Windows 11 x64
### Custom changes
no
Description
Description
After #31936 / commit
e45b30bc681f, player base stats stack on every level-up until relog.The regression appears to come from the new
Unit::SetCreateStatimplementation:void Unit::SetCreateStat(Stats stat, float val) { UnitMods const unitMod = static_cast<UnitMods>(UNIT_MOD_STAT_START + AsUnderlyingType(stat)); HandleStatFlatModifier(unitMod, BASE_VALUE, val, true); }must be
void Unit::SetCreateStat(Stats stat, float val) { UnitMods const unitMod = static_cast<UnitMods>(UNIT_MOD_STAT_START + AsUnderlyingType(stat)); SetStatFlatModifier(unitMod, BASE_VALUE, val); }Expected behaviour
SetCreateStat should replace the fixed create stat for the current level, not accumulate it across levels.
Steps to reproduce the problem
.levelup 1.Observed: