diff --git a/Game/__pycache__/game.cpython-313.pyc b/Game/__pycache__/game.cpython-313.pyc new file mode 100644 index 0000000..724c744 Binary files /dev/null and b/Game/__pycache__/game.cpython-313.pyc differ diff --git a/Game/__pycache__/menu.cpython-313.pyc b/Game/__pycache__/menu.cpython-313.pyc index 13b6bb6..384dbdd 100644 Binary files a/Game/__pycache__/menu.cpython-313.pyc and b/Game/__pycache__/menu.cpython-313.pyc differ diff --git a/Game/__pycache__/upgrades.cpython-313.pyc b/Game/__pycache__/upgrades.cpython-313.pyc index 053160e..4d4d596 100644 Binary files a/Game/__pycache__/upgrades.cpython-313.pyc and b/Game/__pycache__/upgrades.cpython-313.pyc differ diff --git a/Game/game.py b/Game/game.py index ff9ab73..d2b9df1 100644 --- a/Game/game.py +++ b/Game/game.py @@ -3,29 +3,29 @@ import random propability = 40 coins_per_head = 0.5 -coins = 5 +#wealth = 5000 heads_amount = 1 multiplier = 0.5 -def coin_flip(propability, coins, coins_per_head, heads_amount, multiplier): +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: - heads_per_head += multiplier #Coin-Boost für mehrfaches werfen von Kopf hintereinander + coins_per_head += multiplier #Coin-Boost für mehrfaches werfen von Kopf hintereinander else: coins_per_head = 0.5 - coins += coins_per_head + wealth += coins_per_head print('') - print(f'Du hast {coins} Coins (+ {coins_per_head})') + print(f'Du hast {wealth} Coins (+ {coins_per_head})') input() elif result in range(propability,100): print('Zahl') - coins_amount = 1 + heads_amount = 1 input() -coin_flip(propability, coins, coins_per_head, heads_amount, multiplier) +coin_flip(propability, wealth, coins_per_head, heads_amount, multiplier) diff --git a/Game/upgrade_menu.py b/Game/upgrade_menu.py index 1731a0a..7c694e1 100644 --- a/Game/upgrade_menu.py +++ b/Game/upgrade_menu.py @@ -1,4 +1,6 @@ from upgrades import coin_multiplier, lucky_coin, flip_chance +from game import wealth, coin_flip(propability, wealth, coins_per_head, heads_amount, multiplier) + base_lvl_coin_multiplier = coin_multiplier(0.5, 10) base_lvl_flip_chance = flip_chance(10, 0) @@ -32,23 +34,46 @@ def lvl_up_lucky_coin(): print(f" LC Cost: {base_lvl_lucky_coin.cost}") print(f" LC Chance: {base_lvl_lucky_coin.chance}") -def homepage_upgrades(): +def homepage_upgrades(wealth): while True: - answer = input(' Flip Chance: [1]\n Lucky Coin: [2]\n Multiplier: [3]') + answer = input(' Flip Chance: [1]\n Lucky Coin: [2]\n Multiplier: [3]\n Zum Game: [4]') try: answer = int(answer) if answer == 1: - lvl_up_flip_chance() - break + if wealth >= base_lvl_flip_chance.cost: + lvl_up_flip_chance() + wealth -= base_lvl_flip_chance.cost + print('Erfolgreich geupgradet. Du hast',wealth, "Coins") + break + else: + print('Du bist zu arm') + elif answer == 2: - lvl_up_lucky_coin() - break + if wealth >= base_lvl_lucky_coin.cost: + lvl_up_lucky_coin() + wealth -= base_lvl_lucky_coin.cost + print('Erfolgreich geupgradet. Du hast',wealth, "Coins") + break + else: + print('Du bist zu arm') + elif answer == 3: - lvl_up_multiplier() - break - elif answer not in (1, 2, 3): - print('Bitte 1, 2 oder 3!') + if wealth >= base_lvl_coin_multiplier.cost: + lvl_up_multiplier() + wealth -= base_lvl_coin_multiplier.cost + print('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') -homepage_upgrades() \ No newline at end of file +homepage_upgrades(wealth) \ No newline at end of file