Пример #1
0
        protected void PerformBounce(GameField game, Player caster, Player opponent)
        {
            var target = Targeting.AskForTargetFromTargetingMode(TargetingMode, game, caster, opponent, caster.ActivePokemonCard);

            if (target == null)
            {
                return;
            }

            if (target.IsDead() && !AllowBounceDead)
            {
                return;
            }

            var preventer = target.TemporaryAbilities.OfType <EffectPreventer>().FirstOrDefault();

            if (preventer != null)
            {
                game.GameLog.AddMessage($"Bounce effect prevented by {preventer.Name}");
                return;
            }

            if (onlyBasic)
            {
                ReturnOnlyBasic(target, shuffleIntoDeck, game);
            }
            else if (shuffleIntoDeck)
            {
                ShuffleCardsIntoDeck(target, game);
            }
            else
            {
                ReturnCardsToHand(target, game);
            }
        }
        public void Process(GameField game, Player caster, Player opponent, PokemonCard pokemonSource)
        {
            if (!CoinFlipConditional.IsOk(game, caster))
            {
                return;
            }

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

            if (target.Hp > onlyIfLessThanThisHp)
            {
                return;
            }

            var ability = new AttackStoppingAbility()
            {
                TurnDuration       = Duration,
                IsBuff             = true,
                OnlyStopThisAttack = OnlyThisAttack
            };

            if (OnlyStopAttacksOnSelf)
            {
                ability.OnlyOnCard = pokemonSource.Id;
            }

            target.TemporaryAbilities.Add(ability);
        }
Пример #3
0
        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();
        }
Пример #4
0
        public void Process(GameField game, Player caster, Player opponent, PokemonCard pokemonSource)
        {
            if (MayAbility && !game.AskYesNo(caster, "Discard attached energy?"))
            {
                return;
            }

            if (!CoinflipConditional.IsOk(game, caster))
            {
                return;
            }

            if (Targeting.GetPossibleTargetsFromMode(TargetingMode, game, caster, opponent, caster.ActivePokemonCard, OnlyWithNameLike).All(x => x.AttachedEnergy.Count == 0))
            {
                return;
            }

            int cardsDiscarded = 0;

            while (true)
            {
                PokemonCard target = Targeting.AskForTargetFromTargetingMode(TargetingMode, game, caster, opponent, caster.ActivePokemonCard, string.Empty, OnlyWithNameLike);

                if (target.AttachedEnergy.Count == 0)
                {
                    continue;
                }

                if (Amount == -1 || target.AttachedEnergy.Count <= Amount)
                {
                    while (target.AttachedEnergy.Count > 0)
                    {
                        target.DiscardEnergyCard(target.AttachedEnergy[0], game);
                        cardsDiscarded++;
                    }

                    target.AttachedEnergy.Clear();
                }
                else
                {
                    var message = new PickFromListMessage(target.AttachedEnergy.OfType <Card>().ToList(), Amount);
                    var ids     = caster.NetworkPlayer.SendAndWaitForResponse <CardListMessage>(message.ToNetworkMessage(game.Id)).Cards;

                    var cards = target.AttachedEnergy.Where(x => ids.Contains(x.Id)).ToList();

                    foreach (var card in cards)
                    {
                        target.DiscardEnergyCard(card, game);
                        cardsDiscarded++;
                    }
                }

                break;
            }

            if (targetingMode == TargetingMode.Self || targetingMode == TargetingMode.YourActive || targetingMode == TargetingMode.YourBench || targetingMode == TargetingMode.YourPokemon)
            {
                game.LastDiscard = cardsDiscarded;
            }
        }
Пример #5
0
        protected override void Activate(Player owner, Player opponent, int damageTaken, GameField game)
        {
            while (true)
            {
                var source = Targeting.AskForTargetFromTargetingMode(SourceTargetingMode, game, owner, opponent, PokemonOwner, "Select target to move damage from");

                if (source == null)
                {
                    return;
                }

                if (source.DamageCounters < Amount)
                {
                    continue;
                }

                var target = Targeting.AskForTargetFromTargetingMode(TargetingMode, game, owner, opponent, PokemonOwner, "Select target to move damage to");

                if (target == null)
                {
                    return;
                }

                if (!allowKnockout && target.DamageCounters + Amount >= target.Hp)
                {
                    continue;
                }

                source.Heal(Amount, game);
                target.DealDamage(Amount, game, null, false);
                break;
            }
        }
        public void Process(GameField game, Player caster, Player opponent, PokemonCard pokemonSource)
        {
            if (CoinflipConditional.IsOk(game, caster))
            {
                return;
            }

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

            target.TemporaryAbilities.Add(new DamageTakenModifier(target)
            {
                Modifer = 999999,
                IsBuff  = true
            });
            target.TemporaryAbilities.Add(new PreventStatusEffects(target)
            {
                IsBuff          = true,
                PreventBurn     = true,
                PreventConfuse  = true,
                PreventParalyze = true,
                PreventPoison   = true,
                PreventSleep    = true,
                TurnDuration    = TurnDuration
            });
            target.TemporaryAbilities.Add(new EffectPreventer()
            {
                TurnDuration = TurnDuration
            });
        }
Пример #7
0
        public void Process(GameField game, Player caster, Player opponent, PokemonCard pokemonSource)
        {
            var first  = Targeting.AskForTargetFromTargetingMode(FirstTarget, game, caster, opponent, pokemonSource);
            var second = Targeting.AskForTargetFromTargetingMode(SecondTarget, game, caster, opponent, pokemonSource);

            if (first == null || second == null)
            {
                return;
            }

            int firstDamage  = first.DamageCounters;
            int secondDamage = second.DamageCounters;

            first.DamageCounters  = secondDamage;
            second.DamageCounters = firstDamage;

            game.SendEventToPlayers(new DamageTakenEvent()
            {
                Damage     = firstDamage,
                PokemonId  = second.Id,
                DamageType = pokemonSource.Type
            });

            game.SendEventToPlayers(new DamageTakenEvent()
            {
                Damage     = secondDamage,
                PokemonId  = first.Id,
                DamageType = pokemonSource.Type
            });
        }
Пример #8
0
        public void Process(GameField game, Player caster, Player opponent, PokemonCard pokemonSource)
        {
            var choices = caster.DiscardPile.OfType <EnergyCard>().Where(x => EnergyType == EnergyTypes.All || x.EnergyType == EnergyType).ToList();

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

            var response = caster.NetworkPlayer.SendAndWaitForResponse <CardListMessage>(new PickFromListMessage(choices.OfType <Card>().ToList(), Amount).ToNetworkMessage(game.Id));
            var cards    = response.Cards.Select(id => game.Cards[id]);

            if (individualTargets)
            {
                foreach (EnergyCard card in cards)
                {
                    var target = Targeting.AskForTargetFromTargetingMode(TargetingMode, game, caster, opponent, pokemonSource, $"Select Pokémon to attach {card.Name} to");
                    target.AttachEnergy(card, game);
                }
            }
            else
            {
                var target = Targeting.AskForTargetFromTargetingMode(TargetingMode, game, caster, opponent, pokemonSource, "Select Pokémon to attach energy to");

                foreach (var card in cards)
                {
                    target.AttachEnergy((EnergyCard)card, game);
                }
            }
        }
Пример #9
0
        public void Process(GameField game, Player caster, Player opponent, PokemonCard pokemonSource)
        {
            var target = Targeting.AskForTargetFromTargetingMode(TargetingMode, game, caster, opponent, pokemonSource);
            int heads  = game.FlipCoins(Coins);

            target.Heal(heads * AmountPerCoin, game);
        }
        public void Process(GameField game, Player caster, Player opponent, PokemonCard pokemonSource)
        {
            var target = Targeting.AskForTargetFromTargetingMode(TargetingMode, game, caster, opponent, pokemonSource);

            if (game.FlipCoins(CoinsToFlip) >= HeadsForEffect)
            {
                target.ApplyStatusEffect(StatusEffect, game);
            }
        }
Пример #11
0
        protected override void Activate(Player owner, Player opponent, int damageTaken, GameField game)
        {
            if (CoinFlip && game.FlipCoins(1) == 0)
            {
                return;
            }

            var target = Targeting.AskForTargetFromTargetingMode(TargetingMode, game, owner, opponent, PokemonOwner);

            target?.Heal(Amount, game);
        }
Пример #12
0
        public override Damage GetDamage(Player owner, Player opponent, GameField game)
        {
            var target = Targeting.AskForTargetFromTargetingMode(TargetingMode, game, owner, opponent, owner.ActivePokemonCard);

            if (target.Type == TargetType)
            {
                return(Damage + ExtraDamage);
            }

            return(base.GetDamage(owner, opponent, game));
        }
Пример #13
0
        public void Process(GameField game, Player caster, Player opponent, PokemonCard pokemonSource)
        {
            if (CoinflipConditional.IsOk(game, caster))
            {
                return;
            }

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

            target.TemporaryAbilities.Add(new DisableEnergyAttachmentAbility(target));
        }
Пример #14
0
        public void Process(GameField game, Player caster, Player opponent, PokemonCard pokemonSource)
        {
            PokemonCard target = UseLastTarget ? game.LastTarget : Targeting.AskForTargetFromTargetingMode(TargetingMode, game, caster, opponent, caster.ActivePokemonCard);

            if (target == null)
            {
                return;
            }

            FullHealPokemon(target);
        }
Пример #15
0
        public void Process(GameField game, Player caster, Player opponent, PokemonCard pokemonSource)
        {
            var target = Targeting.AskForTargetFromTargetingMode(TargetMode, game, caster, opponent, pokemonSource);

            if (OnlyIfDead && !target.IsDead())
            {
                return;
            }

            target.DamageCounters = target.Hp - RemainingHp;
        }
Пример #16
0
        public void Process(GameField game, Player caster, Player opponent, PokemonCard pokemonSource)
        {
            if (!CoinflipConditional.IsOk(game, caster))
            {
                return;
            }

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

            ApplyEffectTo(target, StatusEffect, game);
            ApplyEffectTo(target, SecondaryEffect, game);
        }
Пример #17
0
        public void Process(GameField game, Player caster, Player opponent, PokemonCard pokemonSource)
        {
            string info = string.Empty;

            if (!string.IsNullOrEmpty(Name))
            {
                var owner = Targeting.IsYours(TargetingMode) ? "your" : "your opponents";
                info = $"Select 1 of {owner} Pokémon with {Name} in it's name";
            }

            game.LastTarget = Targeting.AskForTargetFromTargetingMode(TargetingMode, game, caster, opponent, pokemonSource, info, Name);
        }
Пример #18
0
        public void Process(GameField game, Player caster, Player opponent, PokemonCard pokemonSource)
        {
            if (CoinflipConditional.IsOk(game, caster))
            {
                return;
            }

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

            target?.TemporaryAbilities.Add(new RetreatStopper(target, Turns)
            {
                IsBuff = true
            });
        }
Пример #19
0
        public void Process(GameField game, Player caster, Player opponent, PokemonCard pokemonSource)
        {
            var target = Targeting.AskForTargetFromTargetingMode(TargetingMode, game, caster, opponent, pokemonSource, "Select Pokémon to move damage to");

            foreach (var pokemon in caster.GetAllPokemonCards())
            {
                if (pokemon.DamageCounters > 0)
                {
                    int damage = Math.Min(pokemon.DamageCounters, DamageToMove);
                    pokemon.Heal(damage, game);
                    target.DealDamage(damage, game, pokemon, false);
                }
            }
        }
Пример #20
0
        public void Process(GameField game, Player caster, Player opponent, PokemonCard pokemonSource)
        {
            var selector = OpponentPicks ? opponent : caster;
            var other    = OpponentPicks ? caster : opponent;

            if (!CoinflipConditional.IsOk(game, caster))
            {
                return;
            }

            PokemonCard target = Targeting.AskForTargetFromTargetingMode(TargetingMode, game, selector, other, selector.ActivePokemonCard);

            target?.Heal(Amount, game);
        }
Пример #21
0
        public override Damage GetDamage(Player owner, Player opponent, GameField game)
        {
            int coins = UseLastDiscardCount ? game.LastDiscard : Coins;

            int heads = game.FlipCoins(coins);

            if (ApplyStatusIfThisOrMoreHeads != -1 && heads >= ApplyStatusIfThisOrMoreHeads)
            {
                var target = Targeting.AskForTargetFromTargetingMode(TargetingMode, game, owner, opponent, owner.ActivePokemonCard);
                target?.ApplyStatusEffect(StatusEffect, game);
            }

            return(heads * Damage);
        }
Пример #22
0
        public void Process(GameField game, Player caster, Player opponent, PokemonCard pokemonSource)
        {
            var target = Targeting.AskForTargetFromTargetingMode(TargetingMode, game, caster, opponent, pokemonSource);

            var ability = Ability.Clone();

            ability.Source       = game.CurrentTrainerCard;
            ability.PokemonOwner = target;
            ability.IsBuff       = true;
            target.TemporaryAbilities.Add(ability);

            if (game.CurrentTrainerCard != null)
            {
                target.AttachedTools.Add(game.CurrentTrainerCard);
            }
        }
Пример #23
0
        public void Process(GameField game, Player caster, Player opponent, PokemonCard pokemonSource)
        {
            int damage = 0;

            foreach (var energy in caster.ActivePokemonCard.AttachedEnergy)
            {
                if (EnergyType == EnergyTypes.All || energy.EnergyType == EnergyType)
                {
                    damage += Amount;
                }
            }

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

            target.DealDamage(damage, game, pokemonSource, true);
        }
Пример #24
0
        public override Damage GetDamage(Player owner, Player opponent, GameField game)
        {
            var target = Targeting.AskForTargetFromTargetingMode(TargetingMode, game, owner, opponent, owner.ActivePokemonCard);

            int extra = 0;

            if (target.HaveStatus(StatusEffect))
            {
                extra = Extra;

                if (applySameStatus)
                {
                    opponent.ActivePokemonCard.ApplyStatusEffect(StatusEffect, game);
                }
            }

            return(Damage + extra);
        }
Пример #25
0
        public void Process(GameField game, Player caster, Player opponent, PokemonCard pokemonSource)
        {
            if (!CoinflipConditional.IsOk(game, caster))
            {
                return;
            }

            var target = Targeting.AskForTargetFromTargetingMode(TargetingMode, game, caster, opponent, pokemonSource);
            var heads  = game.FlipCoins(Coins);

            var damage = heads * Amount;

            if (applyWeaknessResistance)
            {
                damage = DamageCalculator.GetDamageAfterWeaknessAndResistance(damage, pokemonSource, target, null, null);
            }

            target.DealDamage(damage, game, pokemonSource, true);
        }
Пример #26
0
        public void Process(GameField game, Player caster, Player opponent, PokemonCard pokemonSource)
        {
            while (true)
            {
                PokemonCard target = Targeting.AskForTargetFromTargetingMode(TargetingMode, game, caster, opponent, caster.ActivePokemonCard);

                if (target == null)
                {
                    return;
                }

                if (target.AttachedEnergy.Count < amountToDiscard)
                {
                    continue;
                }

                if (target.AttachedEnergy.Count == AmountToDiscard)
                {
                    for (int i = 0; i < AmountToDiscard; i++)
                    {
                        target.DiscardEnergyCard(target.AttachedEnergy[0], game);
                    }
                    target.AttachedEnergy.Clear();
                }
                else
                {
                    var message  = new PickFromListMessage(target.AttachedEnergy.OfType <Card>().ToList(), AmountToDiscard).ToNetworkMessage(game.Id);
                    var response = caster.NetworkPlayer.SendAndWaitForResponse <CardListMessage>(message);

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

                        target.DiscardEnergyCard(card, game);
                    }
                }

                target.Heal(AmountToHeal, game);

                break;
            }
        }
        public void Process(GameField game, Player caster, Player opponent, PokemonCard pokemonSource)
        {
            if (CoinFlip && game.FlipCoins(1) == 0)
            {
                return;
            }

            var response = caster.NetworkPlayer.SendAndWaitForResponse <StatusEffectMessage>(new PickStatusMessage()
            {
                CanBurn     = CanSelectBurn,
                CanConfuse  = CanSelectConfuse,
                CanParalyze = CanSelectParalyze,
                CanPoison   = CanSelectPoison,
                CanSleep    = CanSelectSleep
            }.ToNetworkMessage(game.Id));

            var target = Targeting.AskForTargetFromTargetingMode(TargetingMode, game, caster, opponent, pokemonSource, "Select Pokémon to apply effect to");

            target.ApplyStatusEffect(response.StatusEffect, game);
        }
        public void Process(GameField game, Player caster, Player opponent, PokemonCard pokemonSource)
        {
            var target = Targeting.AskForTargetFromTargetingMode(TargetingMode, game, caster, opponent, pokemonSource);

            var response = caster.NetworkPlayer.SendAndWaitForResponse <AskForAmountMessage>(new AskForAmountMessage()
            {
                Info = "How much do you wan't to heal " + target.Name
            }.ToNetworkMessage(game.Id));

            int wantToHealAmount = response.Answer;

            if (wantToHealAmount < 10)
            {
                wantToHealAmount *= 10;
            }

            int toHeal = Math.Min(target.DamageCounters, wantToHealAmount);

            target.Heal(toHeal, game);
            caster.DrawCards(toHeal / 10);
        }
Пример #29
0
        public void Process(GameField game, Player caster, Player opponent, PokemonCard pokemonSource)
        {
            var source = Targeting.AskForTargetFromTargetingMode(SourceTargetingMode, game, caster, opponent, pokemonSource, "Select Pokémon to Move energy from");

            var availableEnergy = source.AttachedEnergy.Where(e => EnergyType == EnergyTypes.All || e.EnergyType == EnergyType).ToList();

            if (availableEnergy.Count > AmountToMove)
            {
                var pickEnergyMessage = new PickFromListMessage(availableEnergy.OfType <Card>().ToList(), AmountToMove).ToNetworkMessage(game.Id);
                var response          = caster.NetworkPlayer.SendAndWaitForResponse <CardListMessage>(pickEnergyMessage);

                availableEnergy.Clear();
                foreach (var id in response.Cards)
                {
                    availableEnergy.Add((EnergyCard)game.Cards[id]);
                }
            }

            var newTarget = Targeting.AskForTargetFromTargetingMode(NewTargetingMode, game, caster, opponent, pokemonSource, "Select Pokémon to Move energy from");

            if (newTarget == null)
            {
                foreach (var energy in availableEnergy)
                {
                    source.DiscardEnergyCard(energy, game);
                }
            }
            else
            {
                foreach (var energy in availableEnergy)
                {
                    source.AttachedEnergy.Remove(energy);
                    game.SendEventToPlayers(new AttachedEnergyDiscardedEvent()
                    {
                        DiscardedCard = energy, FromPokemonId = source.Id
                    });
                    newTarget.AttachEnergy(energy, game);
                }
            }
        }
        public void Process(GameField game, Player caster, Player opponent, PokemonCard pokemonSource)
        {
            if (IsMay)
            {
                if (UseLastYesNoAnswer && !game.LastYesNo)
                {
                    return;
                }
                else if (!game.AskYesNo(caster, "Apply effect?"))
                {
                    return;
                }
            }

            if (!CoinflipConditional.IsOk(game, caster))
            {
                return;
            }

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

            target.TemporaryAbilities.Add(new PreventStatusEffects(target)
            {
                IsBuff          = true,
                PreventBurn     = true,
                PreventConfuse  = true,
                PreventParalyze = true,
                PreventPoison   = true,
                PreventSleep    = true,
                TurnDuration    = TurnDuration
            });
            target.TemporaryAbilities.Add(new EffectPreventer()
            {
                TurnDuration = TurnDuration
            });
        }