Пример #1
0
        private void Generate_Click(object sender, EventArgs e)
        {
            if (GeneratorLevelTextBox.Text != "")
            {
                try
                {
                    int level = Convert.ToInt32(GeneratorLevelTextBox.Text);

                    if (SurpriseCombatFirstPreference.Checked)
                    {
                        GeneratorManager.CombatPreferenceSelect(MoveCombatFirstPreference, MeleeCombatFirstPreference, RangedCombatFirstPreference,
                                                                MagicCombatFirstPreference, BlockCombatFirstPreference, DodgeCombatFirstPreference, RandomCombatFirstPreference);
                    }
                    if (SurpriseCombatSecondPreference.Checked)
                    {
                        GeneratorManager.CombatPreferenceSelect(MoveCombatSecondPreference, MeleeCombatSecondPreference, RangedCombatSecondPreference,
                                                                MagicCombatSecondPreference, BlockCombatSecondPreference, DodgeCombatSecondPreference, RandomCombatSecondPreference);
                    }
                    if (SurpriseCombatThirdPreference.Checked)
                    {
                        GeneratorManager.CombatPreferenceSelect(MoveCombatThirdPreference, MeleeCombatThirdPreference, RangedCombatThirdPreference,
                                                                MagicCombatThirdPreference, BlockCombatThirdPreference, DodgeCombatThirdPreference, RandomCombatThirdPreference);
                    }

                    if (SurpriseNonCombatFirstPreference.Checked)
                    {
                        GeneratorManager.NonCombatPreferenceSelect(AnimalHandlingNonCombatFirstPreference, ArcaneArtsNonCombatFirstPreference, AthleticsNonCombatFirstPreference,
                                                                   PerceptionNonCombatFirstPreference, PracticalNonCombatFirstPreference, PrecisionNonCombatFirstPreference, SpeechNonCombatFirstPreference,
                                                                   StealthNonCombatFirstPreference, RandomNonCombatFirstPreference);
                    }
                    if (SurpriseNonCombatSecondPreference.Checked)
                    {
                        GeneratorManager.NonCombatPreferenceSelect(AnimalHandlingNonCombatSecondPreference, ArcaneArtsNonCombatSecondPreference, AthleticsNonCombatSecondPreference,
                                                                   PerceptionNonCombatSecondPreference, PracticalNonCombatSecondPreference, PrecisionNonCombatSecondPreference, SpeechNonCombatSecondPreference,
                                                                   StealthNonCombatSecondPreference, RandomNonCombatSecondPreference);
                    }
                    if (SurpriseNonCombatThirdPreference.Checked)
                    {
                        GeneratorManager.NonCombatPreferenceSelect(AnimalHandlingNonCombatThirdPreference, ArcaneArtsNonCombatThirdPreference, AthleticsNonCombatThirdPreference,
                                                                   PerceptionNonCombatThirdPreference, PracticalNonCombatThirdPreference, PrecisionNonCombatThirdPreference, SpeechNonCombatThirdPreference,
                                                                   StealthNonCombatThirdPreference, RandomNonCombatThirdPreference);
                    }

                    for (int baseLevel = 1; baseLevel <= level; baseLevel++)
                    {
                        int combatSkillPoints    = GeneratorManager.GetSkillPointsByLevel(baseLevel);
                        int nonCombatSkillPoints = combatSkillPoints;

                        GeneratorManager.CombatSkillSelect(MoveCombatFirstPreference, MeleeCombatFirstPreference, RangedCombatFirstPreference,
                                                           MagicCombatFirstPreference, BlockCombatFirstPreference, DodgeCombatFirstPreference, RandomCombatFirstPreference, baseLevel);
                        combatSkillPoints--;
                        if (combatSkillPoints > 0)
                        {
                            GeneratorManager.CombatSkillSelect(MoveCombatSecondPreference, MeleeCombatSecondPreference, RangedCombatSecondPreference,
                                                               MagicCombatSecondPreference, BlockCombatSecondPreference, DodgeCombatSecondPreference, RandomCombatSecondPreference, baseLevel);
                            combatSkillPoints--;
                        }
                        if (combatSkillPoints > 0)
                        {
                            GeneratorManager.CombatSkillSelect(MoveCombatThirdPreference, MeleeCombatThirdPreference, RangedCombatThirdPreference,
                                                               MagicCombatThirdPreference, BlockCombatThirdPreference, DodgeCombatThirdPreference, RandomCombatThirdPreference, baseLevel);
                            combatSkillPoints--;
                        }
                        while (combatSkillPoints > 0)
                        {
                            GeneratorManager.RandomCombatSkillSelect(baseLevel);
                            combatSkillPoints--;
                        }

                        GeneratorManager.NonCombatSkillSelect(AnimalHandlingNonCombatFirstPreference, ArcaneArtsNonCombatFirstPreference, AthleticsNonCombatFirstPreference,
                                                              PerceptionNonCombatFirstPreference, PracticalNonCombatFirstPreference, PrecisionNonCombatFirstPreference, SpeechNonCombatFirstPreference,
                                                              StealthNonCombatFirstPreference, RandomNonCombatFirstPreference, baseLevel);
                        nonCombatSkillPoints--;
                        if (nonCombatSkillPoints > 0)
                        {
                            GeneratorManager.NonCombatSkillSelect(AnimalHandlingNonCombatSecondPreference, ArcaneArtsNonCombatSecondPreference, AthleticsNonCombatSecondPreference,
                                                                  PerceptionNonCombatSecondPreference, PracticalNonCombatSecondPreference, PrecisionNonCombatSecondPreference, SpeechNonCombatSecondPreference,
                                                                  StealthNonCombatSecondPreference, RandomNonCombatSecondPreference, baseLevel);
                            nonCombatSkillPoints--;
                        }
                        if (nonCombatSkillPoints > 0)
                        {
                            GeneratorManager.NonCombatSkillSelect(AnimalHandlingNonCombatThirdPreference, ArcaneArtsNonCombatThirdPreference, AthleticsNonCombatThirdPreference,
                                                                  PerceptionNonCombatThirdPreference, PracticalNonCombatThirdPreference, PrecisionNonCombatThirdPreference, SpeechNonCombatThirdPreference,
                                                                  StealthNonCombatThirdPreference, RandomNonCombatThirdPreference, baseLevel);
                            nonCombatSkillPoints--;
                        }
                        while (nonCombatSkillPoints > 0)
                        {
                            GeneratorManager.RandomNonCombatSkillSelect(baseLevel);
                            nonCombatSkillPoints--;
                        }
                    }

                    //Print out the results.
                    GeneratorManager.CreateCharacter(GeneratorListBox, level, GeneratorNameTextBox.Text);
                }
                catch (FormatException)
                {
                }
            }
        }