public override int Rate() { if (OpHeroHp < 1) { return(int.MaxValue); } if (HeroHp < 1) { return(int.MinValue); } float score = 0; score += HeroHp - OpHeroHp; score += BoardZone.Count() - OpBoardZone.Count(); score += HeroAtk - OpHeroAtk; foreach (Minion Minion in BoardZone) { score += MinionScore(Minion, true); } foreach (Minion Minion in OpBoardZone) { score -= MinionScore(Minion, false); } return((int)Math.Round(score)); }
public override int Rate() { // Final actions if (OpHeroHp < 1) { return(Int32.MaxValue); } if (HeroHp < 1) { return(Int32.MinValue); } int result = 0; result += HeroHp * Values[0]; result -= OpHeroHp * Values[1]; result += BoardZone.Count() * Values[2]; result -= OpBoardZone.Count() * Values[3]; result += MinionTotAtk * Values[4]; result -= OpMinionTotAtk * Values[5]; result += MinionTotHealth * Values[6]; result -= OpMinionTotHealth * Values[7]; result += MinionTotHealthTaunt * Values[8]; result -= OpMinionTotHealthTaunt * Values[9]; return(result); }
//Choice cards***can choose a task when you play it private PlayerTask PlayCard(List <PlayerTask> PlayerTaskList, Controller myself, HandZone myHand, BoardZone theBoard, POGame game) { PlayerTask returnTask = null; int maxManaCard = 0; int HighestDamage = 0; int WeaponAttackDamage = 0; //For each valid option, prints all available moves and the cost of the card foreach (PlayerTask task in PlayerTaskList) { if (task.PlayerTaskType == PlayerTaskType.PLAY_CARD) { /*if(task.Target != null){ * Console.WriteLine($"Can Play: {task} Mana: {task.Source.Card.Cost} Target Controller: {task.Target.Controller} Type: {task.Source.Card.Type}"); * } * else{ * Console.WriteLine($"Can Play {task}, {task.Source.Card.Cost} mana. Type: {task.Source.Card.Type}"); * }*/ var cardType = task.Source.Card.Type; if (game.CurrentPlayer.RemainingMana > 0) { if (cardType == CardType.MINION) { //Console.WriteLine(task); //Console.WriteLine($"Entered if statement 0"); if (task.Source.Card.Taunt == true) { //Console.WriteLine($"Entered if statement 1"); if (theBoard.Count() >= 1) { //Console.WriteLine($"Entered if statement 2"); returnTask = task; } } else if (task.Source.Card.Charge == true || task.Source.Card.Rush == true && task.PlayerTaskType == PlayerTaskType.PLAY_CARD && task.Source.Card.Cost >= maxManaCard) { //Adds to the task list because these minions can attack in the same turn //Console.WriteLine($"Entered if statement 3"); maxManaCard = task.Source.Card.Cost; returnTask = task; var mi = new MinionID(); //mi = minion id Minion PlayerMinion = null; Minion OpponentMinion = null; foreach (var x in playerList) { if (x.ToString().Equals(task.Source.ToString())) { PlayerMinion = x; } } int Damage = 0; foreach (var y in opponentList) { if (y.AttackDamage > Damage) { Damage = Damage + y.AttackDamage; OpponentMinion = y; } } mi.playerMinion = PlayerMinion; mi.opponentMinion = OpponentMinion; TurnTaskList.Add(mi); continue; } else { if (task.PlayerTaskType == PlayerTaskType.PLAY_CARD && task.Source.Card.Cost >= maxManaCard) { maxManaCard = task.Source.Card.Cost; returnTask = task; } } } else if (cardType == CardType.SPELL && task.Target != null && task.Target.Controller != myself && task.Target.Health > 0) { //Better way to verify spell target by ID for (int i = 0; i < opponentList.Count(); i++) { if (opponentList[i].Id == task.Target.Id) { returnTask = task; } else if (task.Target.AttackDamage > HighestDamage) { HighestDamage = task.Target.AttackDamage; returnTask = task; } } if (task.Target.Id == game.CurrentOpponent.Hero.Id) { returnTask = task; } continue; } else if (cardType == CardType.WEAPON) { if (task.Source.Card.ATK > WeaponAttackDamage) { WeaponAttackDamage = task.Source.Card.ATK; returnTask = task; } } // can't explicitly target own minions and hero else if (task.Target == null) { maxManaCard = task.Source.Card.Cost; returnTask = task; } } else if (myHand.Count() == 1) { returnTask = task; } else { //Console.WriteLine($"No play card task available"); } } } /*if(returnTask == null){ * Console.WriteLine("Return Playcard task: No card selected"); * } * else{ * Console.WriteLine($"Return PlayCard task: {returnTask}"); * }*/ return(returnTask); }