From: Jeremy Thurgood Date: Sat, 17 May 2014 17:31:43 +0000 (+0200) Subject: Gain-MSB default action. X-Git-Tag: 0.1~65 X-Git-Url: https://git.ctpug.org.za/?a=commitdiff_plain;h=878a4c484dabe53a07ae7b02c5bb4b31adec5599;p=naja.git Gain-MSB default action. --- 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)