Exemplo n.º 1
0
        private void CreateMyCharacter()
        {
            BackgroundDict.TryGetValue(cbBackgrounds.SelectedItem.ToString(), out Background background);
            CharacterClassDict.TryGetValue(cbCharacterClasses.SelectedItem.ToString(), out CharacterClassOption characterClass);
            RaceDict.TryGetValue(cbRaces.SelectedItem.ToString(), out Race race);

            SelectedSkillString = cbSkill1.Text + cbSkill2.Text + cbSkill3.Text + cbSkill4.Text;
            characterClass.GetClassSkills(SelectedSkillString);

            myCharacter = new Character(background, characterClass, race);

            if (ComputerRoll)
            {
                if (cbStat1.SelectedIndex != cbStat2.SelectedIndex && cbStat1.SelectedIndex != cbStat3.SelectedIndex && cbStat1.SelectedIndex != cbStat4.SelectedIndex &&
                    cbStat1.SelectedIndex != cbStat5.SelectedIndex && cbStat1.SelectedIndex != cbStat6.SelectedIndex && cbStat2.SelectedIndex != cbStat3.SelectedIndex &&
                    cbStat2.SelectedIndex != cbStat4.SelectedIndex && cbStat2.SelectedIndex != cbStat5.SelectedIndex && cbStat2.SelectedIndex != cbStat6.SelectedIndex &&
                    cbStat3.SelectedIndex != cbStat4.SelectedIndex && cbStat3.SelectedIndex != cbStat5.SelectedIndex && cbStat3.SelectedIndex != cbStat6.SelectedIndex &&
                    cbStat4.SelectedIndex != cbStat5.SelectedIndex && cbStat4.SelectedIndex != cbStat6.SelectedIndex && cbStat5.SelectedIndex != cbStat6.SelectedIndex)
                {
                    uStatBlock[cbStat1.SelectedIndex] = (int)lblStat1.Content;
                    uStatBlock[cbStat2.SelectedIndex] = (int)lblStat2.Content;
                    uStatBlock[cbStat3.SelectedIndex] = (int)lblStat3.Content;
                    uStatBlock[cbStat4.SelectedIndex] = (int)lblStat4.Content;
                    uStatBlock[cbStat5.SelectedIndex] = (int)lblStat5.Content;
                    uStatBlock[cbStat6.SelectedIndex] = (int)lblStat6.Content;



                    myCharacter.Strength       = uStatBlock[0] + race.StrengthBonus + AssignableStat1[0] + AssignableStat2[0];
                    myCharacter.Dexterity      = uStatBlock[1] + race.DexterityBonus + AssignableStat1[1] + AssignableStat2[1];
                    myCharacter.Constitution   = uStatBlock[2] + race.ConstitutionBonus + AssignableStat1[2] + AssignableStat2[2];
                    myCharacter.Intelligence   = uStatBlock[3] + race.InteligenceBonus + AssignableStat1[3] + AssignableStat2[3];
                    myCharacter.Wisdom         = uStatBlock[4] + race.WisdomBonus + AssignableStat1[4] + AssignableStat2[4];
                    myCharacter.Charisma       = uStatBlock[5] + race.CharismaBonus + AssignableStat1[5] + AssignableStat2[5];
                    myCharacter.StatBonusArray = myCharacter.SetStatMods();
                    myCharacter.SetPassiveStats(characterClass);


                    OpenGenerationForms();
                }
                else
                {
                    MessageBox.Show("Please assign each roll value to a unique stat.");
                }
            }

            if (SuicideRoll)
            {
                if (uStatBlock[0] + race.StrengthBonus + AssignableStat1[0] + AssignableStat2[0] <= 20)
                {
                    myCharacter.Strength = uStatBlock[0] + race.StrengthBonus + AssignableStat1[0] + AssignableStat2[0];
                }
                else
                {
                    myCharacter.Strength = 20;
                }

                if (uStatBlock[1] + race.DexterityBonus + AssignableStat1[1] + AssignableStat2[1] <= 20)
                {
                    myCharacter.Dexterity = uStatBlock[1] + race.DexterityBonus + AssignableStat1[1] + AssignableStat2[1];
                }
                else
                {
                    myCharacter.Dexterity = 20;
                }

                if (uStatBlock[2] + race.ConstitutionBonus + AssignableStat1[2] + AssignableStat2[2] <= 20)
                {
                    myCharacter.Constitution = uStatBlock[2] + race.ConstitutionBonus + AssignableStat1[2] + AssignableStat2[2];
                }
                else
                {
                    myCharacter.Constitution = 20;
                }

                if (uStatBlock[3] + race.InteligenceBonus + AssignableStat1[3] + AssignableStat2[3] <= 20)
                {
                    myCharacter.Intelligence = uStatBlock[3] + race.InteligenceBonus + AssignableStat1[3] + AssignableStat2[3];
                }
                else
                {
                    myCharacter.Intelligence = 20;
                }

                if (uStatBlock[4] + race.WisdomBonus + AssignableStat1[4] + AssignableStat2[4] <= 20)
                {
                    myCharacter.Wisdom = uStatBlock[4] + race.WisdomBonus + AssignableStat1[4] + AssignableStat2[4];
                }
                else
                {
                    myCharacter.Wisdom = 20;
                }

                if (uStatBlock[5] + race.CharismaBonus + AssignableStat1[5] + AssignableStat2[5] <= 20)
                {
                    myCharacter.Charisma = uStatBlock[5] + race.CharismaBonus + AssignableStat1[5] + AssignableStat2[5];
                }
                else
                {
                    myCharacter.Charisma = 20;
                }
                myCharacter.StatBonusArray = myCharacter.SetStatMods();
                myCharacter.SetPassiveStats(characterClass);

                OpenGenerationForms();
            }

            if (SelfRoll)
            {
                if (txtbxSelfRolledStr.Text != "" && txtbxSelfRolledDex.Text != "" && txtbxSelfRolledCon.Text != "" && txtbxSelfRolledInt.Text != "" && txtbxSelfRolledWis.Text != "" && txtbxSelfRolledCha.Text != "")
                {
                    if (int.Parse(txtbxSelfRolledStr.Text) >= 3 && int.Parse(txtbxSelfRolledStr.Text) <= 18 &&
                        int.Parse(txtbxSelfRolledDex.Text) >= 3 && int.Parse(txtbxSelfRolledDex.Text) <= 18 &&
                        int.Parse(txtbxSelfRolledCon.Text) >= 3 && int.Parse(txtbxSelfRolledCon.Text) <= 18 &&
                        int.Parse(txtbxSelfRolledInt.Text) >= 3 && int.Parse(txtbxSelfRolledInt.Text) <= 18 &&
                        int.Parse(txtbxSelfRolledWis.Text) >= 3 && int.Parse(txtbxSelfRolledWis.Text) <= 18 &&
                        int.Parse(txtbxSelfRolledCha.Text) >= 3 && int.Parse(txtbxSelfRolledCha.Text) <= 18)


                    {
                        uStatBlock[0] = int.Parse(txtbxSelfRolledStr.Text);
                        uStatBlock[1] = int.Parse(txtbxSelfRolledDex.Text);
                        uStatBlock[2] = int.Parse(txtbxSelfRolledCon.Text);
                        uStatBlock[3] = int.Parse(txtbxSelfRolledInt.Text);
                        uStatBlock[4] = int.Parse(txtbxSelfRolledWis.Text);
                        uStatBlock[5] = int.Parse(txtbxSelfRolledCha.Text);



                        myCharacter.Strength       = uStatBlock[0] + race.StrengthBonus + AssignableStat1[0] + AssignableStat2[0];
                        myCharacter.Dexterity      = uStatBlock[1] + race.DexterityBonus + AssignableStat1[1] + AssignableStat2[1];
                        myCharacter.Constitution   = uStatBlock[2] + race.ConstitutionBonus + AssignableStat1[2] + AssignableStat2[2];
                        myCharacter.Intelligence   = uStatBlock[3] + race.InteligenceBonus + AssignableStat1[3] + AssignableStat2[3];
                        myCharacter.Wisdom         = uStatBlock[4] + race.WisdomBonus + AssignableStat1[4] + AssignableStat2[4];
                        myCharacter.Charisma       = uStatBlock[5] + race.CharismaBonus + AssignableStat1[5] + AssignableStat2[5];
                        myCharacter.StatBonusArray = myCharacter.SetStatMods();
                        myCharacter.SetPassiveStats(characterClass);
                    }

                    else
                    {
                        MessageBox.Show("Please enter a number between 3 and 18 for all stats");
                    }
                }
                else
                {
                    MessageBox.Show("Please enter a number between 3 and 18 for all stats");
                }

                OpenGenerationForms();
            }
        }