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); } } } } } }
public void CheckSpellDC(bool isGnome) { List <string> classNames = _characterClasses.GetClassNames(); SpellList SL; string formula = string.Empty; Dictionary <string, SpellList> classSpellsClone = new Dictionary <string, SpellList>(_classSpells); foreach (string className in classNames) { formula = string.Empty; if (_characterClasses.CanClassCastSpells(className.ToLower())) { if (classSpellsClone.ContainsKey(className)) { SL = CkeckClassSpellDCs(isGnome, ref formula, className); classSpellsClone.Remove(className); } } } if (!classNames.Any() && classSpellsClone.Any() && _monsterSB.SpellsPrepared.Length > 0) { string temp = _monsterSB.SpellsPrepared; temp = temp.Substring(0, temp.IndexOf(PathfinderConstants.SPACE)); if (classSpellsClone.ContainsKey(temp)) { SL = _classSpells[temp]; List <SpellData> listOfSpells = SL.ListOfSpells; int abilityBonus = StatBlockInfo.GetAbilityModifier(_monsterSB.GetAbilityScoreValue(_characterClasses.GetSpellBonusAbility(temp))); foreach (SpellData spellData in listOfSpells) { if (spellData.DC > 0) { int computedDC = 10 + spellData.Level + abilityBonus; formula = "10 +" + spellData.Level.ToString() + " spell level +" + abilityBonus.ToString() + " ability bonus"; if (computedDC == spellData.DC) { _messageXML.AddPass("Spell DC-" + spellData.Name); } else { _messageXML.AddFail("Spell DC-" + spellData.Name, computedDC.ToString(), spellData.DC.ToString(), formula); } } } classSpellsClone.Remove(temp); } } if (!classNames.Any() && classSpellsClone.Any() && _monsterSB.SpellsKnown.Length > 0) { string temp = _monsterSB.SpellsKnown; temp = temp.Substring(0, temp.IndexOf(PathfinderConstants.SPACE)); if (classSpellsClone.ContainsKey(temp)) { SL = _classSpells[temp]; List <SpellData> listOfSpells = SL.ListOfSpells; if (temp == "Spells") { temp = "Sorcerer"; } int abilityBonus = StatBlockInfo.GetAbilityModifier(_monsterSB.GetAbilityScoreValue(_characterClasses.GetSpellBonusAbility(temp))); foreach (SpellData spellData in listOfSpells) { if (spellData.DC > 0) { int computedDC = 10 + spellData.Level + abilityBonus; formula = "10 +" + spellData.Level.ToString() + " spell level +" + abilityBonus.ToString() + " ability bonus"; if (computedDC == spellData.DC) { _messageXML.AddPass("Spell DC-" + spellData.Name); } else { _messageXML.AddFail("Spell DC-" + spellData.Name, computedDC.ToString(), spellData.DC.ToString(), formula); } } } } classSpellsClone.Remove(temp); } if (classSpellsClone.Any()) { _messageXML.AddFail("Spell DC-", " Can't find Spell Block(s) for these classes: " + string.Join(", ", classSpellsClone.Keys.ToArray())); } }