public virtual bool CanReatreat(GameField game) { if (Owner.BenchedPokemon.Count == 0) { return(false); } return(!IsParalyzed && !IsAsleep && AttachedEnergy.Sum(x => x.Amount) >= (RetreatCost + game.GetRetreatCostModified())); }
public PokemonCard Evolve(PokemonCard evolution) { ClearStatusEffects(); evolution.SetBase(this); evolution.EvolvedFrom = this; evolution.AttachedEnergy = new List <EnergyCard>(AttachedEnergy); AttachedEnergy.Clear(); return(evolution); }
public void DiscardEnergyCard(EnergyCard energyCard, GameField game, bool isExtraCost = false) { if (!isExtraCost) { var preventer = TemporaryAbilities.OfType <EffectPreventer>().FirstOrDefault(); if (preventer != null) { game.GameLog.AddMessage($"Discard energy card prevented by {preventer.Name}"); return; } } AttachedEnergy.Remove(energyCard); Owner.DiscardPile.Add(energyCard); game?.SendEventToPlayers(new AttachedEnergyDiscardedEvent { FromPokemonId = Id, DiscardedCard = energyCard }); energyCard.OnPutInDiscard(Owner); }
public void AttachEnergy(EnergyCard energyCard, GameField game) { energyCard.RevealToAll(); AttachedEnergy.Add(energyCard); bool fromHand = false; if (Owner.Hand.Contains(energyCard)) { Owner.Hand.Remove(energyCard); fromHand = true; } else if (Owner.DiscardPile.Contains(energyCard)) { Owner.DiscardPile.Remove(energyCard); } game.SendEventToPlayers(new EnergyCardsAttachedEvent() { AttachedTo = this, EnergyCard = energyCard }); energyCard.OnAttached(this, fromHand, game); switch (energyCard.EnergyType) { case EnergyTypes.All: case EnergyTypes.Colorless: game.TriggerAbilityOfType(TriggerType.EnergyAttached, this, 0, this); break; case EnergyTypes.Water: game.TriggerAbilityOfType(TriggerType.WaterAttached, this, 0, this); break; case EnergyTypes.Fire: game.TriggerAbilityOfType(TriggerType.FireAttached, this, 0, this); break; case EnergyTypes.Grass: game.TriggerAbilityOfType(TriggerType.GrassAttached, this, 0, this); break; case EnergyTypes.Electric: game.TriggerAbilityOfType(TriggerType.ElectricAttached, this, 0, this); break; case EnergyTypes.Psychic: game.TriggerAbilityOfType(TriggerType.PsychicAttached, this, 0, this); break; case EnergyTypes.Fighting: game.TriggerAbilityOfType(TriggerType.FightingAttached, this, 0, this); break; case EnergyTypes.Darkness: break; case EnergyTypes.Steel: break; case EnergyTypes.Fairy: break; case EnergyTypes.Dragon: break; default: break; } }
public int GetEnergyOfType(EnergyTypes energyType) => AttachedEnergy.Count(e => e.EnergyType == energyType || e.EnergyType == EnergyTypes.All);