Ejemplo n.º 1
0
        public bool CanCast(GameField game, Player caster, Player opponent)
        {
            var availableChoices = CardUtil.GetCardsOfType(caster.Hand, CardType);

            if (amount == -1 && availableChoices.Count > 0)
            {
                return(true);
            }

            if (AllowDiscardLess)
            {
                return(true);
            }

            return(availableChoices.Count >= amount);
        }
Ejemplo n.º 2
0
        public void Process(GameField game, Player caster, Player opponent, PokemonCard pokemonSource)
        {
            var target = opponents ? opponent : caster;

            if (amount == -1)
            {
                game.SendEventToPlayers(new CardsDiscardedEvent()
                {
                    Cards  = new List <Card>(target.Hand),
                    Player = target.Id
                });

                var cards = CardUtil.GetCardsOfType(target.Hand, CardType).ToList();
                target.Deck.ShuffleInCards(cards);

                foreach (var card in cards)
                {
                    target.Hand.Remove(card);
                }

                game.SendEventToPlayers(new CardsDiscardedEvent()
                {
                    Cards  = new List <Card>(cards),
                    Player = target.Id
                });
            }
            else
            {
                var message = new DiscardCardsMessage(Amount, CardUtil.GetCardFilters(CardType));
                var choices = target.NetworkPlayer.SendAndWaitForResponse <CardListMessage>(message.ToNetworkMessage(game.Id)).Cards;

                var cards = choices.Select(id => game.Cards[id]).ToList();

                foreach (var card in cards)
                {
                    target.Hand.Remove(card);
                }

                target.Deck.ShuffleInCards(cards);

                game.SendEventToPlayers(new CardsDiscardedEvent()
                {
                    Cards  = new List <Card>(cards),
                    Player = target.Id
                });
            }
        }
Ejemplo n.º 3
0
        public void Process(GameField game, Player caster, Player opponent, PokemonCard pokemonSource)
        {
            int amount = FlipCoinsForAmount != -1 ? game.FlipCoins(FlipCoinsForAmount) : Amount;

            if (amount == 0)
            {
                return;
            }

            List <Card> choices = CardUtil.GetCardsOfType(caster.DiscardPile, CardType, EnergyType);

            var message  = new PickFromListMessage(choices, 0, amount).ToNetworkMessage(game.Id);
            var response = caster.NetworkPlayer.SendAndWaitForResponse <CardListMessage>(message).Cards;
            var cards    = new List <Card>();

            foreach (var id in response)
            {
                var card = game.Cards[id];
                caster.DiscardPile.Remove(card);

                if (shuffleIntoDeck)
                {
                    cards.Add(card);
                    caster.Deck.Cards.Push(card);
                }
                else
                {
                    caster.Hand.Add(card);
                    game.SendEventToPlayers(new DrawCardsEvent()
                    {
                        Player = caster.Id, Cards = new List <Card>()
                        {
                            card
                        }
                    });
                }
            }

            if (shuffleIntoDeck)
            {
                opponent.RevealCards(cards);
                caster.Deck.Shuffle();
            }
        }
Ejemplo n.º 4
0
        public void Process(GameField game, Player caster, Player opponent, PokemonCard pokemonSource)
        {
            if (CoinFlip && game.FlipCoins(1) == 0)
            {
                return;
            }

            var target = TargetsOpponent ? opponent : caster;

            List <Card> choices = CardUtil.GetCardsOfType(target.DiscardPile, CardType);

            var message  = new PickFromListMessage(choices, Amount).ToNetworkMessage(game.Id);
            var response = caster.NetworkPlayer.SendAndWaitForResponse <CardListMessage>(message).Cards;

            foreach (var id in response)
            {
                var card = game.Cards[id];
                target.Deck.Cards.Push(card);
                target.DiscardPile.Remove(card);
            }
        }
Ejemplo n.º 5
0
 public bool CanCast(GameField game, Player caster, Player opponent)
 {
     return(CardUtil.GetCardsOfType(caster.DiscardPile, CardType).Any());
 }