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

            if (card.CardId == "GAME_005")
            {
                // the coin
                foreach (RockCard handCard in sceneContext.Scene.Self.Cards)
                {
                    if (handCard.Cost == sceneContext.Scene.Self.Resources + 1)
                    {
                        return(4.5);
                    }
                }

                return(-4);
            }

            double score = 4;

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

            score -= wastedCost * 0.4d;

            if (sceneContext.Scene.Self.Cards.Count >= 5)
            {
                score += 0.5;
            }

            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 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 #3
0
        /// <summary>
        /// Compute score for using a HeroPower.
        /// </summary>
        /// <param name="sceneContext">The RockSceneContext</param>
        /// <param name="cardRockId">The RockId of HeroPower</param>
        /// <returns>The score in double</returns>
        private static double ScoreForUseHeroPower(RockSceneContext sceneContext, int cardRockId)
        {
            double   score = 4; // initial score
            RockCard card  = sceneContext.GetRockCard(cardRockId);

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

            score -= wastedCost * 0.4d;

            return(score);
        }
Example #4
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 #5
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);
        }