Skip to content

Commit

Permalink
agregado el cambio de rol al intercambiar carta infectado
Browse files Browse the repository at this point in the history
  • Loading branch information
ezeluduena committed Nov 8, 2023
1 parent 86f4e17 commit ebce152
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion app/routers/games/action_functions.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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


Expand Down

0 comments on commit ebce152

Please sign in to comment.