Medicine
This commit is contained in:
@@ -11,6 +11,7 @@ class Cat:
|
||||
last_login=None,
|
||||
fullness=100,
|
||||
happiness=100,
|
||||
sick=False,
|
||||
):
|
||||
self.name = name
|
||||
self.traits = traits
|
||||
@@ -19,6 +20,7 @@ class Cat:
|
||||
self.inventory = inventory if inventory is not None else {}
|
||||
self.fullness = fullness # really hunger, but 100 hunger being defualt sounds like its 100% hungry so its fullness.
|
||||
self.happiness = happiness
|
||||
self.sick = sick
|
||||
|
||||
def apply_decay(self): # first neat function! yayyy!
|
||||
elapsed_hours = (time.time() - self.last_login) / 3600
|
||||
@@ -26,6 +28,12 @@ class Cat:
|
||||
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."
|
||||
)
|
||||
|
||||
def to_dict(self):
|
||||
return vars(self)
|
||||
|
||||
Reference in New Issue
Block a user