From f1ea9a1de595e6afd325820162966008f1c60565 Mon Sep 17 00:00:00 2001 From: Toasterkitten Date: Thu, 25 Jun 2026 16:56:33 -0400 Subject: [PATCH] stuff --- untitled/screens/house.py | 4 +-- untitled/screens/pet.py | 64 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 66 insertions(+), 2 deletions(-) create mode 100644 untitled/screens/pet.py diff --git a/untitled/screens/house.py b/untitled/screens/house.py index 881f9fa..63e1bb7 100644 --- a/untitled/screens/house.py +++ b/untitled/screens/house.py @@ -1,6 +1,7 @@ import time from untitled import generation, model, persistence, rules, ui +from untitled.screens import pet from untitled.screens.common import go_to, options @@ -41,8 +42,7 @@ def house(save: model.Save): print("You don't have any food!") case "Pet your cat": rules.reconcile(save.cat, time.time()) - rules.excite(save.cat) - print(f"You pet {save.cat.name}, {save.cat.name} is now happy.") + pet.pet(save.cat) case "Go to...": go_to(save) case "Menu": diff --git a/untitled/screens/pet.py b/untitled/screens/pet.py new file mode 100644 index 0000000..fdc0c77 --- /dev/null +++ b/untitled/screens/pet.py @@ -0,0 +1,64 @@ +from untitled import rules, ui + + +def pet(cat): + if cat.happiness == 100: + print("Your cat is already fully happy! They don't want any more pets.") + return + original_happiness = cat.happiness + print(f"Mash keys to pet {cat.name}, press enter when you're done.") + count = 0 + last = None + print("\rPets: 0", end="", flush=True) + while True: + if count < 100000: + key = ui.getch() + if key in ("\r", "\n"): + print() + break + if key != last: + count += 1 + last = key + print(f"\rPets: {count}", end="", flush=True) + else: + rules.excite(cat, -5) + print(f"\n{cat.name} ran away to protect your hands") + print( + f"You lost 5% happiness due to stressing your cat. Before petting, your cat was {round(original_happiness,1)}% happy. You lost {round(original_happiness-cat.happiness,1)}% happiness. Your cat is now {round(cat.happiness,1)}% happy." + ) + return + add_happiness = 0 + if count == 0: + print("You didn't pet your cat at all.") + return + elif count < 50: + add_happiness = 5 + print(f"You didn't pet your cat enough, {cat.name} wants more pets.") + elif count <= 200: + add_happiness = 15 + print(f"You pet {cat.name} a lot, {cat.name} is happy.") + elif count <= 500: + add_happiness = 20 + print(f"You pet {cat.name} a lot. {cat.name} is very happy.") + elif count <= 1000: + add_happiness = 20 + print(f"You pet {cat.name} an absurd amount of times.") + elif count <= 10000: + add_happiness = 15 + print(f"{cat.name} has had enough pets.") + elif count <= 20000: + add_happiness = 10 + print("What are you even doing at this point?") + elif count <= 50000: + add_happiness = 5 + print("You should probably stop now.") + elif count <= 75000: + add_happiness = 2 + print("Seriously. Stop.") + else: + add_happiness = 1 + print(f"{cat.name} is getting extremely worried about your hands.") + rules.excite(cat, add_happiness) + print( + f"Your cat is now {round(cat.happiness,1)}% percent happy. Before petting, your cat was {round(original_happiness,1)}% happy. You gained {round(cat.happiness-original_happiness,1)}% happiness." + )