X-Git-Url: https://git.ctpug.org.za/?a=blobdiff_plain;f=naja%2Fgameboard.py;h=74abc12e5e82d763faf8f7dfb20df36745356fd4;hb=5dcf76d018eac5124c9dc81690a9d2bdec081280;hp=e02dd3d51b16fc0d0afebfbc5584856f1db64d2a;hpb=9f6988141b3238d693a6c4ee5db3fb1d4af56ce0;p=naja.git diff --git a/naja/gameboard.py b/naja/gameboard.py index e02dd3d..74abc12 100644 --- a/naja/gameboard.py +++ b/naja/gameboard.py @@ -22,7 +22,8 @@ class GameBoard(object): self.puzzle = state.get('puzzle', False) self.player = player self.board_locations = board_locations - self.player_mode = EXAMINE + self.player_mode = state.get('player_mode', EXAMINE) + self.has_cheated = state.get('cheater', options.cheat_enabled) @classmethod def new_game(cls, deck, @@ -54,7 +55,7 @@ class GameBoard(object): return cls(state, player, board_locations) def export(self): - return { + data = { 'max_health': self.max_health, 'health': self.health, 'wins_required': self.wins_required, @@ -63,7 +64,11 @@ class GameBoard(object): 'puzzle': self.puzzle, 'player': self.player.export(), 'board_locations': self.export_board_locations(), + 'player_mode': self.player_mode, } + if self.has_cheated: + data['cheater'] = True + return data @classmethod def import_locations(cls, locations_definition):