Beispiel #1
0
    public void Play(CardState card, Targets targets)
    {
        if (!card.CanPlay(board, targets))
        {
            Debug.LogError("The card '" + card.name + "' cannot be played with this board state!");
            return;
        }

        int turnPlayer = board.turn % 2;

        if (turnPlayer != card.playerNum)
        {
            Debug.LogError("Tried to play an opponents card!!");
            return;
        }

        if (turnPlayer == localPlayerNum)
        {
            informer.PlayCard(card, targets);
        }

        card.TryTrigger(EffectTrigger.PLAY, this, board, targets);

        foreach (CardState boardCard in board.playOrder)
        {
            boardCard.TryTrigger(EffectTrigger.CARD_PLAYED, this, board, new Targets(card));
        }

        if (card.isPermanent)
        {
            board.playOrder.Add(card);
            board.board[turnPlayer].Add(card);
        }
    }