Beispiel #1
0
 public void getCard(player opponent)
 {
     while (true)
     {
         Console.WriteLine("           ------------------   ");
         Console.WriteLine("you are now " + this.hitPoint.ToString() + "/30 hit point ");
         Console.WriteLine("   your " + this.inHand.Count.ToString() + " card:");
         for (int iCard = 0; iCard < this.inHand.Count; iCard++)
         {
             string tmp = this.inHand[iCard].show();
             Console.WriteLine(iCard.ToString() + "  " + tmp);
         }
         Console.WriteLine("you have " + this.mana.ToString() + "/" + this.manasum.ToString() +
             "  mana crystal");
         Console.WriteLine("your opponent have : " + opponent.getHitPoint().ToString()+" hit point.");
         Console.WriteLine("           ------------------   ");
         Console.Write("please enter which card you want to use or you can enter 'q' to quit.\nenter a number:  ");
         string input = Console.ReadLine();
         if (input == "q")
             break;
         int index = int.Parse(input);
         if (index < 0 | index > this.inHand.Count)
             Console.WriteLine("error input index!");
         else
         {
             if (this.inHand[index].useCard(this, opponent))
                 this.inHand.RemoveAt(index);
         }
         if (opponent.getHitPoint() < 1)
         { break; }
     }
 }
Beispiel #2
0
        public bool getTurn(player opponent)
        {
            bool isOver=false;
            this.pickACard();
            this.manasum +=1;
            if (this.manasum > 10)
                this.manasum = 10;
            this.mana = this.manasum;
            Console.WriteLine("Now, " + this.name + ", this is your turn.");
            this.getCard(opponent);

            if (opponent.getHitPoint() < 1)
                isOver = true;
            return isOver;
        }