depressed

This commit is contained in:
2026-04-21 08:03:12 -04:00
parent 359a331ec4
commit 653fcd7034
4 changed files with 78 additions and 28 deletions

View File

@@ -12,6 +12,7 @@ class Cat:
fullness=100, fullness=100,
happiness=100, happiness=100,
sick=False, sick=False,
depressed=False,
): ):
self.name = name self.name = name
self.traits = traits self.traits = traits
@@ -21,19 +22,34 @@ class Cat:
self.fullness = fullness # really hunger, but 100 hunger being defualt sounds like its 100% hungry so its fullness. self.fullness = fullness # really hunger, but 100 hunger being defualt sounds like its 100% hungry so its fullness.
self.happiness = happiness self.happiness = happiness
self.sick = sick self.sick = sick
self.depressed = depressed
def apply_decay(self): # first neat function! yayyy! def apply_decay(self): # first neat function! yayyy!
elapsed_hours = (time.time() - self.last_login) / 3600 elapsed_hours = (time.time() - self.last_login) / 3600
if elapsed_hours <= 0: if elapsed_hours <= 0:
elapsed_hours = 0 elapsed_hours = 0
self.fullness -= 5 * elapsed_hours self.fullness -= 5 * elapsed_hours
self.happiness -= 5 * elapsed_hours
if self.fullness <= 0: if self.fullness <= 0:
self.fullness = 0 self.fullness = 0
self.sick = True if not self.sick:
print( self.sick = True
"Your cat didn't have enough food and got sick. There is medicine in the shop." print(
) "Your cat didn't have enough food and got sick while you were away. There is medicine in the shop."
)
else:
print("Your cat is still sick! You can buy medicine in the shop.")
happiness_decay = 10 if self.sick else 5
self.happiness -= happiness_decay * elapsed_hours
if self.happiness <= 0:
self.happiness = 0
if not self.depressed:
self.depressed = True
print(
"Your cat didn't get happy enough and got depressed, you can buy catnip in the shop to help."
)
else:
print("Your cat is still depressed! You can get catnip in the shop.")
# TODO: do what claude said in latest summary
def to_dict(self): def to_dict(self):
return vars(self) return vars(self)

View File

@@ -33,6 +33,6 @@ CAT_PERSONALITIES = [ # TODO: start at different happiness levels based on pers
CAT_EYE_COLORS = ["green", "yellow", "blue", "orange"] CAT_EYE_COLORS = ["green", "yellow", "blue", "orange"]
SHOP_ITEMS = {"Food": 5, "Medicine": 15} SHOP_ITEMS = {"Food": 5, "Medicine": 15, "Catnip": 15}
BYPASS_TAMPER_CHECK_MESSAGE = "I truly understand that this is cheating and that it is ONLY for development and nothing else. I understand that it is mean to mess with my cat savefile and I apologize to my cat." BYPASS_TAMPER_CHECK_MESSAGE = "I truly understand that this is cheating and that it is ONLY for development and nothing else. I understand that it is mean to mess with my cat savefile and I apologize to my cat."

View File

@@ -16,15 +16,37 @@ def item_menu(cat: data.cat.Cat, item):
"Please choose an option", [f"Give your cat the medicine", "Back"] "Please choose an option", [f"Give your cat the medicine", "Back"]
): ):
case "Give your cat the medicine": case "Give your cat the medicine":
if cat.inventory.get("Medicine", False): if cat.sick:
cat.sick = False if cat.inventory.get("Medicine", False):
cat.fullness = 25.0 cat.sick = False
cat.inventory["Medicine"] -= 1 cat.fullness = 25.0
print( cat.inventory["Medicine"] -= 1
f"{cat.name} eats the medicine. {cat.name} is feeling better! They still are hungry though." print(
) f"{cat.name} eats the medicine. {cat.name} is feeling better! They still are hungry though."
)
else:
print("You don't have any medicine!")
else: else:
print("You don't have any medicine!") print("Your cat isn't sick! They don't need the medicine.")
case "Back":
pass
case "Catnip":
match ui.select(
"Please choose an option", [f"Give your cat the catnip", "Back"]
):
case "Give your cat the catnip":
if cat.depressed:
if cat.inventory.get("Catnip", False):
cat.depressed = False
cat.happiness = 25.0
cat.inventory["Catnip"] -= 1
print(
f"{cat.name} plays with the catnip. {cat.name} is less depressed! They still are still sad though."
)
else:
print("You don't have any catnip!")
else:
print("Your cat isn't depressed. They don't need the catnip.")
case "Back": case "Back":
pass pass

View File

@@ -203,8 +203,14 @@ def storage(cat: Cat):
def house(cat: Cat): def house(cat: Cat):
print("Welcome to your house!") print("Welcome to your house!")
if cat.sick: if cat.sick and cat.depressed:
print(
f"{cat.name} is sick and depressed, go to the shop for medicine and catnip."
)
elif cat.sick:
print(f"{cat.name} is sick, go to the shop to get medicine!") print(f"{cat.name} is sick, go to the shop to get medicine!")
elif cat.depressed:
print(f"{cat.name} is depressed, head to the shop for catnip.")
while True: while True:
match ui.select( match ui.select(
"Please choose an option", "Please choose an option",
@@ -217,22 +223,28 @@ def house(cat: Cat):
], ],
): ):
case "Check on your cat": case "Check on your cat":
if not cat.sick: print(
print( f"{cat.name} - a{" sick" if cat.sick else ""}{" and" if cat.sick and cat.depressed else ""}{" depressed" if cat.depressed else ""} {cat.traits["size"]} {cat.traits["color"]} with {cat.traits["eyes"]} eyes."
f"{cat.name} - a {cat.traits["size"]} {cat.traits["color"]} with {cat.traits["eyes"]} eyes." )
) print(f"Happiness: {round(cat.happiness,1)}%")
print(f"Happiness: {round(cat.happiness,1)}%") print(f"Fullness: {round(cat.fullness,1)}/100")
print(f"Fullness: {round(cat.fullness,1)}/100") print(f"You have ${cat.money}.")
print(f"You have ${cat.money}.")
else:
print(f"{cat.name} is still sick! Go to the shop to get medicine!")
case "Pet your cat": case "Pet your cat":
if not cat.sick: if not cat.sick and not cat.depressed:
pet(cat) pet(cat)
else: else:
print( if cat.depressed and cat.sick:
f"{cat.name} is too sick for pets, go to the shop for medicine!" print(
) f"{cat.name} is too sick and depressed for pets. Go to the shop to get medicine and catnip."
)
elif cat.sick:
print(
f"{cat.name} is too sick for pets, go to the shop for medicine!"
)
elif cat.depressed:
print(
f"{cat.name} is too depressed for pets. Go to the shop for catnip."
)
case "Feed your cat": case "Feed your cat":
if not cat.sick: if not cat.sick:
feed(cat) feed(cat)