Ejemplo n.º 1
0
        public bool IsTheControllerOf(ICardInPlay card)
        {
            if (card.BaseCard is ITreacheryCard)
            {
                return(false);
            }

            foreach (var cardInPlay in cardsInPlay)
            {
                if (cardInPlay.BaseCard.Id == card.BaseCard.Id)
                {
                    return(true);
                }

                if (cardInPlay is IAttachmentHostInPlay)
                {
                    var host = cardInPlay as IAttachmentHostInPlay;
                    if (host.Attachments.Any(x => x.BaseCard.Id == card.BaseCard.Id))
                    {
                        return(true);
                    }
                }
            }

            return(false);
        }
Ejemplo n.º 2
0
        public void RemoveCardInPlay(ICardInPlay card)
        {
            if (card == null)
            {
                throw new ArgumentNullException("card");
            }

            if (!cardsInPlay.Contains(card))
            {
                return;
            }

            cardsInPlay.Remove(card);

            var leavesPlayEffect = new CardLeavesPlayEffect(Game, card);
            var leavesPlayHandle = leavesPlayEffect.GetHandle(Game);

            Game.AddEffect(leavesPlayEffect);
            Game.TriggerEffect(leavesPlayHandle);

            foreach (var callback in cardRemovedFromPlayCallbacks)
            {
                callback(card);
            }
        }
Ejemplo n.º 3
0
        public void AddCardInPlay(ICardInPlay card)
        {
            if (card == null)
            {
                throw new ArgumentNullException("card");
            }

            if (cardsInPlay.Contains(card))
            {
                return;
            }

            cardsInPlay.Add(card);

            var entersPlayEffect = new CardEntersPlayEffect(Game, card);
            var entersPlayHandle = entersPlayEffect.GetHandle(Game);

            Game.AddEffect(entersPlayEffect);
            Game.TriggerEffect(entersPlayHandle);

            foreach (var callback in cardAddedToPlayCallbacks)
            {
                callback(card);
            }
        }
Ejemplo n.º 4
0
        private void CardAddedToPlay(ICardInPlay cardInPlay)
        {
            var heroInPlay = cardInPlay as IHeroInPlay;
            if (heroInPlay != null)
            {
                var heroViewModel = new PlayerCardInPlayViewModel<IHeroCard>(dispatcher, heroInPlay);
                Dispatch(() => heroes.Add(heroViewModel));
                return;
            }

            PlayerCardInPlayViewModel viewModel = null;

            var allyInPlay = cardInPlay as IAllyInPlay;
            if (allyInPlay != null)
            {
                viewModel = new PlayerCardInPlayViewModel<IAllyCard>(dispatcher, allyInPlay);
            }

            var attachmentInPlay = cardInPlay as IAttachmentInPlay;
            if (attachmentInPlay != null)
            {
                viewModel = new PlayerCardInPlayViewModel<IAttachmentCard>(dispatcher, attachmentInPlay);
            }

            var treasureInPlay = cardInPlay as ITreasureInPlay;
            if (treasureInPlay != null)
            {
                viewModel = new PlayerCardInPlayViewModel<ITreasureCard>(dispatcher, treasureInPlay);
            }

            if (viewModel == null)
                return;

            Dispatch(() => cardsInPlay.Add(viewModel));
        }
Ejemplo n.º 5
0
 public DamageDealt(IGame game, ICard source, ICardInPlay target, byte damage)
     : base(game)
 {
     this.Source = source;
     this.Target = target;
     this.damage = damage;
 }
Ejemplo n.º 6
0
 public DamageDealt(IGame game, ICard source, ICardInPlay target, byte damage)
     : base(game)
 {
     this.Source = source;
     this.Target = target;
     this.damage = damage;
 }
Ejemplo n.º 7
0
 protected ModifierBase(string type, PhaseCode startPhase, ISource source, ICardInPlay target, TimeScope duration, int value)
     : base("Modifier", GetText(target, type, value), source)
 {
     this.StartPhase = startPhase;
     this.Target     = target;
     this.Duration   = duration;
     this.Value      = value;
 }
        public CardEntersPlayEffect(IGame game, ICardInPlay cardInPlay)
            : base("Card Enters Play", "When a card enters play", game)
        {
            if (cardInPlay == null)
                throw new ArgumentNullException("cardInPlay");

            this.cardInPlay = cardInPlay;
        }
Ejemplo n.º 9
0
 protected ModifierBase(string type, PhaseCode startPhase, ISource source, ICardInPlay target, TimeScope duration, int value)
     : base("Modifier", GetText(target, type, value), source)
 {
     this.StartPhase = startPhase;
     this.Target = target;
     this.Duration = duration;
     this.Value = value;
 }
Ejemplo n.º 10
0
        public DetermineHitPoints(IGame game, ICardInPlay damageable)
            : base(game)
        {
            this.Damageable = damageable;

            var damageableCard = damageable.BaseCard as IDamageableCard;

            hitPoints = damageableCard != null ? damageableCard.PrintedHitPoints : (byte)0;
        }
Ejemplo n.º 11
0
        public DetermineHitPoints(IGame game, ICardInPlay damageable)
            : base(game)
        {
            this.Damageable = damageable;

            var damageableCard = damageable.BaseCard as IDamageableCard;

            hitPoints = damageableCard != null ? damageableCard.PrintedHitPoints : (byte)0;
        }
        public CardLeavesPlayEffect(IGame game, ICardInPlay cardInPlay)
            : base("Card Leaves Play", "When a card leaves play", game)
        {
            if (cardInPlay == null)
            {
                throw new ArgumentNullException("cardInPlay");
            }

            this.cardInPlay = cardInPlay;
        }
Ejemplo n.º 13
0
        private void CardRemovedFromPlay(ICardInPlay cardInPlay)
        {
            var viewModel = cardsInPlay.Where(x => x.CardId == cardInPlay.BaseCard.Id).FirstOrDefault();

            if (viewModel == null)
            {
                return;
            }

            Dispatch(() => cardsInPlay.Remove(viewModel));
        }
Ejemplo n.º 14
0
        private void CardAddedToPlay(ICardInPlay cardInPlay)
        {
            var heroInPlay = cardInPlay as IHeroInPlay;

            if (heroInPlay != null)
            {
                var heroViewModel = new PlayerCardInPlayViewModel <IHeroCard>(dispatcher, heroInPlay);
                Dispatch(() => heroes.Add(heroViewModel));
                return;
            }

            PlayerCardInPlayViewModel viewModel = null;

            var allyInPlay = cardInPlay as IAllyInPlay;

            if (allyInPlay != null)
            {
                viewModel = new PlayerCardInPlayViewModel <IAllyCard>(dispatcher, allyInPlay);
            }

            var attachmentInPlay = cardInPlay as IAttachmentInPlay;

            if (attachmentInPlay != null)
            {
                viewModel = new PlayerCardInPlayViewModel <IAttachmentCard>(dispatcher, attachmentInPlay);
            }

            var treasureInPlay = cardInPlay as ITreasureInPlay;

            if (treasureInPlay != null)
            {
                viewModel = new PlayerCardInPlayViewModel <ITreasureCard>(dispatcher, treasureInPlay);
            }

            if (viewModel == null)
            {
                return;
            }

            Dispatch(() => cardsInPlay.Add(viewModel));
        }
Ejemplo n.º 15
0
 public CardEntersPlay(IGame game, ICardInPlay enteringPlay)
     : base(game)
 {
     this.EnteringPlay = enteringPlay;
 }
Ejemplo n.º 16
0
 private static string GetText(ICardInPlay target, string type, int value)
 {
     return value > -1 ?
         string.Format("{0}: +{1} to {2}", target.Title, value, type)
         : string.Format("{0}: -{1} to {2}", target.Title, Math.Abs(value), type);
 }
Ejemplo n.º 17
0
        private void CardRemovedFromPlay(ICardInPlay cardInPlay)
        {
            var viewModel = cardsInPlay.Where(x => x.CardId == cardInPlay.BaseCard.Id).FirstOrDefault();
            if (viewModel == null)
                return;

            Dispatch(() => cardsInPlay.Remove(viewModel));
        }
Ejemplo n.º 18
0
 public CheckForTrait(IGame game, ICardInPlay target, Trait trait)
     : base(game)
 {
     this.Target = target;
     this.Trait = trait;
 }
Ejemplo n.º 19
0
 public CardEntersPlay(IGame game, ICardInPlay enteringPlay)
     : base(game)
 {
     this.EnteringPlay = enteringPlay;
 }
Ejemplo n.º 20
0
 public DamageHealed(IGame game, ICardInPlay target, byte damage)
     : base(game)
 {
     this.Target = target;
     this.damage = damage;
 }
Ejemplo n.º 21
0
 public WillpowerModifier(PhaseCode startPhase, ISource source, ICardInPlay target, TimeScope duration, int value)
     : base("Willpower", startPhase, source, target, duration, value)
 {
 }
Ejemplo n.º 22
0
 public DamageHealed(IGame game, ICardInPlay target, byte damage)
     : base(game)
 {
     this.Target = target;
     this.damage = damage;
 }
Ejemplo n.º 23
0
 private static string GetDescription(byte damage, ICardInPlay cardInPlay)
 {
     return(string.Format("Deal {0} damage to {1}", damage, cardInPlay.Title));
 }
Ejemplo n.º 24
0
 private static string GetDescription(byte damage, ICardInPlay cardInPlay)
 {
     return string.Format("Deal {0} damage to {1}", damage, cardInPlay.Title);
 }
Ejemplo n.º 25
0
 public AttackModifier(PhaseCode startPhase, ISource source, ICardInPlay target, TimeScope duration, int value)
     : base("Attack", startPhase, source, target, duration, value)
 {
 }
Ejemplo n.º 26
0
 public AttackModifier(PhaseCode startPhase, ISource source, ICardInPlay target, TimeScope duration, int value)
     : base("Attack", startPhase, source, target, duration, value)
 {
 }
Ejemplo n.º 27
0
 public CardLeavesPlay(IGame game, ICardInPlay leavingPlay)
     : base(game)
 {
     this.LeavingPlay = leavingPlay;
 }
Ejemplo n.º 28
0
 public CheckForTrait(IGame game, ICardInPlay target, Trait trait)
     : base(game)
 {
     this.Target = target;
     this.Trait  = trait;
 }
Ejemplo n.º 29
0
 public DealDamageEffect(IGame game, ICardInPlay cardInPlay, byte damage)
     : base("Deal Damage", GetDescription(damage, cardInPlay), game)
 {
     this.cardInPlay = cardInPlay;
     this.damage = damage;
 }
Ejemplo n.º 30
0
 private static string GetText(ICardInPlay target, string type, int value)
 {
     return(value > -1 ?
            string.Format("{0}: +{1} to {2}", target.Title, value, type)
         : string.Format("{0}: -{1} to {2}", target.Title, Math.Abs(value), type));
 }
Ejemplo n.º 31
0
 public DealDamageEffect(IGame game, ICardInPlay cardInPlay, byte damage)
     : base("Deal Damage", GetDescription(damage, cardInPlay), game)
 {
     this.cardInPlay = cardInPlay;
     this.damage     = damage;
 }
Ejemplo n.º 32
0
        public void RemoveCardInPlay(ICardInPlay card)
        {
            if (card == null)
                throw new ArgumentNullException("card");

            if (!cardsInPlay.Contains(card))
                return;

            cardsInPlay.Remove(card);

            var leavesPlayEffect = new CardLeavesPlayEffect(Game, card);
            var leavesPlayHandle = leavesPlayEffect.GetHandle(Game);
            Game.AddEffect(leavesPlayEffect);
            Game.TriggerEffect(leavesPlayHandle);

            foreach (var callback in cardRemovedFromPlayCallbacks)
                callback(card);
        }
Ejemplo n.º 33
0
        public bool IsTheControllerOf(ICardInPlay card)
        {
            if (card.BaseCard is ITreacheryCard)
                return false;

            foreach (var cardInPlay in cardsInPlay)
            {
                if (cardInPlay.BaseCard.Id == card.BaseCard.Id)
                    return true;

                if (cardInPlay is IAttachmentHostInPlay)
                {
                    var host = cardInPlay as IAttachmentHostInPlay;
                    if (host.Attachments.Any(x => x.BaseCard.Id == card.BaseCard.Id))
                        return true;
                }
            }

            return false;
        }
Ejemplo n.º 34
0
 public CardLeavesPlay(IGame game, ICardInPlay leavingPlay)
     : base(game)
 {
     this.LeavingPlay = leavingPlay;
 }
Ejemplo n.º 35
0
 public WillpowerModifier(PhaseCode startPhase, ISource source, ICardInPlay target, TimeScope duration, int value)
     : base("Willpower", startPhase, source, target, duration, value)
 {
 }
Ejemplo n.º 36
0
        public void AddCardInPlay(ICardInPlay card)
        {
            if (card == null)
                throw new ArgumentNullException("card");

            if (cardsInPlay.Contains(card))
                return;

            cardsInPlay.Add(card);

            var entersPlayEffect = new CardEntersPlayEffect(Game, card);
            var entersPlayHandle = entersPlayEffect.GetHandle(Game);
            Game.AddEffect(entersPlayEffect);
            Game.TriggerEffect(entersPlayHandle);

            foreach (var callback in cardAddedToPlayCallbacks)
                callback(card);
        }