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
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:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user