stuff
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
import time
|
import time
|
||||||
|
|
||||||
from untitled import generation, model, persistence, rules, ui
|
from untitled import generation, model, persistence, rules, ui
|
||||||
|
from untitled.screens import pet
|
||||||
from untitled.screens.common import go_to, options
|
from untitled.screens.common import go_to, options
|
||||||
|
|
||||||
|
|
||||||
@@ -41,8 +42,7 @@ def house(save: model.Save):
|
|||||||
print("You don't have any food!")
|
print("You don't have any food!")
|
||||||
case "Pet your cat":
|
case "Pet your cat":
|
||||||
rules.reconcile(save.cat, time.time())
|
rules.reconcile(save.cat, time.time())
|
||||||
rules.excite(save.cat)
|
pet.pet(save.cat)
|
||||||
print(f"You pet {save.cat.name}, {save.cat.name} is now happy.")
|
|
||||||
case "Go to...":
|
case "Go to...":
|
||||||
go_to(save)
|
go_to(save)
|
||||||
case "Menu":
|
case "Menu":
|
||||||
|
|||||||
64
untitled/screens/pet.py
Normal file
64
untitled/screens/pet.py
Normal file
@@ -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."
|
||||||
|
)
|
||||||
Reference in New Issue
Block a user