diff --git a/app/routers/games/action_functions.py b/app/routers/games/action_functions.py index 7838a5b..7692728 100644 --- a/app/routers/games/action_functions.py +++ b/app/routers/games/action_functions.py @@ -70,6 +70,14 @@ async def send_seduction_done_event(player_id: int, objective_player_id: int): await player_connections.send_event_to(player_id, json_msg) await player_connections.send_event_to(objective_player_id, json_msg) +async def send_suspicious_card_played_event(player_id: int, card_name: str): + json_msg = { + "event": Events.SUSPICIOUS_CARD_PLAYED, + "card_name": card_name + } + await player_connections.send_event_to(player_id, json_msg) + await asyncio.sleep(5) + @db_session def process_flamethrower_card(game: Game, player: Player, objective_player: Player): @@ -127,6 +135,8 @@ def process_suspicious_card(game: Game, player: Player, objective_player: Player description=random_card.description ) + asyncio.ensure_future(send_suspicious_card_played_event(player.id, random_card.name)) + return result diff --git a/app/routers/games/utils.py b/app/routers/games/utils.py index 2bbd27a..adc2fb1 100644 --- a/app/routers/games/utils.py +++ b/app/routers/games/utils.py @@ -51,6 +51,7 @@ class Events(str, Enum): INTERCHANGE_INTENTION = 'interchange_intention' INTERCHANGE_INTENTION_DONE = 'interchange_intention_done' DEFENSE_CARD_PLAYED = "defense_card_played" + SUSPICIOUS_CARD_PLAYED = "suspicious_card_played" async def send_played_card_event(game_name: str, player_id: int, card_id: int):