Beispiel #1
0
        private static void ShuffleCardsIntoDeck(PokemonCard target, GameField game)
        {
            foreach (var card in target.AttachedEnergy)
            {
                target.Owner.Deck.Cards.Push(card);
            }
            target.AttachedEnergy.Clear();

            var evolution = target;

            while (evolution.EvolvedFrom != null)
            {
                evolution.EvolvedFrom.DamageCounters = 0;
                evolution.EvolvedFrom.ClearStatusEffects();

                target.Owner.Deck.Cards.Push(evolution.EvolvedFrom);

                evolution             = evolution.EvolvedFrom;
                evolution.EvolvedFrom = null;
            }

            target.DamageCounters = 0;
            target.ClearStatusEffects();
            target.Owner.Deck.Cards.Push(target);
            target.Owner.Deck.Shuffle();

            if (target == target.Owner.ActivePokemonCard)
            {
                target.Owner.ActivePokemonCard = null;
                game?.SendEventToPlayers(new PokemonBouncedEvent()
                {
                    PokemonId = target.Id
                });
                target.Owner.SelectActiveFromBench(game);
            }
            else
            {
                game?.SendEventToPlayers(new PokemonBouncedEvent()
                {
                    PokemonId = target.Id
                });
                target.Owner.BenchedPokemon.Remove(target);
                game?.SendEventToPlayers(new PokemonRemovedFromBench {
                    PokemonId = target.Id
                });
            }
        }
Beispiel #2
0
        private void DiscardOrBounceBasic(PokemonCard target, bool shuffleIntoDeck, PokemonCard pokemon, GameField game)
        {
            pokemon.EvolvedFrom    = null;
            pokemon.DamageCounters = 0;
            pokemon.ClearStatusEffects();
            target.Owner.BenchedPokemon.Remove(pokemon);

            if (pokemon.Stage > 0)
            {
                if (shuffleIntoDeck)
                {
                    target.Owner.Deck.ShuffleInCard(pokemon);
                }
                else
                {
                    target.Owner.DiscardPile.Add(pokemon);
                }
                game.SendEventToPlayers(new CardsDiscardedEvent {
                    Player = target.Owner.Id, Cards = new List <Card> {
                        pokemon
                    }
                });
            }
            else if (shuffleIntoDeck)
            {
                target.Owner.Deck.ShuffleInCard(pokemon);
                game.SendEventToPlayers(new DrawCardsEvent {
                    Player = target.Owner.Id, Cards = new List <Card> {
                        pokemon
                    }
                });
            }
            else
            {
                target.Owner.Hand.Add(pokemon);
                game.SendEventToPlayers(new DrawCardsEvent {
                    Player = target.Owner.Id, Cards = new List <Card> {
                        pokemon
                    }
                });
            }
        }
Beispiel #3
0
        private void KillPokemon(PokemonCard pokemon)
        {
            DiscardPile.AddRange(pokemon.AttachedEnergy);
            pokemon.AttachedEnergy.Clear();

            if (pokemon.EvolvedFrom != null)
            {
                DiscardPile.Add(pokemon.EvolvedFrom);

                if (pokemon.EvolvedFrom.EvolvedFrom != null)
                {
                    DiscardPile.Add(pokemon.EvolvedFrom.EvolvedFrom);
                    pokemon.EvolvedFrom.EvolvedFrom = null;
                }

                pokemon.EvolvedFrom = null;
            }

            DiscardPile.Add(pokemon);

            pokemon.DamageCounters = 0;
            pokemon.ClearStatusEffects();
        }
Beispiel #4
0
        private void ReturnCardsToHand(PokemonCard target, GameField game)
        {
            var cardsDiscarded = new List <Card>();
            var cardsDrawn     = new List <Card>();

            foreach (var card in target.AttachedEnergy)
            {
                if (ReturnAttachedToHand)
                {
                    target.Owner.Hand.Add(card);
                    cardsDrawn.Add(card);
                }
                else
                {
                    target.Owner.DiscardPile.Add(card);
                    cardsDiscarded.Add(card);
                }
            }
            target.AttachedEnergy.Clear();

            var evolution2 = target;

            while (evolution2.EvolvedFrom != null)
            {
                evolution2.EvolvedFrom.DamageCounters = 0;
                evolution2.EvolvedFrom.ClearStatusEffects();

                if (ReturnAttachedToHand)
                {
                    target.Owner.Hand.Add(evolution2.EvolvedFrom);
                    cardsDrawn.Add(evolution2.EvolvedFrom);
                }
                else
                {
                    target.Owner.DiscardPile.Add(evolution2.EvolvedFrom);
                    cardsDiscarded.Add(evolution2.EvolvedFrom);
                }

                evolution2             = evolution2.EvolvedFrom;
                evolution2.EvolvedFrom = null;
            }

            target.DamageCounters = 0;
            target.ClearStatusEffects();
            target.Owner.Hand.Add(target);
            cardsDrawn.Add(target);

            game?.SendEventToPlayers(new CardsDiscardedEvent()
            {
                Player = target.Owner.Id, Cards = new List <Card>(cardsDrawn)
            });

            if (target == target.Owner.ActivePokemonCard)
            {
                target.Owner.ActivePokemonCard = null;
                game?.SendEventToPlayers(new PokemonBouncedEvent()
                {
                    PokemonId = target.Id, ToHand = true
                });
                target.Owner.SelectActiveFromBench(game);
            }
            else
            {
                target.Owner.BenchedPokemon.Remove(target);
                game?.SendEventToPlayers(new PokemonBouncedEvent()
                {
                    PokemonId = target.Id, ToHand = true
                });
            }

            game?.SendEventToPlayers(new DrawCardsEvent()
            {
                Player = target.Owner.Id, Cards = new List <Card>(cardsDrawn)
            });
        }