コード例 #1
0
        public void AccessChest()
        {
            var exit = false;

            while (!exit)
            {
                PrintChestMenu();
                switch (GameService.ParseIntput())
                {
                case 1:
                    GameService.NewPage("\nWhich item would you like to take?", "chest");
                    Console.ReadKey();
                    break;

                case 2:
                    GameService.NewPage("\nWhich item would you like to store?", "chest");
                    Console.ReadKey();
                    break;

                case 3:
                    exit = true;
                    break;

                default:
                    Console.WriteLine("Invalid input");
                    Console.ReadKey();
                    break;
                }
            }
        }
コード例 #2
0
        private bool SaveAndQuit()
        {
            var confirm   = false;
            var confirmed = false;

            while (!confirmed)
            {
                GameService.NewPage("\nAre you sure you want to Save and Quit?" +
                                    "\n1) Yes I want to save and quit" +
                                    "\n2) No I want to return to the game", "saveQuit");
                confirmed = true;
                switch (GameService.ParseIntput())
                {
                case 1:
                    _saveServices.SaveGame(_characterSuperModel);
                    confirm = true;
                    break;

                case 2:
                    break;

                default:
                    confirmed = false;
                    Console.WriteLine("Invalid input.");
                    Console.ReadKey();
                    break;
                }
            }
            return(confirm);
        }
コード例 #3
0
ファイル: CityServices.cs プロジェクト: JTux/RPGConsoleGame
        private void GuildStore()
        {
            bool leaveStore = false;

            while (!leaveStore)
            {
                PrintStoreMenu();
                _saveServices.SaveGame(_characterSuperModel);
                switch (GameService.ParseIntput())
                {
                case 1:
                    ShopWeapons();
                    break;

                case 2:
                    GameService.NewPage("No refunds! Go away!", "inv");
                    Console.ReadKey();
                    break;

                case 3:
                    BuyPotion();
                    break;

                case 4:
                    leaveStore = true;
                    break;

                default:
                    Console.WriteLine("Invalid input.");
                    Console.ReadKey();
                    break;
                }
            }
        }
コード例 #4
0
        private void ChooseCombatStyle()
        {
            var exit = false;

            while (!exit)
            {
                exit = true;
                PrintStyleMenu();
                switch (GameService.ParseIntput())
                {
                case 1:
                    _characterSuperModel.CombatStyle = StyleType.Melee;
                    break;

                case 2:
                    _characterSuperModel.CombatStyle = StyleType.Ranged;
                    break;

                case 3:
                    _characterSuperModel.CombatStyle = StyleType.Mage;
                    break;

                default:
                    exit = false;
                    Console.WriteLine("Invalid input");
                    Console.ReadKey();
                    break;
                }
            }
            Console.WriteLine("Style set!");
            Console.ReadKey();
        }
コード例 #5
0
ファイル: CityServices.cs プロジェクト: JTux/RPGConsoleGame
        private void ShopWeapons()
        {
            var exit = false;

            while (exit != true)
            {
                var cat            = "";
                var chosenCategory = false;
                while (!chosenCategory)
                {
                    chosenCategory = true;
                    PrintShopCategory();
                    _saveServices.SaveGame(_characterSuperModel);
                    switch (GameService.ParseIntput())
                    {
                    case 1:
                        cat = "melee";
                        break;

                    case 2:
                        cat = "ranged";
                        break;

                    case 3:
                        cat = "magic";
                        break;

                    case 4:
                        exit = true;
                        break;

                    default:
                        chosenCategory = false;
                        Console.WriteLine("Invalid input");
                        Console.ReadKey();
                        break;
                    }
                }
                if (exit == true)
                {
                    break;
                }

                var canBuyItems = GetShopItems(cat);
                BuyWeapon(canBuyItems, cat);
            }
        }
コード例 #6
0
        public bool OpenInventory()
        {
            var exit = false;

            while (!exit)
            {
                PrintInvMenu();
                switch (GameService.ParseIntput())
                {
                case 1:
                    PrintCurrentItems();
                    break;

                case 2:
                    PrintCurrentAttacks();
                    break;

                case 3:
                    ChooseCombatStyle();
                    break;

                case 4:
                    if (SaveAndQuit())
                    {
                        return(true);
                    }
                    else
                    {
                        break;
                    }

                case 5:
                    exit = true;
                    break;

                default:
                    Console.WriteLine("Invalid input");
                    Console.ReadKey();
                    break;
                }
            }
            _saveServices.SaveGame(_characterSuperModel);
            return(false);
        }
コード例 #7
0
ファイル: CityServices.cs プロジェクト: JTux/RPGConsoleGame
        private void VisitGuildMaster(string guildName)
        {
            var guildKey = "";

            switch (guildName)
            {
            case "Melee":
                guildKey = "meleeGuild";
                break;

            case "Ranged":
                guildKey = "archerGuild";
                break;

            case "Mage":
                guildKey = "mageGuild";
                break;
            }

            var exit = false;

            while (!exit)
            {
                exit = true;

                GameService.NewPage($"\nYou approach the {guildName} Guild Master and..." +
                                    $"\n1) Learn new Attacks" +
                                    $"\n2) Leave", guildKey);
                switch (GameService.ParseIntput())
                {
                case 1:
                    LearnAttacks(_characterSuperModel, guildName);
                    break;

                case 2:
                    break;

                default:
                    Console.WriteLine("Invalid input");
                    Console.ReadKey();
                    break;
                }
            }
        }
コード例 #8
0
        public bool RunMenu()
        {
            var leaveVillage = false;

            while (!leaveVillage)
            {
                PrintMenuOptions();
                _saveServices.SaveGame(_characterSuperModel);
                var input = GameService.ParseIntput();
                switch (input)
                {
                case 1:
                    GameService.NewPage("\nYou go knock on the elder's door to recieve instruction. After a minute or so of waiting you realize no one is home." +
                                        "\nOff in the distance you hear someone muttering something about maybe not waiting until the weekend next time and actually\n" +
                                        "implementing features they advertise. Then again, maybe you're hearing things. It's okay though, you don't need handholding.", "elder");
                    Console.ReadKey();
                    break;

                case 2:
                    GoHome();
                    break;

                case 3:
                    bool leaveFromInv = _inventoryServices.OpenInventory();
                    if (leaveFromInv)
                    {
                        return(false);
                    }
                    break;

                case 4:
                    leaveVillage = Leave();
                    break;

                default:
                    Console.WriteLine("Invalid input.");
                    Console.ReadKey();
                    break;
                }
            }
            return(leaveVillage);
        }
コード例 #9
0
ファイル: CityServices.cs プロジェクト: JTux/RPGConsoleGame
        private void BuyWeapon(List <Equipment> shoppingList, string key)
        {
            var shopping = true;

            while (shopping)
            {
                PrintShopItems(shoppingList, key);
                var response     = GameService.ParseIntput();
                var existingItem = shoppingList.FirstOrDefault(i => i.GearID == response);
                if (existingItem != null)
                {
                    _characterSuperModel.CharacterEquipment.Add(existingItem);
                    break;
                }
                Console.WriteLine("Invalid input");
                Console.ReadKey();
            }
            Console.WriteLine("Item bought!");
            Console.ReadKey();
        }
コード例 #10
0
        private bool Leave()
        {
            var leave  = false;
            var output = false;

            while (!leave)
            {
                PrintLeaveMenu();
                leave = true;
                switch (GameService.ParseIntput())
                {
                case 1:
                    var isDead = _exploringServices.Explore();
                    if (isDead)
                    {
                        GameService.NewPage("You slowly open your eyes. \"Wha.. what happened?\"\n" +
                                            "Near your bed you find a note a note. It reads:\n\n" +
                                            "\"Found you beaten and bruised out by the road. What kind of champion are you trying to be? Don't do it again.\"");
                        _characterSuperModel.CharacterHealth = _characterSuperModel.CharacterMaxHealth;
                        Console.ReadKey();
                    }
                    output = false;
                    break;

                case 2:
                    output = true;
                    break;

                case 3:
                    output = false;
                    break;

                default:
                    Console.WriteLine("Invalid input");
                    leave = false;
                    Console.ReadKey();
                    break;
                }
            }
            return(output);
        }
コード例 #11
0
        private void GoHome()
        {
            var leaveHome = false;

            while (!leaveHome)
            {
                PrintHomeMenu();
                var input = GameService.ParseIntput();
                switch (input)
                {
                case 1:
                    _inventoryServices.AccessChest();
                    break;

                case 2:
                    if ((_characterSuperModel.CharacterHealth += healthFromPlayerBed) > _characterSuperModel.CharacterMaxHealth)
                    {
                        _characterSuperModel.CharacterHealth = _characterSuperModel.CharacterMaxHealth;
                    }
                    else
                    {
                        _characterSuperModel.CharacterHealth += healthFromPlayerBed;
                    }
                    GameService.NewPage($"You sleep in your bed and recover {healthFromPlayerBed} HP." +
                                        $"\nYou now have {_characterSuperModel.CharacterHealth}/{_characterSuperModel.CharacterMaxHealth} HP.");
                    Console.ReadLine();
                    break;

                case 3:
                    leaveHome = true;
                    break;

                default:
                    Console.WriteLine("Invalid input");
                    Console.ReadKey();
                    break;
                }
            }
        }
コード例 #12
0
ファイル: CityServices.cs プロジェクト: JTux/RPGConsoleGame
        private void GuildMenu()
        {
            bool leaveGuild = false;

            while (!leaveGuild)
            {
                PrintGuildMenu();
                _saveServices.SaveGame(_characterSuperModel);
                switch (GameService.ParseIntput())
                {
                case 1:
                    GuildStore();
                    break;

                case 2:
                    VisitGuildMaster("Melee");
                    break;

                case 3:
                    VisitGuildMaster("Ranged");
                    break;

                case 4:
                    VisitGuildMaster("Mage");
                    break;

                case 5:
                    leaveGuild = true;
                    break;

                default:
                    Console.WriteLine("Invalid input.");
                    Console.ReadKey();
                    break;
                }
            }
        }
コード例 #13
0
ファイル: CityServices.cs プロジェクト: JTux/RPGConsoleGame
        public bool RunMenu()
        {
            bool leaveCity = false;

            while (!leaveCity)
            {
                PrintMenuOptions();
                _saveServices.SaveGame(_characterSuperModel);
                var input = GameService.ParseIntput();
                switch (input)
                {
                case 1:
                    GuildMenu();
                    break;

                case 2:
                    EnterArena();
                    if (_characterSuperModel.IsDead)
                    {
                        GameService.NewPage("You slowly open your eyes. \"Wha.. what happened?\"\n" +
                                            "Near your bed you find a note a note. It reads:\n\n" +
                                            "\"You got smashed bud. Maybe you should train a bit more before you enter the arena again.\"");
                        _characterSuperModel.CharacterHealth = _characterSuperModel.CharacterMaxHealth;
                        Console.ReadKey();
                    }
                    break;

                case 3:
                    if ((_characterSuperModel.CharacterBaseHealth += healthFromInnBed) > _characterSuperModel.CharacterMaxHealth)
                    {
                        _characterSuperModel.CharacterHealth = _characterSuperModel.CharacterMaxHealth;
                    }
                    else
                    {
                        _characterSuperModel.CharacterHealth += healthFromInnBed;
                    }
                    GameService.NewPage($"You sleep in a comfy bed at the inn and recover {healthFromInnBed} HP." +
                                        $"\nYou now have {_characterSuperModel.CharacterHealth}/{_characterSuperModel.CharacterMaxHealth} HP.");
                    Console.ReadKey();
                    break;

                case 4:
                    bool leaveFromInv = _inventoryServices.OpenInventory();
                    if (leaveFromInv)
                    {
                        return(false);
                    }
                    break;

                case 5:
                    leaveCity = Leave();
                    break;

                default:
                    Console.WriteLine("Invalid input.");
                    Console.ReadKey();
                    break;
                }
            }
            return(leaveCity);
        }