✨ don't draw problems that can't be accepted
This commit is contained in:
parent
c7ed5599b4
commit
eb8b884d47
|
@ -222,7 +222,7 @@ class Phase:
|
|||
async def dice(self, ctx: Context, author, dice):
|
||||
raise UnwantedCommand()
|
||||
|
||||
async def choose_problem(self, ctx: Context, author, problem):
|
||||
async def choose_problem(self, ctx: Context, author):
|
||||
raise UnwantedCommand()
|
||||
|
||||
async def accept(self, ctx: Context, author, yes):
|
||||
|
@ -319,7 +319,7 @@ class TiragePhase(Phase):
|
|||
def available(self, problem):
|
||||
return all(team.accepted_problems[self.round] != problem for team in self.teams)
|
||||
|
||||
async def choose_problem(self, ctx: Context, author, problem):
|
||||
async def choose_problem(self, ctx: Context, author):
|
||||
team = self.current_team
|
||||
if self.team_for(author) != team:
|
||||
raise UnwantedCommand(
|
||||
|
@ -337,6 +337,12 @@ class TiragePhase(Phase):
|
|||
"ou de le refuser (`!no)`."
|
||||
)
|
||||
|
||||
# Choose an *available* problem
|
||||
problems = [
|
||||
p for p in PROBLEMS if self.available(p) and not p in team.accepted_problems
|
||||
]
|
||||
problem = random.choice(problems)
|
||||
|
||||
await ctx.send(f"{team.mention} a tiré **{problem}** !")
|
||||
if not self.available(problem):
|
||||
await ctx.send(
|
||||
|
|
Loading…
Reference in New Issue