home · contact · privacy
Invert weariness metric into energy metric.
authorChristian Heller <c.heller@plomlompom.de>
Thu, 17 Dec 2020 00:13:21 +0000 (01:13 +0100)
committerChristian Heller <c.heller@plomlompom.de>
Thu, 17 Dec 2020 00:13:21 +0000 (01:13 +0100)
plomrogue/game.py
plomrogue/tasks.py
plomrogue/things.py
rogue_chat.html
rogue_chat_curses.py

index b394c5d1024c4662c350b5ad6fdfb8f026a2006e..ff035bb8dd28f3ab0b22425b22cb1f3f1e5e312d 100755 (executable)
@@ -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(),
index eb9d31ac3bdd72852eeb664f70d7fd3b49fd1c27..6f42109362fc7aaf7e2810921e65ffe66d74a3d2 100644 (file)
@@ -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:
index 6637b3744199d94a989fc23000b4b40963d2e3c7..dbec52f57a329b826d1300642b08c378e3973165 100644 (file)
@@ -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
index f08105023e30b3d062b58e06fb9f52551647cee9..47bf58d3aa4c937dfe5b078a6a161c25349ccd16 100644 (file)
@@ -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() {
index e3046cfe5f787dba7a993500805bc1459e5ed65e..f0ec6633ca6591da4d954a90b8321de7f2eca9a9 100755 (executable)
@@ -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():