depressed
This commit is contained in:
26
data/cat.py
26
data/cat.py
@@ -12,6 +12,7 @@ class Cat:
|
||||
fullness=100,
|
||||
happiness=100,
|
||||
sick=False,
|
||||
depressed=False,
|
||||
):
|
||||
self.name = name
|
||||
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.happiness = happiness
|
||||
self.sick = sick
|
||||
self.depressed = depressed
|
||||
|
||||
def apply_decay(self): # first neat function! yayyy!
|
||||
elapsed_hours = (time.time() - self.last_login) / 3600
|
||||
if elapsed_hours <= 0:
|
||||
elapsed_hours = 0
|
||||
self.fullness -= 5 * elapsed_hours
|
||||
self.happiness -= 5 * elapsed_hours
|
||||
if self.fullness <= 0:
|
||||
self.fullness = 0
|
||||
self.sick = True
|
||||
print(
|
||||
"Your cat didn't have enough food and got sick. There is medicine in the shop."
|
||||
)
|
||||
if not self.sick:
|
||||
self.sick = True
|
||||
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):
|
||||
return vars(self)
|
||||
|
||||
@@ -33,6 +33,6 @@ CAT_PERSONALITIES = [ # TODO: start at different happiness levels based on pers
|
||||
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."
|
||||
|
||||
Reference in New Issue
Block a user