public void Validate_TrueResult()
        {
            CharacterClassLevel objCharacterClassLevel = new CharacterClassLevel();

            objCharacterClassLevel.ClassLevel = 1;
            objCharacterClassLevel.Validate();
            Assert.IsTrue(objCharacterClassLevel.Validated);
        }
        public void Validate_FalseResult()
        {
            CharacterClassLevel objCharacterClassLevel = new CharacterClassLevel();

            objCharacterClassLevel.ClassLevel = 0;
            objCharacterClassLevel.Validate();
            Assert.IsTrue(!objCharacterClassLevel.Validated && (objCharacterClassLevel.ValidationMessage.Length > 0));
        }
        public void Test_GetCharacterClassLevel_ByCharacterID_BadResult()
        {
            int CharacterID = 0;
            CharacterClassLevel objCharacterClassLevel = new CharacterClassLevel();

            objCharacterClassLevel.GetCharacterClassLevel(CharacterID);

            Assert.IsTrue(objCharacterClassLevel.ClassLevel == 0 && objCharacterClassLevel.ClassID == 0 && objCharacterClassLevel.CharacterID == 0);
        }
        public void Test_GetCharacterClassLevel_ByCharacterID_GoodResult()
        {
            int CharacterID = 1;
            CharacterClassLevel        objCharacterClassLevel = new CharacterClassLevel();
            List <CharacterClassLevel> lstCharClassLevel      = new List <CharacterClassLevel>();

            lstCharClassLevel = objCharacterClassLevel.GetCharacterClassLevel(CharacterID);

            Assert.IsTrue(lstCharClassLevel.Count > 0);
        }
        public void Test_GetCharacterClassLevel_BadResult()
        {
            bool blnIsInList;
            List <CharacterClassLevel> lstCharacterClassLevel = new List <CharacterClassLevel>();

            lstCharacterClassLevel = objNewCharacterClassLevel.GetCharacterClassLevel(1);

            blnIsInList = CharacterClassLevel.IsCharacterClassLevelInList(objNewCharacterClassLevel, lstCharacterClassLevel);

            Assert.IsFalse(blnIsInList);
        }
        public void Test_GetCharacterClassLevel_GoodResult()
        {
            bool blnIsInList = false;
            CharacterClassLevel        objCharacterClassLevel = new CharacterClassLevel();
            List <CharacterClassLevel> lstCharacterClassLevel = new List <CharacterClassLevel>();

            lstCharacterClassLevel = objNewCharacterClassLevel.GetCharacterClassLevel(1);
            objCharacterClassLevel = lstCharacterClassLevel[0];

            blnIsInList = CharacterClassLevel.IsCharacterClassLevelInList(objCharacterClassLevel, lstCharacterClassLevel);

            Assert.IsTrue(blnIsInList);
        }
        public void Test_SaveAndDeleteCharacterClassLevel()
        {
            bool returnVal;
            CharacterClassLevel        objCharacterClassLevel = new CharacterClassLevel();
            List <CharacterClassLevel> lstCharClassLevel      = new List <CharacterClassLevel>();

            objNewCharacterClassLevel.SaveCharacterClassLevel();
            lstCharClassLevel = objNewCharacterClassLevel.GetCharacterClassLevel(1);
            Assert.IsTrue(CharacterClassLevel.IsCharacterClassLevelInList(objNewCharacterClassLevel, lstCharClassLevel));

            returnVal = objNewCharacterClassLevel.DeleteCharacterClassLevel();

            Assert.IsTrue(returnVal && objNewCharacterClassLevel.DeleteOK);
        }
        public void Test_IsClassInList_SingleClassParam_GoodResult()
        {
            bool  blnIsInList = false;
            Class objClass    = new Class();

            List <CharacterClassLevel> lstCharacterClassLevel = new List <CharacterClassLevel>();

            lstCharacterClassLevel = objNewCharacterClassLevel.GetCharacterClassLevel(1);
            objClass = lstCharacterClassLevel[0].objCharacterClass;

            blnIsInList = CharacterClassLevel.IsClassInList(objClass, lstCharacterClassLevel);

            Assert.IsTrue(blnIsInList);
        }
        public void Test_IsClassInList_SingleClassParam_BadResult()
        {
            bool  blnIsInList;
            Class objClass = new Class();

            objClass.GetClass(4);

            List <CharacterClassLevel> lstCharacterClassLevel = new List <CharacterClassLevel>();

            lstCharacterClassLevel = objNewCharacterClassLevel.GetCharacterClassLevel(1);

            blnIsInList = CharacterClassLevel.IsClassInList(objClass, lstCharacterClassLevel);

            Assert.IsFalse(blnIsInList);
        }
        public void Test_IsClassInList_ListClassParam_BadResult()
        {
            bool         blnIsInList = false;
            Class        objClass    = new Class();
            Class        objClass2   = new Class();
            List <Class> lstClasses  = new List <Class>();

            List <CharacterClassLevel> lstCharacterClassLevel = new List <CharacterClassLevel>();

            lstCharacterClassLevel = objNewCharacterClassLevel.GetCharacterClassLevel(1);
            objClass.GetClass(4);
            objClass2.GetClass(2);
            lstClasses.Add(objClass);
            lstClasses.Add(objClass2);

            blnIsInList = CharacterClassLevel.IsClassInList(lstClasses, lstCharacterClassLevel);

            Assert.IsFalse(blnIsInList);
        }
        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 ?
        }