Пример #1
0
        public static void showRate(Info player, Info enemy)
        {
            TextRPG TextRPG = new TextRPG();

            double count = 0;

            // 1000번 실행
            for (int i = 0; i < 1000; i++)
            {
                TextRPG.RandPlayer(player);

                // 10마리 잡음
                for (int j = 0; j < 10; j++)
                {
                    TextRPG.RandEnemy(enemy);

                    while (enemy.health > 0 && player.health > 0)
                    {
                        battle(player, enemy);
                    }

                    if (player.health <= 0)
                    {
                        break;
                    }
                }
                if (player.health > 0)
                {
                    count++;
                }
            }

            Console.WriteLine("승률: " + count / 10 + "%");
        }
Пример #2
0
        public void Restart(Info player)
        {
            TextRPG TextRPG = new TextRPG();

            Console.WriteLine("게임을 재실행합니다.\n");
            Console.ReadKey();
            Console.Clear();

            TextRPG.SetPlayer(player);
            Console.Clear();
        }
Пример #3
0
        public void SetPlayer(Info player)
        {
            Interface Interface = new Interface();
            Commands  Commands  = new Commands();
            TextRPG   TextRPG   = new TextRPG();

            TextRPG.RandPlayer(player);          // 능력치 돌리고
            Interface.PlayerStatInterface();     // 명령어 보여주고
            Interface.PlayerInterface(player);   // 능력치 보여주고
            Commands.PlayerStatCommands(player); // 입력 받음
        }
Пример #4
0
        public void Restart(Info player, Info enemy)
        {
            TextRPG TextRPG = new TextRPG();

            Console.WriteLine("게임을 재실행합니다.\n");
            Console.ReadKey();
            Console.Clear();
            TextRPG.SetPlayer(player);

            TextRPG.count = 0;

            TextRPG.RandEnemy(enemy);
        }
Пример #5
0
        public void PlayerStatCommands(Info player)
        {
            Commands Commands = new Commands();
            TextRPG  TextRPG  = new TextRPG();
            string   command;

            Console.Write("Command : ");
            command = Console.ReadLine().ToLower();   // 소문자로 전환
            switch (command)
            {
            case "-start":
                Console.WriteLine("게임을 시작합니다.");
                Console.ReadKey();
                break;

            case "-restart":
                Commands.Restart(player);
                break;

            case "-reroll":
                Console.WriteLine("능력치를 재설정합니다.");
                Console.ReadKey();
                Console.Clear();
                TextRPG.SetPlayer(player);
                break;

            case "-quit":
                Commands.Quit();
                break;

            default:
                Console.WriteLine("명령어에 해당하지 않는 입력\n");
                PlayerStatCommands(player);
                break;
            }
        }
Пример #6
0
        public static void Main(string[] args)
        {
            Info player = new Info();
            Info enemy  = new Info();

            //승률 확인
            //WinRate.showRate (player, enemy);
            //Console.ReadKey ();

            Interface Interface = new Interface();
            Commands  Commands  = new Commands();
            TextRPG   TextRPG   = new TextRPG();

            // 시작 화면 인터페이스
            Interface.StartInterface();
            Console.ReadKey();
            Console.Clear();

            // goto 문 사용해서 restart시 여기로 (이거 괜찮은 걸까?) => 아닌 걸로 판명

            // 처음 부분으로 돌아가려면?

            // 게임 실행 전 플레이어 능력치 굴림
            TextRPG.SetPlayer(player);
            Console.Clear();


            // reroll 기능 추가

            // start로 실행


            while (count <= 10)
            {
                // interface + count
                Interface.MainInterface();
                if (count == 0)
                {
                    Console.WriteLine("적을 10마리 처치하면 승리!!\n");
                }
                if (enemy.health <= 0 || count == 0)
                {
                    Console.WriteLine(++count + "번째 적을 마주쳤습니다.\n");
                    enemy = new Info();
                    TextRPG.RandEnemy(enemy);
                }
                if (count > 0)
                {
                    Console.WriteLine(count + " / 10");
                }

                // show interface
                Interface.PlayerInterface(player);
                Interface.EnemyInterface(enemy);
                Commands.ReadCommands(player, enemy);

                TextRPG.IsAchivement();

                // 0 health
                if (player.health <= 0)
                {
                    Console.ReadKey();
                    TextRPG.GameOver(player, enemy);
                }

                // kill enemy
                if (enemy.health <= 0)
                {
                    Console.WriteLine("적을 처치했습니다!!\n");
                    // Game Clear
                    if (count > 9)
                    {
                        Console.ReadKey();
                        TextRPG.GameClear(player, enemy);
                    }
                }
                Console.ReadKey();
                Console.Clear();
            }
        }