Exemple #1
0
 SCards dealDamageEnemy(int X)
 {
     return(this._game.cards
            .select(SFilter.located(SPlace.board), SFilter.enemy(this))
            .targetOneCard(this, String.Format("Deal {0} damage to enemy unit", X))
            .damage(X, this));
 }
Exemple #2
0
        public override string ToString()
        {
            string        res        = "";
            int           placeCount = 8;
            List <string> reses      = new List <string>(placeCount);

            for (int i = 0; i < placeCount; ++i)
            {
                reses.Add("");
                select(SFilter.located((SPlace)i)).foreachCard((c) => { reses[i] += (reses[i].Length == 0 ? "" : ", ") + c.id; });
                if (reses[i].Length > 0)
                {
                    res += String.Format("{1}=<{0}> ", reses[i], ((SPlace)i).ToString());
                }
            }
            return(res);
        }
Exemple #3
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);
        }
Exemple #4
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));
        }
Exemple #5
0
 SCards deck(int player)
 {
     return(_cards.select(SFilter.hostBy(player), SFilter.located(SPlace.deck)));
 }
Exemple #6
0
 SCards shuffleDeck(int player)
 {
     return(_cards.shuffle(_random, SFilter.hostBy(player), SFilter.located(SPlace.deck)));
 }
Exemple #7
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);
 }
Exemple #8
0
 SLocationView _locationView()
 {
     return(new SLocationView(_location, game.cards.select(SFilter.located(_location.place), SFilter.hostBy(_player)).indexOf(this), _player));
 }