public virtual bool CanPayFor(ICardEffect cardEffect)
        {
            if (cardEffect == null)
            {
                throw new ArgumentNullException("cardEffect");
            }

            //var costlyEffect = cardEffect as ICostlyEffect;
            //if (costlyEffect != null)
            //{
            //}

            if (Card.HasEffect <IDuringCheckForResourceMatch>())
            {
                var check = new CheckForResourceMatch(Game, cardEffect);

                foreach (var checkEffect in Card.Text.Effects.OfType <IDuringCheckForResourceMatch>())
                {
                    checkEffect.DuringCheckForResourceMatch(check);
                }

                return(check.IsResourceMatch);
            }

            return(false);
        }
Example #2
0
        public override bool CanPayFor(ICardEffect cardEffect)
        {
            if (cardEffect == null)
            {
                throw new ArgumentNullException("cardEffect");
            }

            if (base.CanPayFor(cardEffect))
            {
                return(true);
            }

            var costlyEffect = cardEffect as ICostlyEffect;

            if (costlyEffect != null)
            {
                if (costlyEffect.ResourceSphere == Sphere.Neutral)
                {
                    return(true);
                }

                return(HasResourceIcon(costlyEffect.ResourceSphere));
            }

            return(true);
        }
Example #3
0
        // METHODS


        /// <inheritdoc />
        public override void Resolve(Card owner, CombatManager combatManager)
        {
            // Pick a random effect amongst the one available.
            ICardEffect effect = GetNext();

            effect?.Resolve(owner, combatManager);
            NextEffect = null;
        }
        private void TriggerEffect(IGame game, IEffectHandle handle, ICardEffect cardEffect)
        {
            game.AddEffect(cardEffect);
            var playEffectHandle = cardEffect.GetHandle(game);

            game.TriggerEffect(playEffectHandle);
            handle.Resolve(string.Format("{0} triggered {1}", player.Name, cardEffect.ToString()));
        }
        private PayResourcesEffectBase(ISource source, Sphere resourceSphere, byte numberOfResources, bool isVariableCost, IPlayer player, ICostlyCard costlyCard, ICardEffect cardEffect)
            : base("Pay Resources", GetText(player, resourceSphere, numberOfResources, isVariableCost), source)
        {
            if (player == null)
                throw new ArgumentNullException("player");

            this.resourceSphere = resourceSphere;
            this.numberOfResources = numberOfResources;
            this.isVariableCost = isVariableCost;
            this.player = player;
            this.costlyCard = costlyCard;
            this.cardEffect = cardEffect;
        }
Example #6
0
 public void AddEffect(ICardEffect effect)
 {
     effects.Add(effect);
 }
 private void TriggerEffect(IGame game, IEffectHandle handle, ICardEffect cardEffect)
 {
     game.AddEffect(cardEffect);
     var playEffectHandle = cardEffect.GetHandle(game);
     game.TriggerEffect(playEffectHandle);
     handle.Resolve(string.Format("{0} triggered {1}", player.Name, cardEffect.ToString()));
 }
Example #8
0
 protected void AddEffect(ICardEffect effect)
 {
     text.AddEffect(effect);
 }
 public ResourcePayment(ICardEffect cardEffect)
     : this()
 {
     this.costlyCard = null;
     this.cardEffect = cardEffect;
 }
 protected PayResourcesEffectBase(ISource source, Sphere resourceSphere, byte numberOfResources, bool isVariableCost, IPlayer player, ICardEffect cardEffect)
     : this(source, resourceSphere, numberOfResources, isVariableCost, player, null, cardEffect)
 {
     if (cardEffect == null)
     {
         throw new ArgumentNullException("cardEffect");
     }
 }
 protected PayResourcesEffectBase(ISource source, Sphere resourceSphere, byte numberOfResources, bool isVariableCost, IPlayer player, ICardEffect cardEffect)
     : this(source, resourceSphere, numberOfResources, isVariableCost, player, null, cardEffect)
 {
     if (cardEffect == null)
         throw new ArgumentNullException("cardEffect");
 }
Example #12
0
 public void AddEffect(ICardEffect effect)
 {
     effects.Add(effect);
 }
Example #13
0
 public void AddEffect(ICard source, ICardEffect cardEffect)
 {
     cardEffect.Source = source;
     _effects.Push(cardEffect);
 }
 public ResourcePayment(ICardEffect cardEffect)
     : this()
 {
     this.costlyCard = null;
     this.cardEffect = cardEffect;
 }
Example #15
0
 public void AddEffect(ICard source, ICardEffect cardEffect)
 {
     cardEffect.Source = source;
     _effects.Push(cardEffect);
 }
 public CheckForResourceMatch(IGame game, ICardEffect cardEffect)
     : base(game)
 {
     this.costlyCard = null;
     this.cardEffect = cardEffect;
 }
Example #17
0
 public void AddEffect(ICardEffect cardEffect)
 {
     _effects.Push(cardEffect);
 }
        private PayResourcesEffectBase(ISource source, Sphere resourceSphere, byte numberOfResources, bool isVariableCost, IPlayer player, ICostlyCard costlyCard, ICardEffect cardEffect)
            : base("Pay Resources", GetText(player, resourceSphere, numberOfResources, isVariableCost), source)
        {
            if (player == null)
            {
                throw new ArgumentNullException("player");
            }

            this.resourceSphere    = resourceSphere;
            this.numberOfResources = numberOfResources;
            this.isVariableCost    = isVariableCost;
            this.player            = player;
            this.costlyCard        = costlyCard;
            this.cardEffect        = cardEffect;
        }
 public CheckForResourceMatch(IGame game, ICardEffect cardEffect)
     : base(game)
 {
     this.costlyCard = null;
     this.cardEffect = cardEffect;
 }