set_bits_ym: &SET-BITS-YM
action_class: 'SetBits'
required_bits: [YELLOW, MAGENTA]
+ acquire_win_token: &ACQUIRE-WIN-TOKEN
+ action_class: 'AcquireWinToken'
+ required_bits: [CYAN, MAGENTA, YELLOW]
cards:
- actions:
required_bits: [YELLOW]
- actions:
- *SET-BITS-YM
+ - actions:
+ - *BAD-DEFAULT
+ - *ACQUIRE-WIN-TOKEN
if not self.check_and_clear_MSB(board.player):
board.lose_health()
board.player.bits.set_bits(location.bitwise_operand)
+
+
+class AcquireWinToken(LocationAction):
+ TEXT = "Acquire a win token, then clear all high bits."
+ USES_MSB = True
+
+ def perform_action(self, board, location):
+ if self.check_and_clear_MSB(board.player):
+ board.acquire_win_token()
+ board.player.bits.clear_bits(set([
+ BITS.CYAN, BITS.MAGENTA, BITS.YELLOW,
+ ]))
self.health -= 1
# TODO: Check win/lose
+ def acquire_win_token(self):
+ self.wins += 1
+ # TODO: Check win/lose
+
def replace_card(self, position):
location = LocationCard.new_location(choice(self.locations).copy())
self.board_locations[position] = location