def __init__(self): self.achievements = { "Educated": False, "Have Home": False, "Girlfriend": False, "Father": False, } self.issues = { "Poor": 5, "Uneducated": 10, "Stressed": 0, "Overweight": 5, "Guilty": 0, "Bored": 3, "Lonely": 6, "Addiction": 1, } self.stats = Stats(self)
class State: def __init__(self): self.achievements = { "Educated": False, "Have Home": False, "Girlfriend": False, "Father": False, } self.issues = { "Poor": 5, "Uneducated": 10, "Stressed": 0, "Overweight": 5, "Guilty": 0, "Bored": 3, "Lonely": 6, "Addiction": 1, } self.stats = Stats(self) def _get_total(self): total = 0 for count in self.issues.values(): total += count return total total = property(_get_total) def increase(self, scene, name, amount=1): self.issues[name] += amount self.stats.show(name) self.check_victory(scene) def decrease(self, scene, name, amount=1): self.issues[name] -= amount if self.issues[name] < 1: self.issues[name] = 0 self.stats.hide(name) if self.issues["Uneducated"] == 0: self.achievements["Educated"] = True self.check_victory(scene) def check_victory(self, scene): if self.total == 0: scene.finish(scenes.Endgame, True) else: if self.issues["Poor"] > 10: scene.finish(scenes.Endgame, False, [ "With no money,", "hopelessness set in,", "and you took your own life." ]) elif self.issues["Stressed"] > 10: scene.finish(scenes.Endgame, False, [ "Hopelessly stressed,", "you could no longer take living,", "and took your own life." ]) elif self.issues["Overweight"] > 10: scene.finish( scenes.Endgame, False, ["You died due to a", "hopelessly unhealthy lifestyle."]) elif self.issues["Bored"] > 10: scene.finish(scenes.Endgame, False, [ "Hopelessly bored with life,", "you saw no reason to go on." ]) elif self.issues["Lonely"] > 10: scene.finish( scenes.Endgame, False, ["Hopelessly lonely,", "you saw no reason to go on."]) elif self.issues["Addiction"] > 10: scene.finish(scenes.Endgame, False, [ "Your addictions lead you", "to a to die a hopeless death", "desperately seeking a fix." ]) elif self.total > 35: scene.finish(scenes.Endgame, False, [ "Your life became hopeless", "as your issues built up,", "you saw no reason to go on." ])
class State: def __init__(self): self.achievements = { "Educated": False, "Have Home": False, "Girlfriend": False, "Father": False, } self.issues = { "Poor": 5, "Uneducated": 10, "Stressed": 0, "Overweight": 5, "Guilty": 0, "Bored": 3, "Lonely": 6, "Addiction": 1, } self.stats = Stats(self) def _get_total(self): total = 0 for count in self.issues.values(): total += count return total total = property(_get_total) def increase(self, scene, name, amount=1): self.issues[name] += amount self.stats.show(name) self.check_victory(scene) def decrease(self, scene, name, amount=1): self.issues[name] -= amount if self.issues[name] < 1: self.issues[name] = 0 self.stats.hide(name) if self.issues["Uneducated"] == 0: self.achievements["Educated"] = True self.check_victory(scene) def check_victory(self, scene): if self.total == 0: scene.finish(scenes.Endgame, True) else: if self.issues["Poor"] > 10: scene.finish(scenes.Endgame, False, ["With no money,", "hopelessness set in,", "and you took your own life."]) elif self.issues["Stressed"] > 10: scene.finish(scenes.Endgame, False, ["Hopelessly stressed,", "you could no longer take living,", "and took your own life."]) elif self.issues["Overweight"] > 10: scene.finish(scenes.Endgame, False, ["You died due to a", "hopelessly unhealthy lifestyle."]) elif self.issues["Bored"] > 10: scene.finish(scenes.Endgame, False, ["Hopelessly bored with life,", "you saw no reason to go on."]) elif self.issues["Lonely"] > 10: scene.finish(scenes.Endgame, False, ["Hopelessly lonely,", "you saw no reason to go on."]) elif self.issues["Addiction"] > 10: scene.finish(scenes.Endgame, False, ["Your addictions lead you", "to a to die a hopeless death", "desperately seeking a fix."]) elif self.total > 35: scene.finish(scenes.Endgame, False, ["Your life became hopeless", "as your issues built up,", "you saw no reason to go on."])