From 878a4c484dabe53a07ae7b02c5bb4b31adec5599 Mon Sep 17 00:00:00 2001 From: Jeremy Thurgood Date: Sat, 17 May 2014 19:31:43 +0200 Subject: [PATCH] Gain-MSB default action. --- data/location_decks/standard.yaml | 9 ++++++--- naja/actions.py | 8 ++++++++ 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/data/location_decks/standard.yaml b/data/location_decks/standard.yaml index 5e14e9d..150a6e1 100644 --- a/data/location_decks/standard.yaml +++ b/data/location_decks/standard.yaml @@ -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 diff --git a/naja/actions.py b/naja/actions.py index 464b3ae..c7717ea 100644 --- a/naja/actions.py +++ b/naja/actions.py @@ -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) -- 2.34.1