Exemplo n.º 1
0
        static void Main(string[] args)
        {
            ////////////////////////////////////
            // Used to prevent console resize //
            ////////////////////////////////////
            IntPtr handle  = GetConsoleWindow();
            IntPtr sysMenu = GetSystemMenu(handle, false);

            if (handle != IntPtr.Zero)
            {
                DeleteMenu(sysMenu, SC_CLOSE, MF_BYCOMMAND);
                DeleteMenu(sysMenu, SC_MINIMIZE, MF_BYCOMMAND);
                DeleteMenu(sysMenu, SC_MAXIMIZE, MF_BYCOMMAND);
                DeleteMenu(sysMenu, SC_SIZE, MF_BYCOMMAND);
            }
            ////////////////////////////////////

            //Create the new player
            _player = Player.CreateNewPlayer();
            _player.EquippedWeapon = World.Weapons[1];

            foreach (var item in World.Spells)
            {
                _player.KnownSpells.Add(item);
            }

            //Bools
            bool _gameOver = false;

            //Enum
            State value = State.Exploration;

            ////////////////////////////////////

            _player.CharacterCreation();

            Console.Clear();

            Console.CursorVisible = false;

            UI.Initialize();
            UI.DrawGUI(_player);
            UI.DrawGameScreen();
            UI.DrawPlayer(_player);
            MapManager.DrawMap();

            do
            {
                if (value == State.Exploration)
                {
                    UI.DrawGUI(_player);
                    value = ParseCommand();
                }

                else if (value == State.Battle)
                {
                    Monster _currentMonster = new Monster(standardMonster.Name, standardMonster.Damage, standardMonster.MaxHP, standardMonster.ExperiencePointsValue, standardMonster.GoldValue);

                    Console.Clear();
                    UI.DrawBattleScreen();
                    UI.DrawGUI(_player);

                    Entity dead = NewBattle.StartBattle(_currentMonster, _player);

                    if (dead == _currentMonster)
                    {
                        value = State.Exploration;
                        Console.Clear();
                        UI.DrawGameScreen();
                        MapManager.DrawMap();
                        UI.DrawPlayer(_player);
                    }
                    else
                    {
                        UI.WriteToInfoArea("You are dead. GAME OVER");
                        _gameOver = true;
                    }
                }
            } while (!_gameOver);

            Console.WriteLine("It seems that you have been killed");
            Console.ReadKey();
        }