From dfb05774efac717d1adc699e97b6140599e5df1e Mon Sep 17 00:00:00 2001 From: Christian Heller Date: Wed, 16 Dec 2020 21:57:04 +0100 Subject: [PATCH] Add weariness mechanic. --- plomrogue/game.py | 3 ++- plomrogue/things.py | 7 +++++++ rogue_chat.html | 12 ++++++++---- rogue_chat_curses.py | 14 ++++++++------ 4 files changed, 25 insertions(+), 11 deletions(-) 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: