예제 #1
0
 public static void BasicInformation(CharacterBasic character, Stats abilityScores, bool langProfFlag)
 {
     string[] dashboardItems = { $"1.  Name:          {character.Name}",
                                 $"2.  Gender:        {character.Gender}",
                                 $"3.  Race:          {character.SubRace}{character.Draconic} {character.Race}",
                                 $"4.  Background:    {character.Background}",
                                 $"    Class:         {character.SubClass} {character.CClass}",
                                 $"5.  Alignment:     {character.Alignment}",
                                 "6.  Stats          " };
     bool[]   dashboardSets = { character.NameSet, character.GenderSet, character.RaceSet, character.BackgroundSet, character.CClassSet, character.AlignmentSet, abilityScores.Set };
     for (int i = 0; i < dashboardItems.Length; i++)
     {
         if (dashboardSets[i] == false)
         {
             Console.ForegroundColor = ConsoleColor.Red;
         }
         else if (dashboardSets[i] == true)
         {
             Console.ForegroundColor = ConsoleColor.Green;
         }
         Console.WriteLine(dashboardItems[i]);
     }
     if (langProfFlag == true)
     {
         Console.ForegroundColor = ConsoleColor.Red;
         Console.WriteLine("7.  Language/Proficiency");
     }
     else if (langProfFlag == false)
     {
         Console.ForegroundColor = ConsoleColor.Green;
         Console.WriteLine("7.  Language/Proficiency");
     }
     Console.ResetColor();
 }
        public static void Conditionals(CharacterBasic character, Health health, Stats abilityModifiers, Equipment equipment, Languages languages, Proficiency proficiencies, CharacterClass characterClass, Features features, SpellBook spellCasting)
        {
            //Collects all relevant objects from Program Main and overwrites their properties from corresponding objects from a 'Character Class' class determined by the controller.

            Console.Clear();
            characterClass             = Controller(character.CClass); //Gets character class properties
            character.SubClass         = characterClass.SubClass;
            health.HitPointsConstant   = characterClass.HitPointsConstant;
            health.HitDice             = characterClass.HitDice;
            proficiencies.ClassArms    = characterClass.ClassArmsProficiencies;
            proficiencies.SavingThrows = characterClass.SavingThrows;
            features.Class             = characterClass.Features;

            equipment.ClassBag   = Equipment.Controller(character.CClass, character, abilityModifiers, features);                                   //Gets the equipment setting/options. Determined by character class.
            equipment.Bag        = Proficiency.Configuration.ListHelper(equipment.Bag, equipment.RaceBag, equipment.ClassBag);                      //Consolidates equipment into a main list.
            proficiencies.Tools  = Proficiency.Configuration.ListHelper(proficiencies.Tools, proficiencies.RaceTools, proficiencies.ClassTools);    //Consolidates tools into a main list.
            proficiencies.Arms   = Proficiency.Configuration.ListHelper(proficiencies.Arms, proficiencies.RaceArms, proficiencies.ClassArms);       //Consolidates armaments into a main list.
            proficiencies.Skills = Proficiency.Configuration.ListHelper(proficiencies.Skills, proficiencies.RaceSkills, proficiencies.ClassSkills); //Consolidates skills into a main list.


            if (characterClass.SubClass == "Life") //Heavy armor proficiency is granted by Life Domain.
            {
                Cleric cleric = new Cleric();
                cleric.DomainSpells = new List <string> {
                    "Bless", "Cure Wounds"
                };
                cleric.Cantrips = cleric.SelectSpells(cleric, 0, abilityModifiers);
                foreach (string cantrip in cleric.Cantrips)
                {
                    features.Class.Add(cantrip);
                }
                features.Class.Add("Bless");
                features.Class.Add("Cure Wounds");
                features.Class.Add("Disciple of Life");

                characterClass.ClassArmsProficiencies.Add("Heavy Armor");
            }
            if (characterClass.SubClass == "Evocation") //Heavy armor proficiency is granted by Life Domain.
            {
                Wizard wizard = new Wizard();
                wizard.Cantrips  = wizard.SelectSpells(wizard, 0, abilityModifiers);
                wizard.SpellBook = wizard.FillSpellBook(wizard);
                foreach (string cantrip in wizard.Cantrips)
                {
                    features.Class.Add(cantrip);
                }
                foreach (string spell in wizard.SpellBook)
                {
                    features.Class.Add(spell);
                }
                features.Class.Add("Arcane Recovery");
            }
            Console.Clear();
            if (character.Background == "Acolyte")
            {
                equipment.Bag.Add("Holy Symbol");
                features.Background.Add(BackgroundFeatures.Acolyte());
            }
        }
예제 #3
0
 public static void ClassFeatures(CharacterBasic character, Features features)
 {
     Dashboard.Generic("\r\nClass Features: ", features.Class);
     //else if (character.CClass == "Cleric")
     //{
     //    Console.Write("Spell DC: {0} Spell ATK: {1} Cantrips: {2} Domain Spells: {3}");
     //}
     //else if (character.CClass == "Wizard")
     //{
     //    Console.Write("Spell DC: {0} Spell ATK: {1} Cantrips: {2} Spells: {3} ");
     //}
 }
예제 #4
0
        public static List <string> Cleric(List <string> equipment, CharacterBasic character, Stats abilityModifiers, Features features)
        {
            //For all of this code, a new equipment list is created, and the user will select items from a series of prompts.
            //First, the user selects weapons and armor.
            //Second, the user selects a bag containing adventuring gear.
            equipment = new List <string> {
                "Shield", "Holy Symbol"
            };                              //All Clerics will start with these items.
            if (character.Race == "Dwarf")  //Dwarfs have weapon proficiency with warhammers.
            {
                string[] startingInitialWeapon = { "Mace", "Warhammer" };
                equipment.Add(Builder.ItemToList("Select a starting weapon: ", "", startingInitialWeapon, startingInitialWeapon));
            }
            else    //Mace will be selected by default if the character doesn't have warhammer proficiency. There's no reason to let the user pick a first weapon they can't use.
            {
                equipment.Add("Mace");
            }
            string firstWeapon = equipment.Last();

            string[] startingArmor = { "Scale Mail       AC: 13 + Dex modifier (max 2)", //Chain Mail is only an option if the character is proficient with heavy armor. Because SRD only allows the Cleric to choose Life Domain anyway (which grants Heavy Armor Proficiency, the option is included here for simplicity.
                                       "Leather Armor    AC: 11 + Dex modifier",
                                       "Chain Mail       AC: 16" };
            string[] startingArmorSelection = { "Scale Mail", "Leather Armor", "Chain Mail" };

            equipment.Add(Builder.ItemToList("Select a starting armor: ", "", startingArmor, startingArmorSelection));

            string[] startingWeapons = { "Club                    1d4 bludgeoning, light",    //User can choose a crossbow or any simple weapon
                                         "Dagger                  1d4 piercing, finesse, light, thrown (range 20/60)",
                                         "Greatclub               1d8 bludgeoning, Two-handed",
                                         "Handaxe                 1d6 slashing, Light, thrown (range 20/60)",
                                         "Javelin                 1d6 piercing, Thrown (range 30/120)",
                                         "Light Hammer            1d4 bludgeoning, Light, thrown (range 20/60)",
                                         "Mace                    1d6 bludgeoning",
                                         "Quarterstaff            1d6 bludgeoning, Versatile (1d8)",
                                         "Sickle                  1d4 slashing, Light",
                                         "Spear                  1d6 piercing, Thrown (range 20/60), versatile (1d8)",
                                         "Crossbow, 20 bolts     1d8 piercing, Ammunition (range 80/320), loading, two-handed",
                                         "Dart                   1d4 piercing, Finesse, thrown (range 20/60)",
                                         "Shortbow               1d6 piercing, Ammunition (range 80/320),two-handed",
                                         "Sling                  1d4 bludgeoning, Ammunition (30/120)" };
            string[] startingWeaponsSelection = { "Club", "Dagger", "Greatclub", "Handaxe", "Javelin", "Light Hammer", "Mace", "Quarterstaff", "Sickle", "Spear", "Crossbow w/ 20 bolts", "Dart", "Shortbow", "Sling" }; //User can choose a crossbow or any simple weapon

            equipment.Add(Builder.ItemToList($"Your Cleric has a {firstWeapon}. \r\nSelect a second weapon: ", "", startingWeapons, startingWeaponsSelection));

            string[] equipmentPack = { "Priest’s Pack: \r\n" +
                                       "   backpack, blanket, 10 candles, tinderbox, alms box, 2 blocks of incense, censer, vestments, 2 days rations, waterskin",
                                       "Explorer’s Pack: \r\n" +
                                       "   backpack, bedroll, mess kit, tinderbox, 10 torches, 10 days rations, waterskin, 50 ft of hempen rope" };
            string[] equipmentPackSelection = { "Priest's Pack", "Explorer's Pack" };
            equipment.Add(Builder.ItemToList("Select an equipment pack: ", "", equipmentPack, equipmentPackSelection));
            return(equipment);
        }
예제 #5
0
 public static void SavingThrows(CharacterBasic character, Proficiency proficiencies)
 {
     //The stats assigned to saving throw proficiency are determined by Character Class.
     if (character.CClassSet == false)
     {
         Console.ForegroundColor = ConsoleColor.Red;
     }
     else
     {
         Console.ForegroundColor = ConsoleColor.Green;
     }
     Console.WriteLine("\r\nSaving Throws: {0} {1}", proficiencies.SavingThrows[0], proficiencies.SavingThrows[1]);
     Console.ResetColor();
 }
 public static Stats Conditionals(CharacterBasic character, CharacterRace race, Stats racialBonus, Equipment equipment, Languages languages, Proficiency proficiencies, Features features)
 {
     //Controls details of character race choice. Subraces, ability scores, Languages based on race. Subrace functionality technically not necessary due to licensing restrictions. Included in case of software repurposing.
     race = Controller(character.Race);
     character.SubRace        = race.SubRace;
     character.Draconic       = race.Draconic;
     character.Speed          = race.Speed;
     racialBonus              = race.RacialBonus;
     languages.Native         = race.NativeLanguage;
     proficiencies.RaceTools  = race.RaceToolsProficiencies;
     proficiencies.RaceArms   = race.RaceArmsProficiencies;
     proficiencies.RaceSkills = race.RaceSkillsProficiencies;
     features.Race            = race.Features;
     proficiencies.Tools      = Proficiency.Configuration.ListHelper(proficiencies.Tools, proficiencies.RaceTools, proficiencies.ClassTools);
     proficiencies.Arms       = Proficiency.Configuration.ListHelper(proficiencies.Arms, proficiencies.RaceArms, proficiencies.ClassArms);
     proficiencies.Skills     = Proficiency.Configuration.ListHelper(proficiencies.Skills, proficiencies.RaceSkills, proficiencies.ClassSkills);
     return(racialBonus);
 }
예제 #7
0
        public static List <string> Wizard(List <string> equipment, CharacterBasic character, Stats abilityModifiers, Features features)
        {
            //For all of this code, a new equipment list is created, and the user will select items from a series of prompts.
            //First, the user chooses a medium to channel magic through.
            //Second, the user selects a weapon.
            //Third, the user selects a bag containing adventuring gear.

            equipment = new List <string> {
                "Spellbook"
            };                                              //All Wizards have a spell book.
            string[] magicMedium = { "Component Pouch\r\n" +
                                     "      A small, watertight leather belt pouch that has compartments to hold all the material components and other \r\n" +
                                     "      special items you need to cast your spells, except for those components that have a specific cost \r\n" +
                                     "      (as indicated in a spell's description).",
                                     "Arcane Focus\r\n" +
                                     "      A special item— an orb, a crystal, a rod, a specially constructed staff, a wand-­‐like length of wood, or \r\n" +
                                     "      some similar item— designed to channel the power of arcane spells.\r\n" };
            string[] magicMediumSelection = { "Component Pouch", "Arcane Focus" };
            string   medium = Builder.ItemToList("Select a magic item: \r\n", "", magicMedium, magicMediumSelection);

            if (medium == "Arcane Focus")
            {
                string[] focusOptions   = { "Orb", "Crystal", "Rod", "Staff", "Wooden Wand", "Other" };
                string[] focusSelection = { "Orb", "Crystal", "Rod", "Staff", "Wooden Wand", "" };
                medium = Builder.ItemToList("Select a magic item: \r\n", "", focusOptions, focusSelection);
            }
            equipment.Add(medium);

            string[] armsChoice = { "Quarterstaff  1d6 bludgeoning, Versatile (1d8)",
                                    "Dagger        1d4 piercing, finesse, light, thrown (range 20/60)" };
            string[] armsChoiceSelection = { "Quarterstaff", "Dagger" };
            equipment.Add(Builder.ItemToList("Select a weapon: \r\n", "", armsChoice, armsChoiceSelection));

            string[] equipmentPack = { "Scholar’s Pack: \r\n" +
                                       "   backpack, book of lore, bottle of ink, ink pen, 10 sheets of parchment, little bag of sand, small knife.",
                                       "Explorer’s Pack: \r\n" +
                                       "   backpack, bedroll, mess kit, tinderbox, 10 torches, 10 day's rations, waterskin, 50 ft of hempen rope" };
            string[] equipmentPackSelection = { "Scholar's Pack", "Explorer's Pack" };
            equipment.Add(Builder.ItemToList("Select an equipment pack: ", "", equipmentPack, equipmentPackSelection));
            return(equipment);
        }
예제 #8
0
        public static void Menu(CharacterBasic character, Health health, Stats abilityScores, Stats abilityModifiers, Stats savingThrows, Equipment equipment, Languages languages, Proficiency proficiencies, Skills skills, CharacterClass characterClass, Features features, bool langProfFlag)   //Lists every important user choice. Information here will be used in future updates to launch to a webpage using HTML/CSS to allow easy porting of configs to character sheet
        {
            //Displays all the user's selections and everything they gain from said selections.
            //Red indicates unfinished, Green indicates completed
            Console.Clear();
            BasicInformation(character, abilityScores, langProfFlag);
            SavingThrows(character, proficiencies);
            HealthInformation(health, character, abilityModifiers, equipment);
            AbilityScores(abilityScores, abilityModifiers);

            Generic("\r\nRace Features: ", features.Race);
            ClassFeatures(character, features);
            Generic("\r\nLanguages: ", languages.List);
            Generic("\r\nEquipment: ", equipment.Bag);
            Generic("\r\nTools Proficiency: ", proficiencies.Tools);
            Generic("\r\nArms Proficiency: ", proficiencies.Arms);

            Generic("\r\nSkills: ", proficiencies.Skills);
            Skills(savingThrows, skills, abilityScores);
            Console.Write("\r\nEnter selection: ");
        }
예제 #9
0
        public static List <string> Rogue(List <string> equipment, CharacterBasic character, Stats abilityModifiers, Features features)
        {
            //For all of this code, a new equipment list is created, and the user will select items from a series of prompts.
            //First, the user selects weapons and armor.
            //Second, the user selects a bag containing adventuring gear.

            equipment = new List <string> {
                "Leather Armor", "2 Daggers", "Thieves' Tools"
            };

            string[] armsChoice = { "Rapier         1d6 piercing, Finesse",
                                    "Shortsword     1d4 piercing, Finesse, light" };
            string[] armsChoiceSelection = { "Rapier", "Shortsword" };
            equipment.Add(Builder.ItemToList("Selection one of the 2: ", "", armsChoice, armsChoiceSelection));
            string[] armsChoice2 = { "Shortbow & Quiver  1d6 piercing, Ammunition (range 80/320),two-handed\r\n" +
                                     "  w/ 20 arrows",
                                     "Shortsword         1d4 piercing, Finesse, light" };
            string[] armsChoiceSelection2 = { "Shortbow & Quiver w/ 20 arrows", "Shortsword" };
            switch (Builder.ItemToList("Selection one of the 2: ", "", armsChoice2, armsChoiceSelection2))
            {
            case "Shortbow & Quiver w/ 20 arrows":
                equipment.Add("Shortbow & Quiver");
                equipment.Add("20 arrows");
                break;

            case "Shortsword":
                equipment.Add("Shortsword");
                break;
            }

            string[] equipmentPack = { "Dungeoneer’s Pack: \r\n" +
                                       "   backpack, crowbar, hammer, 10 pitons, 10 torches, tinderbox, 10 day's rations, waterskin. 50 feet of hempen rope",
                                       "Explorer’s Pack: \r\n" +
                                       "   backpack, bedroll, mess kit, tinderbox, 10 torches, 10 day's rations, waterskin, 50 ft of hempen rope" };
            string[] equipmentPackSelection = { "Dungeoneer's Pack", "Explorer's Pack" }; //Website error, verify elsewhere
            equipment.Add(Builder.ItemToList("Select an equipment pack: ", "", equipmentPack, equipmentPackSelection));
            return(equipment);
        }
예제 #10
0
        public static void HealthInformation(Health health, CharacterBasic character, Stats abilityModifiers, Equipment equipment)
        {
            int hillDwarf = 0;

            if (character.SubRace == "Hill" && character.Race == "Dwarf")   //Hill Dwarfs have a racial trait that they gain +1 HP per character level.
            {
                hillDwarf = (1 * character.Level);
            }
            health.HitPoints  = health.HitPointsConstant + abilityModifiers.Constitution + hillDwarf; //HP is determined by a constant provided by character class. HP = constant + (Constitution ability modifier)
            health.ArmorClass = Health.SetArmorClass(abilityModifiers, equipment);                    //AC is determined by armor, shield, and/ or Dexterity modifier.
            health.Initiative = abilityModifiers.Dexterity;                                           //Initiative directly equals Dexterity modifier. Other factors apply but are irrelevent within application scope.
            //If information in this display panel is not yet completed by user input, it should not display and remain red. Only finalized details should display.
            string[] valueList   = { "HP: ", "   AC: ", "   Hit Dice: ", "   Initiative: ", "   Speed: " };
            string[] blankerList = { health.HitPoints.ToString(), health.ArmorClass.ToString(), health.HitDice, health.Initiative.ToString(), character.Speed.ToString() };
            bool []  boolList    = { health.HitPointsSet, health.ArmorClassSet, health.HitDiceSet, health.InitiativeSet, character.RaceSet };

            for (int i = 0; i < boolList.Length; i++)   //All false booleans in the list will yield a blank string.
            {
                if (boolList[i] == false)
                {
                    blankerList[i] = "";
                }
            }
            for (int i = 0; i < valueList.Length; i++)  //All true booleans in the list will yield their value in string form.
            {
                if (blankerList[i] == "")
                {
                    Console.ForegroundColor = ConsoleColor.Red;
                }
                else
                {
                    Console.ForegroundColor = ConsoleColor.Green;
                }
                Console.Write("{0}{1}", valueList[i], blankerList[i]);
            }
            Console.ResetColor();
        }
예제 #11
0
        public static List <String> Controller(string CClass, CharacterBasic character, Stats abilityModifiers, Features features)
        {
            List <string> equipment = new List <string>();

            switch (CClass)
            {
            case "Cleric":
                equipment = Cleric(equipment, character, abilityModifiers, features);
                break;

            case "Fighter":
                equipment = Fighter(equipment, character, abilityModifiers, features);
                break;

            case "Rogue":
                equipment = Rogue(equipment, character, abilityModifiers, features);
                break;

            case "Wizard":
                equipment = Wizard(equipment, character, abilityModifiers, features);
                break;
            }
            return(equipment);
        }
예제 #12
0
        public static List <string> Fighter(List <string> equipment, CharacterBasic character, Stats abilityModifiers, Features features)
        {
            //For all of this code, a new equipment list is created, and the user will select items from a series of prompts.
            //First, the user chooses a fighting style, which adds certain numerical benefits or proficiencies.
            //Second, the user selects weapons and armor.
            //Third, the user selects a bag containing adventuring gear.
            equipment = new List <string> {
            };
            string[] fightingStylesOption = { "Archery", "Defense", "Dueling", "Great Weapon Fighting", "Protection", "Two Weapon Fighting" };
            for (int i = 0; i < 1; i++)
            {
                string fightingStyle = $"Fighting Style: {Builder.ItemToList("Select a fighting style: ", "", fightingStylesOption, fightingStylesOption)}";
                features.Class[0] = fightingStyle;
            }
            string[] startingArmor = { "Leather Armor, Longbow w/ 20 arrows         AC: 11 + Dex modifier",
                                       "Chain Mail                                  AC: 16" };
            string[] startingArmorSelection = { "Leather Armor  Longbow w/ 20 arrows", "Chain Mail" };
            switch (Builder.ItemToList("Select starting armor: ", "", startingArmor, startingArmorSelection))
            {
            case "Leather Armor  Longbow w/ 20 arrows":
                equipment.Add("Leather Armor");
                equipment.Add("Longbow w/ 20 arrows");
                break;

            case "Chain Mail":
                equipment.Add("Chain Mail");
                break;
            }
            Console.Clear();
            string[] martialWeapons = { " Battleaxe     1d8 slashing, Versatile (1d10)",
                                        " Flail         1d8 bludgeoning",
                                        " Glaive        1d10 slashing, Heavy, reach, two-handed",
                                        " Greataxe      1d12 slashing, Heavy, two-handed",
                                        " Greatsword    2d6 slashing, Heavy, two-handed",
                                        " Halberd       1d10 slashing, Heavy, reach, two-handed",
                                        " Longsword     1d8 slashing, Verrsatile",
                                        " Lance         1d12 piercing, Reach, special",
                                        " Maul          2d6 bludgeoning, Heavy, two-handed",
                                        "Morningstar   1d8 piercing",
                                        "Pike          1d6 piercing,	Heavy, reach, two-handed",
                                        "Rapier        1d6 piercing, Finesse",
                                        "Scimitar      1d6 slashing, Finesse, light",
                                        "Shortsword    1d4 piercing, Finesse, light",
                                        "Trident       1d8 piercing, Thrown (range 20/60), versatile (1d8)",
                                        "War pick      1d8 piercing",
                                        "Warhammer     1d8 bludgeoning, Versatile (1d10)",
                                        "Whip          1d4 slashing, Finesse, reach" };
            string[] martialWeaponsSelected = { "Battleaxe", "Flail", "Glaive", "Greataxe", "Greatsword", "Halberd", "Lance", "Longsword", "Maul", "Morningstar", "Pike", "Rapier", "Scimitar", "Shortsword", "Trident", "War pick", "Warhammer", "Whip" };
            string[] armsChoice             = { "Weapon and Shield", "2 Weapons" };
            switch (Builder.ItemToList("You can choose between a martial weapon w/ shield or 2 martial weapons. A shield adds +2 to AC when equipped.", "", armsChoice, armsChoice))
            {
            case "Weapon and Shield":
                equipment.Add("Shield");
                equipment.Add(Builder.ItemToList("Select a martial weapon: ", "", martialWeapons, martialWeaponsSelected));
                break;

            case "2 Weapons":
                for (int i = 0; i < 2; i++)
                {
                    Console.Clear();
                    equipment.Add(Builder.ItemToList($"Select 2 martial weapons. \r\nSelection {i + 1}:", "", martialWeapons, martialWeaponsSelected));
                }
                break;
            }
            string[] armsChoice2 = { "Light Crossbow w/ 20 bolts", "2 Handaxe" };
            equipment.Add(Builder.ItemToList("Select between a Crossbow or 2 Handaxes: ", "", armsChoice2, armsChoice2));
            string[] equipmentPack = { "Dungeoneer’s Pack: \r\n" +
                                       "   backpack, crowbar, hammer, 10 pitons, 10 torches, tinderbox, 10 day's rations, waterskin. 50 feet of hempen rope",
                                       "Explorer’s Pack: \r\n" +
                                       "   backpack, bedroll, mess kit, tinderbox, 10 torches, 10 day's rations, waterskin, 50 ft of hempen rope" };
            string[] equipmentPackSelection = { "Dungeoneer's Pack", "Explorer's Pack" };
            equipment.Add(Builder.ItemToList("Select an equipment pack: ", "", equipmentPack, equipmentPackSelection));
            Console.Clear();
            return(equipment);
        }
예제 #13
0
        public static Stats Menu(CharacterBasic character, Stats stats, Stats racialBonus)
        {
            Console.Clear();
            stats = new Stats();                           //Reset
            List <string> emptyList = new List <string>(); //Buffer list
            List <string> statNames = new List <string> {
                "Constitution", "Strength", "Dexterity", "Intelligence", "Wisdom", "Charisma"
            };
            string     statSelection    = "";
            List <int> unassignedScores = new List <int>();

            unassignedScores = StatProcessor(unassignedScores); //Gets numbers for user to assign
            Builder.DataLine("\r\nStat results: ", emptyList, unassignedScores);
            Console.Write("\r\nPress enter to continue...");
            Console.ReadLine();

            for (int i = 0; i < 6; i++) //This loop displays user stat choices
            {
                switch (Builder.Selection($"Stat Pool: {unassignedScores[0]} {unassignedScores[1]} {unassignedScores[2]} {unassignedScores[3]} {unassignedScores[4]} {unassignedScores[5]}\r\n\r\n" +
                                          "Optimal stat arrangement: \r\n" +
                                          "Cleric: Wisdom     Fighter: Strength     Rogue: Dexterity     Wizard: Intelligence \r\n\r\n" +
                                          "Ability Modifier Table: \r\n" +
                                          "Ability Score:      0    2    4    6    8    10    12    14    16    18    20    22    24    26    28    30\r\n" +
                                          "Ability Modifier:  -5   -4   -3   -2   -1    0      1     2     3     4     5     6     7     8     9    10\r\n\r\n" +
                                          $"Racial Bonus ({character.Race}):   Con: {racialBonus.Constitution} Str: {racialBonus.Strength} Dex: {racialBonus.Dexterity} Int: {racialBonus.Intelligence} Wis: {racialBonus.Wisdom} Cha: {racialBonus.Charisma} \r\n\r\n" +
                                          $"Ability Scores: Con: {stats.Constitution} Str: {stats.Strength} Dex: {stats.Dexterity} Int: {stats.Intelligence} Wis: {stats.Wisdom} Cha: {stats.Charisma} \r\n" +
                                          "\r\nAssign: " + unassignedScores[i], statNames.ToArray(), statNames.ToArray()))
                {
                case "Constitution":
                    stats.Constitution = unassignedScores[i];
                    statNames.Remove("Constitution");
                    break;

                case "Strength":
                    stats.Strength = unassignedScores[i];
                    statNames.Remove("Strength");
                    break;

                case "Dexterity":
                    stats.Dexterity = unassignedScores[i];
                    statNames.Remove("Dexterity");
                    break;

                case "Intelligence":
                    stats.Intelligence = unassignedScores[i];
                    statNames.Remove("Intelligence");
                    break;

                case "Wisdom":
                    stats.Wisdom = unassignedScores[i];
                    statNames.Remove("Wisdom");
                    break;

                case "Charisma":
                    stats.Charisma = unassignedScores[i];
                    statNames.Remove("Charisma");
                    break;

                case "":
                    i--;
                    break;
                }
            }
            return(stats);
        }
예제 #14
0
            public static List <string> SelectSkills(CharacterBasic character, CharacterClass characterClass) //Uses objects from main to determine skill options.
            {
                int           options = 2;                                                                    //All current character classes except Rogue get 2 options.
                string        raceSkill;                                                                      //Some races get a free skill intrinsically. For others, this string will stay blank.
                List <string> knownProficiencies = new List <string>();                                       //Empty list to build and send back to Program Main.

                switch (character.Race)                                                                       //This assignment comes first to prevent intrinsic skills from appearing in later selection.
                {
                case "Elf":
                    raceSkill = "Perception";
                    break;

                case "Half-Orc":
                    raceSkill = "Intimidation";
                    break;

                default:
                    raceSkill = "";
                    break;
                }
                knownProficiencies.Add(raceSkill);
                if (character.CClass == "Rogue")    //Rogues get 4 skill choices. Other classes get 2.
                {
                    options += 2;
                }
                List <string> classOptions     = characterClass.ClassSkillProficiencies.ToList <string>();                             //Skills by character classare added to a list.
                List <string> allProficiencies = new List <string> {
                    "Athletics", "Acrobatics", "SleightOfHand", "Stealth", "Arcana", "History", "Investigation", "Nature", "Religion", //Full skill list
                    "AnimalHandling", "Insight", "Medicine", "Perception", "Survival", "Deception", "Intimidation", "Performance", "Persuasion"
                };

                if (classOptions.Contains(raceSkill))   //Removes race skill so that it wont appear in future selection
                {
                    classOptions.Remove(raceSkill);
                }
                //Prompts the user based on background.
                string acolytePrompt = "The 'Acolyte' background is not enabled, which would enable proficiency in Insight and Religion. \r\n"; //Default prompt

                if (character.Background == "Acolyte")
                {
                    //'Acolyte' grants Insight and Religion. They are added to 'known' list. These skills are removed from options list so they dont appear in later selection.
                    knownProficiencies.Add("Insight");
                    knownProficiencies.Add("Religion");
                    if (classOptions.Contains("Insight"))
                    {
                        classOptions.Remove("Insight");
                    }
                    if (classOptions.Contains("Religion"))
                    {
                        classOptions.Remove("Religion");
                    }

                    string[] proficiencyOptions = classOptions.ToArray();

                    acolytePrompt = "The 'Acolyte' background grants proficiency in Insight and Religion. \r\n";
                    for (int i = 0; i < options; i++)   //Selection menu to choose unassigned skill proficiencies. Will remove skills from list as selected.
                    {
                        knownProficiencies.Add(Builder.ItemToList(acolytePrompt + "The " + character.CClass + " can choose proficiency in " + options + " of the following skills: \r\n\r\n" +
                                                                  $"Selection {i + 1}:\r\n", "", proficiencyOptions, proficiencyOptions));
                        proficiencyOptions = ProficiencyListUpdate(knownProficiencies, proficiencyOptions);
                    }
                    options = 0; //Zero-ed out to prevent unexpected errors.
                }
                else
                {
                    for (int i = 0; i < options; i++)   //Selection menu to choose unassigned skill proficiencies. Will remove skills from list as selected.
                    {
                        knownProficiencies.Add(Builder.ItemToList(acolytePrompt + "The " + character.CClass + " can choose proficiency in " + options + " of the following skills: \r\n\r\n" +
                                                                  $"Selection {i + 1}:\r\n", "", characterClass.ClassSkillProficiencies, characterClass.ClassSkillProficiencies));

                        characterClass.ClassSkillProficiencies = ProficiencyListUpdate(knownProficiencies, characterClass.ClassSkillProficiencies);
                    }
                    options = 0;    //Zero-ed out to prevent unexpected errors.
                }


                if (character.Race == "Half-Elf")
                {
                    options += 2;   //Half-Elves get 2 additional skill proficiencies
                }
                if (options > 0)    //If the character has any more options left, they will select from the full list of remaining unassigned skills
                {
                    string[] proficiencyOptions = allProficiencies.ToArray();
                    proficiencyOptions = ProficiencyListUpdate(knownProficiencies, proficiencyOptions);
                    for (int i = 0; i < options; i++)
                    {
                        knownProficiencies.Add(Builder.ItemToList("Half-Elves gain 2 extra proficiencies: \r\n\r\n" +
                                                                  $"Selection { i + 1}:\r\n", "", proficiencyOptions, proficiencyOptions));
                        proficiencyOptions = ProficiencyListUpdate(knownProficiencies, proficiencyOptions);
                    }
                }
                return(knownProficiencies);  //User selections are all added to the list and return to Program Main
            }
예제 #15
0
        static void Main(string[] args)
        {
            //Initializing objects, variables, etc.
            bool displayMenu  = true;
            bool langProfFlag = true;

            //Name, Gender, Race, Subrace, Draconic Heritage, Class, Subclass, Background, Alignment, Level, Speed
            CharacterBasic character = new CharacterBasic();

            //HP, HP constant, AC, Hit Dice, Initiative
            Health health = new Health();

            //Constitution, Strength, Dexterity, Intelligence, Wisdom, Charisma
            Stats stats            = new Stats();   //Generic object to hold numbers.
            Stats racialBonus      = new Stats();   //These values come from race selection.
            Stats abilityScores    = new Stats();   //Stat values and Racial values are added and stored here.
            Stats abilityModifiers = new Stats();   //These values are used for various skills and actions. Each number is determined directly by it's corresponding ability score from a table.
            Stats savingThrows     = new Stats();   //These values are primarily used for specific proficiencies. Each number is determined by it's corresponding ability modifier; + 2 if proficient.

            Languages languages = new Languages();
            Skills    skills    = new Skills();

            //Empty equipment list
            Equipment equipment = new Equipment(
                bag: new List <string>(),
                raceBag: new List <string>(),
                classBag: new List <string>());
            //Empty features list
            Features features = new Features(
                race: new List <string> {
                ""
            },
                cClass: new List <string> {
                ""
            },
                background: new List <string> {
                ""
            });

            //Empty proficiencies list
            Proficiency proficiencies = new Proficiency(
                2,          //Proficiency Bonus
                arms: new List <string>(),
                skills: new List <string>(),
                tools: new List <string>(),
                savingThrows: new List <string> {
                "", ""
            });                                                     //Invisible string values hard-coded in to prevent error.

            //Secondary object for collecting additional details from race decision.
            CharacterRace race = new CharacterRace(
                "", "", "", 0, 0, "", racialBonus,             //Race, Subrace, Draconic Heritage, Speed, Extra Language, Extra Proficiency, native Language, Racial Bonus
                features: new List <string>(),
                raceArms: new List <string>(),
                raceSkills: new List <string>(),
                raceTools: new List <string>(),
                cantrips: new List <string>());

            //Secondary object for collecting additional details from class decision.
            CharacterClass characterClass = new CharacterClass();
            SpellBook      spellCasting   = new SpellBook();

            StartUp();          //Display text
            while (displayMenu) //Encloses entire program
            {
                displayMenu = MainMenu();
            }
            bool MainMenu()
            {
                //This is the primary menu for selecting and editing aspects of the character.
                //When a character property is set, the display listing turns green.

                RefreshValues();                                                                                                                                                       //Assigns the end results of stat configuration. Readjusts every time user returns to Main Menu
                Dashboard.Menu(character, health, abilityScores, abilityModifiers, savingThrows, equipment, languages, proficiencies, skills, characterClass, features, langProfFlag); //Display panel
                switch (Dashboard.Controller())                                                                                                                                        //Primary configuration menu
                {
                case "Name":
                    Console.Clear();
                    Console.WriteLine("Name your character: ");
                    character.Name = Console.ReadLine();
                    if (character.Name is "")
                    {
                        character.NameSet = false;
                    }
                    else
                    {
                        character.NameSet = true;
                    }
                    return(true);

                case "Gender":
                    Console.Clear();
                    character.Gender    = "";
                    character.Gender    = character.SetGender();
                    character.GenderSet = true;
                    return(true);

                case "Race":     //Races in D&D are better described as humanoid subspecies. Dwarves differ from Elves like Pitbulls differ from Greyhounds.
                    Console.Clear();
                    character.Race = "";
                    RaceListsReset();       //Empties relevent lists used when character race is changed.
                    while (character.Race == "")
                    {
                        character.Race = race.SetRace();
                    }
                    racialBonus    = CharacterRace.Conditionals(character, race, racialBonus, equipment, languages, proficiencies, features);  //Secondary menu for character race
                    languages.List = new List <string> {
                        "Common", languages.Native
                    };                                                                      //The language list is cleared. Common and native language from race are set. Other languages known will be set under "Language/Proficiency" menu.

                    //Lists used in RaceConditionals are emptied. Preventative measure against unexpected errors.
                    equipment.RaceBag       = new List <string>();      //Reset
                    proficiencies.RaceTools = new List <string>();      //Reset
                    proficiencies.RaceArms  = new List <string>();      //Reset
                    character.RaceSet       = true;
                    langProfFlag            = true;
                    return(true);

                case "Background & Class":  //User can choose Acolyte background or None. Only the 4 classic D&D classes are included for now. The rest will be included in later updates.
                    Console.Clear();
                    ClassListsReset();      //Empties relevent lists used when character race is changed.
                    character.Background = "";
                    character.CClass     = "";
                    string backgroundPrevious = character.Background;
                    character.Background = characterClass.SetBackground();
                    if (!character.Background.Equals(backgroundPrevious))       //If the user removes the 'Acolyte' background, the language list should reset so that they don't get the extra language benefits.
                    {
                        languages.List = new List <string>();
                    }
                    character.CClass = characterClass.SetClass();
                    characterClass   = CharacterClass.Controller(character.CClass);                                                                                //Gets class features for selected class
                    CharacterClass.Conditionals(character, health, abilityModifiers, equipment, languages, proficiencies, characterClass, features, spellCasting); //Secondary menu for character class options. Includes integration of background benefits.

                    //Lists used in RaceConditionals are emptied. Preventative measure against unexpected errors.
                    equipment.ClassBag        = new List <string>();    //Reset
                    languages.Background      = new List <string>();    //Reset
                    proficiencies.ClassTools  = new List <string>();    //Reset
                    proficiencies.ClassArms   = new List <string>();    //Reset
                    proficiencies.ClassSkills = new List <string>();    //Reset
                    character.BackgroundSet   = true;
                    character.CClassSet       = true;
                    langProfFlag = true;
                    return(true);

                case "Alignment":       //Character alignment describes broad-stroked trajectory of character's moral/social tendencies. Mostly for role-play, but matters for Cleric/Paladin classes.
                    Console.Clear();
                    character.Alignment    = "";
                    character.Alignment    = character.SetAlignment();
                    character.AlignmentSet = true;
                    return(true);

                case "Stats":       //Series of menus that will ultimately facilitate assignment of character ability scores.
                    Console.Clear();
                    stats     = Stats.Menu(character, stats, racialBonus);
                    stats.Set = true;
                    return(true);

                case "Language/Proficiency":                            //Extra languages and proficiency choices will be determined here
                    if (character.Race == "" || character.CClass == "") //If race or class are not set, returns to main menu
                    {
                        Console.Clear();
                        Console.WriteLine("This menu will become available after you've selected both a race and class. \r\n" +
                                          "Press Enter to return to the main menu.");
                        Console.ReadLine();
                        return(true);
                    }
                    else          //Continues with selection
                    {
                        langProfFlag         = false;
                        languages.List       = Languages.SelectLanguages(languages.Native, character.Race, character.Background); //Adjusts for extra languages
                        proficiencies.Skills = Proficiency.Configuration.SelectSkills(character, characterClass);                 //Adjusts for skill options
                    }
                    return(true);

                case "Null":
                    return(true);

                case "Exit":
                    return(false);
                }
                return(false);
            }

            void RefreshValues()
            {
                //This function updates all settings, especially numerical, every time the user returns to the main menu.
                //Equipment
                equipment.Bag = Proficiency.Configuration.ListHelper(equipment.Bag, equipment.RaceBag, equipment.ClassBag); //equipment is consolidated into main list.
                equipment.Bag = Equipment.DuplicateItemStacker(equipment.Bag);                                              //Any duplicates are stacked. If 2 of 'x' exists, it becomes '2 x'.

                //Stats
                abilityScores    = Stats.AbilityScoreAssigner(stats, racialBonus);  //Ability Score x = Stat x + Racial Bonus x.
                abilityModifiers = Stats.AbilityModifierAssigner(abilityScores);    //Ability Modifier x assigned by charting system from AbilityModAssigner method, given Ability Score x.

                //For dashboard
                if (stats.Set == true)
                {
                    //If the user has used the 'Stats' menu, the ability scores should be assigned. So long as this is the case, the following conditions are also true.
                    //The dashboard class will use these booleans for it's processes.
                    abilityScores.Set    = true;
                    abilityModifiers.Set = true;
                    health.InitiativeSet = true;
                }
                if (health.HitPointsConstantSet == true && abilityModifiers.Set == true && character.RaceSet == true)
                {
                    health.HitPointsSet = true;
                }
                if (character.CClassSet)
                {
                    //If the user has used the 'Background & Class' menu, the following conditions are true.
                    //The dashboard class will use these booleans for it's processes.
                    health.HitPointsConstantSet = true;
                    health.HitDiceSet           = true;
                    if (abilityModifiers.Set == true)
                    {
                        health.ArmorClassSet = true;
                    }
                }


                //The following is poorly optimized code, it manually sets individual data points. Methods will be written to streamline these in the future.

                //Saving Throws
                savingThrows = Skills.SavingThrowAssigner(savingThrows, abilityModifiers);  //Saving Throw x = Ability Modifier x, +2 if proficient

                if (proficiencies.SavingThrows.Contains("Constitution"))
                {
                    savingThrows.Constitution += proficiencies.ProficiencyBonus;
                }
                if (proficiencies.SavingThrows.Contains("Strength"))
                {
                    savingThrows.Strength += proficiencies.ProficiencyBonus;
                }
                if (proficiencies.SavingThrows.Contains("Dexterity"))
                {
                    savingThrows.Dexterity += proficiencies.ProficiencyBonus;
                }
                if (proficiencies.SavingThrows.Contains("Intelligence"))
                {
                    savingThrows.Intelligence += proficiencies.ProficiencyBonus;
                }
                if (proficiencies.SavingThrows.Contains("Wisdom"))
                {
                    savingThrows.Wisdom += proficiencies.ProficiencyBonus;
                }
                if (proficiencies.SavingThrows.Contains("Charisma"))
                {
                    savingThrows.Charisma += proficiencies.ProficiencyBonus;
                }

                //Groups each skill together by their related ability modifier. Foreach loop will assign each group the value of it's modifier.
                int[][] skillsBuilder = new int[5][];
                skillsBuilder[0] = new int[] { abilityModifiers.Strength, skills.Athletics };                                                                         //Strength
                skillsBuilder[1] = new int[] { abilityModifiers.Dexterity, skills.Acrobatics, skills.SleightOfHand, skills.Stealth };                                 //Dexterity
                skillsBuilder[2] = new int[] { abilityModifiers.Intelligence, skills.Arcana, skills.History, skills.Investigation, skills.Nature, skills.Religion };  //Intelligence
                skillsBuilder[3] = new int[] { abilityModifiers.Wisdom, skills.AnimalHandling, skills.Insight, skills.Medicine, skills.Perception, skills.Survival }; //Wisdom
                skillsBuilder[4] = new int[] { abilityModifiers.Charisma, skills.Deception, skills.Intimidation, skills.Performance, skills.Persuasion };             //Charisma
                foreach (int[] item in skillsBuilder)
                {
                    for (int i = 1; i < item.Length; i++)
                    {
                        item[i] = item[0];
                    }
                }

                //skill x = related modifier + 2 (if proficient)
                skills.Athletics = skillsBuilder[0][0];
                if (proficiencies.Skills.Contains(nameof(skills.Athletics)))
                {
                    skills.Athletics += proficiencies.ProficiencyBonus;
                }
                skills.Acrobatics = skillsBuilder[1][0];
                if (proficiencies.Skills.Contains(nameof(skills.Acrobatics)))
                {
                    skills.Acrobatics += proficiencies.ProficiencyBonus;
                }
                skills.SleightOfHand = skillsBuilder[1][1];
                if (proficiencies.Skills.Contains(nameof(skills.SleightOfHand)))
                {
                    skills.SleightOfHand += proficiencies.ProficiencyBonus;
                }
                skills.Stealth = skillsBuilder[1][2];
                if (proficiencies.Skills.Contains(nameof(skills.Stealth)))
                {
                    skills.Stealth += proficiencies.ProficiencyBonus;
                }
                skills.Arcana = skillsBuilder[2][0];
                if (proficiencies.Skills.Contains(nameof(skills.Arcana)))
                {
                    skills.Arcana += proficiencies.ProficiencyBonus;
                }
                skills.History = skillsBuilder[2][1];
                if (proficiencies.Skills.Contains(nameof(skills.History)))
                {
                    skills.History += proficiencies.ProficiencyBonus;
                }
                skills.Investigation = skillsBuilder[2][2];
                if (proficiencies.Skills.Contains(nameof(skills.Investigation)))
                {
                    skills.Investigation += proficiencies.ProficiencyBonus;
                }
                skills.Nature = skillsBuilder[2][3];
                if (proficiencies.Skills.Contains(nameof(skills.Nature)))
                {
                    skills.Nature += proficiencies.ProficiencyBonus;
                }
                skills.Religion = skillsBuilder[2][4];
                if (proficiencies.Skills.Contains(nameof(skills.Religion)))
                {
                    skills.Religion += proficiencies.ProficiencyBonus;
                }
                skills.AnimalHandling = skillsBuilder[3][0];
                if (proficiencies.Skills.Contains(nameof(skills.AnimalHandling)))
                {
                    skills.AnimalHandling += proficiencies.ProficiencyBonus;
                }
                skills.Insight = skillsBuilder[3][1];
                if (proficiencies.Skills.Contains(nameof(skills.Insight)))
                {
                    skills.Insight += proficiencies.ProficiencyBonus;
                }
                skills.Medicine = skillsBuilder[3][2];
                if (proficiencies.Skills.Contains(nameof(skills.Medicine)))
                {
                    skills.Medicine += proficiencies.ProficiencyBonus;
                }
                skills.Perception = skillsBuilder[3][3];
                if (proficiencies.Skills.Contains(nameof(skills.Perception)))
                {
                    skills.Perception += proficiencies.ProficiencyBonus;
                }
                skills.Survival = skillsBuilder[3][4];
                if (proficiencies.Skills.Contains(nameof(skills.Survival)))
                {
                    skills.Survival += proficiencies.ProficiencyBonus;
                }
                skills.Deception = skillsBuilder[4][0];
                if (proficiencies.Skills.Contains(nameof(skills.Deception)))
                {
                    skills.Deception += proficiencies.ProficiencyBonus;
                }
                skills.Intimidation = skillsBuilder[4][1];
                if (proficiencies.Skills.Contains(nameof(skills.Intimidation)))
                {
                    skills.Intimidation += proficiencies.ProficiencyBonus;
                }
                skills.Performance = skillsBuilder[4][2];
                if (proficiencies.Skills.Contains(nameof(skills.Performance)))
                {
                    skills.Performance += proficiencies.ProficiencyBonus;
                }
                skills.Persuasion = skillsBuilder[4][3];
                if (proficiencies.Skills.Contains(nameof(skills.Persuasion)))
                {
                    skills.Persuasion += proficiencies.ProficiencyBonus;
                }

                //These disabled lists are part of potential strategies for replacing manually-written code with loops.
                //Each skill is grouped by the ability modifier it depends on. By default, the skill literally equals the modifier.
                //If the character is proficient in the skill, it's value = ability modifier + proficiency bonus. The bonus is always 2 so long as the application only manipulates level 1 characters.
                //Intended strategy to replace hard-coded instructons:
                //First: Use a loop to compare known proficiencies with list of all proficiencies. If a match occurs, switch the corresponding skills boolean to true, else boolean is false.
                //Second: Use another loop to compare list of all skills with skills boolean. If false, skill = modifier. If true, skill = modifier + proficiency bonus;

                //List<string> allSkillNames = new List<string> { "Athletics",
                //                                                "Acrobatics", "SleightOfHand", "Stealth",
                //                                                "Arcana", "History", "Investigation", "Nature", "Religion",
                //                                                "AnimalHandling", "Insight", "Medicine", "Perception", "Survival",
                //                                                "Deception", "Intimidation", "Performance", "Persuasion" };
                //List<int> allSkills = new List<int> { skills.Athletics,
                //                                      skills.Acrobatics, skills.SleightOfHand, skills.Stealth,
                //                                      skills.Arcana, skills.History, skills.Investigation, skills.Nature, skills.Religion,
                //                                      skills.AnimalHandling, skills.Insight, skills.Medicine, skills.Perception, skills.Survival,
                //                                      skills.Deception, skills.Intimidation, skills.Performance, skills.Persuasion };

                //List<bool> allProficiencies = new List<bool> { skills.AthleticsSet,
                //                                               skills.AcrobaticsSet, skills.SleightOfHandSet, skills.StealthSet,
                //                                               skills.ArcanaSet, skills.HistorySet, skills.InvestigationSet, skills.NatureSet, skills.ReligionSet,
                //                                               skills.AnimalHandlingSet, skills.InsightSet, skills.MedicineSet, skills.PerceptionSet, skills.SurvivalSet,
                //                                               skills.DeceptionSet, skills.IntimidationSet, skills.PerformanceSet, skills.PersuasionSet };
            }

            void ClassListsReset()
            {
                equipment.Bag      = new List <string>();        //Reset
                equipment.ClassBag = new List <string>();        //Reset

                languages.Background = new List <string>();      //Reset

                proficiencies.Tools      = new List <string>();  //Reset
                proficiencies.ClassTools = new List <string>();  //Reset

                proficiencies.Arms      = new List <string>();   //Reset
                proficiencies.ClassArms = new List <string>();   //Reset

                proficiencies.Skills      = new List <string>(); //Reset
                proficiencies.ClassSkills = new List <string>(); //Reset
            }

            void RaceListsReset()
            {
                equipment.RaceBag = new List <string>();             //Reset
                languages.List    = new List <string> {
                    "Common"
                };                                                  //Reset
                languages.Native         = "";                      //Reset
                proficiencies.Tools      = new List <string>();     //Reset
                proficiencies.RaceTools  = new List <string>();     //Reset
                proficiencies.Arms       = new List <string>();     //Reset
                proficiencies.RaceArms   = new List <string>();     //Reset
                proficiencies.Skills     = new List <string>();     //Reset
                proficiencies.RaceSkills = new List <string>();     //Reset
            }
        }