From: Christian Heller Date: Wed, 16 Dec 2020 20:57:04 +0000 (+0100) Subject: Add weariness mechanic. X-Git-Url: https://plomlompom.com/repos/%7B%7Bdb.prefix%7D%7D/%7B%7B%20web_path%20%7D%7D/decks/static/template?a=commitdiff_plain;h=dfb05774efac717d1adc699e97b6140599e5df1e;p=plomrogue2 Add weariness mechanic. --- diff --git a/plomrogue/game.py b/plomrogue/game.py index 1658808..5e6c144 100755 --- a/plomrogue/game.py +++ b/plomrogue/game.py @@ -277,7 +277,8 @@ class Game(GameBase): player = self.get_player(c_id) self.io.send('PLAYERS_HAT_CHARS ' + quote(player.get_cookie_chars()), c_id) - self.io.send('BLADDER_PRESSURE %s' % player.need_for_toilet, c_id) + self.io.send('STATS %s %s' % (player.need_for_toilet, + player.weariness), c_id) if player.id_ in player_ids_send_fov: self.io.send('FOV %s' % quote(player.fov_stencil.terrain), c_id) self.io.send('MAP %s %s %s' % (self.get_map_geometry_shape(), diff --git a/plomrogue/things.py b/plomrogue/things.py index 3686ab0..c8ef346 100644 --- a/plomrogue/things.py +++ b/plomrogue/things.py @@ -452,6 +452,7 @@ class Thing_CookieSpawner(Thing): class ThingAnimate(Thing): + weariness = 0 def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) @@ -480,6 +481,7 @@ class ThingAnimate(Thing): task = self.next_task[0] self.next_task = [None] task.check() + task.todo += self.weariness * 10 return task def proceed(self): @@ -624,6 +626,11 @@ class Thing_Player(ThingAnimate): elif self.tripping > 0 and self.tripping % 250 == 0: self.send_msg('RANDOM_COLORS') self.game.changed = True + if random.random() > 0.9999: + if self.standing: + self.weariness += 1 + elif self.weariness > 0: + self.weariness -= 1 def send_msg(self, msg): for c_id in self.game.sessions: diff --git a/rogue_chat.html b/rogue_chat.html index 291a98c..84d481c 100644 --- a/rogue_chat.html +++ b/rogue_chat.html @@ -129,8 +129,8 @@ terminal rows: