Beispiel #1
0
 public CharInventory(Character owner, Screen screen)
 {
     _screen    = screen;
     _exception = new CombatException(_screen);
     Owner      = owner;
     AddItem();     // FIX LATER
 }
Beispiel #2
0
 public PlayerTurn(Match match, Screen screen, Player player, Character enemy, CombatException exception)
 {
     _match     = match;
     _screen    = screen;
     _player    = player;
     _enemy     = enemy;
     _exception = exception;
 }
Beispiel #3
0
        static void Main(string[] args)       // Change to Main2() when testing
        {
            // ----------- INITIALIZATION -------------

            Player          p  = new Player();
            BlackKnight     bk = new BlackKnight();
            Screen          s  = new Screen(p, bk);
            CombatException e  = new CombatException(s);
            Match           m  = new Match(s);
            PlayerTurn      pt = new PlayerTurn(m, s, p, bk, e);
            EnemyTurn       et = new EnemyTurn(m, s, p, bk);

            m.SetUpFight(p, bk);   // Used for setting up opponents and Screen class for the combat

            // ------------ FIRST CHOICE --------------

            int startingChoice = 0;

            while (startingChoice != 1 && startingChoice != 2)   // Locks the player until he/she chooses a valid option
            {
                Console.Clear();

                s.Encounter();     // Make it possible to fight other opponents later

                try
                {
                    startingChoice = int.Parse(Console.ReadLine());

                    switch (startingChoice)
                    {
                    case 1:
                        Console.Clear();
                        s.PrepareFight();
                        Thread.Sleep(4000);
                        break;

                    case 2:
                        Console.Clear();
                        s.Flee();
                        break;

                    default:
                        e.InvalidChoice();
                        break;
                    }
                }
                catch
                {
                    e.InvalidChoice();
                }
            }


            // ---------------- TURNS -------------------

            while (startingChoice == 1 && m.MatchInProgress)
            {
                // ----- Player Turn -----

                pt.Turn();

                // ----- Enemy Turn -----

                et.Turn();
            }
        }