Example #1
0
        public IActionResult Attack(Guid gameId, Guid playerId, Guid cardId, int state)
        {
            try
            {
                switch (state)
                {
                case 1:
                {
                    IState logic = new AttackState(_attackLogic);
                    logic.Handle(gameId, playerId, cardId);
                    break;
                }

                case 2:
                {
                    IState logic = new TargetState(_attackLogic);
                    logic.Handle(gameId, playerId, cardId);
                    break;
                }

                case 3:
                {
                    IState logic = new CancelState(_attackLogic);
                    logic.Handle(gameId, playerId, cardId);
                    break;
                }
                }


                return(Ok());
            }
            catch
            {
                return(BadRequest());
            }
        }