This commit is contained in:
2026-06-24 20:21:26 -04:00
parent 6c0dfcf40c
commit 3f3913abee
3 changed files with 16 additions and 4 deletions

View File

@@ -1,6 +1,6 @@
import string
from untitled import content
from untitled import content, model
def validate_cat_name(name, auto_gen=False):
@@ -17,13 +17,16 @@ def validate_cat_name(name, auto_gen=False):
return "Your cat's name needs at least 1 letter."
def reconcile(cat, now):
def reconcile(cat: model.Cat, now):
elapsed_hours = (now - cat.last_updated) / 3600
if elapsed_hours <= 0:
return
cat.fullness -= content.HUNGER_DECAY_PER_HOUR * elapsed_hours
if cat.fullness < 0:
cat.fullness = 0
cat.happiness -= content.BASE_HAPPINESS_DECAY_PER_HOUR * elapsed_hours
if cat.happiness < 0:
cat.happiness = 0
cat.last_updated = now