/*******************************************************************/
        public bool CanThisCardBeSelected(string cardId, string investigatorId)
        {
            CardInfo     card         = cardRepository.Get(cardId);
            Investigator investigator = investigatorRepository.Get(investigatorId);

            if (investigator == null)
            {
                return(false);
            }
            if (investigator.IsEliminated)
            {
                return(false);
            }
            if (investigator.SelectionIsFull)
            {
                return(false);
            }
            if (!unlockCardsRepository.IsThisCardUnlocked(card))
            {
                return(false);
            }
            if (!IsThisCardAllowed(card, investigator))
            {
                return(false);
            }
            if (IsThisCardWasted(card))
            {
                return(false);
            }
            if (IsThisCardInMax(card, investigator))
            {
                return(false);
            }
            return(true);
        }
        public Investigator Swap(int positionToSwap, Investigator investigator)
        {
            int realPosition = investigators.IndexOf(investigator);

            investigators[realPosition]   = investigators[positionToSwap];
            investigators[positionToSwap] = investigator;
            return(investigators[realPosition]);
        }
 public bool IsThisCardAllowed(CardInfo card, Investigator investigator)
 {
     if (card.IsInvestigator)
     {
         return(true);
     }
     if (investigator == null)
     {
         return(false);
     }
     if (!investigator.DeckBuilding.AllowedCards.Contains(card))
     {
         return(false);
     }
     if (investigator.Xp < card.Xp)
     {
         return(false);
     }
     return(true);
 }
        /*******************************************************************/
        public int XpPayCost(string cardId, string investigatorId)
        {
            CardInfo     card          = cardRepository.Get(cardId);
            Investigator investigator  = investigatorRepository.Get(investigatorId);
            bool         canBeSelected = cardSelectionFilter.CanThisCardBeSelected(cardId, investigatorId);

            if (!canBeSelected)
            {
                return(0);
            }
            if (!investigator.IsPlaying)
            {
                return(0);
            }
            if (investigator.LastCardRemoved == card)
            {
                return(0);
            }
            return((card.Xp ?? 0) == 0 ? 1 : (card.Xp ?? 0));
        }
Esempio n. 5
0
        /*******************************************************************/
        public bool CanThisCardBeSelected(string investigatorId)
        {
            Investigator investigator = investigatorRepository.Get(investigatorId);

            if (selectorRepository.IsSelectionFull)
            {
                return(false);
            }
            if (investigator.IsEliminated)
            {
                return(false);
            }
            if (!unlockCardsRepository.IsThisCardUnlocked(investigator.Info))
            {
                return(false);
            }
            if (IsThisInvestigatorWasted(investigator))
            {
                return(false);
            }
            return(true);
        }
Esempio n. 6
0
        /*******************************************************************/
        public bool CanThisSelectorBeRemoved(string cardId, string investigatorId)
        {
            CardInfo     card         = cardRepository.Get(cardId);
            Investigator investigator = investigatorRepository.Get(investigatorId);

            if (investigator == null)
            {
                return(false);
            }
            if (investigator.IsMandatoryCard(card))
            {
                return(false);
            }
            if (investigator.IsPlaying && investigator.Xp <= 0)
            {
                return(false);
            }
            if (investigator.IsPlaying && !investigator.SelectionIsFull)
            {
                return(false);
            }
            return(true);
        }
 private bool IsThisCardInMax(CardInfo card, Investigator investigator) =>
 investigator.GetAmountOfThisCardInDeck(card) >= GameValues.MAX_SIMILARS_CARDS_IN_DECK;
Esempio n. 8
0
 private bool IsThisInvestigatorWasted(Investigator investigator) =>
 investigator.Info.Quantity - selectorRepository.AmountSelectedOfThisInvestigator(investigator) <= 0;
 public void Remove(Investigator investigator) => investigators.Remove(investigator);
 public void Add(Investigator investigator) => investigators.Add(investigator);
 public int AmountSelectedOfThisInvestigator(Investigator investigator) =>
 investigators.Count(inv => inv == investigator);
 /*******************************************************************/
 public bool Contains(Investigator investigator) => investigators.Contains(investigator);