コード例 #1
0
 public virtual bool ChooseDefenseCard()
 {
     Console.WriteLine();
     if (playerDefenseCards.Count > 0)
     {
         Console.WriteLine("Please select a defense card to mount");
         for (int i = 0; i < playerDefenseCards.Count; i++)
         {
             Console.WriteLine((i + 1) + ": " + playerDefenseCards[i].Name + " - " + (playerDefenseCards[i].Defense * 100) + "% chance of deflect");
         }
         int userChoice = Int32.Parse(Console.ReadLine());
         MountCard(playerDefenseCards[userChoice - 1]);
         Console.WriteLine();
         return(true);
     }
     else
     {
         if (playerAttackCards.Count > 0)
         {
             Console.WriteLine("You are all out of defense cards. You must play an attack card now");
             ChooseAttackCard();
         }
         else
         {
             Console.WriteLine("You are all out of cards. Generating a defense card for you...");
             MountCard(CardDealer.GenerateDefenseCard(this));
         }
         return(false);
     }
 }
コード例 #2
0
 public override bool ChooseDefenseCard()
 {
     if (playerDefenseCards.Count > 0)
     {
         MountCard(playerDefenseCards[r.Next(0, playerDefenseCards.Count)]);
         return(true);
     }
     else
     {
         Console.WriteLine("Your opponent is out of defense cards. Generating one...");
         MountCard(CardDealer.GenerateDefenseCard(this));
         return(false);
     }
 }