From: Christian Heller Date: Thu, 17 Dec 2020 00:13:21 +0000 (+0100) Subject: Invert weariness metric into energy metric. X-Git-Url: https://plomlompom.com/repos/%7B%7B%20web_path%20%7D%7D/static/%7B%7Bdb.prefix%7D%7D/%7B%7Bprefix%7D%7D/processes?a=commitdiff_plain;h=dfe8541633da35717021f06839d1a386481c95f1;p=plomrogue2 Invert weariness metric into energy metric. --- diff --git a/plomrogue/game.py b/plomrogue/game.py index b394c5d..ff035bb 100755 --- a/plomrogue/game.py +++ b/plomrogue/game.py @@ -277,7 +277,7 @@ class Game(GameBase): self.io.send('PLAYERS_HAT_CHARS ' + quote(player.get_cookie_chars()), c_id) self.io.send('STATS %s %s' % (player.need_for_toilet, - player.weariness), c_id) + player.energy), 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/tasks.py b/plomrogue/tasks.py index eb9d31a..6f42109 100644 --- a/plomrogue/tasks.py +++ b/plomrogue/tasks.py @@ -68,7 +68,7 @@ class Task_MOVE(Task): if 'sittable' in terrain_type.tags: self.thing.standing = False self.thing.send_msg('CHAT "You sink into the %s. ' - 'Staying here will reduce your weariness."' + 'Staying here will replenish your energy."' % terrain_type.description) self.thing.invalidate('fov') if self.thing.blocks_light: diff --git a/plomrogue/things.py b/plomrogue/things.py index 6637b37..dbec52f 100644 --- a/plomrogue/things.py +++ b/plomrogue/things.py @@ -479,7 +479,7 @@ class Thing_CrateSpawner(ThingSpawner): class ThingAnimate(Thing): - weariness = 0 + energy = 0 def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) @@ -508,7 +508,7 @@ class ThingAnimate(Thing): task = self.next_task[0] self.next_task = [None] task.check() - task.todo += self.weariness * 10 + task.todo += max(0, -self.energy * 10) return task def proceed(self): @@ -660,22 +660,22 @@ class Thing_Player(ThingAnimate): self.game.changed = True if random.random() > 0.9999: if self.standing: - self.weariness += 1 + self.energy -= 1 else: - self.weariness -= 1 - if self.weariness > 0 and self.weariness % 5 == 0: - self.send_msg('CHAT "All that walking or standing makes ' - 'you weary, and thereby slower. Find a place ' - 'to sit or lie down to regain energy."') + self.energy += 1 + if self.energy < 0 and self.energy % 5 == 0: + self.send_msg('CHAT "All that walking or standing uses up ' + 'your energy, which makes you slower. Find a' + ' place to sit or lie down to regain it."') self.game.changed = True if self.dancing and random.random() > 0.99 and not self.next_task[0]: self.dancing -= 1 direction = random.choice(self.game.map_geometry.directions) self.set_next_task('MOVE', [direction]) if random.random() > 0.9: - self.weariness += 1 + self.energy -= 1 self.game.changed = True - if 1000000 * random.random() < -self.weariness: + if 1000000 * random.random() < self.energy: self.send_msg('CHAT "Your body tries to ' 'dance off its energy surplus."') self.dancing = 50 diff --git a/rogue_chat.html b/rogue_chat.html index f081050..47bf58d 100644 --- a/rogue_chat.html +++ b/rogue_chat.html @@ -491,7 +491,7 @@ let server = { game.things_new = []; } else if (tokens[0] === 'STATS') { game.bladder_pressure_new = parseInt(tokens[1]) - game.weariness_new = parseInt(tokens[2]) + game.energy_new = parseInt(tokens[2]) } else if (tokens[0] === 'THING') { let t = game.get_thing_temp(tokens[4], true); t.position = parser.parse_yx(tokens[1]); @@ -549,7 +549,7 @@ let server = { game.player = game.things[game.player_id]; game.players_hat_chars = game.players_hat_chars_new; game.bladder_pressure = game.bladder_pressure_new - game.weariness = game.weariness_new + game.energy = game.energy_new game.turn_complete = true; if (tui.mode.name == 'post_login_wait') { tui.switch_mode('play'); @@ -1219,7 +1219,7 @@ let tui = { }, draw_stats_line: function(n) { terminal.write(1, this.window_width, - 'WEARINESS: ' + game.weariness + + 'ENERGY: ' + game.energy + ' BLADDER: ' + game.bladder_pressure); }, draw_history: function() { diff --git a/rogue_chat_curses.py b/rogue_chat_curses.py index e3046cf..f0ec663 100755 --- a/rogue_chat_curses.py +++ b/rogue_chat_curses.py @@ -296,7 +296,7 @@ def cmd_GAME_STATE_COMPLETE(game): game.player = game.get_thing(game.player_id) game.players_hat_chars = game.players_hat_chars_new game.bladder_pressure = game.bladder_pressure_new - game.weariness = game.weariness_new + game.energy = game.energy_new game.turn_complete = True if game.tui.mode.name == 'post_login_wait': game.tui.switch_mode('play') @@ -364,9 +364,9 @@ def cmd_RANDOM_COLORS(game): game.tui.set_random_colors() cmd_RANDOM_COLORS.argtypes = '' -def cmd_STATS(game, bladder_pressure, weariness): +def cmd_STATS(game, bladder_pressure, energy): game.bladder_pressure_new = bladder_pressure - game.weariness_new = weariness + game.energy_new = energy cmd_STATS.argtypes = 'int:nonneg int' class Game(GameBase): @@ -946,8 +946,8 @@ class TUI: y += 1 def draw_stats(): - stats = 'WEARY: %s BLADDER: %s' % (self.game.weariness, - self.game.bladder_pressure) + stats = 'ENERGY: %s BLADDER: %s' % (self.game.energy, + self.game.bladder_pressure) safe_addstr(0, self.window_width, stats) def draw_mode():