Esempio n. 1
0
        public static CardItem Parse(Card card, int wrtPlayerId)
        {
            if (card == null)
            {
                return(null);
            }
            var item = new CardItem()
            {
                DeckPlaceItem = DeckPlaceItem.Parse(card.Place),
                PlaceInDeck   = Game.CurrentGame.Decks[card.Place].IndexOf(card)
            };

            if (card.Place.Player != null && card.Place.DeckType == DeckType.Hand &&
                wrtPlayerId >= 0 && wrtPlayerId < Game.CurrentGame.Players.Count &&
                Game.CurrentGame.HandCardVisibility[Game.CurrentGame.Players[wrtPlayerId]].Contains(card.Place.Player))
            {
                item.CardId = card.Id;
                return(item);
            }
            else
            {
                if (card.RevealOnce)
                {
                    item.CardId     = card.Id;
                    card.RevealOnce = false;
                }
                else
                {
                    item.CardId = -1;
                }
                return(item);
            }
        }
Esempio n. 2
0
        public Card ToCard(int wrtPlayerId)
        {
            if (DeckPlaceItem == null)
            {
                return(null);
            }
            var cardDeck = Game.CurrentGame.Decks[DeckPlaceItem.ToDeckPlace()];

            if (cardDeck == null || cardDeck.Count <= PlaceInDeck)
            {
                return(null);
            }
            if (DeckPlaceItem.ToDeckPlace().Player != null && DeckPlaceItem.ToDeckPlace().DeckType == DeckType.Hand &&
                wrtPlayerId >= 0 && wrtPlayerId < Game.CurrentGame.Players.Count &&
                Game.CurrentGame.HandCardVisibility[Game.CurrentGame.Players[wrtPlayerId]].Contains(DeckPlaceItem.ToDeckPlace().Player))
            {
                var theCard = cardDeck.FirstOrDefault(cd => cd.Id == CardId);
                return(theCard);
            }

            if (DeckPlaceItem.ToDeckPlace().DeckType != DeckType.Equipment && DeckPlaceItem.ToDeckPlace().DeckType != DeckType.DelayedTools && CardId >= 0 && Game.CurrentGame.IsClient)
            {
                cardDeck[PlaceInDeck].Id   = CardId;
                cardDeck[PlaceInDeck].Type = (CardHandler)(GameEngine.CardSet[CardId].Type.Clone());
                cardDeck[PlaceInDeck].Suit = GameEngine.CardSet[CardId].Suit;
                cardDeck[PlaceInDeck].Rank = GameEngine.CardSet[CardId].Rank;
                var bp = DeckPlaceItem.ToDeckPlace().Player;
                if (bp != null)
                {
                    Game.CurrentGame._FilterCard(bp, cardDeck[PlaceInDeck]);
                }
            }
            return(cardDeck[PlaceInDeck]);
        }
Esempio n. 3
0
        public static DeckPlaceItem Parse(DeckPlace dp)
        {
            DeckPlaceItem dpi = new DeckPlaceItem();

            dpi.PlayerItem = PlayerItem.Parse(dp.Player);
            dpi.DeckName   = dp.DeckType.AbbriviatedName;
            return(dpi);
        }
Esempio n. 4
0
 public static DeckPlaceItem Parse(DeckPlace dp)
 {
     DeckPlaceItem dpi = new DeckPlaceItem();
     dpi.PlayerItem = PlayerItem.Parse(dp.Player);
     dpi.DeckName = dp.DeckType.AbbriviatedName;
     return dpi;
 }