+ y_offset = (INFO_SIZE[1] - hint.surface.get_rect().height
+ - BIT_SIZE[1] - 2)
+ self.surface.blit(hint.surface, pos())
+
+ # Game mode (puzzle, easy, standard, hard, etc ...)
+ game_mode = TextBoxWidget(
+ (0, 0), self.mode_hint(), padding=4, centre=True,
+ colour=PALETTE.WHITE, border=2,
+ bg_colour=PALETTE.BLACK, border_colour=PALETTE.BLUE,
+ box_width=box_width)
+ game_mode.prepare()
+
+ y_offset = (INFO_SIZE[1] - BIT_SIZE[1] + 12)
+ self.surface.blit(game_mode.surface, pos())
+
+ def mode_hint(self):
+ gameboard = self.state.gameboard
+ if gameboard.puzzle:
+ return "PUZZLE"
+ return {
+ 0: "DEATH", 1: "LUDICROUS",
+ 2: "RAMBO", 3: "HARD",
+ 4: "STANDARD", 5: "EASY",
+ }.get(gameboard.max_health, "UNKNOWN")
+
+ def prepare_action(self, choice, action, y_offset, box_width):
+ x_offset = INFO_LEFT_PADDING
+ glyphs_x_offset = 0
+ glyphs_y_offset = y_offset
+ y_offset += ACTION_TEXT_OFFSET
+ action_viable = action.check_available(self.state.player)
+ text_colour = PALETTE.BLACK if action_viable else PALETTE.GREY
+
+ text = TextBoxWidget(
+ (x_offset, y_offset), action.get_text(self.card),
+ box_width=box_width,
+ fontsize=28, colour=text_colour,
+ border=2, border_colour=PALETTE.GREY)
+ text.render(self.surface)
+
+ border_colour = None
+ if choice == self.chosen:
+ border_colour = PALETTE.GREEN if action_viable else PALETTE.ORANGE
+ if border_colour:
+ bottom = y_offset + text.surface.get_rect().height
+ right = text.surface.get_rect().width + x_offset
+ pygame.draw.lines(self.surface, border_colour, True,
+ [(x_offset, y_offset), (right, y_offset),
+ (right, bottom), (x_offset, bottom)], 4)