/// <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); }
/// <summary> /// Generate a sample RockHero. /// </summary> /// <returns>A RockHero.</returns> private static RockHero GenerateRockHero() { var rockHero = new RockHero(); return(rockHero); }
/// <summary> /// Snapshot a Hero. /// </summary> /// <param name="player">The Player.</param> /// <returns>The RockHero.</returns> private static RockHero SnapshotHero(Player player) { var rockHero = new RockHero(); var heroEntity = player.GetHero(); switch (player.GetHeroCard().GetEntity().GetClass()) { case TAG_CLASS.WARLOCK: rockHero.Class = RockHeroClass.Warlock; break; case TAG_CLASS.HUNTER: rockHero.Class = RockHeroClass.Hunter; break; case TAG_CLASS.DRUID: rockHero.Class = RockHeroClass.Druid; break; case TAG_CLASS.PALADIN: rockHero.Class = RockHeroClass.Paladin; break; case TAG_CLASS.ROGUE: rockHero.Class = RockHeroClass.Rogue; break; case TAG_CLASS.SHAMAN: rockHero.Class = RockHeroClass.Shaman; break; case TAG_CLASS.WARRIOR: rockHero.Class = RockHeroClass.Warrior; break; case TAG_CLASS.PRIEST: rockHero.Class = RockHeroClass.Priest; break; case TAG_CLASS.MAGE: rockHero.Class = RockHeroClass.Mage; break; default: rockHero.Class = RockHeroClass.None; break; } rockHero.RockId = heroEntity.GetEntityId(); rockHero.Name = heroEntity.GetName(); rockHero.CardId = heroEntity.GetCardId(); rockHero.Damage = heroEntity.GetATK(); rockHero.CanAttack = heroEntity.CanAttack(); rockHero.IsExhausted = heroEntity.IsExhausted(); rockHero.Health = heroEntity.GetRealTimeRemainingHP(); rockHero.IsQuest = heroEntity.IsQuest(); rockHero.IsSecret = heroEntity.IsSecret(); return(rockHero); }