From c71ac7b42b6124467d57601fbdd690a3ce934676 Mon Sep 17 00:00:00 2001 From: ezeluduena Date: Sat, 11 Nov 2023 15:35:20 -0300 Subject: [PATCH 1/6] Se actualiza el turno luego del cambio de lugar --- app/routers/games/action_functions.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/routers/games/action_functions.py b/app/routers/games/action_functions.py index a4e4c48..3c62cbc 100644 --- a/app/routers/games/action_functions.py +++ b/app/routers/games/action_functions.py @@ -161,6 +161,7 @@ def process_change_places_card(game: Game, player: Player, objective_player: Pla tempPosition = player.position player.position = objective_player.position objective_player.position = tempPosition + game.turn = player.position asyncio.ensure_future(send_players_chagnge_event( game, player.id, objective_player.id)) @@ -171,6 +172,7 @@ def process_better_run_card(game: Game, player: Player, objective_player: Player tempPosition = player.position player.position = objective_player.position objective_player.position = tempPosition + game.turn = player.position asyncio.ensure_future(send_players_chagnge_event( game, player.id, objective_player.id)) @@ -199,5 +201,5 @@ def process_seduction_card(game: Game, player: Player, objective_player: Player, process_card_exchange(game, player, objective_player, card_to_exchange, random_card) - asyncio.ensure_future(send_seduction_done_event( - player.id, objective_player.id)) + # asyncio.ensure_future(send_seduction_done_event( + # player.id, objective_player.id)) From 7956e28957848044a0062976eb526f136db8782a Mon Sep 17 00:00:00 2001 From: ezeluduena Date: Sat, 11 Nov 2023 16:03:50 -0300 Subject: [PATCH 2/6] =?UTF-8?q?Arreglo=20de=20envio=20de=20mensajes=20al?= =?UTF-8?q?=20jugar=20seducci=C3=B3n?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/routers/games/action_functions.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/app/routers/games/action_functions.py b/app/routers/games/action_functions.py index 3c62cbc..b70f061 100644 --- a/app/routers/games/action_functions.py +++ b/app/routers/games/action_functions.py @@ -49,8 +49,8 @@ async def send_players_chagnge_event(game: Game, player_id: int, objective_playe async def send_players_exchagnge_event(game: Game, player_id: int, objective_player_id: int): json_msg = { "event": Events.EXCHANGE_DONE, - "player_id": player_id, - "objective_player_id": objective_player_id + "player_name": get_player_name_by_id(player_id), + "objective_player_name": get_player_name_by_id(objective_player_id) } await player_connections.send_event_to_other_players_in_game(game.name, json_msg, player_id) @@ -186,9 +186,6 @@ def process_card_exchange(game: Game, player: Player, objective_player: Player, objective_player.hand.remove(objective_player_card) objective_player.hand.add(player_card) - asyncio.ensure_future(send_players_exchagnge_event( - game, player.id, objective_player.id)) - @db_session def process_seduction_card(game: Game, player: Player, objective_player: Player, @@ -201,5 +198,8 @@ def process_seduction_card(game: Game, player: Player, objective_player: Player, process_card_exchange(game, player, objective_player, card_to_exchange, random_card) + asyncio.ensure_future(send_players_exchagnge_event( + game, player.id, objective_player.id)) + # asyncio.ensure_future(send_seduction_done_event( # player.id, objective_player.id)) From 0ac8b2f09b24801d6547e9d4081f4c11a64142e8 Mon Sep 17 00:00:00 2001 From: ezeluduena Date: Sat, 11 Nov 2023 16:34:13 -0300 Subject: [PATCH 3/6] cambio en envio de mensajes --- app/routers/games/action_functions.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/routers/games/action_functions.py b/app/routers/games/action_functions.py index b70f061..cd1f212 100644 --- a/app/routers/games/action_functions.py +++ b/app/routers/games/action_functions.py @@ -43,7 +43,7 @@ async def send_players_chagnge_event(game: Game, player_id: int, objective_playe "player_id": player_id, "objective_player_id": objective_player_id } - await player_connections.send_event_to_other_players_in_game(game.name, json_msg, player_id) + await player_connections.send_event_to_all_players_in_game(game.name, json_msg, player_id) async def send_players_exchagnge_event(game: Game, player_id: int, objective_player_id: int): @@ -52,7 +52,7 @@ async def send_players_exchagnge_event(game: Game, player_id: int, objective_pla "player_name": get_player_name_by_id(player_id), "objective_player_name": get_player_name_by_id(objective_player_id) } - await player_connections.send_event_to_other_players_in_game(game.name, json_msg, player_id) + await player_connections.send_event_to_all_players_in_game(game.name, json_msg, player_id) async def send_resolute_card_played_event(game: Game, player_id: int, option_cards: list[int]): From 6d08247366b4ec0a5610d1d92e6c43213658182c Mon Sep 17 00:00:00 2001 From: ezeluduena Date: Sat, 11 Nov 2023 16:41:13 -0300 Subject: [PATCH 4/6] fix --- app/routers/games/action_functions.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/routers/games/action_functions.py b/app/routers/games/action_functions.py index cd1f212..f906cb9 100644 --- a/app/routers/games/action_functions.py +++ b/app/routers/games/action_functions.py @@ -43,7 +43,7 @@ async def send_players_chagnge_event(game: Game, player_id: int, objective_playe "player_id": player_id, "objective_player_id": objective_player_id } - await player_connections.send_event_to_all_players_in_game(game.name, json_msg, player_id) + await player_connections.send_event_to_all_players_in_game(game.name, json_msg) async def send_players_exchagnge_event(game: Game, player_id: int, objective_player_id: int): @@ -52,7 +52,7 @@ async def send_players_exchagnge_event(game: Game, player_id: int, objective_pla "player_name": get_player_name_by_id(player_id), "objective_player_name": get_player_name_by_id(objective_player_id) } - await player_connections.send_event_to_all_players_in_game(game.name, json_msg, player_id) + await player_connections.send_event_to_all_players_in_game(game.name, json_msg) async def send_resolute_card_played_event(game: Game, player_id: int, option_cards: list[int]): From 930f16cd0cf74f5b2be3ddbbcdc0fbd299714cde Mon Sep 17 00:00:00 2001 From: ezeluduena Date: Sat, 11 Nov 2023 17:27:51 -0300 Subject: [PATCH 5/6] fix: cambio de turno lanzallamas --- app/routers/games/services.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/app/routers/games/services.py b/app/routers/games/services.py index 2a91010..fee56c0 100644 --- a/app/routers/games/services.py +++ b/app/routers/games/services.py @@ -283,9 +283,6 @@ def play_action_card(game_name: str, play_info: PlayInformation): objective_player: Player = find_player_by_id( play_info.objective_player_id) - if game.turn != 0 and objective_player.position < player.position: - game.turn = game.turn - 1 - create_intention_in_game( game, ActionType.FLAMETHROWER, player, objective_player) From 0e00476623910133227b8a58e876a5d7d07be281 Mon Sep 17 00:00:00 2001 From: ezeluduena Date: Sat, 11 Nov 2023 17:29:55 -0300 Subject: [PATCH 6/6] fix: reacomodo de turno --- app/routers/games/action_functions.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/routers/games/action_functions.py b/app/routers/games/action_functions.py index f906cb9..f1d0220 100644 --- a/app/routers/games/action_functions.py +++ b/app/routers/games/action_functions.py @@ -88,6 +88,10 @@ def process_flamethrower_card(game: Game, player: Player, objective_player: Play p.position -= 1 objective_player.position = -1 + # Reacomodo el turno + if game.turn != 0 and objective_player.position < player.position: + game.turn = game.turn - 1 + asyncio.ensure_future(send_players_eliminated_event(game=game, killer_id=player.id, killer_name=player.name,