diff options
Diffstat (limited to 'swiftstory')
-rw-r--r-- | swiftstory/Client.py | 6 | ||||
-rw-r--r-- | swiftstory/Game.py | 14 | ||||
-rw-r--r-- | swiftstory/Player.py | 6 |
3 files changed, 7 insertions, 19 deletions
diff --git a/swiftstory/Client.py b/swiftstory/Client.py index e7c0464..bc347f9 100644 --- a/swiftstory/Client.py +++ b/swiftstory/Client.py @@ -27,12 +27,6 @@ class Client: return await game.try_join(self) - def set_game(self, game): - self.game = game - - def set_player(self, player): - self.player = player - async def play_white_card(self, card_id): if self.game is None: return error('You have to join a game first') diff --git a/swiftstory/Game.py b/swiftstory/Game.py index 9885182..ee1fd86 100644 --- a/swiftstory/Game.py +++ b/swiftstory/Game.py @@ -42,8 +42,8 @@ class Game: for card in cards: player.receive_card(card) - client.set_player(player) - client.set_game(self) + client.player = player + client.game = self self.players.append(player) @@ -86,7 +86,7 @@ class Game: if self.judge is player: return error('You\'re the judge, you silly') - elif player.get_has_played(): + elif player.has_played: return error('You already played, you dumb ass') try: @@ -94,7 +94,7 @@ class Game: except IndexError: return error('Invalid card id') - player.set_has_played() + player.has_played = True self.board.play_card(player, card) @@ -147,7 +147,7 @@ class Game: # reset the state of the players for p in self.players: - if p.get_has_played(): + if p.has_played: idx = p.receive_card(self.board.pick_white_card()) card_idx = p.cards[idx] card_desc = self.white_desc[card_idx] @@ -161,7 +161,7 @@ class Game: }, }, }) - p.set_has_played(False) + p.has_played = False self.board.recycle_black_card() self.judge = None @@ -228,7 +228,7 @@ class Game: }, }, }) - p.set_has_played(False) + p.has_played = False self.board.played_cards = [] self.state = self.WAITING_NEW_JUDGE diff --git a/swiftstory/Player.py b/swiftstory/Player.py index 3380908..786569c 100644 --- a/swiftstory/Player.py +++ b/swiftstory/Player.py @@ -17,12 +17,6 @@ class Player: def pop_card(self, card_id): return self.cards.pop(card_id) - def get_has_played(self): - return self.has_played - - def set_has_played(self, has=True): - self.has_played = has - async def inc_score(self): self.score += 1 await self.send_notification({ |