Example #1
0
        /// <summary>
        /// Compute score for using a Card on target.
        /// </summary>
        /// <param name="sceneContext">The RockSceneContext</param>
        /// <param name="cardRockId">The RockId of Card</param>
        /// <param name="targetRockId">The RockId of Target</param>
        /// <returns>The score in double</returns>
        private static double ScoreForUseCardOnTarget(RockSceneContext sceneContext, int cardRockId, int targetRockId)
        {
            double   score = 1; // initial score
            RockCard card  = sceneContext.GetRockCard(cardRockId);

            // adjust score by wasted cost
            int wastedCost = sceneContext.GetMininWastedCost(cardRockId);

            score -= wastedCost * 0.1d;

            switch (card.CardType)
            {
            case RockCardType.Enchantment:
                if (sceneContext.IsEnemy(targetRockId))
                {
                    score -= 1;
                }

                break;

            case RockCardType.Spell:
                if (sceneContext.IsFriendly(targetRockId))
                {
                    score -= 1;
                }

                break;

            case RockCardType.Weapon:
                if (sceneContext.GetFriendlyRockPlayer().HasWeapon)
                {
                    score -= 1;
                }
                else
                {
                    score += 4;
                }

                break;

            default:
                break;
            }

            return(score);
        }