FreekakeApp/lib/util/player_point.dart
2025-05-10 14:48:08 +07:00

32 lines
473 B
Dart

class PlayerPoints {
int xp;
int gp;
int sp;
int level;
PlayerPoints({
required this.xp,
required this.gp,
required this.sp,
required this.level,
});
void addXP(int value) {
xp += value;
if (xp >= xpToNextLevel()) {
levelUp();
}
}
void addGP(int value) => gp += value;
void addSP(int value) => sp += value;
int xpToNextLevel() => 1000 + (level * 200);
void levelUp() {
level++;
sp++;
xp = 0;
}
}