コード例 #1
0
 public static void LoadDictionaryWithDamageThresholdIncreases(out Dictionary <int, int> objDic, bool blnFeat)
 {
     objDic = new Dictionary <int, int>();
     if (blnFeat)
     {
         objDic.Add(1, Common.GetAppSettingsID("ImprovedDamageThresholdFeatID"));
     }
     //else
     //{
     //    //Nothing right now so don't add anything, empty dictioinary
     //}
 }
コード例 #2
0
        public int DetermineNumberOfForcePowersGained()
        {
            int intReturnVal            = 0;
            int intFeatIDFPNum          = 0;
            int intAbilityIncreaseFPNum = 0;
            //FP Can be gained by taking Force Training Feat (check the objCharLevelFeat object) (Wisdom Mod + 1)
            //FP Can be gained by increasing Wisdom, if modifier goes up then Character gets 1 FP per instance of  Force Training Feat
            //Or BOTH
            Ability objAbility = new Ability("Wisdom");

            //Force Training FeatID = 116
            if (objCharLevelFeat.FeatID == Common.GetAppSettingsID("ForceTrainingFeatID"))
            {
                if ((((objCharacter.GetCharacterAbilityScore(objAbility) + 1) - 10) / 2) != objCharacter.GetCharacterAbilityModifier(objAbility))
                {
                    intFeatIDFPNum = intFeatIDFPNum + 1;
                }

                //Its Wisdom Mod + 1 for the Feat
                intFeatIDFPNum = intFeatIDFPNum + objCharacter.GetCharacterAbilityModifier(objAbility) + 1;
            }

            if (objRaceFeat.FeatID == Common.GetAppSettingsID("ForceTrainingFeatID"))
            {
                if ((((objCharacter.GetCharacterAbilityScore(objAbility) + 1) - 10) / 2) != objCharacter.GetCharacterAbilityModifier(objAbility))
                {
                    intFeatIDFPNum = intFeatIDFPNum + 1;
                }

                //Its Wisdom Mod + 1 for the Feat
                intFeatIDFPNum = intFeatIDFPNum + objCharacter.GetCharacterAbilityModifier(objAbility) + 1;
            }

            //Has Wisdom incresed?
            if (objAbility1Modified.AbilityID == 3 || objAbility2Modified.AbilityID == 3)
            {
                //(([Strength]-(10))/(2))
                if ((((objCharacter.GetCharacterAbilityScore(objAbility) + 1) - 10) / 2) != objCharacter.GetCharacterAbilityModifier(objAbility))
                {
                    foreach (Feat objFeat in objCharacter.lstFeats)
                    {
                        if (objFeat.FeatID == 116)
                        {
                            intAbilityIncreaseFPNum++;
                        }
                    }
                }
            }
            intReturnVal = intFeatIDFPNum + intAbilityIncreaseFPNum;
            return(intReturnVal);
        }
コード例 #3
0
        public int DetermineNumberOfLanguagesGained()
        {
            int intReturnVal              = 0;
            int intFeatIDLangNum          = 0;
            int intAbilityIncreaseLangNum = 0;

            Ability objAbility = new Ability("Intelligence");

            //Languages can be gained by Taking "Linguist" as a Feat (Bonus or Level)
            //Increasing Intelligence to gain a Int Mod point
            //Or both

            //Linguist FeatID = 33// now in AppSettings
            if (objCharLevelFeat.FeatID == Common.GetAppSettingsID("LinguistFeatID"))
            {
                //The user has increase their Intelligence this level so we need to check the mod for this instance of Force Training
                if (objAbility1Modified.AbilityID == 2 || objAbility2Modified.AbilityID == 2)
                {
                    if ((((objCharacter.GetCharacterAbilityScore(objAbility) + 1) - 10) / 2) != objCharacter.GetCharacterAbilityModifier(objAbility))
                    {
                        intFeatIDLangNum = intFeatIDLangNum + objCharacter.GetCharacterAbilityModifier(objAbility) + 1;
                    }
                }
                else
                {
                    intFeatIDLangNum = intFeatIDLangNum + objCharacter.GetCharacterAbilityModifier(objAbility) + 1;
                }
            }

            //Has intelligence increased
            //The user has increase their Intelligence this level so we need to check the mod for this instance of Force Training
            if (objAbility1Modified.AbilityID == 2 || objAbility2Modified.AbilityID == 2)
            {
                if ((((objCharacter.GetCharacterAbilityScore(objAbility) + 1) - 10) / 2) != objCharacter.GetCharacterAbilityModifier(objAbility))
                {
                    intAbilityIncreaseLangNum = intAbilityIncreaseLangNum + 1;
                }
            }

            intReturnVal = intFeatIDLangNum + intAbilityIncreaseLangNum;
            return(intReturnVal);
        }
コード例 #4
0
        private void SetButtonLocations()
        {
            int currentLoc = 0;
            CharUpgradeButtonOptions objCurr = new CharUpgradeButtonOptions();

            int intForceRegimenMastery = Common.GetAppSettingsID("ForceRegimenMasteryID");
            int intForceTrainingID     = Common.GetAppSettingsID("ForceTrainingFeatID");

            //Determine what buttons are needed and put them in an array
            if (objCALC.lstButtonsNeeded.Count == 0)
            {
                //Check to see whats needed - Talent
                if (objCALC.ClassLevelInfoAvailable(Common.strClassLevelInfoProps.Talent))
                {
                    objCurr.SetID     = currentLoc;
                    objCurr.objButton = this.btnTalentAddition;
                    objCurr.objLabel  = this.lblTalentAddition;
                    objCALC.lstButtonsNeeded.Add(objCurr);
                    objCurr = new CharUpgradeButtonOptions();
                    currentLoc++;
                }

                // - Bonus Feat
                if (objCALC.ClassLevelInfoAvailable(Common.strClassLevelInfoProps.BonusFeat))
                {
                    objCurr.SetID     = currentLoc;
                    objCurr.objButton = this.btnBonusFeat;
                    objCurr.objLabel  = this.lblBonusFeat;
                    objCALC.lstButtonsNeeded.Add(objCurr);
                    objCurr = new CharUpgradeButtonOptions();
                    currentLoc++;
                }

                // - Race Feat
                if ((objCALC.objCharacter.objRace.BonusFeat) && (objCALC.objCharacter.CharacterLevelID == 0))
                {
                    objCurr.SetID     = currentLoc;
                    objCurr.objButton = this.btnRaceFeat;
                    objCurr.objLabel  = this.lblRaceFeat;
                    objCALC.lstButtonsNeeded.Add(objCurr);
                    objCurr = new CharUpgradeButtonOptions();
                    currentLoc++;
                }

                // - Character Level
                if (objCALC.objNewCharLevel.FeatAvailable)
                {
                    objCurr.SetID     = currentLoc;
                    objCurr.objButton = this.btnLevelFeat;
                    objCurr.objLabel  = this.lblLevelFeat;
                    objCALC.lstButtonsNeeded.Add(objCurr);
                    objCurr = new CharUpgradeButtonOptions();
                    currentLoc++;
                }

                // - Force Powers
                if (objCALC.objCharacter.ForcePowersAvailableForSelection(intForceTrainingID, objCALC.objCharLevelFeat, objCALC.objRaceFeat, objCALC.objAbility1Modified, objCALC.objAbility2Modified))
                {
                    objCurr.SetID     = currentLoc;
                    objCurr.objButton = this.btnForcePower;
                    objCurr.objLabel  = this.lblForcePowers;
                    objCALC.lstButtonsNeeded.Add(objCurr);
                    objCurr = new CharUpgradeButtonOptions();
                    currentLoc++;
                }

                //Check to see whats needed - Force Secret
                if (objCALC.ClassLevelInfoAvailable(Common.strClassLevelInfoProps.ForceSecret))
                {
                    objCurr.SetID     = currentLoc;
                    objCurr.objButton = this.btnForceSecret;
                    objCurr.objLabel  = this.lblForceSecret;
                    objCALC.lstButtonsNeeded.Add(objCurr);
                    objCurr = new CharUpgradeButtonOptions();
                    currentLoc++;
                }

                // - Force Technique
                if (objCALC.ClassLevelInfoAvailable(Common.strClassLevelInfoProps.ForceTechnique))
                {
                    objCurr.SetID     = currentLoc;
                    objCurr.objButton = this.btnForceTechnique;
                    objCurr.objLabel  = this.lblForceTechnique;
                    objCALC.lstButtonsNeeded.Add(objCurr);
                    objCurr = new CharUpgradeButtonOptions();
                    currentLoc++;
                }

                // - Languages
                if (objCALC.DetermineNumberOfLanguagesGained() > 0)
                {
                    objCurr.SetID     = currentLoc;
                    objCurr.objButton = this.btnForceTechnique;
                    objCurr.objLabel  = this.lblForceTechnique;
                    objCALC.lstButtonsNeeded.Add(objCurr);
                    objCurr = new CharUpgradeButtonOptions();
                    currentLoc++;
                }

                // - Abilities Increase
                if (objCALC.objNewCharLevel.AbilityIncrease)
                {
                    objCurr.SetID     = currentLoc;
                    objCurr.objButton = this.btnAbilityIncrease;
                    objCurr.objLabel  = this.lblAbilitiesIncrease;
                    objCALC.lstButtonsNeeded.Add(objCurr);
                    objCurr = new CharUpgradeButtonOptions();
                    currentLoc++;
                }

                // - Skills Increase - We can use the Number of Languages
                if (objCALC.DetermineNumberOfSkillsGained() > 0)
                {
                    objCurr.SetID     = currentLoc;
                    objCurr.objButton = this.btnSkills;
                    objCurr.objLabel  = this.lblSkills;
                    objCALC.lstButtonsNeeded.Add(objCurr);
                    objCurr = new CharUpgradeButtonOptions();
                    currentLoc++;
                }

                // - Starting Feat
                if ((objCALC.ClassLevel == 1) && (objCALC.objNewCharLevel.CharacterLevelID != 1))
                {
                    objCurr.SetID     = currentLoc;
                    objCurr.objButton = this.btnStartingFeat;
                    objCurr.objLabel  = this.lblStartingFeat;
                    objCALC.lstButtonsNeeded.Add(objCurr);
                    objCurr = new CharUpgradeButtonOptions();
                    currentLoc++;
                }
                else
                {
                    if ((objCALC.ClassLevel == 1) && (objCALC.objCharacter.CharacterLevelID == 0))
                    {
                        //add the starting feats for this class
                        if (!objCALC.blnStartingFeatsAdded)
                        {
                            objCALC.objCharacter.AddCharacterStartingFeats(objCALC.objSelectedClass);
                            objCALC.blnStartingFeatsAdded = true;
                        }
                    }
                }

                // - Force Regimen
                if (objCALC.objCharacter.ForceRegimenAvailableForSelection(intForceRegimenMastery, objCALC.objCharLevelFeat, objCALC.objRaceFeat, objCALC.objAbility1Modified, objCALC.objAbility2Modified))
                {
                    objCurr.SetID     = currentLoc;
                    objCurr.objButton = this.btnForceRegiem;
                    objCurr.objLabel  = this.lblForceRegiem;
                    objCALC.lstButtonsNeeded.Add(objCurr);
                    objCurr = new CharUpgradeButtonOptions();
                    currentLoc++;
                }

                currentLoc = 0;
                foreach (CharUpgradeButtonOptions objCUBO in objCALC.lstButtonsNeeded)
                {
                    objCUBO.objButton.Location = GetFormButton(objCUBO.objButton.Name).Location = arryButtonLoc[objCUBO.SetID];
                    objCUBO.objButton.Visible  = true;
                    objCUBO.objLabel.Location  = GetFormLabel(objCUBO.objLabel.Name).Location = arryLabelLoc[objCUBO.SetID];
                }
            }

            else
            {
                //Do we need to turn some of the buttons OFF base on a feat that was selected and now changed
                if (objCALC.CharUpgradeButtonOptionsListContainsButton(this.btnForcePower))
                {
                    //If we have them we need to see if either the abilities have increase OR the Feat (Race or Level) is a force Training,
                    //If the ability hasn't increased and the feat is not a ForceTrainingID then we clear out the Force Powers
                    if (!objCALC.objCharacter.ForcePowersAvailableForSelection(intForceTrainingID, objCALC.objCharLevelFeat, objCALC.objRaceFeat, objCALC.objAbility1Modified, objCALC.objAbility2Modified))
                    {
                        //Remove the button and clear out the lst of ForcePowers.
                        objCALC.lstButtonsNeeded = objCALC.RemoveCharUpgradeButtonFromList(this.btnForcePower);
                        SetButtonLocationList();
                    }

                    //make sure we don't have too many force powers
                    if (objCALC.lstNewForcePowers.Count > objCALC.DetermineNumberOfForcePowersGained())
                    {
                        objCALC.lstNewForcePowers = new List <ForcePower>();
                        this.lblForcePowers.Text  = "";
                    }
                }
                //Do we need to Turn some of the button on based on a Feat Selection (Force Power, Force Regimen, etc)

                if (objCALC.objCharLevelFeat.FeatID == intForceTrainingID || objCALC.objRaceFeat.FeatID == intForceTrainingID)
                {
                    //The Char Level Feat Selected is one requiring a Selection of another Entity (Force Power)
                    //Check to see if the buttons already enabled.
                    if (!objCALC.CharUpgradeButtonOptionsListContainsButton(this.btnForcePower))
                    {
                        CharUpgradeButtonOptions objFPCurr = new CharUpgradeButtonOptions();
                        objFPCurr.SetID              = objCALC.lstButtonsNeededMaxSetID() + 1;
                        objFPCurr.objButton          = this.btnForcePower;
                        objFPCurr.objLabel           = this.lblForcePowers;
                        objFPCurr.objButton.Location = GetFormButton(objFPCurr.objButton.Name).Location = arryButtonLoc[objFPCurr.SetID];
                        objFPCurr.objLabel.Location  = GetFormLabel(objFPCurr.objLabel.Name).Location = arryLabelLoc[objFPCurr.SetID];
                        objCALC.lstButtonsNeeded.Add(objFPCurr);
                    }
                }
                if (objCALC.objCharLevelFeat.FeatID == intForceRegimenMastery || objCALC.objRaceFeat.FeatID == intForceRegimenMastery)
                {
                    //The Char Level Feat Selected is one requiring a Selection of another Entity (Force Power , Force Regimen, etc)
                    //Check to see if the buttons already enabled.
                    if (!objCALC.CharUpgradeButtonOptionsListContainsButton(this.btnForceRegiem))
                    {
                        CharUpgradeButtonOptions objFPCurr = new CharUpgradeButtonOptions();
                        objFPCurr.SetID              = objCALC.lstButtonsNeededMaxSetID() + 1;
                        objFPCurr.objButton          = this.btnForceRegiem;
                        objFPCurr.objLabel           = this.lblForceRegiem;
                        objFPCurr.objButton.Location = GetFormButton(objFPCurr.objButton.Name).Location = arryButtonLoc[objFPCurr.SetID];
                        objFPCurr.objLabel.Location  = GetFormLabel(objFPCurr.objLabel.Name).Location = arryLabelLoc[objFPCurr.SetID];
                        objCALC.lstButtonsNeeded.Add(objFPCurr);
                    }
                }

                //Turn the buttons back on, we are comming back into the form (maybe)
                foreach (CharUpgradeButtonOptions objCUBO in objCALC.lstButtonsNeeded)
                {
                    //objCUBO.objButton.Visible
                    switch (objCUBO.objButton.Name)
                    {
                    case "btnTalentAddtion":
                        this.btnTalentAddition.Visible  = true;
                        this.btnTalentAddition.Location = objCUBO.objButton.Location;
                        this.lblTalentAddition.Location = objCUBO.objLabel.Location;
                        break;

                    case "btnAbilityIncrease":
                        this.btnAbilityIncrease.Visible    = true;
                        this.btnAbilityIncrease.Location   = objCUBO.objButton.Location;
                        this.lblAbilitiesIncrease.Location = objCUBO.objLabel.Location;
                        break;

                    case "btnBonusFeat":
                        this.btnBonusFeat.Visible  = true;
                        this.btnBonusFeat.Location = objCUBO.objButton.Location;
                        this.lblBonusFeat.Location = objCUBO.objLabel.Location;
                        break;

                    case "btnRaceFeat":
                        this.btnRaceFeat.Visible  = true;
                        this.btnRaceFeat.Location = objCUBO.objButton.Location;
                        this.lblRaceFeat.Location = objCUBO.objLabel.Location;
                        break;

                    case "btnForcePower":
                        this.btnForcePower.Visible   = true;
                        this.btnForcePower.Location  = objCUBO.objButton.Location;
                        this.lblForcePowers.Location = objCUBO.objLabel.Location;
                        break;

                    case "btnForceSecret":
                        this.btnForceSecret.Visible  = true;
                        this.btnForceSecret.Location = objCUBO.objButton.Location;
                        this.lblForceSecret.Location = objCUBO.objLabel.Location;
                        break;

                    case "btnForceTechnique":
                        this.btnForceTechnique.Visible  = true;
                        this.btnForceTechnique.Location = objCUBO.objButton.Location;
                        this.lblForceTechnique.Location = objCUBO.objLabel.Location;
                        break;

                    case "btnLanguages":
                        this.btnLanguages.Visible  = true;
                        this.btnLanguages.Location = objCUBO.objButton.Location;
                        this.lblLanguages.Location = objCUBO.objLabel.Location;
                        break;

                    case "btnLevelFeat":
                        this.btnLevelFeat.Visible  = true;
                        this.btnLevelFeat.Location = objCUBO.objButton.Location;
                        this.lblLevelFeat.Location = objCUBO.objLabel.Location;
                        break;

                    case "btnSkills":
                        this.btnSkills.Visible  = true;
                        this.btnSkills.Location = objCUBO.objButton.Location;
                        this.lblSkills.Location = objCUBO.objLabel.Location;
                        break;

                    case "btnStartingFeat":
                        this.btnStartingFeat.Visible  = true;
                        this.btnStartingFeat.Location = objCUBO.objButton.Location;
                        this.lblStartingFeat.Location = objCUBO.objLabel.Location;
                        break;

                    case "btnForceRegiem":
                        this.btnForceRegiem.Visible  = true;
                        this.btnForceRegiem.Location = objCUBO.objButton.Location;
                        this.lblForceRegiem.Location = objCUBO.objLabel.Location;
                        break;

                    default:
                        btnTalentAddition.Visible       = true;
                        this.btnTalentAddition.Location = objCUBO.objButton.Location;
                        this.lblTalentAddition.Location = objCUBO.objLabel.Location;
                        break;
                    }
                }
            }
        }
コード例 #5
0
        private void SetWeaponFields(Weapon objWeapon)
        {
            intWeaponSelectedID       = objWeapon.WeaponID;
            this.txtWeaponCost.Text   = objWeapon.Cost.ToString();
            this.txtBookName.Text     = objWeapon.objBook.BookName;
            this.txtRateOfFire.Text   = objWeapon.RateOfFire;
            this.txtWeaponDamage.Text = objWeapon.DamageDieNumber.ToString() + "d" + objWeapon.DamageDieType.ToString();
            if (objWeapon.ExtraDamage > 0)
            {
                txtWeaponDamage.Text = txtWeaponDamage.Text + "+" + objWeapon.ExtraDamage.ToString();
            }
            this.txtWeaponName.Text            = objWeapon.WeaponName;
            this.ckbStunDamage.Checked         = objWeapon.Stun;
            this.txtWeaponNotes.Text           = objWeapon.WeaponDescription;
            this.txtWeaponProficiencyFeat.Text = objWeapon.objWeaponProficiencyFeat.FeatName;
            this.txtWeaponSize.Text            = objWeapon.objWeaponSize.WeaponSizeName;
            this.txtWeaponStunDamage.Text      = objWeapon.StunDieNumber.ToString() + "d" + objWeapon.StunDieType.ToString();
            if (objWeapon.ExtraStunDamage > 0)
            {
                txtWeaponStunDamage.Text = txtWeaponStunDamage.Text + "+" + objWeapon.ExtraStunDamage.ToString();
            }
            this.txtWeaponType.Text = objWeapon.objWeaponType.WeaponTypeName;

            this.ckbAccurate.Checked         = objWeapon.Accurate;
            this.ckbAreaOfAttack.Checked     = objWeapon.AreaOfAttack;
            this.ckbDoubleWeapon.Checked     = objWeapon.DoubleWeapon;
            this.ckbInaccurate.Checked       = objWeapon.Inaccurate;
            this.ckbRequiresOrdiance.Checked = objWeapon.RequiresSeperateAmmo;
            this.ckbSlugThrower.Checked      = objWeapon.Slugthrower;


            //Set Ranges
            lvRanges.Items.Clear();
            if (objWeapon.objRanges.Count > 1)
            {
                foreach (Range objRange1 in objWeapon.objRanges)
                {
                    if (objWeapon.Inaccurate)
                    {
                        if (!objRange1.RangeName.ToString().ToLower().Contains("long"))
                        {
                            lvRanges.Items.Add(SetRangeListViewItem(objRange1, objWeapon));
                        }
                    }
                    else
                    {
                        lvRanges.Items.Add(SetRangeListViewItem(objRange1, objWeapon));
                    }
                }
            }
            else
            {
                foreach (Range objRange in objWeapon.objRanges)
                {
                    lvRanges.Items.Add(SetRangeListViewItem(objRange, objWeapon));
                }
            }


            for (int i = 0; i < lvRanges.Columns.Count; i++)
            {
                lvRanges.Columns[i].Width = -2;
            }

            //Set Character Specific Data
            if (objCharacter.CharacterID == 0)
            {
                ShowCharacterCheckData(false);
            }
            else
            {
                txtMeleeAttackBonus.Text = objCharacter.CalculateMeleeToHit(objWeapon, Common.GetAppSettingsID("Weapon_Finese_SimpleWeapons"), Common.GetAppSettingsID("Weapon_Finese_Lightsabers")).ToString();
                txtMeleeDamageBonus.Text = objCharacter.CalculateMeleeBonusDamage().ToString();
                if (objWeapon.ExtraDamage > 0)
                {
                    txtMeleeDamageBonus.Text = txtMeleeDamageBonus.Text + "+" + objWeapon.ExtraDamage.ToString();
                }
                txtRangeAttackBonus.Text = objCharacter.CalculateRangeToHit(objWeapon).ToString();
                txtRangeDamageBonus.Text = objCharacter.CalculateRangeBonusDamage().ToString();
                SetAttackAndDamageBonusesVisibility(objWeapon);
                ShowCharacterCheckData(true);
            }

            this.btnSelectWeapon.Enabled = true;
        }