mirror of
https://github.com/rr-/pq-cli.git
synced 2026-11-12 22:40:36 -07:00
mechanic: use upstream's exponential level curve
This commit is contained in:
5 files changed
+3526
-3500
No files matched your search
+3
-2
@@ -59,8 +59,9 @@ class SignalMixin:
|
||||
|
||||
|
||||
def level_up_time(level: int) -> int:
|
||||
# seconds
|
||||
return 20 * level * 60
|
||||
# seconds: 20 minutes for level 1, exponential increase after that.
|
||||
# floor(x + 0.5) mirrors JS Math.round, unlike Python's round().
|
||||
return math.floor((20 + 1.15**level) * 60 + 0.5)
|
||||
|
||||
|
||||
class Bar(SignalMixin):
|
||||
|
||||
Vendored
+1173
-1166
File diff suppressed because it is too large.
Load diff
Vendored
+1180
-1173
File diff suppressed because it is too large.
Load diff
Vendored
+1161
-1159
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,9 @@
|
||||
from pqcli.mechanic import level_up_time
|
||||
|
||||
|
||||
def test_level_up_time_matches_upstream() -> None:
|
||||
# Math.round((20 + Math.pow(1.15, level)) * 60), pq-web 5cd39f1
|
||||
assert level_up_time(1) == 1269
|
||||
assert level_up_time(10) == 1443
|
||||
assert level_up_time(30) == 5173
|
||||
assert level_up_time(100) == 70460007
|
||||
Reference in new issue
Block a user