Room != Group
This commit is contained in:
parent
4886806af7
commit
6e41710943
|
@ -263,7 +263,7 @@ async def open(ctx: commands.Context):
|
||||||
if room is None:
|
if room is None:
|
||||||
await ctx.reply("Les salles ne sont pas configurées.")
|
await ctx.reply("Les salles ne sont pas configurées.")
|
||||||
if len(list(room.players)) != 3 or not all(player for player in room.players):
|
if len(list(room.players)) != 3 or not all(player for player in room.players):
|
||||||
return await ctx.reply(f"La salle {room.room.value} ne contient pas trois joueurs, "
|
return await ctx.reply(f"La groupe {room.room.value} ne contient pas trois joueurs, "
|
||||||
f"merci de finir sa configuration avec `!setup {room.room.value}`.")
|
f"merci de finir sa configuration avec `!setup {room.room.value}`.")
|
||||||
|
|
||||||
# Send messages to players
|
# Send messages to players
|
||||||
|
@ -282,7 +282,8 @@ async def open(ctx: commands.Context):
|
||||||
channel_id = player.private_channel_id
|
channel_id = player.private_channel_id
|
||||||
channel = bot.get_channel(channel_id)
|
channel = bot.get_channel(channel_id)
|
||||||
message = "Les votes sont ouverts.\n"
|
message = "Les votes sont ouverts.\n"
|
||||||
message += f"Vous devez aller voter en salle **{room.room.value}**.\n"
|
effective_room = room.room if vote.player2 is not None else room.room.next
|
||||||
|
message += f"Vous devez aller voter en salle **{effective_room.value}**.\n"
|
||||||
if other_player:
|
if other_player:
|
||||||
message += f"Vous êtes allié⋅e avec **{other_player.name}**.\n"
|
message += f"Vous êtes allié⋅e avec **{other_player.name}**.\n"
|
||||||
message += f"Vous affrontez {' et '.join(f'**{adv.name}**' for adv in other_vote.players)}.\n"
|
message += f"Vous affrontez {' et '.join(f'**{adv.name}**' for adv in other_vote.players)}.\n"
|
||||||
|
@ -318,7 +319,7 @@ async def close(ctx: commands.Context):
|
||||||
if vote.swapped:
|
if vote.swapped:
|
||||||
vote.vote = Vote.ALLY if vote.vote == Vote.BETRAY else Vote.BETRAY
|
vote.vote = Vote.ALLY if vote.vote == Vote.BETRAY else Vote.BETRAY
|
||||||
await ctx.send(f"L'équipe **{' et '.join(player.name for player in vote.players)}** "
|
await ctx.send(f"L'équipe **{' et '.join(player.name for player in vote.players)}** "
|
||||||
f"en salle **{room.room.value}** a vu son vote échangé. "
|
f"dans le groupe **{room.room.value}** a vu son vote échangé. "
|
||||||
f"Nouveau vote : **{vote.vote.value}**")
|
f"Nouveau vote : **{vote.vote.value}**")
|
||||||
|
|
||||||
for player in game.players.values():
|
for player in game.players.values():
|
||||||
|
@ -367,7 +368,7 @@ async def prepare(ctx: commands.Context):
|
||||||
))
|
))
|
||||||
game.save()
|
game.save()
|
||||||
|
|
||||||
await ctx.reply("Le tour suivant est en préparation. Utilisez `!setup A|B|C` pour paramétrer les salles A, B ou C. "
|
await ctx.reply("Le tour suivant est en préparation. Utilisez `!setup A|B|C` pour paramétrer les groupes A, B ou C. "
|
||||||
"Dan peut faire la même chose.")
|
"Dan peut faire la même chose.")
|
||||||
|
|
||||||
|
|
||||||
|
@ -377,9 +378,11 @@ async def preview(ctx: commands.Context):
|
||||||
game: Game = Game.INSTANCE
|
game: Game = Game.INSTANCE
|
||||||
current_round = game.rounds[-1]
|
current_round = game.rounds[-1]
|
||||||
for room in current_round.rooms:
|
for room in current_round.rooms:
|
||||||
await ctx.send(f"Dans la salle **{room.room.value}**, s'affronteront :\n"
|
await ctx.send(f"Dans la groupe **{room.room.value}**, s'affronteront :\n"
|
||||||
f"- **{' et '.join(str(player or '_personne_') for player in room.vote1.players)}**\n"
|
f"- **{' et '.join(str(player or '_personne_') for player in room.vote1.players)}** "
|
||||||
f"- **{' et '.join(str(player or '_personne_') for player in room.vote2.players)}**")
|
f"(salle {room.room.next.value})\n"
|
||||||
|
f"- **{' et '.join(str(player or '_personne_') for player in room.vote2.players)}** "
|
||||||
|
f"(salle {room.room.value})")
|
||||||
|
|
||||||
|
|
||||||
@bot.command(help="Préparation d'une salle")
|
@bot.command(help="Préparation d'une salle")
|
||||||
|
@ -389,9 +392,9 @@ async def setup(ctx: commands.Context, room: Room):
|
||||||
current_round = game.rounds[-1]
|
current_round = game.rounds[-1]
|
||||||
|
|
||||||
if game.state != GameState.PREPARING:
|
if game.state != GameState.PREPARING:
|
||||||
return await ctx.reply("Vous ne pouvez pas préparer la salle avant le tour suivant.")
|
return await ctx.reply("Vous ne pouvez pas préparer le groupe avant le tour suivant.")
|
||||||
|
|
||||||
await ctx.reply(f"Préparation de la salle {room.value}.")
|
await ctx.reply(f"Préparation du groupe {room.value}.")
|
||||||
|
|
||||||
match room:
|
match room:
|
||||||
case Room.A:
|
case Room.A:
|
||||||
|
@ -402,7 +405,7 @@ async def setup(ctx: commands.Context, room: Room):
|
||||||
round_room = current_round.room_c
|
round_room = current_round.room_c
|
||||||
|
|
||||||
view = PrepareRoomView(round_room, 0, timeout=300)
|
view = PrepareRoomView(round_room, 0, timeout=300)
|
||||||
await ctx.send(f"Veuillez choisir qui s'affrontera seul dans la salle **{room.value}**.", view=view)
|
await ctx.send(f"Veuillez choisir qui s'affrontera seul dans le groupe **{room.value}**.", view=view)
|
||||||
|
|
||||||
if round_room.vote1.player1 is not None:
|
if round_room.vote1.player1 is not None:
|
||||||
await ctx.send(f"Attention : **{round_room.vote1.player1.name}** est déjà choisie.")
|
await ctx.send(f"Attention : **{round_room.vote1.player1.name}** est déjà choisie.")
|
||||||
|
@ -578,7 +581,7 @@ class PrepareRoomView(disnake.ui.View):
|
||||||
|
|
||||||
if replaced_player != player:
|
if replaced_player != player:
|
||||||
await interaction.send(
|
await interaction.send(
|
||||||
f"Attention : **{player.name}** était déjà attribué⋅e dans la salle "
|
f"Attention : **{player.name}** était déjà attribué⋅e dans le groupe "
|
||||||
f"**{room.room.value}**. Vous devrez probablement la re-configurer.")
|
f"**{room.room.value}**. Vous devrez probablement la re-configurer.")
|
||||||
|
|
||||||
if vote.player1 == player:
|
if vote.player1 == player:
|
||||||
|
@ -618,10 +621,12 @@ class PrepareRoomView(disnake.ui.View):
|
||||||
case 2:
|
case 2:
|
||||||
self.round_room.vote2.player2 = player
|
self.round_room.vote2.player2 = player
|
||||||
await interaction.send(
|
await interaction.send(
|
||||||
f"Dans la salle **{round_room.room.value}**, **{round_room.vote1.player1.name}** "
|
f"Dans le groupe **{round_room.room.value}**, **{round_room.vote1.player1.name}** "
|
||||||
f"affrontera **{round_room.vote2.player1.name}** et **{round_room.vote2.player2.name}**.")
|
f"(salle {round_room.room.next.value}) "
|
||||||
|
f"affrontera **{round_room.vote2.player1.name}** et **{round_room.vote2.player2.name}** "
|
||||||
|
f"(salle {round_room.room.value}).")
|
||||||
await interaction.send(
|
await interaction.send(
|
||||||
"Vous pouvez redéfinir la salle tant que le tour n'est pas lancé. "
|
"Vous pouvez redéfinir le groupe tant que le tour n'est pas lancé. "
|
||||||
"Utilisez !preview pour un récapitulatif des tours.")
|
"Utilisez !preview pour un récapitulatif des tours.")
|
||||||
|
|
||||||
game.save()
|
game.save()
|
||||||
|
|
|
@ -10,6 +10,16 @@ class Room(Enum):
|
||||||
B = 'B'
|
B = 'B'
|
||||||
C = 'C'
|
C = 'C'
|
||||||
|
|
||||||
|
@property
|
||||||
|
def next(self) -> 'Room':
|
||||||
|
match self:
|
||||||
|
case Room.A:
|
||||||
|
return Room.B
|
||||||
|
case Room.B:
|
||||||
|
return Room.C
|
||||||
|
case Room.C:
|
||||||
|
return Room.A
|
||||||
|
|
||||||
|
|
||||||
class GameState(Enum):
|
class GameState(Enum):
|
||||||
PREPARING = 0
|
PREPARING = 0
|
||||||
|
|
|
@ -48,7 +48,7 @@
|
||||||
<table class="table table-striped">
|
<table class="table table-striped">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="col">Salle</th>
|
<th scope="col">Groupe</th>
|
||||||
<th scope="col">Équipes</th>
|
<th scope="col">Équipes</th>
|
||||||
<th scope="col">Vote</th>
|
<th scope="col">Vote</th>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
Loading…
Reference in New Issue