Parameterised action text.
authorJeremy Thurgood <firxen@gmail.com>
Wed, 14 May 2014 21:07:27 +0000 (23:07 +0200)
committerJeremy Thurgood <firxen@gmail.com>
Wed, 14 May 2014 21:07:27 +0000 (23:07 +0200)
naja/actions.py
naja/widgets/info_area.py

index 9c4e8f3fcc756973612cb4d60140bd7ed0114ed5..7d5be63b7663d727fc81cd66a9105f5eda3a8927 100644 (file)
@@ -17,6 +17,9 @@ class LocationAction(object):
         self.required_bits = frozenset(bits)
         self.data = data
 
+    def get_text(self):
+        return self.TEXT % self.data
+
     def check_available(self, player):
         return player.bits.check_bits(self.required_bits)
 
@@ -99,8 +102,7 @@ class GainHealthAndClearBitsOrMSB(LocationAction):
 
 
 class ShiftLocations(LocationAction):
-    # TODO: Direction parameter in TEXT.
-    TEXT = "Shift board locations."
+    TEXT = "Shift board locations %(direction)s."
 
     def perform_action(self, board, location):
         board.shift_locations(self.data['direction'])
index 83998822bb054794766de2d0bdd24ba96aa2b568..d7ad07de421d41a5879ee26322ed2d10dd0fd87e 100644 (file)
@@ -76,7 +76,7 @@ class InfoAreaWidget(Widget):
             self.surface.blit(img, (0, y_offset))
             y_offset += 8
         text = TextBoxWidget(
-            (12, y_offset), action.TEXT,
+            (12, y_offset), action.get_text(),
             box_width=(INFO_SIZE[0] - 12) // EIGHT_BIT_SCALE,
             fontsize=28)
         text.render(self.surface)