def get_text(self, location=None):
substitutions = self.data.copy()
- if 'direction' in self.data:
+ if 'shift' in self.data:
+ substitutions['shift'] = self.data['shift']
+ substitutions['direction'] = self.data['direction']
+ elif 'direction' in self.data:
substitutions['rowcol'] = {
'NORTH': 'column',
'SOUTH': 'column',
board.player.bits.toggle_bits(location.bitwise_operand)
+class ShiftBits(LocationAction):
+ TEXT = "Barrel-shift player %(shift)s bits %(direction)s."
+ GLYPHS = (ACTION_GLYPHS.CHANGE_BOARD,)
+
+ def perform_action(self, board, location):
+ shift = self.data['shift']
+ if self.data['direction'] == 'left':
+ board.player.bits.shift_bits_left(shift)
+ else:
+ board.player.bits.shift_bits_right(shift)
+
+
class LoseHealthOrMSBAndSetBits(LocationAction):
TEXT = "Lose {HEALTH} or {MSB}, then set %(location_bits)s."
GLYPHS = (ACTION_GLYPHS.SET_BITS,)