Proper glyphs for GenericBits.
[naja.git] / naja / actions.py
index 5aa465a4c3122889e801871211432323a0cbaf71..4dafbc6fbe3ebed6dc8d68b06a19986013183c61 100644 (file)
@@ -16,6 +16,12 @@ class LocationAction(object):
         self.required_bits = required_bits
         self.data = data
 
+    def get_glyphs(self):
+        return self.GLYPHS
+
+    def get_msb_glyph(self):
+        return self.MSB_GLYPH
+
     def get_text(self, location=None):
         substitutions = self.data.copy()
 
@@ -129,6 +135,16 @@ class GenericBits(LocationAction):
         bits.toggle_bits(self.toggle_bits)
         bits.clear_bits(self.clear_bits)
 
+    def get_glyphs(self):
+        glyphs = []
+        if self.set_bits:
+            glyphs.append(ACTION_GLYPHS.SET_BITS)
+        if self.clear_bits:
+            glyphs.append(ACTION_GLYPHS.CLEAR_BITS)
+        if self.toggle_bits:
+            glyphs.append(ACTION_GLYPHS.TOGGLE_BITS)
+        return tuple(glyphs)
+
     def get_text(self, location=None):
         if 'message' in self.data:
             return super(GenericBits, self).get_text()
@@ -175,6 +191,8 @@ class AcquireWinToken(LocationAction):
         board.player.bits.clear_bits(set([
             BITS.RED, BITS.GREEN, BITS.BLUE,
         ]))
+        if self.data.get('once', False):
+            location.actions.remove(self)
 
 
 class GainHealth(LocationAction):