didier/database/utils/math/currency.py

67 lines
1.5 KiB
Python

import math
__all__ = [
"capacity_upgrade_price",
"interest_upgrade_price",
"rob_upgrade_price",
"jail_chance",
"jail_time",
"rob_amount",
"rob_chance",
]
def interest_upgrade_price(level: int) -> int:
"""Calculate the price to upgrade your interest level"""
base_cost = 600
growth_rate = 1.8
return math.floor(base_cost * (growth_rate**level))
def capacity_upgrade_price(level: int) -> int:
"""Calculate the price to upgrade your capacity level"""
base_cost = 800
growth_rate = 1.6
return math.floor(base_cost * (growth_rate**level))
def rob_upgrade_price(level: int) -> int:
"""Calculate the price to upgrade your rob level"""
base_cost = 950
growth_rate = 1.9
return math.floor(base_cost * (growth_rate**level))
def jail_chance(level: int) -> float:
"""Calculate the chance that you'll end up in jail"""
base_chance = 0.35
growth_rate = 1.15
return max(0.0, base_chance - (growth_rate**level))
def jail_time(level: int) -> int:
"""Calculate the time in hours you'll have to spend in jail"""
base_hours = 2
growth_rate = 1.27
return math.floor(base_hours + growth_rate**level)
def rob_amount(level: int) -> int:
"""Calculate the maximum amount of Didier Dinks that you can rob"""
base_amount = 250
growth_rate = 1.4
return math.floor(base_amount * (growth_rate**level))
def rob_chance(level: int) -> float:
"""Calculate the chances of a robbing attempt being successful"""
base_chance = 0.25
return base_chance + 2.1 * level