Gain-MSB default action.
authorJeremy Thurgood <firxen@gmail.com>
Sat, 17 May 2014 17:31:43 +0000 (19:31 +0200)
committerJeremy Thurgood <firxen@gmail.com>
Sat, 17 May 2014 17:31:43 +0000 (19:31 +0200)
data/location_decks/standard.yaml
naja/actions.py

index 5e14e9d84da0860c2c059e60a09e188966a62ad9..150a6e118ff7a1a0530079d524b8b7515fc2fbf6 100644 (file)
@@ -16,6 +16,9 @@ _action_definitions:
   - &BAD-DEFAULT
     action_class: 'LoseHealthOrMSB'
     required_bits: []
+  - &SET-MSB-DEFAULT
+    action_class: 'GainMSB'
+    required_bits: []
 
   - &KNIGHT-MSB-DEFAULT
     action_class: 'AllowChessMoveIfMSB'
@@ -132,19 +135,19 @@ _card_definitions:
   - &KNIGHT-AND-SET
     card_name: 'knight_set'
     actions:
-      - *BAD-DEFAULT
+      - *SET-MSB-DEFAULT
       - *SET-BITS-B
       - *KNIGHT-MOVE
   - &CASTLE-AND-SET
     card_name: 'castle_set'
     actions:
-      - *BAD-DEFAULT
+      - *SET-MSB-DEFAULT
       - *SET-BITS-G
       - *CASTLE-MOVE
   - &BISHOP-AND-SET
     card_name: 'bishop_set'
     actions:
-      - *BAD-DEFAULT
+      - *SET-MSB-DEFAULT
       - *SET-BITS-R
       - *BISHOP-MOVE
 
index 464b3ae285482c2b6d3967d8687c39759bd78308..c7717ea9062197a618172b59b9a4da6c88a3eda4 100644 (file)
@@ -196,3 +196,11 @@ class AllowChessMoveIfMSB(LocationAction):
             if self.check_and_clear_MSB(board.player):
                 chesspiece = CHESS_PIECES[self.data['chesspiece']]
                 board.allow_chess_move(chesspiece)
+
+
+class GainMSB(LocationAction):
+    TEXT = "Set {MSB}."
+    GLYPHS = (ACTION_GLYPHS.MSB,)
+
+    def perform_action(self, board, location):
+        board.player.bits.set_bit(BITS.MSB)