import time import random import math import Toolbox as tb import Texte as t # Colorize, made with help from Niklas MAGENTA = "\033[35m" BLUE = "\033[34m" RESET = "\033[0m" # called to return to standard terminal text color def blue(s): return BLUE + s + RESET def magenta(s): return MAGENTA + s + RESET def wähleAusListe(listeDerOptionen): """Lässt Benutzer*innen eine Option aus einer Liste auswählen und gibt die gewählte Option zurück.""" auswahl = tb.wähleAusListe(listeDerOptionen) return listeDerOptionen[auswahl - 1] def askUser(question): while True: answer = input(question + " ") if answer != "": return answer # generate Age using Wää formula def askUserInt(question): while True: try: return int(askUser(question + " ")) except: print(t.err_not_a_number) def generateAge(interest_age): min = int((interest_age / 2) + 7) max = int((interest_age - 7) * 2) print(min) print(max) return tb.randomInRange(min, max) def showStats(intrest): print("You got " + str(intrest.rom_points) + " of "+str(intrest.rom_goals)+" rom points") class RomanticInterest: def __init__(self, gender, age): self.name = random.choice(t.names.get(gender, t.names[t.gender_other])) self.gender = gender self.age = age self.rom_goals = 200 self.rom_points = 50 def introduce(self): print(magenta("oh...")) print(magenta("Hallo du!")) time.sleep(0.7) print(magenta("Mein name ist " + self.name + ".")) time.sleep(0.5) ## only print pronouns if nonbinary otherwise clear from name if self.gender == t.gender_other: print("Und BTW meine Pronomen sind: they/them.") def react_to(self, action): """ call this function to react to a action defined in texte """ # first choice if action == t.action_ask_age: print(magenta("Ich bin " + str(self.age) + " jahre alt!")) self.rom_points -= 20 elif action == t.action_throw_book: print(magenta(t.situation_get_hurt_bad)) self.rom_points -= 100 elif action == t.action_introduce_self: print(magenta("Hallo du")) self.rom_points += 50 # second choice elif action == t.action_dance: print(magenta(t.situation_wierd_cute)) self.rom_points += 50 elif action == t.action_ask_for_number: ## It depends on achieved rompoints if self.rom_points > 100: print(magenta(t.situation_accept)) self.rom_points += 50 elif self.rom_points > 0: print(magenta(t.situation_decline_friendly)) else: print(magenta(t.situation_decline_agressive)) self.rom_points -= 100 elif action == t.action_tell_compliment: print(magenta(t.situation_recieve_compliment)) self.rom_points += 100 # third choice elif action == t.action_invite_to_date: ## It depends on achieved rompoints if self.rom_points > 150: print(magenta(t.situation_accept)) self.rom_points += 100 elif self.rom_points > 50: print(magenta(t.situation_decline_friendly)) else: print(magenta(t.situation_decline_agressive)) self.rom_points -= 100 elif action == t.action_hug_out_of_blue: ## It depends on achieved rompoints if self.rom_points > 100: print(magenta(t.situation_hug_back)) self.rom_points += 100 elif self.rom_points > 50: print(magenta(t.situation_stand_akward)) self.rom_points -= 20 else: print(magenta(t.situation_react_to_inapropriate)) self.rom_points -= 100 self.rom_points -= 10000 print(magenta(t.situation_react_to_inapropriate)) elif action == t.action_send_dickpic: self.rom_points -= 10000 print(magenta(t.situation_react_to_inapropriate)) def is_won(self): return self.rom_points > self.rom_goals class User: def __init__(self): self.name = askUser(t.ask_name) self.age = askUserInt(t.ask_age) print(t.ask_sexual_preference) self.preference = wähleAusListe([ t.gender_male, t.gender_female, t.gender_other, ]) def __str__(self): return self.name + str(self.age) + self.preference def do_action(self, action): # first choice if action == t.action_ask_age: print(blue(t.ask_age)) elif action == t.action_throw_book: print(blue(t.situation_throw_book)) elif action == t.action_introduce_self: print(blue("Hallo")) # Second Choice elif action == t.action_dance: print(blue(t.situation_dance)) elif action == t.action_ask_for_number: print(blue(t.situation_ask_for_number)) elif action == t.action_tell_compliment: print(blue(t.situation_tell_compliment)) # Third choice elif action == t.action_invite_to_date: print(blue(t.situation_ask_for_date)) elif action == t.action_hug_out_of_blue: print(blue(t.situation_hug)) elif action == t.action_send_dickpic: print(blue(t.situation_send_dickpic))