Exemplo n.º 1
0
        /// <summary>
        /// Trash the card from the field.
        /// </summary>
        /// <param name="fieldIndex">Field index.</param>
        /// <param name="cardStr">Card string.</param>
        /// <returns>Trashed card instance.</returns>
        public Card Trash(int fieldIndex, string cardStr)
        {
            GameStatus.Status nextStatus = status.Act(GameStatus.Action.Trash);
            if (GameStatus.Status.Error == nextStatus)
            {
                throw GameException.getAlreadyTrashedException();
            }
            if (fieldIndex >= FIELD_NUM || fieldIndex < 0)
            {
                throw GameException.getFieldIndexException();
            }

            CardDeck deck = this.fields[fieldIndex].CardList[this.turn];

            if (this.fields[fieldIndex].IsFixed || deck.Last().Name != cardStr)
            {
                throw GameException.getCardAlreadyFixedException();
            }


            Card card = deck.Move(cardStr, this.talon.Trash);

            this.lastTrashed      = card;
            this.lastTrashedField = this.fields[fieldIndex];

            status.Current = card.HasSpecial ? nextStatus : GameStatus.Status.Trashed;
            return(card);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Fire the special effect of the card.
        /// </summary>
        /// <param name="opt">Special effect option.</param>
        public void Special(params string[] opt)
        {
            GameStatus.Status nextStatus = status.Act(GameStatus.Action.Special);
            if (GameStatus.Status.Error == nextStatus)
            {
                throw GameException.getAlreadyTrashedException();
            }
            bool ret = this.lastTrashed.Special(this, opt);

            if (ret)
            {
                status.Current = nextStatus;
            }
        }