public void EvolvePokemon(PokemonCard basePokemon, PokemonCard evolution, bool ignoreAllChecks = false) { if (!ignoreAllChecks && !ActivePlayer.Id.Equals(basePokemon.Owner.Id) || !ActivePlayer.Id.Equals(evolution.Owner.Id)) { GameLog.AddMessage("Evolution stopped by epic 1337 anti-cheat"); return; } if (!ignoreAllChecks && GetAllPassiveAbilities().Any(ability => ability.ModifierType == PassiveModifierType.StopEvolutions)) { GameLog.AddMessage("Evolution stopped by ability"); return; } if (!ignoreAllChecks && (!basePokemon.CanEvolve() || !basePokemon.CanEvolveTo(evolution))) { return; } GameLog.AddMessage($"Evolving {basePokemon.GetName()} to {evolution.GetName()}"); if (ActivePlayer.ActivePokemonCard.Id.Equals(basePokemon.Id)) { basePokemon.Evolve(evolution); ActivePlayer.ActivePokemonCard = evolution; evolution.EvolvedThisTurn = true; } else { basePokemon.Evolve(evolution); evolution.EvolvedThisTurn = true; ActivePlayer.BenchedPokemon.ReplaceWith(basePokemon, evolution); } bool triggerEnterPlay = false; if (ActivePlayer.Hand.Contains(evolution)) { ActivePlayer.Hand.Remove(evolution); triggerEnterPlay = true; } evolution.RevealToAll(); SendEventToPlayers(new PokemonEvolvedEvent { TargetPokemonId = basePokemon.Id, NewPokemonCard = evolution }); if (triggerEnterPlay) { TriggerAbilityOfType(TriggerType.EnterPlay, evolution); } PushGameLogUpdatesToPlayers(); }
public void Bounce_EvolvedPokemon_OnlyBasic() { var effect = new BouncePokemonEffect() { OnlyBasic = true, ShuffleIntoDeck = false, ReturnAttachedToHand = true, TargetingMode = TargetingMode.OpponentActive }; var opponent = new Player(); var pokemon = new PokemonCard(opponent) { Name = "Pokemon1", Stage = 0, Hp = 100 }; var evolution = new PokemonCard(opponent) { Name = "Evo", Stage = 1, EvolvesFrom = "Pokemon1", Hp = 100 }; opponent.ActivePokemonCard = evolution; pokemon.Evolve(evolution); var other = new PokemonCard(opponent); opponent.BenchedPokemon.Add(other); var sub = Substitute.For <INetworkPlayer>(); sub.SendAndWaitForResponse <CardListMessage>(Arg.Any <NetworkMessage>()).ReturnsForAnyArgs(new CardListMessage { Cards = new List <NetworkId> { other.Id } }); opponent.SetNetworkPlayer(sub); var game = new GameField(); game.AddPlayer(new Player() { Id = NetworkId.Generate() }); game.AddPlayer(opponent); opponent.Id = NetworkId.Generate(); effect.Process(game, game.Players[0], opponent, null); Assert.Single(opponent.Hand); Assert.Equal(pokemon.Id, opponent.Hand[0].Id); Assert.Single(opponent.DiscardPile); Assert.Equal(evolution.Id, opponent.DiscardPile[0].Id); }
public void KillActivePokemon_StageOne_NoEnergy() { var player = new Player(); var abra = new PokemonCard(player); var kadabra = new PokemonCard(player); abra.Evolve(kadabra); player.ActivePokemonCard = kadabra; player.KillActivePokemon(); Assert.Null(player.ActivePokemonCard); Assert.Equal(2, player.DiscardPile.Count); }