コード例 #1
0
 public DamageDealt(IGame game, ICard source, ICardInPlay target, byte damage)
     : base(game)
 {
     this.Source = source;
     this.Target = target;
     this.damage = damage;
 }
コード例 #2
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));
        }
コード例 #3
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;
 }
コード例 #4
0
        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;
        }
コード例 #5
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;
        }
コード例 #6
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);
 }
コード例 #7
0
 public CheckForTrait(IGame game, ICardInPlay target, Trait trait)
     : base(game)
 {
     this.Target = target;
     this.Trait = trait;
 }
コード例 #8
0
 public CardEntersPlay(IGame game, ICardInPlay enteringPlay)
     : base(game)
 {
     this.EnteringPlay = enteringPlay;
 }
コード例 #9
0
ファイル: Player.cs プロジェクト: bossaia/alexandrialibrary
        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;
        }
コード例 #10
0
 public DamageHealed(IGame game, ICardInPlay target, byte damage)
     : base(game)
 {
     this.Target = target;
     this.damage = damage;
 }
コード例 #11
0
ファイル: Player.cs プロジェクト: bossaia/alexandrialibrary
        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);
        }
コード例 #12
0
 public AttackModifier(PhaseCode startPhase, ISource source, ICardInPlay target, TimeScope duration, int value)
     : base("Attack", startPhase, source, target, duration, value)
 {
 }
コード例 #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));
        }
コード例 #14
0
 public CardLeavesPlay(IGame game, ICardInPlay leavingPlay)
     : base(game)
 {
     this.LeavingPlay = leavingPlay;
 }
コード例 #15
0
 public DealDamageEffect(IGame game, ICardInPlay cardInPlay, byte damage)
     : base("Deal Damage", GetDescription(damage, cardInPlay), game)
 {
     this.cardInPlay = cardInPlay;
     this.damage = damage;
 }
コード例 #16
0
ファイル: Player.cs プロジェクト: bossaia/alexandrialibrary
        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);
        }
コード例 #17
0
 private static string GetDescription(byte damage, ICardInPlay cardInPlay)
 {
     return string.Format("Deal {0} damage to {1}", damage, cardInPlay.Title);
 }
コード例 #18
0
 public WillpowerModifier(PhaseCode startPhase, ISource source, ICardInPlay target, TimeScope duration, int value)
     : base("Willpower", startPhase, source, target, duration, value)
 {
 }