public void CheckFortValue() { string CheckName = "Fort"; try { int ClassMod = CharacterClasses.GetFortSaveValue(); int OnGoingMods = 0; string onGoingModFormula = string.Empty; if (_indvSB != null) { OnGoingMods = _indvSB.GetOnGoingStatBlockModValue(OnGoingStatBlockModifier.StatBlockModifierTypes.SavingThrow, OnGoingStatBlockModifier.StatBlockModifierSubTypes.None, false, ref onGoingModFormula); OnGoingMods += _indvSB.GetOnGoingStatBlockModValue(OnGoingStatBlockModifier.StatBlockModifierTypes.SavingThrow, OnGoingStatBlockModifier.StatBlockModifierSubTypes.SavingThrow_Fort, false, ref onGoingModFormula); } int RaceMod = CharacterClasses.HasClass("animal companion") ? 0 : Race_Base.RaceFort(); int AbilityMod = GetAbilityScoreMod(Race_Base.FortMod()); int FortMod = ClassMod + RaceMod + AbilityMod + OnGoingMods; string formula = "+" + ClassMod.ToString() + " ClassMod " + " +" + RaceMod.ToString() + " RaceMod " + " +" + AbilityMod.ToString() + " AbilityMod "; if (OnGoingMods != 0) { formula += " +" + OnGoingMods.ToString() + " OnGoingMods(" + onGoingModFormula + ")"; } if (_monSBSearch.HasFeat("Great Fortitude")) { FortMod += 2; formula += " +2 Great Fortitude"; } if (_monSBSearch.HasTrait("Forlorn")) { FortMod += 1; formula += " +1 Forlorn"; } if (MonSB.SubType.IndexOf("nightshade") >= 0) { FortMod += 2; formula += " +2 nightshade"; } if (_monSBSearch.HasSQ("lore of true stamina")) { FortMod += 2; formula += " +2 lore of true stamina"; } if (_monSBSearch.HasSQ("spirit (champion)")) { int mediumLevel = CharacterClasses.FindClassLevel("medium"); int bonus = 1; if (mediumLevel >= 4) { bonus++; } if (mediumLevel >= 8) { bonus++; } if (mediumLevel >= 12) { bonus++; } if (mediumLevel >= 15) { bonus++; } if (mediumLevel >= 19) { bonus++; } FortMod += bonus; formula += " +" + bonus.ToString() + " spirit (champion)"; } if (_monSBSearch.HasDomain("Protection")) { int clericLevel = CharacterClasses.FindClassLevel("cleric"); if (clericLevel == 0) { clericLevel = CharacterClasses.FindClassLevel("druid"); } int tempMod = (clericLevel / 5) + 1; FortMod += tempMod; formula += " +" + tempMod.ToString() + " Protection domain"; } if (Race_Base.Name() == "Svirfneblin") { FortMod += 2; formula += " +2 Svirfneblin"; } string FamiliarString = _monSBSearch.FindFamiliarString(CharacterClasses.HasClass("witch")); if (FamiliarString == "rat") { FortMod += 2; formula += " +2 rat familiar"; } if (CharacterClasses.HasClass("Paladin")) { int level = CharacterClasses.FindClassLevel("paladin"); if (level >= 2) //Divine Grace { FortMod += _abilityScores.ChaMod; formula += " + " + _abilityScores.ChaMod.ToString() + " Divine Grace"; } } if (CharacterClasses.HasClass("Antipaladin")) { int level = CharacterClasses.FindClassLevel("Antipaladin"); if (level >= 2) //Unholy Resilience { FortMod += _abilityScores.ChaMod; formula += " + " + _abilityScores.ChaMod.ToString() + " Unholy Resilience"; } } if (CharacterClasses.HasClass("prophet of kalistrade")) { int level = CharacterClasses.FindClassLevel("prophet of kalistrade"); //Auspicious Display --assumes the bling is present int mod = 1; if (level >= 4) { mod++; } if (level >= 7) { mod++; } if (level >= 10) { mod++; } FortMod += mod; formula += " + " + mod.ToString() + " Auspicious Display"; } if (_monSBSearch.HasTemplate("graveknight")) { FortMod += 2; formula += " + 2 Sacrilegious Aura"; } if (_monSBSearch.HasGear("heartstone")) { FortMod += 2; formula += " + 2 heartstone"; } if (_monSBSearch.HasArchetype("Sharper"))//Lucky Save { int rogueLevel = CharacterClasses.FindClassLevel("rogue"); int tempMod = 0; if (rogueLevel >= 3) { tempMod++; } if (rogueLevel >= 9) { tempMod++; } if (rogueLevel >= 15) { tempMod++; } if (tempMod > 0) { FortMod += tempMod; formula += " + " + tempMod.ToString() + " Lucky Save"; } } FortMod += GetMagicItemSaveMods(ref formula); int FortSB = Convert.ToInt32(Utility.GetNonParenValue(MonSB.Fort)); if (FortMod == FortSB) { _messageXML.AddPass(CheckName, formula); } else { _messageXML.AddFail(CheckName, FortMod.ToString(), FortSB.ToString(), formula); } } catch (Exception ex) { _messageXML.AddFail("CheckFortValue", ex.Message); } }