action_class: 'LoseHealthOrMSB'
required_bits: []
+ - &KNIGHT-MSB-DEFAULT
+ action_class: 'AllowChessMoveIfMSB'
+ required_bits: []
+ data: {'chesspiece': KNIGHT}
+ - &CASTLE-MSB-DEFAULT
+ action_class: 'AllowChessMoveIfMSB'
+ required_bits: []
+ data: {'chesspiece': CASTLE}
+ - &BISHOP-MSB-DEFAULT
+ action_class: 'AllowChessMoveIfMSB'
+ required_bits: []
+ data: {'chesspiece': BISHOP}
+
# One-colour actions.
- &SET-BITS-R
action_class: 'SetBits'
- *SET-BITS-R
- *BISHOP-MOVE
+ - &BISHOP-SET-KNIGHT
+ card_name: 'bishop_set_knight'
+ actions:
+ - *BISHOP-MSB-DEFAULT
+ - *SET-BITS-B
+ - *KNIGHT-MOVE
+ - &KNIGHT-SET-CASTLE
+ card_name: 'knight_set_castle'
+ actions:
+ - *KNIGHT-MSB-DEFAULT
+ - *SET-BITS-G
+ - *CASTLE-MOVE
+ - &CASTLE-SET-BISHOP
+ card_name: 'castle_set_bishop'
+ actions:
+ - *CASTLE-MSB-DEFAULT
+ - *SET-BITS-R
+ - *BISHOP-MOVE
+
- &TOGGLE-RG-R
card_name: 'toggle-rg-r'
bits: [RED, GREEN] # Colour-blind robot!
- *KNIGHT-AND-SET
- *CASTLE-AND-SET
- *BISHOP-AND-SET
+ - *BISHOP-SET-KNIGHT
+ - *KNIGHT-SET-CASTLE
+ - *CASTLE-SET-BISHOP
- *TOGGLE-RG-R
- *TOGGLE-RG-G
- *SHIFT-N-AND-HEAL
if self.data['chesspiece'] in CHESS_PIECES:
chesspiece = CHESS_PIECES[self.data['chesspiece']]
board.allow_chess_move(chesspiece)
+
+
+class AllowChessMoveIfMSB(LocationAction):
+ TEXT = "Clear {MSB} and move like a %(chesspiece_name)s for one turn."
+ MSB_GLYPH = ACTION_GLYPHS.MOVEMENT
+
+ def perform_action(self, board, location):
+ if self.data['chesspiece'] in CHESS_PIECES:
+ if self.check_and_clear_MSB(board.player):
+ chesspiece = CHESS_PIECES[self.data['chesspiece']]
+ board.allow_chess_move(chesspiece)