Skip to content

Core/Stats: Base stats accumulate on level-up after #31936 #32042

Description

@Artem29383

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

  1. Log in on a low-level character.
  2. Note the current level and max HP.
  3. Gain exactly one level using normal XP or .levelup 1.
  4. Note max HP immediately after the level-up.
  5. Relog.
  6. 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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions