public void RetreatActivePokemon(PokemonCard replacementPokemon, List <EnergyCard> payedEnergy, GameField game) { var retreatStoppers = GetAllPokemonCards().SelectMany(pokemon => pokemon.TemporaryAbilities.OfType <RetreatStopper>()); if (!ActivePokemonCard.CanReatreat(game) || retreatStoppers.Any()) { return; } foreach (var energyCard in payedEnergy) { ActivePokemonCard.DiscardEnergyCard(energyCard, game); } var oldActivePokemon = ActivePokemonCard; ActivePokemonCard = replacementPokemon; ClearAbilitiesWhenBenched(oldActivePokemon); ActivePokemonCard.DamageStoppers = ActivePokemonCard.DamageStoppers.Where(d => !d.LastsUntilDamageTaken).ToList(); BenchedPokemon.ReplaceWith(replacementPokemon, oldActivePokemon); oldActivePokemon.ClearStatusEffects(); game?.SendEventToPlayers(new PokemonBecameActiveEvent { NewActivePokemonId = replacementPokemon.Id, ReplacedPokemonId = oldActivePokemon.Id }); }
public void SwapActivePokemon(PokemonCard pokemon, GameField game) { BenchedPokemon.ReplaceWith(pokemon, ActivePokemonCard); game?.SendEventToPlayers(new PokemonBecameActiveEvent { NewActivePokemonId = pokemon.Id, ReplacedPokemonId = ActivePokemonCard.Id }); ActivePokemonCard = pokemon; pokemon.RevealToAll(); }
public void ForceRetreatActivePokemon(PokemonCard replacementPokemon, GameField game) { var oldActivePokemon = ActivePokemonCard; ActivePokemonCard = replacementPokemon; BenchedPokemon.ReplaceWith(replacementPokemon, oldActivePokemon); ClearAbilitiesWhenBenched(oldActivePokemon); oldActivePokemon.ClearStatusEffects(); game?.SendEventToPlayers(new PokemonBecameActiveEvent { NewActivePokemonId = replacementPokemon == null ? null : replacementPokemon.Id, ReplacedPokemonId = oldActivePokemon.Id }); }