示例#1
0
    public void AIDrawCard()
    {
        if (priorities.z > priorities.x && priorities.z > priorities.y)
        {
            Debug.Log("Drawing from recon.");
            decks.aiDrawCard(decks.aiReconDeck);
            priorities.z--;
        }
        else if (priorities.x > priorities.z && priorities.x > priorities.y)
        {
            Debug.Log("Drawing from attack.");
            decks.aiDrawCard(decks.aiAttackDeck);
            priorities.x--;
        }
        else if (priorities.y > priorities.x && priorities.y > priorities.z)
        {
            Debug.Log("Drawing from defence.");
            decks.aiDrawCard(decks.aiDefenceDeck);
            priorities.y--;
        }
        else //There's a tie. draw from a random deck
        {
            Debug.Log("Drew random card.");
            int randomNum = Random.Range(1, 3);
            if (randomNum == 1)
            {
                decks.aiDrawCard(decks.aiReconDeck);
            }
            if (randomNum == 2)
            {
                decks.aiDrawCard(decks.aiAttackDeck);
            }
            if (randomNum == 3)
            {
                decks.aiDrawCard(decks.aiDefenceDeck);
            }
        }

        int nA = 0; int nD = 0; int nR = 0;

        for (int i = 0; i < aiHand.Count; i++)
        {
            if (aiHand[i].cardType == 0)
            {
                nA++;
            }
            if (aiHand[i].cardType == 1)
            {
                nD++;
            }
            if (aiHand[i].cardType == 2)
            {
                nR++;
            }
        }
        //Debug.Log(nA + " a cards, " + nD + " d cards, " + nR + " r cards for a total of " + aiHand.Count + " cards");
    }