fix: level-up formula uses current level, add xpToNextLevel to API
All checks were successful
CI/CD — Build & Deploy / Build & Deploy (push) Successful in 33s

XP threshold was computed on level+1 (target), making early levels too
steep (283 XP for level 2 instead of 100). Now uses current level:
level 1→2 = 100 XP, level 2→3 = 283 XP, level 10→11 = 3162 XP.

Added xpToNextLevel field to character and combat responses so the
frontend can display accurate progress bars.
This commit is contained in:
2026-03-24 16:02:51 +01:00
parent 6df11f2860
commit 214045c7ce
3 changed files with 18 additions and 6 deletions

View File

@@ -14,6 +14,7 @@ import { CommunityService } from '../community/community.service';
import {
resolveCombat,
applyXpGain,
xpRequiredForLevel,
CombatantStats,
} from './combat.engine';
@@ -237,6 +238,7 @@ export class CombatService {
character: {
level: character.level,
xp: character.xp,
xpToNextLevel: xpRequiredForLevel(character.level),
gold: character.gold,
hpCurrent: character.hpCurrent,
hpMax: character.hpMax,