Ejemplo n.º 1
0
        //public static byte[] GetCharacterImage(Gender gender, Race race, string DNDClassAssigner, string alignment)
        //{
        //    string charDescription = gender.ToString() + " " + race.ToString() + " " + DNDClassAssigner + " " + alignment;
        //    string url = GetUrl(GetHtmlCode(charDescription));

        //    var request = (HttpWebRequest)WebRequest.Create(url);
        //    var response = (HttpWebResponse)request.GetResponse();

        //    using (Stream dataStream = response.GetResponseStream())
        //    {
        //        if (dataStream == null)
        //            return null;
        //        using (var sr = new BinaryReader(dataStream))
        //        {
        //            byte[] bytes = sr.ReadBytes(100000);

        //            return bytes;
        //        }
        //    }
        //}

        //private static string GetHtmlCode(string characterDescription)
        //{
        //    string url = "https://www.google.com/search?q=" + characterDescription + "&tbm=isch";
        //    string data = "";

        //    var request = (HttpWebRequest)WebRequest.Create(url);
        //    request.Accept = "text/html, application/xhtml+xml, */*";
        //    request.UserAgent = "Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko";

        //    var response = (HttpWebResponse)request.GetResponse();

        //    using (Stream dataStream = response.GetResponseStream())
        //    {
        //        if (dataStream == null)
        //            return "";
        //        using (var sr = new StreamReader(dataStream))
        //        {
        //            data = sr.ReadToEnd();
        //        }
        //    }
        //    return data;
        //}

        //private static string GetUrl(string html)
        //{
        //    var urls = "";

        //    string search = @",""ou"":""(.*?)"",";
        //    MatchCollection matches = Regex.Matches(html, search);

        //    urls = matches[0].Groups[1].Value;
        //    return urls;
        //}


        public static DNDClass GenerateClass(int str, int dex, int con, int intell, int wis, int chr)
        {
            int[] stats         = { str, dex, con, intell, wis, chr };
            int   maxValue      = stats.Max();
            int   maxValueIndex = stats.ToList().IndexOf(maxValue);

            DNDClass selected = DNDClassAssigner.strength[0];

            //Strength classes
            if (maxValueIndex == 0)
            {
                selected = DNDClassAssigner.strength[GenerateNumber(0, DNDClassAssigner.strength.Count())];
            }
            else if (maxValueIndex == 1)
            {
                selected = DNDClassAssigner.dexterity[GenerateNumber(0, DNDClassAssigner.dexterity.Count())];
            }
            else if (maxValueIndex == 2)
            {
                selected = DNDClassAssigner.constitution[GenerateNumber(0, DNDClassAssigner.constitution.Count())];
            }
            else if (maxValueIndex == 3)
            {
                selected = DNDClassAssigner.intelligence[GenerateNumber(0, DNDClassAssigner.intelligence.Count())];
            }
            else if (maxValueIndex == 4)
            {
                selected = DNDClassAssigner.wisdom[GenerateNumber(0, DNDClassAssigner.wisdom.Count())];
            }
            else
            {
                selected = DNDClassAssigner.charisma[GenerateNumber(0, DNDClassAssigner.charisma.Count())];
            }


            return(selected);
        }
Ejemplo n.º 2
0
        private void setup()
        {
            #region Start Screen
            Start_Screen.Controls.Add(StartTitle);
            Start_Screen.Controls.Add(UserName);
            Start_Screen.Controls.Add(PlayerName);
            Start_Screen.Controls.Add(WhatToDo);
            Start_Screen.Controls.Add(WhatToDoText);
            Start_Screen.Controls.Add(TitleNextBtn);
            #endregion

            #region ClassScreen
            Class_Screen.Controls.Add(ClassText);
            Class_Screen.Controls.Add(Classes);



            #endregion


            #region Race Screen
            RaceScreen.Controls.Add(RaceTitle);
            RaceScreen.Controls.Add(Races);
            RaceScreen.Controls.Add(RaceText);
            #endregion
            #region Races

            /*
             * Dwarf
             * Elf
             * Halfling
             * Human
             * DragonBorn
             * Gnome
             * Half-Elf
             * Half-Orc
             * Tiefling
             */


            #region Dwarf
            DNDRace Dwarf = new DNDRace()
            {
                Name = "Dwarf",
                ConstitutionBonus = 2,
                Features          = "Stonecunning: Whenever you make a History check related to the origin of stonework, \n" +
                                    "you are considered proficient in the History skill and add double your proficiency bonus to the check, \n" +
                                    "instead of your normal proficiency bonus.",
                FeatureNames        = "Stonecunning",
                Speed               = 25,
                DarkVision          = 60,
                ResistancesPoison   = true,
                SavingPoisonAdv     = true,
                WeaponNumber        = 4,
                Weaponbattleaxe     = true,
                Weaponhandaxe       = true,
                WeaponlightHammer   = true,
                Weaponwarhammer     = true,
                ToolBrewerssupplies = true,
                ToolMasonstools     = true,
                ToolSmithstools     = true,
                LanguagesDwarfish   = true,
                Look    = Properties.Resources.Dwarf_1,
                Details = "Though they stand well under 5 feet tall, dwarves are so broad and compact that they can weigh as much as a human standing nearly two feet taller.\n" +
                          "Dwarven skin ranges from deep brown to a paler hue tinged with red, but the most common shades are light brown or deep tan, like certain tones of earth. Their hair, worn long but in simple styles, is usually black, gray, or brown, though paler dwarves often have red hair. Male dwarves value their beards highly and groom them carefully." +
                          "Dwarves can live to be more than 400 years old, so the oldest living dwarves often remember a very different world. They respect the traditions of their clans, tracing their ancestry back to the founding of their most ancient strongholds in the youth of the world, and don’t abandon those traditions lightly." +
                          "Individual dwarves are determined and loyal, true to their word and decisive in action, sometimes to the point of stubbornness. Many dwarves have a strong sense of justice, and they are slow to forget wrongs they have suffered. A wrong done to one dwarf is a wrong done to the dwarf’s entire clan, so what begins as one dwarf’s hunt for vengeance can become a full-blown clan feud." +
                          "They love the beauty and artistry of precious metals and fine jewelry, and in some dwarves this love festers into avarice. Whatever wealth they can’t find in their mountains, they gain through trade. They dislike boats, so enterprising humans and halflings frequently handle trade in dwarven goods along water routes." +
                          "The chief unit of dwarven society is the clan, and dwarves highly value social standing. To be clanless is the worst fate that can befall a dwarf." +
                          "Dwarves in other lands are typically artisans, especially weaponsmiths, armorers, and jewelers. Some become mercenaries or bodyguards, highly sought after for their courage and loyalty.",

                //Descriptions = DNDRaceDescription;
            };
            #endregion

            #region Elf
            DNDRace Elf = new DNDRace()
            {
                Name             = "Elf",
                DexterityBonus   = 2,
                SkillPerception  = true,
                DarkVision       = 60,
                SavingCharmedAdv = true,
                LanguagesElvish  = true,
                LanguagesCommon  = true,
                Look             = Properties.Resources.Elf,
                FeatureNames     = "Fey Ancestry, and Trance",
                Features         = "Fey Ancestry: You have advantage on saving throws against being charmed, and magic can’t put you to sleep." +
                                   "Trance: Elves don’t need to sleep. Instead, they meditate deeply, remaining semiconscious, for 4 hours a day. (The Common word for such meditation is “trance.”) While meditating, you can dream after a fashion; such dreams are actually mental exercises that have become reflexive through years of practice. After resting in this way, you gain the same benefit that a human does from 8 hours of sleep.",

                Details = "",

                //Descriptions = DNDRaceDescription;
            };
            #endregion


            #region Human
            DNDRace Human = new DNDRace()
            {
                Name             = "Human",
                DexterityBonus   = 2,
                SkillPerception  = true,
                DarkVision       = 60,
                SavingCharmedAdv = true,
                LanguagesElvish  = true,
                LanguagesCommon  = true,
                Look             = Properties.Resources.Commoner,
                FeatureNames     = "Fey Ancestry, and Trance",
                Features         = "Fey Ancestry: You have advantage on saving throws against being charmed, and magic can’t put you to sleep." +
                                   "Trance: Elves don’t need to sleep. Instead, they meditate deeply, remaining semiconscious, for 4 hours a day. (The Common word for such meditation is “trance.”) While meditating, you can dream after a fashion; such dreams are actually mental exercises that have become reflexive through years of practice. After resting in this way, you gain the same benefit that a human does from 8 hours of sleep.",

                Details = "",

                //Descriptions = DNDRaceDescription;
            };
            #endregion



            #endregion
            #region Subraces
            DNDSubRace HillDwarf = new DNDSubRace {
                MainRace    = Dwarf,
                speed       = 25,
                Name        = "Hill Dwarf",
                Look        = Properties.Resources.Hill_Dwarf,
                WisdomBonus = 1,
                extraLife   = 1,
            };
            DNDSubRace MountainDwarf = new DNDSubRace {
                Name          = "Mountain Dwarf",
                speed         = 25,
                MainRace      = Dwarf,
                StrengthBonus = 2,
                Look          = Properties.Resources.mountaindwarf,
                ArmorLight    = true,
                ArmorMedium   = true
            };

            DNDSubRace HighElf = new DNDSubRace {
                Name              = "High Elf",
                MainRace          = Elf,
                IntelligenceBonus = 1,
                WeaponNumber      = 4,
                WeaponLongBow     = true,
                WeaponShortBow    = true,
                Look              = Properties.Resources.High_elf,
                WeaponLongSword   = true,
                WeaponShortSword  = true,
                ExtraLanguages    = 1,
                WizardCantrip     = 1,
            };
            DNDSubRace WoodElf = new DNDSubRace {
                Name             = "Wood Elf",
                MainRace         = Elf,
                Look             = Properties.Resources.Wood_elf,
                WisdomBonus      = 1,
                WeaponNumber     = 4,
                WeaponLongBow    = true,
                WeaponShortBow   = true,
                WeaponLongSword  = true,
                WeaponShortSword = true,
                speed            = 35,
                FeatureNames     = "Mask of the Wild",
                Features         = "Mask of the Wild: You can attempt to hide even when you are only lightly obscured by foliage, heavy rain, falling snow, mist, and other natural phenomena."
            };

            #endregion
            #region Classes
            DNDClass Barbarian = new DNDClass()
            {
                Name                    = "Barbarian",
                HitDie                  = 12,
                HitDieAverage           = 7,
                ArmorLight              = true,
                ArmorMedium             = true,
                ArmorShield             = true,
                WeaponsSimple           = true,
                WeaponsMartial          = true,
                SavingThrowStrength     = true,
                SavingThrowConstitution = true,
                numOfSkill              = 2,
                SkillAnimalhandling     = true,
                SkillAthletics          = true,
                SkillIntimidiation      = true,
                SkillNature             = true,
                SkillPerception         = true,
                SkillSurvival           = true,
            };
            #endregion

            for (int i = 0; i < DNDRace.allRaces.Count; i++)
            {
                Races.Items.Insert(i, DNDRace.allRaces [i].Name);
            }
        }