From b5c2d3d10be9192643118ffa8c80635588d0e0f0 Mon Sep 17 00:00:00 2001 From: bobloy Date: Sun, 22 Apr 2018 21:38:17 -0400 Subject: [PATCH] start of end condition --- werewolf/game.py | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/werewolf/game.py b/werewolf/game.py index a9168ea..3a559ca 100644 --- a/werewolf/game.py +++ b/werewolf/game.py @@ -651,8 +651,21 @@ class Game: # await channel.set_permissions(member, read_messages=True) async def _check_game_over(self): - # ToDo - pass + alive_players = [player for player self.players if player.alive] + + if len(alive_players)<=2: + # Check 1v1 victory conditions ToDo + pass + else: + #Check if everyone is on the same team + alignment = alive_players[0].role.alignment + for player in alive_players: + if player.role.alignment != alignment: + return False + + # Only remaining team wins + + async def _end_game(self): # ToDo