From ebce152c54ead9942217e31ee2322564cf5add47 Mon Sep 17 00:00:00 2001 From: ezeluduena Date: Wed, 8 Nov 2023 16:37:17 -0300 Subject: [PATCH] agregado el cambio de rol al intercambiar carta infectado --- app/routers/games/action_functions.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/app/routers/games/action_functions.py b/app/routers/games/action_functions.py index ab95db7..4304748 100644 --- a/app/routers/games/action_functions.py +++ b/app/routers/games/action_functions.py @@ -1,7 +1,7 @@ from pony.orm import db_session, select from app.database.models import Game, Card, Player from ..players.schemas import PlayerRol -from ..cards.schemas import CardType, CardResponse +from ..cards.schemas import CardType, CardResponse, CardSubtype from ..websockets.utils import player_connections from .utils import Events from .schemas import RoundDirection, GameStatus @@ -164,6 +164,14 @@ def process_card_exchange(player: Player, objective_player: Player, player_card: objective_player.hand.remove(objective_player_card) objective_player.hand.add(player_card) + if (player.rol == PlayerRol.THE_THING and player_card.type == CardSubtype.CONTAGION): + objective_player.rol = PlayerRol.INFECTED + objective_player.game_last_infected = objective_player.game + + elif (objective_player.rol == PlayerRol.THE_THING and objective_player_card.type == CardSubtype.CONTAGION): + player.rol = PlayerRol.INFECTED + player.game_last_infected = player.game + # enviar evento de intercambio de carta