Exemple #1
0
        public void PickTurnAction(Player p)
        {
            Console.WriteLine($"{p.Name}'s turn!");
            //Movement is the speed of the slowest hero
            int  moves = CalculatePartyMovement(p.Heroes);
            int  num   = 0;
            bool done  = false;

            while (!done)
            {
                Console.WriteLine($"Turn: {currentTurn}");
                Console.WriteLine($"You have {moves} moves left");
                Console.WriteLine("What would you like to do?");
                Console.WriteLine("1) Build");
                Console.WriteLine("2) Explore");
                Console.WriteLine("3) Fight");
                Console.WriteLine("4) End Turn");
                try
                {
                    string input = Console.ReadLine();
                    num = int.Parse(input);
                    switch (num)
                    {
                    case 1:
                        Console.WriteLine("Building not implemented yet");
                        break;

                    case 2:
                        if (moves > 0)
                        {
                            Console.WriteLine("Lets go exploring!");
                            Encounter e = EncounterFactory.GetRandomEncounter(p);
                            e.RunEvent();
                            moves--;
                        }
                        break;

                    case 3:
                        if (moves > 0)
                        {
                            Console.WriteLine("Let's go spoiling for a fight");
                            Player    enemy  = new Player("Evil boyo");
                            Hero      badguy = new Hero(enemy, "French Stewart");
                            Encounter e      = new BattleEvent(p, enemy);
                            e.RunEvent();
                            moves--;
                        }
                        break;

                    case 4:
                        Console.WriteLine("Turn is done!");
                        done = true;
                        break;
                    }
                }
                catch (Exception)
                {
                    Console.WriteLine("I didn't understand, let's try that again");
                    continue;
                }
            }
        }