示例#1
0
        private IEnumerable <ITarget> GetTargets(Card card)
        {
            switch (card.CardType)
            {
            case Card.CardTypes.Creature:
                var guards = OpponentBoardCards.Where(x => x.CardAbilities.Contains(Card.Abilities.Guard)).Select(x => (ITarget)x);
                if (guards != null && guards.Count() > 0)
                {
                    return(guards);
                }
                var targets = OpponentBoardCards.Select(x => (ITarget)x).ToList();
                targets.Add(this);
                return(targets);

            case Card.CardTypes.GreenItem:
                return(PlayerBoardCards.Select(x => (ITarget)x));

            case Card.CardTypes.RedItem:
                return(OpponentBoardCards.Select(x => (ITarget)x));

            case Card.CardTypes.BlueItem:
                List <ITarget> result = new List <ITarget>();
                result.Add(this);
                if (!specialCards.Contains(card.CardNumber))     //no creature as target
                {
                    result.AddRange(OpponentBoardCards.Select(x => (ITarget)x));
                }
                return(result);

            default: throw new NotImplementedException($"Card Type  {card.CardType} not implemented");
            }
        }
示例#2
0
        internal double GetScore()
        {
            double positiveScore = PlayerBoardCards.Sum(x => x.GetScore());

            positiveScore += PlayerHealth * Config.PlayerLifeMultiplier;
            positiveScore += PlayerBoardCards.Count * Config.HandCardsMultiplier + AmountOfHandCards * Config.HandCardsMultiplier;

            if (OpponentHealth <= 0)
            {
                positiveScore += Config.GameWon;
            }

            if (PlayerBoardCards.Count > OpponentBoardCards.Count)
            {
                positiveScore += Config.MoreCreaturesThanEnemyMultiplier;
            }

            if (OpponentBoardCards.Count == 0)
            {
                positiveScore += Config.BoardClearedBonus;
            }

            double negativeScore = OpponentBoardCards.Sum(x => x.GetScore());

            negativeScore += OpponentHealth * Config.OpponentLifeMultiplier;

            return(positiveScore - negativeScore);
        }
示例#3
0
        private Card GetCard(int instanceID)
        {
            var card = OpponentBoardCards.SingleOrDefault(x => x.InstanceId == instanceID);

            if (card != null)
            {
                return(card);
            }

            card = PlayerBoardCards.SingleOrDefault(x => x.InstanceId == instanceID);
            if (card != null)
            {
                return(card);
            }

            throw new KeyNotFoundException();
        }