124 lines
4.0 KiB
Python
124 lines
4.0 KiB
Python
from upgrades import coin_multiplier, lucky_coin, flip_chance
|
|
#import menu
|
|
import random
|
|
|
|
propability = 40
|
|
coins_per_head = 0.5
|
|
wealth = 5000
|
|
heads_amount = 1
|
|
multiplier = 0.5
|
|
|
|
#Game
|
|
def coin_flip(propability, wealth, coins_per_head, heads_amount, multiplier):
|
|
while True:
|
|
result = random.randint(0, 100)
|
|
if result in range(0,propability):
|
|
print(f'Kopf ({heads_amount}x)')
|
|
heads_amount += 1 #Anzahl an hintereinander geworfenen "Köpfen"
|
|
if heads_amount >=3:
|
|
coins_per_head += multiplier #Coin-Boost für mehrfaches werfen von Kopf hintereinander
|
|
else:
|
|
coins_per_head = 0.5
|
|
wealth += coins_per_head
|
|
print('')
|
|
print(f'Du hast {wealth} Coins (+ {coins_per_head})')
|
|
answer = input()
|
|
try:
|
|
answer = int(answer)
|
|
if answer == 4:
|
|
homepage_upgrades(wealth)
|
|
else:
|
|
continue
|
|
except ValueError:
|
|
continue
|
|
elif result in range(propability,100):
|
|
print('Zahl')
|
|
heads_amount = 1
|
|
answer = input()
|
|
try:
|
|
answer = int(answer)
|
|
if answer == 4:
|
|
homepage_upgrades(wealth)
|
|
else:
|
|
continue
|
|
except ValueError:
|
|
continue
|
|
|
|
|
|
|
|
|
|
base_lvl_coin_multiplier = coin_multiplier(0.5, 10)
|
|
base_lvl_flip_chance = flip_chance(10, 0)
|
|
base_lvl_lucky_coin = lucky_coin(0.5, 10)
|
|
|
|
def lvl_up_multiplier():
|
|
lvl_up = True
|
|
|
|
if lvl_up == True:
|
|
base_lvl_coin_multiplier.cost *= 2.5
|
|
base_lvl_coin_multiplier.multiplier *= 5
|
|
print(f' CM: {base_lvl_coin_multiplier.cost}')
|
|
print(f' MM: {base_lvl_coin_multiplier.multiplier}')
|
|
|
|
def lvl_up_flip_chance():
|
|
lvl_up = True
|
|
|
|
if lvl_up == True:
|
|
base_lvl_flip_chance.cost += 1
|
|
base_lvl_flip_chance.cost *= 6
|
|
base_lvl_flip_chance.chance *= 1.5
|
|
print(f" FC Cost: {base_lvl_flip_chance.cost}")
|
|
print(f" FC Chance: {base_lvl_flip_chance.chance}")
|
|
|
|
def lvl_up_lucky_coin():
|
|
lvl_up = True
|
|
|
|
if lvl_up == True:
|
|
base_lvl_lucky_coin.cost *= 3
|
|
base_lvl_lucky_coin.chance *= 1.5
|
|
print(f" LC Cost: {base_lvl_lucky_coin.cost}")
|
|
print(f" LC Chance: {base_lvl_lucky_coin.chance}")
|
|
|
|
def homepage_upgrades(wealth):
|
|
while True:
|
|
answer = input(f' Flip Chance (Preis: {base_lvl_flip_chance.cost} Coins): [1]\n Lucky Coin: [2]\n Multiplier: [3]\n Zum Game: [4]')
|
|
try:
|
|
answer = int(answer)
|
|
if answer == 1:
|
|
if wealth >= base_lvl_flip_chance.cost:
|
|
lvl_up_flip_chance()
|
|
wealth -= base_lvl_flip_chance.cost
|
|
print(f'Erfolgreich geupgradet. Du hast {wealth} Coins')
|
|
break
|
|
else:
|
|
print('Du bist zu arm')
|
|
|
|
elif answer == 2:
|
|
if wealth >= base_lvl_lucky_coin.cost:
|
|
lvl_up_lucky_coin()
|
|
wealth -= base_lvl_lucky_coin.cost
|
|
print(f'Erfolgreich geupgradet. Du hast {wealth} Coins')
|
|
break
|
|
else:
|
|
print('Du bist zu arm')
|
|
|
|
elif answer == 3:
|
|
if wealth >= base_lvl_coin_multiplier.cost:
|
|
lvl_up_multiplier()
|
|
wealth -= base_lvl_coin_multiplier.cost
|
|
print(f'Erfolgreich geupgradet. Du hast {wealth} Coins')
|
|
break
|
|
else:
|
|
print('Du bist zu arm')
|
|
elif answer == 4:
|
|
coin_flip(propability, wealth, coins_per_head, heads_amount, multiplier)
|
|
|
|
|
|
|
|
elif answer not in (1, 2, 3, 4):
|
|
print('Bitte 1, 2, 3 oder 4!')
|
|
|
|
except ValueError:
|
|
print('Nur Zahlen')
|
|
|
|
coin_flip(propability, wealth, coins_per_head, heads_amount, multiplier) |