public void Process(GameField game, Player caster, Player opponent, PokemonCard pokemonSource)
        {
            if (!CoinFlipConditional.IsOk(game, caster))
            {
                return;
            }

            var target = Targeting.AskForTargetFromTargetingMode(TargetingMode.YourBench, game, caster, opponent, pokemonSource);

            if (target == null)
            {
                return;
            }

            var filter = new EvolvesFromPokemonFilter()
            {
                Name = target.Name
            };

            var response = DeckSearchUtil.SearchDeck(game, caster, new List <IDeckFilter> {
                filter
            }, 1);

            if (response.Count == 0)
            {
                return;
            }

            game.EvolvePokemon(target, (PokemonCard)response[0], true);
            caster.Deck.Cards = new Stack <Card>(caster.Deck.Cards.Except(response).ToList());
            caster.Deck.Shuffle();
        }
Example #2
0
        public void Process(GameField game, Player caster, Player opponent, PokemonCard pokemonSource)
        {
            if (caster.BenchedPokemon.Count == GameField.BenchMaxSize && opponent.BenchedPokemon.Count == GameField.BenchMaxSize)
            {
                caster.DrawCards(2);
                return;
            }

            var message = new YesNoMessage()
            {
                Message = "Do you accept the challenge?"
            }.ToNetworkMessage(caster.Id);

            if (!opponent.NetworkPlayer.SendAndWaitForResponse <YesNoMessage>(message).AnsweredYes)
            {
                caster.DrawCards(2);
                return;
            }

            var casterResponse   = DeckSearchUtil.SearchDeck(game, caster, CardUtil.GetCardFilters(CardType.BasicPokemon), GameField.BenchMaxSize - caster.BenchedPokemon.Count);
            var opponentResponse = DeckSearchUtil.SearchDeck(game, opponent, CardUtil.GetCardFilters(CardType.BasicPokemon), GameField.BenchMaxSize - opponent.BenchedPokemon.Count);

            foreach (var pokemon in casterResponse.OfType <PokemonCard>())
            {
                caster.BenchedPokemon.Add(pokemon);
            }

            foreach (var pokemon in opponentResponse.OfType <PokemonCard>())
            {
                opponent.BenchedPokemon.Add(pokemon);
            }

            caster.Deck.Shuffle();
            opponent.Deck.Shuffle();
        }
Example #3
0
        public void Process(GameField game, Player caster, Player opponent, PokemonCard pokemonSource)
        {
            if (!CoinflipConditional.IsOk(game, caster))
            {
                return;
            }

            foreach (PokemonCard card in DeckSearchUtil.SearchDeck(game, caster, new List <IDeckFilter> {
                new PokemonWithNameOrTypeFilter(Names, EnergyType)
                {
                    OnlyBasic = addToBench, InvertName = InvertNameSearch
                }
            }, Amount))
            {
                caster.Deck.Cards = new Stack <Card>(caster.Deck.Cards.Except(new[] { card }));

                if (revealCard)
                {
                    card.RevealToAll();
                }

                if (evolveSource)
                {
                    game.EvolvePokemon(pokemonSource, card, true);
                }
                else if (addToBench)
                {
                    caster.BenchedPokemon.Add(card);
                    game.SendEventToPlayers(new PokemonAddedToBenchEvent()
                    {
                        Player = caster.Id, Pokemon = card, Index = caster.BenchedPokemon.Count - 1
                    });
                }
                else
                {
                    caster.Hand.Add(card);
                    game.SendEventToPlayers(new DrawCardsEvent()
                    {
                        Player = caster.Id, Cards = new List <Card>()
                        {
                            card
                        }
                    });
                }
            }
        }
        public void Process(GameField game, Player caster, Player opponent, PokemonCard pokemonSource)
        {
            foreach (var card in DeckSearchUtil.SearchDeck(game, caster, new List <IDeckFilter> {
                new EvolutionPokemonFilter()
            }, Amount))
            {
                if (revealCard)
                {
                    card.RevealToAll();
                }

                caster.DrawCardsFromDeck(new List <Card> {
                    card
                });
            }

            caster.Deck.Shuffle();
        }
        public void Process(GameField game, Player caster, Player opponent, PokemonCard pokemonSource)
        {
            if (!CoinFlipConditional.IsOk(game, caster))
            {
                return;
            }

            var filter = new ExactCardFilter()
            {
                Name = CardName, Invert = Inverted
            };

            foreach (var card in DeckSearchUtil.SearchDeck(game, caster, new List <IDeckFilter> {
                filter
            }, 1))
            {
                card.RevealToAll();
                caster.DrawCardsFromDeck(new List <NetworkId> {
                    card.Id
                });
            }
        }
Example #6
0
        public void Process(GameField game, Player caster, Player opponent, PokemonCard pokemonSource)
        {
            if (!CoinFlipConditional.IsOk(game, caster))
            {
                return;
            }

            var filter = CardUtil.GetCardFilters(CardType, EnergyType).ToList();
            int amount = useLastDiscardCount ? game.LastDiscard : Amount;

            foreach (var card in DeckSearchUtil.SearchDeck(game, caster, filter, amount))
            {
                if (revealCard)
                {
                    card.RevealToAll();
                }

                switch (result)
                {
                case SearchDeckResult.PutInHand:
                    caster.DrawCardsFromDeck(new List <Card> {
                        card
                    });
                    break;

                case SearchDeckResult.PutInDiscard:
                {
                    caster.Deck.Cards.Except(new[] { card });
                    caster.DiscardPile.Add(card);
                    caster.TriggerDiscardEvent(new List <Card>()
                        {
                            card
                        });
                }
                break;

                case SearchDeckResult.PutOnBench:
                {
                    caster.Deck.Cards.Except(new[] { card });
                    int benchIndex = caster.BenchedPokemon.GetNextFreeIndex();
                    caster.BenchedPokemon.Add((PokemonCard)card);
                    game.SendEventToPlayers(new PokemonAddedToBenchEvent()
                        {
                            Player  = caster.Id,
                            Pokemon = (PokemonCard)card,
                            Index   = benchIndex
                        });
                }
                break;

                case SearchDeckResult.AttachToTarget:
                {
                    caster.Deck.Cards.Except(new[] { card });
                    var target = Targeting.AskForTargetFromTargetingMode(TargetingMode, game, caster, opponent, pokemonSource);
                    target.AttachEnergy((EnergyCard)card, game);
                }
                break;

                default:
                    break;
                }
            }

            caster.Deck.Shuffle();
        }