public void CheckSpellDC(bool IsGnome) { List <string> Names = CharacterClasses.GetClassNames(); SpellList SL = null; string formula = string.Empty; foreach (string name in Names) { formula = string.Empty; if (CharacterClasses.CanClassCastSpells(name.ToLower())) { if (ClassSpells.ContainsKey(name)) { SL = ClassSpells[name]; List <SpellData> ListOfSpells = SL.ListOfSpells; int AbilityScore = MonSB.GetAbilityScoreValue(CharacterClasses.GetSpellBonusAbility(name)); OnGoingStatBlockModifier.StatBlockModifierSubTypes subType = Utility.GetOnGoingAbilitySubTypeFromString(CharacterClasses.GetSpellBonusAbility(name)); AbilityScore += _indvSB.GetOnGoingStatBlockModValue(OnGoingStatBlockModifier.StatBlockModifierTypes.Ability, subType); int AbilityBonus = StatBlockInfo.GetAbilityModifier(AbilityScore); int Bonus = 0; foreach (SpellData SD in ListOfSpells) { try { string Temp = SD.Name; Temp = Temp.Replace("†", string.Empty); List <string> School; Temp = Utility.RemoveSuperScripts(Temp); string search = Utility.SearchMod(Temp); if (search == "empty slot") { continue; } ISpellStatBlock Spell = SpellStatBlock.GetSpellByName(search); Bonus = 0; if (Spell == null) { _messageXML.AddFail("Spell DC", "Missing spell: " + search); } else { if (_monSBSearch.HasSpellFocusFeat(out School)) { if (School.Contains(Spell.school)) { Bonus++; } List <string> School2; if (_monSBSearch.HasGreaterSpellFocusFeat(out School2)) { if (School2.Contains(Spell.school)) { Bonus++; } } if (SLA_SaveFail(SD, Spell)) { _messageXML.AddFail("SLA Save-" + SD.Name, Spell.saving_throw, SD.DC.ToString()); } } if (_monSBSearch.HasElementalSkillFocusFeat(out School)) { if (School.Contains(Spell.school)) { Bonus++; } List <string> School2; if (_monSBSearch.HasGreaterElementalSkillFocusFeat(out School2)) { if (School2.Contains(Spell.school)) { Bonus++; } } if (SLA_SaveFail(SD, Spell)) { _messageXML.AddFail("SLA Save-" + SD.Name, Spell.saving_throw, SD.DC.ToString()); } } if (SD.DC > 0) { ComputeSpellDC(IsGnome, ref formula, name, AbilityBonus, ref Bonus, SD, Spell); } } } catch (Exception ex) { _messageXML.AddFail("CheckSpellDC--" + SD.Name, ex.Message); } } } } } if (!Names.Any() && MonSB.SpellsPrepared.Length > 0) { string temp = MonSB.SpellsPrepared; temp = temp.Substring(0, temp.IndexOf(" ")); if (ClassSpells.ContainsKey(temp)) { SL = ClassSpells[temp]; List <SpellData> ListOfSpells = SL.ListOfSpells; int AbilityBonus = StatBlockInfo.GetAbilityModifier(MonSB.GetAbilityScoreValue(CharacterClasses.GetSpellBonusAbility(temp))); foreach (SpellData SD in ListOfSpells) { if (SD.DC > 0) { int computedDC = 10 + SD.Level + AbilityBonus; formula = "10 +" + SD.Level.ToString() + " spell level +" + AbilityBonus.ToString() + " ability bonus"; if (computedDC == SD.DC) { _messageXML.AddPass("Spell DC-" + SD.Name); } else { _messageXML.AddFail("Spell DC-" + SD.Name, computedDC.ToString(), SD.DC.ToString(), formula); } } } } } if (!Names.Any() && MonSB.SpellsKnown.Length > 0) { string temp = MonSB.SpellsKnown; temp = temp.Substring(0, temp.IndexOf(" ")); if (ClassSpells.ContainsKey(temp)) { SL = ClassSpells[temp]; List <SpellData> ListOfSpells = SL.ListOfSpells; if (temp == "Spells") { temp = "Sorcerer"; } int AbilityBonus = StatBlockInfo.GetAbilityModifier(MonSB.GetAbilityScoreValue(CharacterClasses.GetSpellBonusAbility(temp))); foreach (SpellData SD in ListOfSpells) { if (SD.DC > 0) { int computedDC = 10 + SD.Level + AbilityBonus; formula = "10 +" + SD.Level.ToString() + " spell level +" + AbilityBonus.ToString() + " ability bonus"; if (computedDC == SD.DC) { _messageXML.AddPass("Spell DC-" + SD.Name); } else { _messageXML.AddFail("Spell DC-" + SD.Name, computedDC.ToString(), SD.DC.ToString(), formula); } } } } } }
private SpellList CkeckClassSpellDCs(bool isGnome, ref string formula, string name) { SpellList SL; { SL = _classSpells[name]; List <SpellData> listOfSpells = SL.ListOfSpells; int abilityScoreValue = _monsterSB.GetAbilityScoreValue(_characterClasses.GetSpellBonusAbility(name)); OnGoingStatBlockModifier.StatBlockModifierSubTypes subType = Utility.GetOnGoingAbilitySubTypeFromString(_characterClasses.GetSpellBonusAbility(name)); abilityScoreValue += _indvSB.GetOnGoingStatBlockModValue(OnGoingStatBlockModifier.StatBlockModifierTypes.Ability, subType); int abilityBonus = StatBlockInfo.GetAbilityModifier(abilityScoreValue); int bonus = 0; foreach (SpellData spellData in listOfSpells) { try { string temp = spellData.Name.Replace("†", string.Empty); List <string> schoolList; temp = Utility.RemoveSuperScripts(temp); string search = Utility.SearchMod(temp); if (search == "empty slot") { continue; } ISpellStatBlock spell = _spellStatBlockBusiness.GetSpellByName(search); bonus = 0; if (spell == null) { _messageXML.AddFail("Spell DC", "Missing spell: " + search); } else { if (_monSBSearch.HasSpellFocusFeat(out schoolList)) { if (schoolList.Contains(spell.school)) { bonus++; } List <string> schoolList2; if (_monSBSearch.HasGreaterSpellFocusFeat(out schoolList2)) { if (schoolList2.Contains(spell.school)) { bonus++; } } if (SLA_SaveFail(spellData, spell)) { _messageXML.AddFail("SLA Save-" + spellData.Name, spell.saving_throw, spellData.DC.ToString()); } } if (_monSBSearch.HasElementalSkillFocusFeat(out schoolList)) { if (schoolList.Contains(spell.school)) { bonus++; } List <string> schoolList2; if (_monSBSearch.HasGreaterElementalSkillFocusFeat(out schoolList2)) { if (schoolList2.Contains(spell.school)) { bonus++; } } if (SLA_SaveFail(spellData, spell)) { _messageXML.AddFail("SLA Save-" + spellData.Name, spell.saving_throw, spellData.DC.ToString()); } } if (spellData.DC > 0) { ComputeSpellDC(isGnome, ref formula, name, abilityBonus, ref bonus, spellData, spell); } } } catch (Exception ex) { _messageXML.AddFail("CheckSpellDC--" + spellData.Name, ex.Message); } } } return(SL); }