示例#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));
 }
示例#2
0
文件: SCards.cs 项目: P1nkL1on/Gwent3
        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);
        }
示例#3
0
文件: SPlay.cs 项目: P1nkL1on/Gwent3
        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);
        }
示例#4
0
文件: SCard.cs 项目: P1nkL1on/Gwent3
        public void trigger(STType triggerType, SCard source = null, int param = 0)
        {
            if (containsTrigger(triggerType))
            {
                _triggers[triggerType](this, source, param);
            }

            // then show it to someone
            // or hide from someone
            viewAction(triggerType, source, param);
            // if a trigger from range 20..100
            // then its a trigger, what will trigger
            // other cards with %OtherTrigger% case
            int triggerNum = (int)triggerType;

            if (triggerNum < 20 || triggerNum > 100)
            {
                return;
            }
            foreach (SCard otherCard in _game.cards.select(SFilter.inGame(), SFilter.otherThen(this)).cards)
            {
                otherCard.trigger((STType)(triggerNum + 100), this);
            }
        }
示例#5
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));
        }
示例#6
0
文件: SPlay.cs 项目: P1nkL1on/Gwent3
 SCards deck(int player)
 {
     return(_cards.select(SFilter.hostBy(player), SFilter.located(SPlace.deck)));
 }
示例#7
0
文件: SPlay.cs 项目: P1nkL1on/Gwent3
 SCards shuffleDeck(int player)
 {
     return(_cards.shuffle(_random, SFilter.hostBy(player), SFilter.located(SPlace.deck)));
 }
示例#8
0
文件: SPlay.cs 项目: P1nkL1on/Gwent3
 // 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);
 }
示例#9
0
文件: SCard.cs 项目: P1nkL1on/Gwent3
 SLocationView _locationView()
 {
     return(new SLocationView(_location, game.cards.select(SFilter.located(_location.place), SFilter.hostBy(_player)).indexOf(this), _player));
 }
示例#10
0
文件: SCards.cs 项目: P1nkL1on/Gwent3
        public SCards targetOneCard(SCard source, string requestString)
        {
            SRequestSelectOneCard request = new SRequestSelectOneCard(requestString, this, source);

            return(select(SFilter.hasId(source.game.players.solve(request, source.game.logger).value)));
        }