Example #1
0
        private void btnReroll4_Click(object sender, EventArgs e)
        {
            Die DieTemp = new Die(6);

            this.txtValue4.Text = DieTemp.GenerateRandomNumber().ToString();
            DisableReRollButtons();
            CalculateTotal();
        }
Example #2
0
        private int GetRandomDie(int size)
        {
            Die Die1         = new Die(6);
            int intReturnVal = Die1.GenerateRandomNumber();

            Die1.Dispose(true);
            Die1 = null;
            return(intReturnVal);
        }
        private void btnCommitChanges_Click(object sender, EventArgs e)
        {
            //Save Class Level
            CharacterClassLevel objNewCL = new CharacterClassLevel();

            objNewCL.ClassID     = objCALC.objSelectedClass.ClassID;
            objNewCL.ClassLevel  = objCALC.ClassLevel;
            objNewCL.CharacterID = objCALC.objCharacter.CharacterID;
            objNewCL.SaveCharacterClassLevel();

            //Update New Character Level
            objCALC.objCharacter.CharacterLevelID = objCALC.objNewCharLevel.CharacterLevelID;

            //Add Talent
            if (objCALC.objSelectedTalent.TalentName != null)
            {
                objCALC.objSelectedTalent.SaveCharacterTalent(objCALC.objCharacter.CharacterID, objCALC.objSelectedTalent.TalentID);
            }

            //Add objAbility1Modified
            if (objCALC.objAbility1Modified.AbilityName != null)
            {
                Ability.IncreaseCharacterAbility(objCALC.objAbility1Modified.AbilityID, 1, ref objCALC.objCharacter);
            }

            //Add objAbility2Modified
            if (objCALC.objAbility2Modified.AbilityName != null)
            {
                Ability.IncreaseCharacterAbility(objCALC.objAbility2Modified.AbilityID, 1, ref objCALC.objCharacter);
            }

            //Add Bonus Feat
            if (objCALC.objBonusFeat.FeatName != null)
            {
                objCALC.objBonusFeat.SaveCharacterFeat(objCALC.objCharacter.CharacterID, objCALC.objBonusFeat.FeatID);
            }

            //Add Level Feat
            if (objCALC.objCharLevelFeat.FeatName != null)
            {
                objCALC.objCharLevelFeat.SaveCharacterFeat(objCALC.objCharacter.CharacterID, objCALC.objCharLevelFeat.FeatID);
            }

            //Add Starting Feat
            if (objCALC.lstStartingFeat.Count > 0)
            {
                foreach (Feat objSF in objCALC.lstStartingFeat)
                {
                    objSF.SaveCharacterFeat(objCALC.objCharacter.CharacterID, objSF.FeatID);
                }
            }

            //Add Force Powers
            if (objCALC.lstNewForcePowers.Count > 0)
            {
                foreach (ForcePower objFP in objCALC.lstNewForcePowers)
                {
                    objFP.SaveCharacterForcePower(objCALC.objCharacter.CharacterID, objFP.ForcePowerID);
                }
            }

            //Add Character Skill
            if (objCALC.lstNewSkills.Count > 0)
            {
                foreach (CharacterSkill objCS in objCALC.lstNewSkills)
                {
                    objCS.AbilityMod = Ability.GetAbilityMod(objCS.objSkill.objAbility.AbilityID, objCALC.objCharacter);
                    objCS.HalfLevel  = objCALC.objCharacter.CharacterLevelID / 2;
                    if (CharacterSkill.DoesCharacterHaveSkillFocusForSkill(objCS.objSkill.SkillID, objCALC.objCharacter))
                    {
                        objCS.SkillFocus = 5;
                    }
                    else
                    {
                        objCS.SkillFocus = 0;
                    }
                    objCS.Trained       = 5; //Added a skill, don't check the skill training Feat
                    objCS.Miscellaneous = 0;
                    objCS.CharacterID   = objCALC.objCharacter.CharacterID;
                    objCS.SaveCharacterSkill();
                }
            }

            if (objCALC.objForceSecret.ForceSecretName != null)
            {
                //save character force secret
                objCALC.objForceSecret.SaveCharacterForceSecret(objCALC.objCharacter.CharacterID);
            }

            if (objCALC.objForceTechnique.ForceTechniqueName != null)
            {
                //save character force secret
                objCALC.objForceTechnique.SaveCharacterForceTechnique(objCALC.objCharacter.CharacterID);
            }

            //Add Languages
            if (objCALC.lstLanguages.Count > 0)
            {
                foreach (Language objLan in objCALC.lstLanguages)
                {
                    objLan.SaveCharacterLanguage(objCALC.objCharacter.CharacterID, objLan.LanguageID);
                }
            }

            //Now that we have added a Character Level's objects, we need to update the character.
            //Hit Points

            Ability objAbility = new Ability("Constitution");
            Die     objDie     = new Die(objCALC.objSelectedClass.HitDieType);

            objCALC.objCharacter.HitPoints = objCALC.objCharacter.HitPoints + objDie.GenerateRandomNumber() + objCALC.objCharacter.GetCharacterAbilityModifier(objAbility);

            //Base Attack
            ClassLevelInfo objCLI = new ClassLevelInfo();

            objCLI.GetClassLevel(objCALC.objSelectedClass.ClassID, objCALC.ClassLevel);
            objCALC.objCharacter.BaseAttack = objCALC.objCharacter.BaseAttack + objCLI.BaseAttack;

            //Grapple

            //Skill Increase

            //Defense Modifications

            //Weapon To hit / Damage

            //Damage Thresold

            //Reset force points

            //Increase Destiny Points ?
        }