Beispiel #1
0
            public override void Do(OneCard system, Player who, List <Player> Players)
            {
K:
                bool OneMore = false;

                CardInfo.Shape tempcard = CardInfo.Shape.None;
                bool           IsJ      = false;
                bool           IsSeven  = false;

                Console.WriteLine("카드를 낼시간");
                Console.ForegroundColor = ConsoleColor.Green;
                Console.WriteLine("마지막카드" + system.LastCard);
                Console.ForegroundColor = ConsoleColor.Gray;
                if (system.Attack != 0)
                {
                    Console.ForegroundColor = ConsoleColor.Red;
                    Console.WriteLine("경고! 공격받는중" + system.Attack + "장!");
                    Console.ForegroundColor = ConsoleColor.Gray;
                }
                for (int i = 0; i != Cards.Count; i++)
                {
                    Cards[i].ID = i;
                    Console.WriteLine(i + ":" + Cards[i]);
                }
                Console.WriteLine("먹을려면" + Cards.Count);
                int want = 0;

                try
                {
                    want = int.Parse(Console.ReadLine());
                }
                catch (FormatException e)
                {
                    Console.ForegroundColor = ConsoleColor.DarkRed;
                    Console.WriteLine("올바른 입력이 아닙니다");
                    Console.ForegroundColor = ConsoleColor.Gray;

                    goto K;
                }
                if (want == Cards.Count)
                {
                    if (system.Attack != 0)
                    {
                        for (int j = 0; j != system.Attack; j++)
                        {
                            Console.ForegroundColor = ConsoleColor.White;
                            Console.WriteLine(ID + ": " + system.Take(ref who) + "먹음");
                            Console.ForegroundColor = ConsoleColor.Gray;
                        }
                        system.Attack = 0;
                    }
                    else
                    {
                        Console.ForegroundColor = ConsoleColor.White;
                        Console.WriteLine(ID + ": " + system.Take(ref who) + "먹음");
                        Console.ForegroundColor = ConsoleColor.Gray;
                    }
                    goto Exit;
                }
                if (want > Cards.Count)
                {
                    Console.ForegroundColor = ConsoleColor.DarkRed;
                    Console.WriteLine("올바른 입력이 아닙니다");
                    Console.ForegroundColor = ConsoleColor.Gray;

                    goto K;
                }
                CardInfo card = Cards[want];

                if (system.Attack != 0) //공격받는중
                {
                    if (system.Vaildate(card))
                    {
                        switch (card.Card_Number)
                        {
                        case 1:
                            //A
                            system.Attack += 3;
                            break;

                        case 2:
                            system.Attack += 2;
                            break;

                        case 3:
                            system.Attack = 0;
                            break;
                        }
                        switch (card.Card_Shape)
                        {
                        case CardInfo.Shape.BlackJocker:
                            system.Attack += 5;
                            break;

                        case CardInfo.Shape.ColorJocker:
                            system.Attack += 10;
                            break;
                        }
                        Console.WriteLine(ID + ": 공격대응 " + card + "제출");
                        system.Play(card, ref who, false);
                        if (OneMore)
                        {
                            goto K;
                        }

                        goto Exit;
                    }
                    else
                    {
                        Console.ForegroundColor = ConsoleColor.Red;
                        Console.WriteLine("올바른 카드가 아닙니다!");
                        Console.ForegroundColor = ConsoleColor.Gray;
                        goto K;
                    }
                }
                else //평상시
                {
                    if (system.Vaildate(card))
                    {
                        switch (card.Card_Number)
                        {
                        case 1:
                            //A
                            system.Attack += 3;
                            break;

                        case 2:
                            system.Attack += 2;
                            break;

                        case 3:
                            system.Attack = 0;
                            break;

                        case 11:
                            //J
                            IsJ = true;
                            break;

                        case 12:
                            //Q
                            system.GameTurn.Reverse(system);
                            break;

                        case 13:
                            //K
                            OneMore = true;
                            break;

                        case 7:
                            Console.ForegroundColor = ConsoleColor.Blue;
                            Console.WriteLine("무슨 모양으로 변경하겠습니까?");
                            Console.WriteLine("1. 다이아 2.하트 3.스페이드 4. 클로버");
                            try
                            {
                                tempcard = (CardInfo.Shape) int.Parse(Console.ReadLine());
                            }
                            catch (FormatException e)
                            {
                                Console.ForegroundColor = ConsoleColor.Red;
                                Console.WriteLine("올바른 입력이 아닙니다");
                                goto K;
                            }
                            system.LastCard = new CardInfo(tempcard, 7)
                            {
                                temp = true
                            };
                            IsSeven = true;
                            Console.ForegroundColor = ConsoleColor.Gray;
                            break;
                        }

                        switch (card.Card_Shape)
                        {
                        case CardInfo.Shape.BlackJocker:
                            system.Attack += 5;
                            break;

                        case CardInfo.Shape.ColorJocker:
                            system.Attack += 10;
                            break;
                        }

                        Console.WriteLine(ID + ": " + card + "제출 남은 카드 " + Cards.Count);
                        if (tempcard != CardInfo.Shape.None)
                        {
                            Console.WriteLine("카드 모양 변경: " + tempcard);
                        }

                        system.Play(card, ref who, IsSeven);
                        if (OneMore)
                        {
                            goto K;
                        }

                        goto Exit;
                    }
                    else
                    {
                        Console.WriteLine("올바른 카드가 아닙니다!");
                        goto K;
                    }
                }
Exit:
                if (who.Cards.Count >= 20)
                {
                    system.Bankrupt(who);
                }

                Console.WriteLine(ID + ": " + Cards.Count + "장");
                system.GameTurn.Next(system, Players, IsJ);
            }
Beispiel #2
0
            public override void Do(OneCard system, Player who, List <Player> Players)
            {
K:
                bool Card_found = false;
                bool OneMore = false;

                CardInfo.Shape tempcard = CardInfo.Shape.None;
                bool           IsJ      = false;
                bool           IsSeven  = false;

                if (system.Attack != 0) //공격받는중
                {
                    for (int i = 0; i < Cards.Count; i++)
                    {
                        CardInfo card = Cards[i];
                        if (system.Vaildate(card))
                        {
                            switch (card.Card_Number)
                            {
                            case 1:
                                //A
                                system.Attack += 3;
                                break;

                            case 2:
                                system.Attack += 2;
                                break;

                            case 3:
                                system.Attack = 0;
                                break;
                            }
                            switch (card.Card_Shape)
                            {
                            case CardInfo.Shape.BlackJocker:
                                system.Attack += 5;
                                break;

                            case CardInfo.Shape.ColorJocker:
                                system.Attack += 10;
                                break;
                            }
                            Console.WriteLine(ID + ": 공격대응 " + card + "제출");
                            Card_found = true;
                            system.Play(card, ref who, false);
                            if (OneMore)
                            {
                                goto K;
                            }

                            goto Exit;
                        }
                    }
                    if (!Card_found)
                    {
                        Card_found = false;
                        for (int j = 0; j != system.Attack; j++)
                        {
                            Console.WriteLine(ID + ": " + system.Take(ref who) + "먹음");
                        }
                        system.Attack = 0;
                        goto Exit;
                    }
                }
                else //평상시
                {
                    for (int i = 0; i < Cards.Count; i++)
                    {
                        CardInfo card = Cards[i];
                        if (system.Vaildate(card))
                        {
                            switch (card.Card_Number)
                            {
                            case 1:
                                //A
                                system.Attack += 3;
                                break;

                            case 2:
                                system.Attack += 2;
                                break;

                            case 3:
                                system.Attack = 0;
                                break;

                            case 11:
                                //J
                                IsJ = true;
                                break;

                            case 12:
                                //Q
                                system.GameTurn.Reverse(system);
                                break;

                            case 13:
                                //K
                                OneMore = true;
                                break;

                            case 7:
                                int[] Check_list = new int[5];
                                if (Cards.Count != 0)
                                {
                                    foreach (CardInfo Check_card in Cards)
                                    {
                                        switch (Check_card.Card_Shape)
                                        {
                                        case CardInfo.Shape.Spade:
                                            Check_list[3]++;
                                            break;

                                        case CardInfo.Shape.Heart:
                                            Check_list[2]++;
                                            break;

                                        case CardInfo.Shape.Diamond:
                                            Check_list[1]++;
                                            break;

                                        case CardInfo.Shape.Clover:
                                            Check_list[4]++;
                                            break;
                                        }
                                    }
                                    tempcard        = (CardInfo.Shape)Check_list.ToList().IndexOf(Check_list.Max());
                                    system.LastCard = new CardInfo(tempcard, 7)
                                    {
                                        temp = true
                                    };
                                    IsSeven = true;
                                }
                                break;
                            }

                            switch (card.Card_Shape)
                            {
                            case CardInfo.Shape.BlackJocker:
                                system.Attack += 5;
                                break;

                            case CardInfo.Shape.ColorJocker:
                                system.Attack += 10;
                                break;
                            }
                            Console.ForegroundColor = ConsoleColor.DarkYellow;
                            Console.WriteLine(ID + ": " + card + "제출 남은 카드 " + Cards.Count);
                            if (tempcard != CardInfo.Shape.None)
                            {
                                Console.WriteLine("카드 모양 변경: " + tempcard);
                            }
                            Console.ForegroundColor = ConsoleColor.Gray;

                            Card_found = true;
                            system.Play(card, ref who, IsSeven);
                            if (OneMore)
                            {
                                goto K;
                            }

                            goto Exit;
                        }
                    }
                    if (!Card_found)
                    {
                        Card_found = false;
                        Console.WriteLine(ID + ": " + system.Take(ref who) + "먹음");
                        goto Exit;
                    }
                }
Exit:
                if (who.Cards.Count >= 20)
                {
                    system.Bankrupt(who);
                }
                Console.ForegroundColor = ConsoleColor.DarkYellow;
                Console.WriteLine(ID + ": " + Cards.Count + "장");
                if (Cards.Count == 1)
                {
                    SpeechSynthesizer synthesizer = new SpeechSynthesizer
                    {
                        Volume = 100, // 0...100
                        Rate   = 7    // -10...10
                    };

                    synthesizer.Speak("OneCard");
                }
                Console.ForegroundColor = ConsoleColor.Gray;
                system.GameTurn.Next(system, Players, IsJ);
            }