Implementierung aller Upgrades mit auswirkungen auf das Spiel + Zusaetzliche Menuinformationen fuer Upgrades (Mit Folke natuerlich)
This commit is contained in:
Binary file not shown.
@@ -2,21 +2,19 @@ from upgrades import coin_multiplier, lucky_coin, flip_chance
|
|||||||
#import menu
|
#import menu
|
||||||
import random
|
import random
|
||||||
|
|
||||||
propability = 40
|
|
||||||
coins_per_head = 0.5
|
coins_per_head = 0.5
|
||||||
wealth = 5000
|
wealth = 5000
|
||||||
heads_amount = 1
|
heads_amount = 1
|
||||||
multiplier = 0.5
|
|
||||||
|
|
||||||
#Game
|
#Game
|
||||||
def coin_flip(propability, wealth, coins_per_head, heads_amount, multiplier):
|
def coin_flip(wealth, coins_per_head, heads_amount):
|
||||||
while True:
|
while True:
|
||||||
result = random.randint(0, 100)
|
result = random.randint(0, 100)
|
||||||
if result in range(0,propability):
|
if result in range(0,base_lvl_flip_chance.chance):
|
||||||
print(f'Kopf ({heads_amount}x)')
|
print(f'Kopf ({heads_amount}x)')
|
||||||
heads_amount += 1 #Anzahl an hintereinander geworfenen "Köpfen"
|
heads_amount += 1 #Anzahl an hintereinander geworfenen "Köpfen"
|
||||||
if heads_amount >=3:
|
if heads_amount >=3:
|
||||||
coins_per_head += multiplier #Coin-Boost für mehrfaches werfen von Kopf hintereinander
|
coins_per_head += base_lvl_coin_multiplier.multiplier #Coin-Boost für mehrfaches werfen von Kopf hintereinander
|
||||||
else:
|
else:
|
||||||
coins_per_head = 0.5
|
coins_per_head = 0.5
|
||||||
wealth += coins_per_head
|
wealth += coins_per_head
|
||||||
@@ -31,7 +29,7 @@ def coin_flip(propability, wealth, coins_per_head, heads_amount, multiplier):
|
|||||||
continue
|
continue
|
||||||
except ValueError:
|
except ValueError:
|
||||||
continue
|
continue
|
||||||
elif result in range(propability,100):
|
elif result in range(base_lvl_flip_chance.chance,100):
|
||||||
print('Zahl')
|
print('Zahl')
|
||||||
heads_amount = 1
|
heads_amount = 1
|
||||||
answer = input()
|
answer = input()
|
||||||
@@ -43,12 +41,26 @@ def coin_flip(propability, wealth, coins_per_head, heads_amount, multiplier):
|
|||||||
continue
|
continue
|
||||||
except ValueError:
|
except ValueError:
|
||||||
continue
|
continue
|
||||||
|
return result
|
||||||
|
|
||||||
|
class coin_multiplier(): #Klasse, die das Upgrade darstellt, welches die anzahl des Bonusses beim Kopfwurf veraendert
|
||||||
|
def __init__(self, multiplier:float, cost:int):
|
||||||
|
self.multiplier = multiplier
|
||||||
|
self.cost = cost
|
||||||
|
|
||||||
|
class flip_chance(): #Upgrade, welches die Chance auf kopf veraendert
|
||||||
|
def __init__(self, chance:int, cost:int):
|
||||||
|
self.chance = chance
|
||||||
|
self.cost = cost
|
||||||
|
|
||||||
|
class lucky_coin(): #Upgrade, welches festlegt wie hoch die Wahrscheinlichkeit auf einen LuckyCoin (Jackpot) ist
|
||||||
|
def __init__(self, chance:float, cost:int):
|
||||||
|
self.chance = chance
|
||||||
|
self.cost = cost
|
||||||
|
|
||||||
|
|
||||||
base_lvl_coin_multiplier = coin_multiplier(0.5, 10)
|
base_lvl_coin_multiplier = coin_multiplier(0.5, 10)
|
||||||
base_lvl_flip_chance = flip_chance(10, 0)
|
base_lvl_flip_chance = flip_chance(10, 1)
|
||||||
base_lvl_lucky_coin = lucky_coin(0.5, 10)
|
base_lvl_lucky_coin = lucky_coin(0.5, 10)
|
||||||
|
|
||||||
def lvl_up_multiplier():
|
def lvl_up_multiplier():
|
||||||
@@ -64,11 +76,10 @@ def lvl_up_flip_chance():
|
|||||||
lvl_up = True
|
lvl_up = True
|
||||||
|
|
||||||
if lvl_up == True:
|
if lvl_up == True:
|
||||||
base_lvl_flip_chance.cost += 1
|
base_lvl_flip_chance.cost *= 10
|
||||||
base_lvl_flip_chance.cost *= 6
|
base_lvl_flip_chance.chance *= 2
|
||||||
base_lvl_flip_chance.chance *= 1.5
|
|
||||||
#print(f" FC Cost: {base_lvl_flip_chance.cost}")
|
#print(f" FC Cost: {base_lvl_flip_chance.cost}")
|
||||||
print(f" Flip Chance liegt bei: {base_lvl_flip_chance.chance}")
|
print(f" Flip Chance liegt bei: {base_lvl_flip_chance.chance}%")
|
||||||
|
|
||||||
def lvl_up_lucky_coin():
|
def lvl_up_lucky_coin():
|
||||||
lvl_up = True
|
lvl_up = True
|
||||||
@@ -76,12 +87,12 @@ def lvl_up_lucky_coin():
|
|||||||
if lvl_up == True:
|
if lvl_up == True:
|
||||||
base_lvl_lucky_coin.cost *= 3
|
base_lvl_lucky_coin.cost *= 3
|
||||||
base_lvl_lucky_coin.chance *= 1.5
|
base_lvl_lucky_coin.chance *= 1.5
|
||||||
#print(f" LC Cost: {base_lvl_lucky_coin.cost}")
|
#print(f" Lucky Coin Cost: {base_lvl_lucky_coin.cost}")
|
||||||
print(f" Lucky Coin Chance liegt bei: {base_lvl_lucky_coin.chance}")
|
print(f" Lucky Coin Chance liegt bei: {base_lvl_lucky_coin.chance}%")
|
||||||
|
|
||||||
def homepage_upgrades(wealth):
|
def homepage_upgrades(wealth):
|
||||||
while True:
|
while True:
|
||||||
answer = input(f' Flip Chance (Preis: {base_lvl_flip_chance.cost} Coins): [1]\n Lucky Coin (Preis: {base_lvl_lucky_coin.cost} Coins): [2]\n Multiplier (Preis: {base_lvl_coin_multiplier.cost} Coins): [3]\n Zum Game: [4]')
|
answer = input(f' Flip Chance [{base_lvl_flip_chance.chance}% > {base_lvl_flip_chance.chance*2}%] (Preis: {base_lvl_flip_chance.cost} Coins): [1]\n Lucky Coin [{base_lvl_lucky_coin.chance}% > {base_lvl_lucky_coin.chance*2}] (Preis: {base_lvl_lucky_coin.cost} Coins): [2]\n Multiplier [+{base_lvl_coin_multiplier.multiplier} Coins > {base_lvl_coin_multiplier.multiplier*5} Coins] (Preis: {base_lvl_coin_multiplier.cost} Coins): [3]\n Zum Game: [4]')
|
||||||
try:
|
try:
|
||||||
answer = int(answer)
|
answer = int(answer)
|
||||||
if answer == 1:
|
if answer == 1:
|
||||||
@@ -89,7 +100,7 @@ def homepage_upgrades(wealth):
|
|||||||
lvl_up_flip_chance()
|
lvl_up_flip_chance()
|
||||||
wealth -= base_lvl_flip_chance.cost
|
wealth -= base_lvl_flip_chance.cost
|
||||||
print(f' Erfolgreich geupgradet. Du hast noch {wealth} Coins')
|
print(f' Erfolgreich geupgradet. Du hast noch {wealth} Coins')
|
||||||
break
|
|
||||||
else:
|
else:
|
||||||
print('Du bist zu arm')
|
print('Du bist zu arm')
|
||||||
|
|
||||||
@@ -98,7 +109,6 @@ def homepage_upgrades(wealth):
|
|||||||
lvl_up_lucky_coin()
|
lvl_up_lucky_coin()
|
||||||
wealth -= base_lvl_lucky_coin.cost
|
wealth -= base_lvl_lucky_coin.cost
|
||||||
print(f' Erfolgreich geupgradet. Du hast noch {wealth} Coins')
|
print(f' Erfolgreich geupgradet. Du hast noch {wealth} Coins')
|
||||||
break
|
|
||||||
else:
|
else:
|
||||||
print('Du bist zu arm')
|
print('Du bist zu arm')
|
||||||
|
|
||||||
@@ -107,11 +117,10 @@ def homepage_upgrades(wealth):
|
|||||||
lvl_up_multiplier()
|
lvl_up_multiplier()
|
||||||
wealth -= base_lvl_coin_multiplier.cost
|
wealth -= base_lvl_coin_multiplier.cost
|
||||||
print(f' Erfolgreich geupgradet. Du hast noch {wealth} Coins')
|
print(f' Erfolgreich geupgradet. Du hast noch {wealth} Coins')
|
||||||
break
|
|
||||||
else:
|
else:
|
||||||
print('Du bist zu arm')
|
print('Du bist zu arm')
|
||||||
elif answer == 4:
|
elif answer == 4:
|
||||||
coin_flip(propability, wealth, coins_per_head, heads_amount, multiplier)
|
coin_flip(wealth, coins_per_head, heads_amount)
|
||||||
|
|
||||||
elif answer not in (1, 2, 3, 4):
|
elif answer not in (1, 2, 3, 4):
|
||||||
print('Bitte 1, 2, 3 oder 4!')
|
print('Bitte 1, 2, 3 oder 4!')
|
||||||
@@ -119,4 +128,12 @@ def homepage_upgrades(wealth):
|
|||||||
except ValueError:
|
except ValueError:
|
||||||
print('Nur Zahlen')
|
print('Nur Zahlen')
|
||||||
|
|
||||||
coin_flip(propability, wealth, coins_per_head, heads_amount, multiplier)
|
def check_lucky_coin(result, wealth):
|
||||||
|
if result < base_lvl_lucky_coin.chance or result == base_lvl_lucky_coin.chance:
|
||||||
|
print('Herzlichen Glueckwunsch! Du hast den Lucky Coin bekommen')
|
||||||
|
wealth *= 1.5
|
||||||
|
return wealth
|
||||||
|
|
||||||
|
|
||||||
|
result = coin_flip(wealth, coins_per_head, heads_amount)
|
||||||
|
wealth = check_lucky_coin(result, wealth)
|
||||||
Reference in New Issue
Block a user