diff --git a/src/werewolf_game.py b/src/werewolf_game.py index 4f5388f..6ba781d 100644 --- a/src/werewolf_game.py +++ b/src/werewolf_game.py @@ -36,15 +36,18 @@ class Game: def setup(self): self.role = dict() + # setting default value for r in Role.__subclasses__(): - if r not in [Werewolf, Mason, No_role]: + if r == No_role: + continue + if r in [Werewolf, Mason]: + self.role[r] = [] + else: r(self) - self.role[Werewolf] = [] - self.role[Mason] = [] self.voting_list = self.player_list + [No_player()] for c in self.voting_list: - c.tally = 0 - c.won = c.dead = False + c.reset() + self.time = 0 def distribute_roles(self): shuffle(self.role_list) @@ -74,6 +77,9 @@ class Game: async def start_day(self): await self.send("The day has started") + async def discussion_timer(self): + pass + async def vote(self): # vote @@ -168,8 +174,8 @@ class Game: async def round(self): try: self.check() - self.running = True self.setup() + self.running = True self.distribute_roles() await self.start_night() await self.send_role() @@ -177,7 +183,6 @@ class Game: await self.night_phases() await self.start_day() - # discussion timer await self.vote() self.tally() diff --git a/src/werewolf_players.py b/src/werewolf_players.py index 5c7f89e..8d4fd1c 100644 --- a/src/werewolf_players.py +++ b/src/werewolf_players.py @@ -14,6 +14,10 @@ class Player: def setRole(self, role): self.day_role = self.night_role = role + def reset(self): + self.tally = 0 + self.won = self.dead = False + def name(self): return self.member.name