Food and bugfix

This commit is contained in:
2026-04-17 19:03:00 -04:00
parent 2f2f53bedb
commit d15a7f0aa9
4 changed files with 30 additions and 26 deletions

View File

@@ -99,7 +99,6 @@ def shop(cat: Cat):
else:
print("Cancelled.")
# TODO: idea, each item, when selected in house storage menu, call a item menu thing thats specific for each item
# TODO: make toy mouse that increases happyness (so also add emotions and sicknesses maybe) but has a 25% chance of getting lost under the couch and makes the cat tired possibly
case "Leave the shop":
print("Goodbye!")
@@ -146,28 +145,27 @@ def pet(cat: Cat):
print(f"You pet {cat.name} a lot. {cat.name} is very happy.")
def feed(cat):
# TODO: Make this use inventory["Food"] instead!
if cat.food <= 0:
def feed(cat: Cat):
if cat.inventory.get("Food", 0) <= 0:
print(f"You don't have any food. {cat.name} is sad.")
return
cat.food -= 1
cat.inventory["Food"] -= 1
print(f"You feed {cat.name}, {cat.name} is happy")
def storage(cat: Cat):
while True:
item = ui.select(
"Please choose an item",
[
ui.Choice(title=f"{name}: {amount}", value=name)
for name, amount in cat.inventory.items()
]
+ ["Back"],
)
if item == "Back":
break
systems.items.item_menu(cat, item)
item = ui.select(
"Please choose an item",
[
ui.Choice(title=f"{name}: {amount}", value=name)
for name, amount in cat.inventory.items()
if amount > 0
]
+ ["Back"],
)
if item == "Back":
return
systems.items.item_menu(cat, item)
def house(cat: Cat):
@@ -187,7 +185,6 @@ def house(cat: Cat):
print(
f"{cat.name} - a {cat.traits["size"]} {cat.traits["color"]} with {cat.traits["eyes"]} eyes"
)
print(f"Food: {cat.food}")
case "Pet your cat":
pet(cat)
case "Feed your cat":