Exemplo n.º 1
0
        public void SelectOpponentPokemonMessage()
        {
            var message = new SelectOpponentPokemonMessage(3);

            Assert.NotNull(SerializeAndBack(message));
        }
Exemplo n.º 2
0
        public static PokemonCard AskForTargetFromTargetingMode(TargetingMode targetingMode, GameField game, Player caster, Player opponent, PokemonCard pokemonOwner, string info = "", string nameFilter = "")
        {
            PokemonCard    target;
            NetworkMessage message;
            NetworkId      selectedId;
            IDeckFilter    filter = !string.IsNullOrEmpty(nameFilter) ? new PokemonWithNameOrTypeFilter(nameFilter, EnergyTypes.All) : null;

            switch (targetingMode)
            {
            case TargetingMode.Self:
                target = pokemonOwner;
                break;

            case TargetingMode.YourActive:
                target = caster.ActivePokemonCard;
                break;

            case TargetingMode.YourBench:
                if (caster.BenchedPokemon.Count == 0)
                {
                    return(null);
                }
                else if (caster.BenchedPokemon.Count == 1)
                {
                    return(caster.BenchedPokemon.GetFirst());
                }
                message = new SelectFromYourBenchMessage(1)
                {
                    Info = info, Filter = filter
                }.ToNetworkMessage(game.Id);
                selectedId = caster.NetworkPlayer.SendAndWaitForResponse <CardListMessage>(message).Cards.First();
                target     = (PokemonCard)game.Cards[selectedId];
                break;

            case TargetingMode.YourPokemon:
                message = new SelectFromYourPokemonMessage()
                {
                    Info = info, Filter = filter
                }.ToNetworkMessage(game.Id);
                selectedId = caster.NetworkPlayer.SendAndWaitForResponse <CardListMessage>(message).Cards.First();
                target     = (PokemonCard)game.Cards[selectedId];
                break;

            case TargetingMode.OpponentActive:
                target = opponent.ActivePokemonCard;
                break;

            case TargetingMode.OpponentBench:
                if (opponent.BenchedPokemon.Count == 0)
                {
                    return(null);
                }
                else if (opponent.BenchedPokemon.Count == 1)
                {
                    return(opponent.BenchedPokemon.GetFirst());
                }

                message = new SelectFromOpponentBenchMessage(1)
                {
                    Info = info, Filter = filter
                }.ToNetworkMessage(game.Id);
                selectedId = caster.NetworkPlayer.SendAndWaitForResponse <CardListMessage>(message).Cards.First();
                target     = (PokemonCard)game.Cards[selectedId];
                break;

            case TargetingMode.OpponentPokemon:
                message = new SelectOpponentPokemonMessage(1)
                {
                    Info = info, Filter = filter
                }.ToNetworkMessage(game.Id);
                selectedId = caster.NetworkPlayer.SendAndWaitForResponse <CardListMessage>(message).Cards.First();
                target     = (PokemonCard)game.Cards[selectedId];
                break;

            case TargetingMode.LastEffectTarget:
                target = game.LastTarget;
                break;

            case TargetingMode.AnyPokemon:
                throw new NotImplementedException("TargetingMode.AnyPokemon not implemented in Targeting");

            default:
                target = caster.ActivePokemonCard;
                break;
            }

            if (game != null)
            {
                game.LastTarget = target;
            }

            return(target);
        }
 public SelectingOpponentsPokemonHandler(SelectOpponentPokemonMessage message)
 {
     selectedCards = new List <CardRenderer>();
 }