예제 #1
0
    private static int getRowNumberByCardDice(CardDice cardDice)
    {
        switch (cardDice)
        {
        case CardDice.I:
            return(0);

        case CardDice.II:
            return(1);

        case CardDice.III:
            return(2);

        case CardDice.IV:
            return(3);

        case CardDice.V:
            return(4);

        case CardDice.VI:
            return(5);

        default:
            return(-1);
        }
    }
예제 #2
0
 public Card(CardClass cardClass, CardDice cardDice = CardDice.O, int number = 0, int tripleId = 0)
 {
     Dice     = cardDice;
     Class    = cardClass;
     Number   = number;
     TripleId = tripleId;
 }
예제 #3
0
    public static int ToInt(this CardDice cardDice)
    {
        switch (cardDice)
        {
        case CardDice.I:
            return(1);

        case CardDice.II:
            return(2);

        case CardDice.III:
            return(3);

        case CardDice.IV:
            return(4);

        case CardDice.V:
            return(5);

        case CardDice.VI:
            return(6);

        default:
            throw new System.InvalidProgramException("Cannot convert this enum " + cardDice + " to integer!");
        }
    }
예제 #4
0
    public static int HowManyWorkersNeeded(CardDice actionDice, CardDice targetDice)
    {
        if (actionDice == CardDice.All)
        {
            return(0);
        }

        switch (Mathf.Abs(actionDice.ToInt() - targetDice.ToInt()))
        {
        case 0:
            return(0);

        case 1:
        case 5:
            return(1);

        case 2:
        case 4:
            return(2);

        case 3:
            return(3);

        default:
            throw new System.InvalidProgramException("Illegal value in difference between two dices!");
        }
    }
예제 #5
0
    public static Card ParseToCard(this string card)
    {
        CardClass cardClass  = (CardClass)int.Parse(card.Split(CardSeparator)[0]);
        CardDice  cardDice   = (CardDice)int.Parse(card.Split(CardSeparator)[1]);
        int       cardNumber = int.Parse(card.Split(CardSeparator)[2]);
        int       tripleId   = int.Parse(card.Split(CardSeparator)[3]);

        return(new Card(cardClass, cardDice, cardNumber, tripleId));
    }
예제 #6
0
    public static Card RandomCard(int classNo = -1)
    {
        System.Random random = new System.Random();
        CardClass     cc;

        if (classNo == -1)
        {
            cc = (CardClass)random.Next((int)CardClass.ActionCityHall);
        }
        else
        {
            cc = (CardClass)classNo;
        }

        CardDice cd = (CardDice)random.Next(10);

        return(new Card(cc, cd));
    }
예제 #7
0
 public ProjectCard(Card card, CardDice cardDice)
 {
     Card            = card;
     TakeProjectDice = cardDice;
 }
예제 #8
0
    public static int HowManyWorkersNeededToShip(CardDice dice, CardDice ship)
    {
        if (dice == CardDice.All)
        {
            return(0);
        }

        switch (ship)
        {
        case CardDice.I_II:

            if (dice == CardDice.I)
            {
                return(0);
            }
            if (dice == CardDice.II)
            {
                return(0);
            }
            if (dice == CardDice.III)
            {
                return(1);
            }
            if (dice == CardDice.IV)
            {
                return(2);
            }
            if (dice == CardDice.V)
            {
                return(2);
            }
            if (dice == CardDice.VI)
            {
                return(1);
            }

            break;

        case CardDice.III_IV:

            if (dice == CardDice.I)
            {
                return(2);
            }
            if (dice == CardDice.II)
            {
                return(1);
            }
            if (dice == CardDice.III)
            {
                return(0);
            }
            if (dice == CardDice.IV)
            {
                return(0);
            }
            if (dice == CardDice.V)
            {
                return(1);
            }
            if (dice == CardDice.VI)
            {
                return(2);
            }

            break;

        case CardDice.V_VI:

            if (dice == CardDice.I)
            {
                return(1);
            }
            if (dice == CardDice.II)
            {
                return(2);
            }
            if (dice == CardDice.III)
            {
                return(2);
            }
            if (dice == CardDice.IV)
            {
                return(1);
            }
            if (dice == CardDice.V)
            {
                return(0);
            }
            if (dice == CardDice.VI)
            {
                return(0);
            }

            break;
        }

        throw new System.InvalidProgramException("Card type shipment can with illegal dice! " + ship);
    }