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

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

            score -= wastedCost * 0.4d;

            var target = sceneContext.GetRockObject(targetRockId);

            switch (target.ObjectType)
            {
            case RockObjectType.EnemyHero:
                score -= 5d;
                break;

            case RockObjectType.EnemyMinion:
                // but in some special case, we will want to heal them
                score -= 5d;
                break;

            case RockObjectType.FriendlyHero:
                RockHero hero = (RockHero)target.Object;
                if (hero.Health < 30)
                {
                    score += 0.5d;
                }
                else
                {
                    return(0);
                }

                score += (30 - hero.Health) * 0.05;

                break;

            case RockObjectType.FriendlyMinion:
                RockMinion minion = (RockMinion)target.Object;
                if (minion.Health < minion.BaseHealth)
                {
                    score += minion.Damage * 0.4d;
                }

                break;

            default:
                break;
            }

            return(score);
        }
Example #2
0
        /// <summary>
        /// Compute score for using a HeroPower.
        /// </summary>
        /// <param name="sceneContext">The RockSceneContext</param>
        /// <param name="cardRockId">The RockId of HeroPower</param>
        /// <param name="targetRockId">The RockId of Target</param>
        /// <returns>The score in double</returns>
        private static double ScoreForUseMageHeroPower(RockSceneContext sceneContext, int cardRockId, int targetRockId)
        {
            double   score = 4; // initial score
            RockCard card  = sceneContext.GetRockCard(cardRockId);

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

            score -= wastedCost * 0.4d;

            var target = sceneContext.GetRockObject(targetRockId);

            switch (target.ObjectType)
            {
            case RockObjectType.FriendlyHero:
                score -= 5d;
                break;

            case RockObjectType.FriendlyMinion:
                score -= 5d;
                break;

            case RockObjectType.EnemyHero:
                score += 0.1d;
                break;

            case RockObjectType.EnemyMinion:
                score += 0.1d;
                if (((RockMinion)target.Object).Health < 2)
                {
                    score += ((RockMinion)target.Object).Damage;
                }

                break;

            default:
                break;
            }

            return(score);
        }