Skip to content

Commit 0f30eda

Browse files
committed
Add time multiplier based on speed
1 parent fa6e7b3 commit 0f30eda

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

app.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,17 @@ def add_xp(self, amount: float) -> None: # add XP
8888
1 # reset multiplier if amount is not the same as last item clicked
8989
)
9090
self.last_item_clicked = amount # set last item clicked to amount
91-
self.xp += amount * self.multiplier * self.time_multiplier # add XP by amount
92-
self.total_xp += (
93-
amount * self.multiplier * self.time_multiplier
91+
self.xp += round(
92+
amount
93+
* self.multiplier
94+
* self.time_multiplier
95+
* (1 + 5.0 / (abs(time_difference_seconds) + 1))
96+
) # add XP by amount
97+
self.total_xp += round(
98+
amount
99+
* self.multiplier
100+
* self.time_multiplier
101+
* (1 + 5.0 / (abs(time_difference_seconds) + 1))
94102
) # add total XP by amount
95103
self.check_level_up() # check if user has leveled up
96104

0 commit comments

Comments
 (0)