diff options
author | Viljami Ilola <+@hix.fi> | 2024-03-24 12:32:42 +0200 |
---|---|---|
committer | Viljami Ilola <+@hix.fi> | 2024-03-24 12:32:42 +0200 |
commit | 749d47df38540342a7fe19029284b8115b03574a (patch) | |
tree | dbcc6c9a67644b7f73a00885cbafe8cb14dee3dd /src/sliceitoff/stats | |
parent | c22159dfb5abda283d76248b474098cc2110935c (diff) |
scoring
Diffstat (limited to 'src/sliceitoff/stats')
-rw-r--r-- | src/sliceitoff/stats/stats.py | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/src/sliceitoff/stats/stats.py b/src/sliceitoff/stats/stats.py index 80cd347..4024e53 100644 --- a/src/sliceitoff/stats/stats.py +++ b/src/sliceitoff/stats/stats.py @@ -3,7 +3,9 @@ class Stats: level = 0 bonus = 0 lives = 0 + enemies = 0 percent = 0 + field_count = 0 bgcolor = (64,0,0,255) bordercolor = (0,0,0,255) @@ -14,20 +16,33 @@ class Stats: __class__.bonus = 20_000 __class__.lives = 3 __class__.percent = 100 + __class__.field_count = 1 + __class__.enemies = 3 @staticmethod def level_up(): - __class__.score += __class__.level * 3_000 - __class__.score += __class__.level * __class__.bonus + __class__.score += __class__.calc_bonus()[0] __class__.bonus = 20_000 __class__.percent = 100 + __class__.field_count = 1 __class__.level += 1 + __class__.enemies = 3 + (__class__.level - 1) * 2 @staticmethod def lose_life(): __class__.lives -= 1 return not __class__.lives - + + @staticmethod + def calc_bonus(): + level = __class__.level * 3_000 + life = __class__.lives * 1_000 + time = __class__.level * __class__.bonus + area = __class__.level * int(max(20-__class__.percent,0) * 1_000) + herd = (__class__.enemies - __class__.field_count) * 1_000 + total = level + area + time + life + herd + return total, level, life, time, area, herd + @staticmethod def update_bonus(dt): __class__.bonus = max(0, __class__.bonus - dt) |