Action to gain health.
[naja.git] / naja / actions.py
index 354d88097bd8c624e37f17b8762f7e9dd69cccf9..f62b4637174621c3a29e541d4c445e4ece66f715 100644 (file)
@@ -86,3 +86,13 @@ class AcquireWinToken(LocationAction):
             board.player.bits.clear_bits(set([
                 BITS.CYAN, BITS.MAGENTA, BITS.YELLOW,
             ]))
+
+
+class GainHealthAndClearBitsOrMSB(LocationAction):
+    TEXT = "Gain health, then clear bits specified by this location or MSB."
+    USES_MSB = True
+
+    def perform_action(self, board, location):
+        board.gain_health()
+        if not self.check_and_clear_MSB(board.player):
+            board.player.bits.clear_bits(location.bitwise_operand)