78 lines
2.5 KiB
Python
78 lines
2.5 KiB
Python
import time
|
|
|
|
from untitled import rules, ui
|
|
|
|
|
|
def use_medicine(save):
|
|
match ui.select(
|
|
"What do you want to do with the medicine?",
|
|
[f"Give to {save.cat.name}", "Back"],
|
|
):
|
|
case "Back":
|
|
return True # keep in inventory menu
|
|
case give if give == f"Give to {save.cat.name}":
|
|
if save.cat.sick:
|
|
rules.reconcile(save.cat, time.time())
|
|
if save.player.inventory["medicine"] > 0:
|
|
rules.cure_sick(save)
|
|
print(
|
|
f"You give {save.cat.name} the medicine. They start to feel better. You should probably still feed them."
|
|
)
|
|
else:
|
|
print(
|
|
"You don't have any medicine! (what?) (you shouldn't see this)"
|
|
)
|
|
return False
|
|
else:
|
|
print(f"{save.cat.name} isn't sick!")
|
|
return False
|
|
return False
|
|
|
|
|
|
def use_catnip(save):
|
|
match ui.select(
|
|
"What do you want to do with the catnip?",
|
|
[f"Give to {save.cat.name}", "Back"],
|
|
):
|
|
case "Back":
|
|
return True # keep in inventory menu
|
|
case give if give == f"Give to {save.cat.name}":
|
|
if save.cat.depressed:
|
|
rules.reconcile(save.cat, time.time())
|
|
if save.player.inventory["catnip"] > 0:
|
|
rules.cure_depressed(save)
|
|
print(
|
|
f"You give {save.cat.name} the catnip. They begin to feel happier. You should probably still pet them."
|
|
)
|
|
else:
|
|
print("You don't have any catnip! (what?) (you shouldn't see this)")
|
|
return False
|
|
else:
|
|
print(f"{save.cat.name} isn't depressed!")
|
|
return False
|
|
return False
|
|
|
|
|
|
def inventory(save):
|
|
while True:
|
|
item = ui.select(
|
|
"Please choose an item:",
|
|
[
|
|
item.capitalize()
|
|
for item in save.player.inventory
|
|
if save.player.inventory[item] > 0 and item != "food" # in main program
|
|
]
|
|
+ ["Cancel"],
|
|
)
|
|
if item == "Cancel":
|
|
return
|
|
match item:
|
|
case "Medicine":
|
|
stay = use_medicine(save)
|
|
case "Catnip":
|
|
stay = use_catnip(save)
|
|
case _:
|
|
stay = False
|
|
if not stay:
|
|
break
|