private void Combat()
        {
            Console.Clear();
            //bField.TerrainData[bField.SpawnPoints[0].YVal, bField.SpawnPoints[0].XVal].SpawnCharacter(player);
            //bField.TerrainData[bField.SpawnPoints[1].YVal, bField.SpawnPoints[1].XVal].SpawnCharacter(enemy);

            //Main Print Loop
            while (player.Health > 0 && enemy.Health > 0)
            {
                Console.Clear();
                Console.WriteLine();
                Console.WriteLine();

                PrintMaps.Print(bField.TerrainData, 4, 7, bField.SpawnPoints[0], true);
                PrintHeader();

                ConsoleKey key;

                //PLAYER TURN
                if (playerTurn)
                {
                    PrintPlayerOptions();
                    key = Console.ReadKey(true).Key;
                    switch (key)
                    {
                    case ConsoleKey.UpArrow:
                        if (selection < 3 && selection > 0)
                        {
                            selection--;
                        }
                        break;

                    case ConsoleKey.DownArrow:
                        if (selection < 2 && selection > -1)
                        {
                            selection++;
                        }
                        break;

                    case ConsoleKey.Enter:
                        switch (selection)
                        {
                        case 0:
                            PrintPlayerTurn(player.AssignedMoves[0]);
                            break;

                        case 1:
                            PrintPlayerTurn(player.AssignedMoves[1]);
                            break;

                        case 2:
                            PrintPlayerTurn(player.AssignedMoves[2]);
                            break;
                        }
                        playerTurn = false;
                        break;

                    case ConsoleKey.I:
                        InventoryController.ShowInventory(Program.PlayerInventory);
                        PrintPlayerOptions();
                        break;

                    default:
                        break;
                    }
                }
                //ENEMY TURN
                else
                {
                    PrintEnemyOptions();
                    key = Console.ReadKey(true).Key;
                    switch (key)
                    {
                    case ConsoleKey.Enter:
                        switch (enemy.CombatChoice())
                        {
                        case 1:
                            PrintEnemyTurn(enemy.StandardMove1);
                            break;

                        case 2:
                            PrintEnemyTurn(enemy.StandardMove2);
                            break;

                        case 3:
                            PrintEnemyTurn(enemy.PowerMove1);
                            break;

                        case 4:
                            PrintEnemyTurn(enemy.SupportMove1);
                            break;

                        default:
                            Console.WriteLine("Error with enemy AI");
                            break;
                        }
                        playerTurn = true;
                        break;

                    default:
                        break;
                    }
                }
            }
            Console.SetCursorPosition(Program.SideBuffer.Length, 19);
            if (player.Health > 0)
            {
                Program.PrintCenterLine("You won!");
                enemy.Die();
                Console.ReadKey(true);
            }
            else
            {
                Program.PrintCenterLine("You lost!");
                Console.ReadKey(true);
            }
            Console.Clear();
        }
Esempio n. 2
0
 private static void PrintMap(bool color)
 {
     PrintMaps.Print(currentMap.TerrainData, YBuffer, XBuffer, p1.Position, color);
 }