Esempio n. 1
0
        protected override int processMenuChoice(int choice)
        {
            switch (choice)
            {
            case 1:
                if (enemies.Count > 0)
                {
                    new Battle(player, enemies);
                }
                break;

            case 2:
                addEnemy();
                break;

            case 3:
                StatViewer.viewCharacter(player);
                break;

            case 4:
                break;

            default:
                choice = displayMenu();
                break;
            }

            return(choice);
        }
Esempio n. 2
0
        private static int processChoice(int choice, Character character)
        {
            switch (choice)
            {
            case 1:
                while (StatViewer.viewSkills(character) != 2)
                {
                    ;
                }
                break;

            case 2:
                while (StatViewer.viewAbilities(character) != 3)
                {
                    ;
                }
                break;

            case 3:
                break;

            default:
                choice = menu(character);
                break;
            }

            return(choice);
        }
Esempio n. 3
0
        /// <summary>
        /// Processes the chosen option on the menu
        /// </summary>
        /// <param name="choice"></param>
        /// <returns></returns>
        protected override int processMenuChoice(int choice)
        {
            switch (choice)
            {
            case 1:
                if (player == default(Character))
                {
                    player = new Character(true);
                }

                BattleMenu bm = new BattleMenu(player);
                break;

            case 2:
                if (player == default(Character))
                {
                    player = new Character(true);
                }

                StatViewer.viewCharacter(player);
                break;

            case 3:
                break;

            case 4:
                break;

            case 5:
                break;

            case 6:
                break;

            default:
                Console.WriteLine("Invalid choice");
                processMenuChoice(displayMenu());
                break;
            }

            return(choice);
        }
        /// <summary>
        /// Outputs the list of abilities not in the character's spells List
        /// and allows the adding of them provided the character has ability points
        /// </summary>
        /// <param name="character">The character.</param>
        /// <returns></returns>
        internal static int addNewAbility(Character character)
        {
            Console.Clear();
            List <Ability> abilityList = Helper.getAbilityList().ToList();

            StatViewer.viewAbilityArray(abilityList.ToArray());

            Helper.space(2);

            Console.WriteLine("Select spell: ");
            //Iterate through abilityList variable and list all ability names
            for (int i = 0; i < abilityList.Count; i++)
            {
                if (character.spells.Contains(abilityList[i]))      //If the character has the ability
                {
                    abilityList.RemoveAt(i);                        //Remove it and continue
                    i--;
                    continue;
                }
                Console.WriteLine((i + 1) + ": " + abilityList[i].name);       //List it
            }

            Console.WriteLine((abilityList.Count + 1) + ": Go back");

            int choice = Helper.processChoice(true);

            if (choice == abilityList.Count)
            {
                return(choice);
            }

            else
            {
                try
                {
                    //Output choice to the user
                    Console.WriteLine("Are you sure you want to add: " + abilityList[choice].name + "? (y/n)");
                }

                catch
                {
                    DebugLog.invalidInputError(choice + " is not a valid input");
                    choice = addNewAbility(character);
                }

                //If user enters y
                if (Console.ReadLine() == "y")
                {
                    //If the user has enough ability points to acquire the ability, add it
                    if (character.getAbilityPoints >= abilityList[choice].acquireCost)
                    {
                        character.spells.Add(abilityList[choice]);
                        character.subAbilityPoint();
                    }

                    //Otherwise let the user know that they have insufficient points
                    else
                    {
                        Console.WriteLine("Not enough ability points");
                    }
                }
                //Else recall the function
                else
                {
                    choice = addNewAbility(character);
                }
            }

            return(choice);
        }