Added possibility to add more policies to the deck
This commit is contained in:
parent
42619ac83d
commit
5760ea201e
|
|
@ -512,6 +512,12 @@ class Game:
|
||||||
async def peek_top_3_policies(self) -> List[Policy]:
|
async def peek_top_3_policies(self) -> List[Policy]:
|
||||||
return (await self.peek_deck())[:3]
|
return (await self.peek_deck())[:3]
|
||||||
|
|
||||||
|
@game_started
|
||||||
|
@save_on_success
|
||||||
|
async def add_to_deck(self, policies: List[Policy]):
|
||||||
|
self.config["deck"].extend([policy.value for policy in policies])
|
||||||
|
random.shuffle(self.config["deck"])
|
||||||
|
|
||||||
@game_started
|
@game_started
|
||||||
@policies_drawn
|
@policies_drawn
|
||||||
@save_on_success
|
@save_on_success
|
||||||
|
|
|
||||||
13
SecretBot.py
13
SecretBot.py
|
|
@ -417,6 +417,19 @@ class SecretBot(commands.Cog):
|
||||||
else:
|
else:
|
||||||
await ctx.reply(":warning: You should do this in a channel that is hidden from the players!")
|
await ctx.reply(":warning: You should do this in a channel that is hidden from the players!")
|
||||||
|
|
||||||
|
@commands.command("AddToDeck", help = "Add additional cards to the deck and shuffle it (discard pile not modified)", usage = f"({Policy.LIBERAL.value}|{Policy.FASCIST.value})+")
|
||||||
|
async def add_to_deck(self, ctx: commands.Context, *policies_str):
|
||||||
|
game = await self.get_running_game_or_error_message(ctx)
|
||||||
|
await self.check_is_administrator_or_gm(ctx)
|
||||||
|
policies = []
|
||||||
|
for policy_str in policies_str:
|
||||||
|
try:
|
||||||
|
policies.append(Policy(policy_str.upper()))
|
||||||
|
except ValueError:
|
||||||
|
return await ctx.reply(f":x: Can not interpret `{policy_str}` as a policy value. Valid values are {Policy.LIBERAL.value} and {Policy.FASCIST.value}")
|
||||||
|
await game.add_to_deck(policies)
|
||||||
|
await ctx.reply(":white_check_mark: Done. Policies have been added to the deck and the deck has been shuffled (the discard pile has not been modified).")
|
||||||
|
|
||||||
@commands.command("NbToWin", help = "Set the number of policies needed for a win for each faction")
|
@commands.command("NbToWin", help = "Set the number of policies needed for a win for each faction")
|
||||||
async def set_nb_policies_to_win(self, ctx: commands.Context, nb_liberals: int, nb_fascist: int):
|
async def set_nb_policies_to_win(self, ctx: commands.Context, nb_liberals: int, nb_fascist: int):
|
||||||
game = await self.get_running_game_or_error_message(ctx)
|
game = await self.get_running_game_or_error_message(ctx)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue