halaman baru

This commit is contained in:
='fauz
2025-05-10 14:48:08 +07:00
parent d41e1f84a0
commit 8478822f4a
9 changed files with 610 additions and 34 deletions
+31
View File
@@ -0,0 +1,31 @@
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;
}
}