コード例 #1
0
        private void UpdateRevealedEntity(CardEntity entity, int turn, bool?discarded = null, CardMark?cardMark = null)
        {
            var revealed = RevealedCards.FirstOrDefault(ce => ce.Entity == entity.Entity || (ce.CardId == entity.CardId && ce.Entity == null && ce.Turn <= entity.PrevTurn));

            if (revealed != null)
            {
                revealed.Update(entity.Entity);
            }
            else
            {
                revealed = new CardEntity(entity.Entity)
                {
                    Turn = turn, Created = entity.Created, Discarded = entity.Discarded
                };
                RevealedCards.Add(revealed);
            }
            if (discarded.HasValue)
            {
                revealed.Discarded = discarded.Value;
            }
            if (cardMark.HasValue)
            {
                revealed.CardMark = cardMark.Value;
            }
        }
コード例 #2
0
ファイル: Player.cs プロジェクト: JonnyMcFire/EpixCopy
        private void UpdateRevealedEntity(CardEntity entity, int turn, bool?discarded = null, CardMark?cardMark = null)
        {
            var revealed =
                RevealedCards.FirstOrDefault(
                    ce =>
                    ce.Entity == entity.Entity ||
                    (ce.CardId == entity.CardId && ce.Entity == null && ce.Turn <= entity.PrevTurn));

            if (revealed != null)
            {
                revealed.Update(entity.Entity);
            }
            else
            {
                revealed = new CardEntity(entity.Entity)
                {
                    Turn = turn, Created = entity.Created, Discarded = entity.Discarded
                };
                var cardType = entity.Entity.GetTag(GAME_TAG.CARDTYPE);
                if (cardType != (int)TAG_CARDTYPE.HERO && cardType != (int)TAG_CARDTYPE.ENCHANTMENT && cardType != (int)TAG_CARDTYPE.HERO_POWER &&
                    cardType != (int)TAG_CARDTYPE.PLAYER)
                {
                    RevealedCards.Add(revealed);
                }
            }
            if (discarded.HasValue)
            {
                revealed.Discarded = discarded.Value;
            }
            if (cardMark.HasValue)
            {
                revealed.CardMark = cardMark.Value;
            }
        }
コード例 #3
0
ファイル: Player.cs プロジェクト: JonnyMcFire/EpixCopy
        public void RemoveFromDeck(Entity entity, int turn)
        {
            var revealed = RevealedCards.FirstOrDefault(r => r.Entity == entity);

            if (revealed != null)
            {
                RevealedCards.Remove(revealed);
            }
            var ce = MoveCardEntity(entity, Deck, Removed, turn);

            Log("RemoveFromDeck", ce);
        }
コード例 #4
0
        public void RemoveFromDeck(Entity entity, int turn)
        {
            var revealed = RevealedCards.FirstOrDefault(r => r.Entity == entity);

            if (revealed != null)
            {
                RevealedCards.Remove(revealed);
            }
            var ce = MoveCardEntity(entity, Deck, Removed, turn);

            UpdateRevealedEntity(ce, turn, true);
            VerifyCardMatchesDeck(ce);
            Log(ce);
        }