Beispiel #1
0
        public void PlayEnergyCard(EnergyCard energyCard, PokemonCard target)
        {
            if (!EnergyRule.CanPlayEnergyCard(energyCard, target))
            {
                GameLog.AddMessage("Energy-rule disallowed playing the energy");
                return;
            }

            if (!ActivePlayer.Hand.Contains(energyCard) || ActivePlayer.Hand.Contains(target))
            {
                GameLog.AddMessage($"{ActivePlayer.NetworkPlayer?.Name} tried something wierd");
                return;
            }

            foreach (var ability in target.TemporaryAbilities)
            {
                if (ability is DisableEnergyAttachmentAbility)
                {
                    GameLog.AddMessage($"Ability {ability.Name} stops attaching energy to {target.Name}");
                    return;
                }
            }

            GameLog.AddMessage($"Attaching {energyCard.GetName()} to {target.Name}");

            EnergyRule.CardPlayed(energyCard, target);
            energyCard.RevealToAll();
            target.AttachedEnergy.Add(energyCard);

            bool fromHand = false;

            if (ActivePlayer.Hand.Contains(energyCard))
            {
                fromHand = true;
                ActivePlayer.Hand.Remove(energyCard);
            }

            SendEventToPlayers(new EnergyCardsAttachedEvent()
            {
                AttachedTo = target,
                EnergyCard = energyCard
            });

            energyCard.OnAttached(target, fromHand, this);

            PushGameLogUpdatesToPlayers();
        }
Beispiel #2
0
        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;
            }
        }