Added possibility to cancel a legislative phase
This commit is contained in:
parent
45afcee8fb
commit
a00120d559
|
|
@ -457,6 +457,15 @@ class Game:
|
||||||
self.config["drawn"] = [self.config["deck"].pop(0) for _ in range(3)]
|
self.config["drawn"] = [self.config["deck"].pop(0) for _ in range(3)]
|
||||||
return [Policy(p) for p in self.config["drawn"]]
|
return [Policy(p) for p in self.config["drawn"]]
|
||||||
|
|
||||||
|
@game_started
|
||||||
|
@policies_drawn
|
||||||
|
@save_on_success
|
||||||
|
async def cancel_draw(self):
|
||||||
|
logger.info(f"[{self.guild.name}] Cancelling draw")
|
||||||
|
new_deck = self.config["drawn"] + self.config["deck"]
|
||||||
|
self.config["drawn"] = None
|
||||||
|
self.config["deck"] = new_deck
|
||||||
|
|
||||||
@game_started
|
@game_started
|
||||||
async def peek_policies(self) -> List[Policy]:
|
async def peek_policies(self) -> List[Policy]:
|
||||||
return [Policy(self.config["deck"][i]) for i in range(3)]
|
return [Policy(self.config["deck"][i]) for i in range(3)]
|
||||||
|
|
|
||||||
14
SecretBot.py
14
SecretBot.py
|
|
@ -290,6 +290,20 @@ class SecretBot(commands.Cog):
|
||||||
]
|
]
|
||||||
await ctx.reply("\n".join(message_content))
|
await ctx.reply("\n".join(message_content))
|
||||||
|
|
||||||
|
@commands.command("CancelLegislate", help = "Cancel a legislative phase and put the policies back on top of the deck")
|
||||||
|
async def cancel_legislate_with_confirmation(self, ctx: commands.Context):
|
||||||
|
await self.check_is_administrator_or_gm(ctx)
|
||||||
|
await self.confirm_action("Are you sure that you want to cancel the legislative phase?", ctx.channel, self.cancel_legislate(ctx), ctx.message)
|
||||||
|
|
||||||
|
async def cancel_legislate(self, ctx: commands.Context):
|
||||||
|
game = await self.get_running_game_or_error_message(ctx)
|
||||||
|
await self.check_is_administrator_or_gm(ctx)
|
||||||
|
if game.is_legislative_phase():
|
||||||
|
await game.cancel_draw()
|
||||||
|
await ctx.reply(":white_check_mark: The legislative phase has been canceled and the policy cards put on top of the deck")
|
||||||
|
else:
|
||||||
|
await ctx.reply(":x: The game is not in a legislative phase")
|
||||||
|
|
||||||
@commands.command("Enact", help = "Legislative session only: enact one of the previously drawn policies")
|
@commands.command("Enact", help = "Legislative session only: enact one of the previously drawn policies")
|
||||||
async def enact_drawn_policy(self, ctx: commands.Context, policy_number: int):
|
async def enact_drawn_policy(self, ctx: commands.Context, policy_number: 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