--- /dev/null
+description: "Standard location deck."
+
+# This field is ignored, but it's a useful place to put some action definitions
+# we can reference later.
+_standard_actions:
+ # No-colour actions.
+ - &SET-BITS-DEFAULT
+ action_class: 'LoseHealthOrMSBAndSetBits'
+ required_bits: []
+ - &GAIN-HEALTH-DEFAULT
+ action_class: 'GainHealthAndClearBitsOrMSB'
+ required_bits: []
+ - &TOGGLE-BITS-DEFAULT
+ action_class: 'ToggleBits'
+ required_bits: []
+ - &BAD-DEFAULT
+ action_class: 'LoseHealthOrMSB'
+ required_bits: []
+
+ # One-colour actions.
+ - &SET-BITS-R
+ action_class: 'SetBits'
+ required_bits: [RED]
+ - &SET-BITS-G
+ action_class: 'SetBits'
+ required_bits: [GREEN]
+ - &SET-BITS-B
+ action_class: 'SetBits'
+ required_bits: [BLUE]
+
+ - &SHIFT-N
+ action_class: 'ShiftLocations'
+ required_bits: [BLUE]
+ data: {'direction': NORTH}
+ - &SHIFT-S
+ action_class: 'ShiftLocations'
+ required_bits: [BLUE]
+ data: {'direction': SOUTH}
+ - &SHIFT-E
+ action_class: 'ShiftLocations'
+ required_bits: [GREEN]
+ data: {'direction': EAST}
+ - &SHIFT-W
+ action_class: 'ShiftLocations'
+ required_bits: [GREEN]
+ data: {'direction': WEST}
+
+ # Two-colour actions.
+ - &KNIGHT-MOVE
+ action_class: 'AllowChessMove'
+ required_bits: [RED, GREEN]
+ data: {'chesspiece': KNIGHT}
+ - &CASTLE-MOVE
+ action_class: 'AllowChessMove'
+ required_bits: [RED, BLUE]
+ data: {'chesspiece': CASTLE}
+ - &BISHOP-MOVE
+ action_class: 'AllowChessMove'
+ required_bits: [GREEN, BLUE]
+ data: {'chesspiece': BISHOP}
+
+ - &HEAL-RG
+ action_class: 'GainHealth'
+ required_bits: [RED, GREEN]
+ - &HEAL-RB
+ action_class: 'GainHealth'
+ required_bits: [RED, BLUE]
+
+ # Three-colour actions.
+ - &ACQUIRE-WIN-TOKEN
+ action_class: 'AcquireWinToken'
+ required_bits: [RED, GREEN, BLUE]
+
+# This field is ignored, but it's a useful place to put some action definitions
+# we can reference later.
+_standard_cards:
+ - &WIN-CARD
+ actions:
+ - *ACQUIRE-WIN-TOKEN
+
+ - &KNIGHT-AND-SET
+ actions:
+ - *BAD-DEFAULT
+ - *SET-BITS-B
+ - *KNIGHT-MOVE
+ - &CASTLE-AND-SET
+ actions:
+ - *BAD-DEFAULT
+ - *SET-BITS-G
+ - *CASTLE-MOVE
+ - &BISHOP-AND-SET
+ actions:
+ - *BAD-DEFAULT
+ - *SET-BITS-R
+ - *BISHOP-MOVE
+
+ - &TOGGLE-RG-R
+ bits: [RED, GREEN] # Colour-blind robot!
+ actions:
+ - action_class: 'ToggleBits'
+ required_bits: [RED]
+ - action_class: 'SetBits'
+ required_bits: [GREEN, BLUE]
+ - &TOGGLE-RG-G
+ bits: [RED, GREEN] # Colour-blind robot!
+ actions:
+ - action_class: 'ToggleBits'
+ required_bits: [GREEN]
+ - action_class: 'SetBits'
+ required_bits: [RED, BLUE]
+
+ - &SHIFT-N-AND-HEAL
+ actions:
+ - *TOGGLE-BITS-DEFAULT
+ - *SHIFT-N
+ - *HEAL-RG
+ - &SHIFT-S-AND-HEAL
+ actions:
+ - *TOGGLE-BITS-DEFAULT
+ - *SHIFT-S
+ - *HEAL-RG
+ - &SHIFT-E-AND-HEAL
+ actions:
+ - *TOGGLE-BITS-DEFAULT
+ - *SHIFT-E
+ - *HEAL-RB
+ - &SHIFT-W-AND-HEAL
+ actions:
+ - *TOGGLE-BITS-DEFAULT
+ - *SHIFT-W
+ - *HEAL-RB
+
+cards:
+ - *WIN-CARD
+ - *KNIGHT-AND-SET
+ - *CASTLE-AND-SET
+ - *BISHOP-AND-SET
+ - *TOGGLE-RG-R
+ - *TOGGLE-RG-G
+ - *SHIFT-N-AND-HEAL
+ - *SHIFT-S-AND-HEAL
+ - *SHIFT-E-AND-HEAL
+ - *SHIFT-W-AND-HEAL
# This field is ignored, but it's a useful place to put some action definitions
# we can reference later.
_standard_actions:
- set_bits_default: &SET-BITS-DEFAULT
+ - &SET-BITS-DEFAULT
action_class: 'LoseHealthOrMSBAndSetBits'
required_bits: []
- gain_health_default: &GAIN-HEALTH-DEFAULT
+ - &GAIN-HEALTH-DEFAULT
action_class: 'GainHealthAndClearBitsOrMSB'
required_bits: []
- bad_default: &BAD-DEFAULT
+ - &BAD-DEFAULT
action_class: 'LoseHealthOrMSB'
required_bits: []
- toggle_bits_c: &TOGGLE-BITS-C
+ - &TOGGLE-BITS-C
action_class: 'ToggleBits'
required_bits: [BLUE]
- set_bits_ym: &SET-BITS-YM
+ - &SET-BITS-YM
action_class: 'SetBits'
required_bits: [RED, GREEN]
- acquire_win_token: &ACQUIRE-WIN-TOKEN
+ - &ACQUIRE-WIN-TOKEN
action_class: 'AcquireWinToken'
required_bits: [RED, GREEN, BLUE]
]))
+class GainHealth(LocationAction):
+ TEXT = "Gain {HEALTH}."
+ GLYPHS = (ACTION_GLYPHS.HEAL,)
+
+ def perform_action(self, board, location):
+ board.gain_health()
+
+
class GainHealthAndClearBitsOrMSB(LocationAction):
TEXT = "Gain {HEALTH}, then clear %(location_bits)s or {MSB}."
GLYPHS = (ACTION_GLYPHS.HEAL,)