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);
        }
Example #2
0
        /// <summary>
        /// Compute score for one of the PlayAction.
        /// </summary>
        /// <param name="sceneContext">The RockSceneContext.</param>
        /// <param name="playAction">The PlayAction.</param>
        /// <returns>The score in double.</returns>
        public static double ComputeScore(RockSceneContext sceneContext, List <int> playAction)
        {
            switch (playAction.Count)
            {
            // Use Card (Spell/Enchantment/Minion/Weapon)
            // Use HeroPower
            case 1:
                if (sceneContext.IsFriendlyCard(playAction[0]))
                {
                    // Use Card
                    return(ScoreForUseCard(sceneContext, playAction[0]));
                }
                else if (sceneContext.IsFriendlyHeroPower(playAction[0]))
                {
                    // Use HeroPower
                    return(ScoreForUseHeroPower(sceneContext, playAction[0]));
                }
                else
                {
                    return(0);
                }

            case 2:
                if (sceneContext.IsFriendlyCard(playAction[0]))
                {
                    // Use Spell/Enchantment on target
                    // Use Card with option
                    return(0);
                }
                else if (sceneContext.IsFriendlyHeroPower(playAction[0]))
                {
                    // Use HeroPower on target
                    switch (sceneContext.GetFriendlyRockPlayer().Hero.Class)
                    {
                    case RockHeroClass.Mage:
                        return(ScoreForUseMageHeroPower(sceneContext, playAction[0], playAction[1]));

                    case RockHeroClass.Priest:
                        return(ScoreForUsePriestHeroPower(sceneContext, playAction[0], playAction[1]));

                    default:
                        return(0d);
                    }
                }
                else if (sceneContext.IsFriendlyMinion(playAction[0]))
                {
                    if (sceneContext.IsEnemyMinion(playAction[1]))
                    {
                        // Use Minion Attack
                        return(ScoreForMinionAttack(sceneContext, playAction[0], playAction[1]));
                    }

                    return(ScoreForMinionAttackHero(sceneContext, playAction[0], playAction[1]));
                }
                else if (sceneContext.IsObjectType(playAction[0], RockObjectType.FriendlyHeroWeapon))
                {
                    // HeroWeapon Attack
                    return(ScoreForWeaponAttack(sceneContext, playAction[0], playAction[1]));
                }
                else
                {
                    return(0);
                }

            case 3:
            {
                // Use Card with option and on target
            }

            break;
            }

            return(0);
        }