示例#1
0
 private void applyAIAction(Robert agent)
 {
     switch (agent.actionType)
     {
         case "Desperation":
         case "Super Desperation":
             if ((agent.cardToPlay != 2) && (agent.cardToPlay != 1) && (agent.cardToPlay != 3) && (agent.cardToPlay != 38) && (agent.cardToPlay != 81) && (agent.cardToPlay != 37) && (agent.cardToPlay != 79))
             {
                 applyEvent(AI, agent.cardToPlay, agent.targets, agent.targetAmounts);
             }
             else
             {
                 game.scoreRegion(agent.cardToPlay);
             }
             playCard(AI, agent.cardToPlay, true, false);
             break;
         case "Scoring":
             game.scoreRegion(agent.cardToPlay);
             playCard(AI, agent.cardToPlay, true, false);
             break;
         case "Event":
             applyEvent(AI, agent.cardToPlay, agent.targets, agent.targetAmounts);
             playCard(AI, agent.cardToPlay, true, false);
             break;
         case "SpaceRace":
             attemptSpaceRace(AI);
             playCard(AI, agent.cardToPlay, false, true);
             break;
         case "Realingment":
             //need to make sure apropriate number of realingments are made
             foreach (int target in agent.targets)
             {
                 attempRealignment(AI, target);
             }
             playCard(AI, agent.cardToPlay, false, false);
             break;
         case "Coup":
             attemptCoup(AI, agent.targets[0], agent.targetAmounts[0]);
             playCard(AI, agent.cardToPlay, false, false);
             break;
         case "Inital Placement":
             for (int i = 0; i < agent.targets.Count; i++)
             {
                 placeInfluence(AI, agent.targets[i], agent.targetAmounts[i]);
             }
             break;
         case "Place Influence":
             for (int i = 0; i < agent.targets.Count; i++)
             {
                 placeInfluence(AI, agent.targets[i], agent.targetAmounts[i]);
             }
             playCard(AI, agent.cardToPlay, false, false);
             break;
     }
 }
示例#2
0
 public void getAiMove()
 {
     Robert rob = new Robert(game, AI);
     AiOuput = rob.actionType + "\r\n";
     if (AI == 1)
     {
         Card card = new Card();
         foreach (Card crd in game.cards.usHand)
         {
             if (crd.id == rob.cardToPlay)
             {
                 card = crd;
                 break;
             }
         }
         AiOuput = AiOuput + "Card to Play: " + card.name + "\r\nOPS Value: " + card.opsValue.ToString() + "\r\n";
     }
     else
     {
         Card card = new Card();
         foreach (Card crd in game.cards.ussrHand)
         {
             if (crd.id == rob.cardToPlay)
             {
                 card = crd;
                 break;
             }
         }
         AiOuput = AiOuput + "Card to Play: " + card.name + "\r\nOPS Value: " + card.opsValue.ToString() + "\r\n";
     }
     if (rob.targets.Count == rob.targetAmounts.Count)
     {
         for (int i = 0; i < rob.targets.Count; i++)
         {
             AiOuput = AiOuput + "Target: " + game.countryLst.countries[rob.targets[i]].name + " Amount: " + rob.targetAmounts[i].ToString() + "\r\n";
         }
     }
     //in case something breaks
     else
     {
         foreach (var x in rob.targets)
         {
             AiOuput = AiOuput + "Target: " + game.countryLst.countries[x].name + "\r\n";
         }
         foreach(var y in rob.targetAmounts)
         {
             AiOuput = AiOuput + "Amount: " + y.ToString() + "\r\n";
         }
         AiOuput = AiOuput + "Something didn't quite go right\r\n";
     }
     applyAIAction(rob);
 }