Skip to content

Commit 68058d8

Browse files
committed
Update XP calculation when leveling up
1 parent a9fe0bb commit 68058d8

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

app.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,12 @@ def check_level_up(self): # check if user has leveled up
5454
self.xp >= self.xp_required
5555
): # if user XP is greater than or equal to XP required
5656
self.xp -= self.xp_required
57-
self.xp_required = round(
58-
self.xp_required + self.xp_required * 1 / math.sqrt(self.level)
57+
self.xp_required = max(
58+
1,
59+
round(
60+
self.xp_required
61+
+ max(1, self.xp_required * 1 / math.sqrt(self.level))
62+
),
5963
) # increase XP required exponentially with slower growth at higher levels
6064
self.level += 1 # increase level
6165

0 commit comments

Comments
 (0)