Esempio n. 1
0
    // Client-called function to play a card from the player's hand
    public void PlayCardFromHand(int player, int cardID)
    {
        if (m_turnState == CGTurnState.WAIT_FOR_PLAY_CARD_FROM_HAND && m_activePlayerID == player)
        {
            if (m_activePlayer.CanPlayCard(cardID))
            {
                // Play the card from hand, adding any "OnPlay" effects to the stack
                m_activePlayer.PlayCardFromHand(cardID);

                // Add any "PlayCard" triggered effects to the stack
                TriggerEvent("PlayCard");

                ResolveStack();

                // Return to game logic once a card has been played
                m_turnState = CGTurnState.CARD_PLAYED_FROM_HAND;
                RunGameLogic();
                return;
            }

            // Tell client to highlight playable cards and keep waiting for a valid card
            List <int> playableCardIDs      = m_activePlayer.m_hand.GetPlayableCardIDs();
            CGC_WaitForPlayFromHand command = new CGC_WaitForPlayFromHand(playableCardIDs, m_activePlayerID);
            m_connection.TransmitStream(command.PackCommand(), m_activePlayerID);
        }
    }
Esempio n. 2
0
    /** "Play" phase */
    CGTurnState Phase3()
    {
        Debug.Log("Phase 3: Play phase");

        SendPhaseTransition("Play step");

        List <int> playableCardIDs = m_activePlayer.m_hand.GetPlayableCardIDs();

        if (playableCardIDs.Count == 0)
        {
            TriggerEvent("SkipCard");
            ResolveStack();
            return(CGTurnState.DEFAULT);
        }

        // Tell client to highlight playable cards
        CGC_WaitForPlayFromHand command = new CGC_WaitForPlayFromHand(playableCardIDs, m_activePlayerID);

        m_connection.TransmitStream(command.PackCommand(), m_activePlayerID);

        // Wait for client to return chosen card
        return(CGTurnState.WAIT_FOR_PLAY_CARD_FROM_HAND);
    }