Exemplo n.º 1
0
        void mulliganCard(SCard card)
        {
            // currently solving for Mulligan-problem
            // if you swap a card you will always
            // draw from deck the first card
            // with a different name
            // (if all deck has only theese names)
            // then drop it
            bool allSameName = _cards
                               .select(SFilter.hostBy(card.host), SFilter.located(SPlace.deck))
                               .isAll(SFilter.withName(card.name));
            var deck = _cards.select(SFilter.hostBy(card.host), SFilter.located(SPlace.deck));

            // then select first or first
            // with different name
            // and move it yto your hand
            (allSameName ? deck.first() : deck.first(1, SFilter.mulliganName(card.name)))
            .move(SPlace.hand);
        }
Exemplo n.º 2
0
        // if card is shown before
        // then it has format X, where X - is its id
        // otherwise
        // card has format <cY>, where Y - index in its
        // current place
        string cardView(SCard card, int p)
        {
            //return isVisible(card, p) || card.host == p ?
            //    String.Format("[id={0}]", card.id.ToString())
            //  : String.Format("[c{0}]", card.game.cards.select(SFilter.located(card.location.place), SFilter.hostBy(card.host)).indexOf(card));
            string place = String.Format("{0}st card in p{1}'s {2}", card.game.cards.select(SFilter.located(card.location.place), SFilter.hostBy(card.host)).indexOf(card), card.host, card.location);
            string id    = isVisible(card, p)? String.Format("id={0} ", card.id) : "";

            return(String.Format("{0}{1}", id, place));
        }
Exemplo n.º 3
0
 SCards deck(int player)
 {
     return(_cards.select(SFilter.hostBy(player), SFilter.located(SPlace.deck)));
 }
Exemplo n.º 4
0
 SCards shuffleDeck(int player)
 {
     return(_cards.shuffle(_random, SFilter.hostBy(player), SFilter.located(SPlace.deck)));
 }
Exemplo n.º 5
0
 // shuffle a card from somewhere to a deck
 // puts it to deck
 // then put it to random position in deck
 public SCard shuffleCard(SCard card)
 {
     card.maybe.move(SPlace.deck);
     _cards.putRandom(_random, card, SFilter.hostBy(card.host), SFilter.located(SPlace.deck));
     return(card);
 }
Exemplo n.º 6
0
 SLocationView _locationView()
 {
     return(new SLocationView(_location, game.cards.select(SFilter.located(_location.place), SFilter.hostBy(_player)).indexOf(this), _player));
 }