private static bool SLA_SaveFail(SpellData SD, ISpellStatBlock Spell) { var savingThrowLower = Spell.saving_throw.ToLower(); return(SD.DC == -1 && !savingThrowLower.Contains("none") && !savingThrowLower.Contains("harmless") && Spell.saving_throw.Length > 0 && !savingThrowLower.Contains("see text") && !savingThrowLower.Contains("negates") && !savingThrowLower.Contains("disbelief")); }
public void ReplaceTables(ISpellStatBlock SB_old, ISpellStatBlock SB_new) { int TableCount = SB_old.description_formated.PhraseCount("<table>"); if (TableCount == 0) { return; } int PosStart = SB_old.description_formated.IndexOf("<table>"); int PosEnd = SB_old.description_formated.IndexOf("</table>"); List <string> TableHold = new List <string>(); for (int a = 0; a < TableCount; a++) { TableHold.Add(SB_old.description_formated.Substring(PosStart, PosEnd - PosStart + "</table>".Length)); PosStart = SB_old.description_formated.IndexOf("<table>", PosEnd); if (PosStart >= 0) { PosEnd = SB_old.description_formated.IndexOf("</table>", PosStart); } } string TableStart = string.Empty; string TableEnd = string.Empty; string TableText = string.Empty; string OldFormatted = SB_new.description_formated; foreach (string Table in TableHold) { TableStart = FindTableTextStart(Table); TableEnd = FindTableTextEnd(Table); PosStart = SB_new.description_formated.IndexOf(TableStart); PosEnd = SB_new.description_formated.IndexOf(TableEnd); if (PosStart >= 0 && PosEnd >= 0) { TableText = SB_new.description_formated.Substring(PosStart, PosEnd - PosStart + TableEnd.Length); SB_new.description_formated = SB_new.description_formated.Replace(TableText, Table); SB_new.full_text = SB_new.full_text.Replace(OldFormatted, SB_new.description_formated); } } }
public string CreateFullText(ISpellStatBlock SB) { SpellSB = SB; StringBuilder fullTextSB = new StringBuilder(); fullTextSB.Append(CommonMethods.Get_CSS_Ref()); Foramt_Basics_Div(fullTextSB); fullTextSB.Append(PathfinderConstants.EDIV); Format_Description_Div(fullTextSB); Format_HauntStatistics(fullTextSB); string Temp = fullTextSB.ToString(); FindReplaceTextService findReplaceTextService = new FindReplaceTextService(PathfinderConstants.ConnectionString); findReplaceTextService.ExecuteFindReplaceOnText(ref Temp); // Utility.FixItalics(ref Temp); return(Temp); }
public static void CheckQuickenSpellLikeAbilityMonster(int CasterLevel, SpellData SD, ISpellStatBlock Spell, StatBlockMessageWrapper _messageXML) { if ((SD.metaMagicPowers & StatBlockInfo.MetaMagicPowers.quickened) == StatBlockInfo.MetaMagicPowers.quickened) { int MinCasterLevelNeeded = -1; switch (Spell.SLA_Level) { case 0: MinCasterLevelNeeded = 8; break; case 1: MinCasterLevelNeeded = 10; break; case 2: MinCasterLevelNeeded = 12; break; case 3: MinCasterLevelNeeded = 14; break; case 4: MinCasterLevelNeeded = 16; break; case 5: MinCasterLevelNeeded = 18; break; case 6: MinCasterLevelNeeded = 20; break; } if (CasterLevel >= MinCasterLevelNeeded) { _messageXML.AddPass("Quicken Spell-Like Ability-" + SD.Name); } else { _messageXML.AddFail("Quicken Spell-Like Ability-" + SD.Name, MinCasterLevelNeeded.ToString(), CasterLevel.ToString()); } } }
private void ComputeSpellDC(bool IsGnome, ref string formula, string name, int AbilityBonus, ref int Bonus, SpellData SD, ISpellStatBlock Spell) { int Bloodline = 0; int gnomeBonus = 0; int spellClassLevel = Spell.GetSpellLevelByClass(name, _monSBSearch.HasCurse("haunted"), _monSBSearch.HasFeat("Shade of the Uskwood"), _monSBSearch.HasArchetype("Razmiran priest")); if (SD.Domain) { spellClassLevel = SD.Level; } // if (spellClassLevel < 0 && SD.Domain) spellClassLevel = SD.Level; if (spellClassLevel < 0 && _monSBSearch.HasBloodline()) { Dictionary <string, int> bloodlineBonusSpells = CharacterClasses.GetBloodlineBonusSpells(); if (bloodlineBonusSpells.ContainsKey(Spell.name.ToLower())) { spellClassLevel = SD.Level; } } if (spellClassLevel < 0 && _monSBSearch.HasMystery()) { Dictionary <string, int> mysteryBonusSpells = CharacterClasses.GetMysteryBonusSpells(); if (mysteryBonusSpells.ContainsKey(Spell.name.ToLower())) { spellClassLevel = SD.Level; } } if (spellClassLevel < 0 && _monSBSearch.HasPatron()) { List <string> patronBonusSpells = CharacterClasses.GetPatronBonusSpells(); if (patronBonusSpells.Contains(Spell.name.ToLower())) { spellClassLevel = SD.Level; } } if (IsGnome && Spell.school.Contains("illusion")) { gnomeBonus = 1; } if (_monSBSearch.HasBloodline("arcane")) { int sorcererLevel = CharacterClasses.FindClassLevel("sorcerer"); if (sorcererLevel >= 15) { string schoolPower = _monSBSearch.GetSQ("school power"); schoolPower = schoolPower.Replace("spells)", string.Empty).Trim(); int Pos = schoolPower.LastIndexOf(" "); schoolPower = schoolPower.Substring(Pos).Trim(); if (Spell.school.Contains(schoolPower)) { Bloodline += 2; } } } if (_monSBSearch.HasBloodline("fey")) { if (Spell.subschool.Contains("compulsion")) { Bloodline += 2; } } if (_monSBSearch.HasBloodline("stormborn")) { if (Spell.descriptor.Contains("electricity") || Spell.descriptor.Contains("sonic")) { Bloodline += 1; } } if (_monSBSearch.HasBloodline("infernal")) { if (Spell.subschool.Contains("charm")) { Bloodline += 2; } } if (_monSBSearch.HasClassArchetype("winter witch")) { if (Spell.descriptor.Contains("cold")) { Bonus += 1; } } if (_monSBSearch.Race() == "kitsune" && Spell.school.Contains("enchantment")) { Bonus += 1; } if (_monSBSearch.HasSubType("sahkil") && (Spell.school.Contains("emotion") || Spell.school.Contains("fear"))) { Bonus += 2; } List <string> School; if (_monSBSearch.HasElementalSkillFocusFeat(out School)) { if (School.Contains(Spell.descriptor)) { Bonus++; } List <string> School2; if (_monSBSearch.HasGreaterElementalSkillFocusFeat(out School2)) { if (School2.Contains(Spell.descriptor)) { Bonus++; } } } int computedDC = 10 + spellClassLevel + AbilityBonus + Bonus + Bloodline + gnomeBonus; formula = "10 +" + spellClassLevel.ToString() + " spell class level +" + AbilityBonus.ToString() + " ability bonus"; if (Bloodline != 0) { formula += " +" + Bloodline.ToString() + " bloodline"; } if (gnomeBonus != 0) { formula += " +" + gnomeBonus.ToString() + " gnome magic"; } if (Bonus != 0) { formula += " +" + Bonus.ToString() + " skill/spell focus 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> 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 CheckSLA(bool IsGnome) { if (!SLA.Any()) { return; } SpellList SL = null; int AbilityBonus = 0; string AbilityBonusName = "Cha"; string formulaConcentration = string.Empty; foreach (KeyValuePair <string, SpellList> sla in SLA) { SL = sla.Value; if (sla.Key == "Domain" || sla.Key == "Qinggong Monk") { AbilityBonus = StatBlockInfo.GetAbilityModifier(MonSB.GetAbilityScoreValue(StatBlockInfo.AbilityName.Wisdom)); AbilityBonusName = "Wis"; formulaConcentration = SL.CasterLevel.ToString() + " Caster Level +" + AbilityBonus.ToString() + " Wisdom modifier"; } else if (sla.Key == "Rogue" || sla.Key.Contains("Evoker") || sla.Key.Contains("Enchanter") || sla.Key.Contains("Arcane") || sla.Key.Contains("Diviner") || sla.Key.Contains("Conjurer")) { AbilityBonus = StatBlockInfo.GetAbilityModifier(MonSB.GetAbilityScoreValue(StatBlockInfo.AbilityName.Intelligence)); AbilityBonusName = "Int"; formulaConcentration = SL.CasterLevel.ToString() + " Caster Level +" + AbilityBonus.ToString() + " Intelligence modifier"; } else { AbilityBonus = StatBlockInfo.GetAbilityModifier(MonSB.GetAbilityScoreValue(StatBlockInfo.AbilityName.Charisma)); formulaConcentration = SL.CasterLevel.ToString() + " Caster Level +" + AbilityBonus.ToString() + " Charisma modifier"; } int Other = 0; if (_monSBSearch.Race() == "Spriggan") { Other++; formulaConcentration += " +1 Spriggan Magic"; } int computedConcentration = SL.CasterLevel + AbilityBonus + Other; if (SL.Concentration == computedConcentration) { _messageXML.AddPass("SLA Concentration-" + SL.Source); } else { _messageXML.AddFail("SLA Concentration-" + SL.Source, computedConcentration.ToString(), SL.Concentration.ToString(), formulaConcentration); } List <SpellData> ListOfSpells = SL.ListOfSpells; int CasterLevel = SL.CasterLevel; int gnomeBonus = 0; foreach (SpellData SD in ListOfSpells) { string search = Utility.SearchMod(SD.Name); ISpellStatBlock Spell = SpellStatBlock.GetSpellByName(search); if (Spell != null) { SpellChecker.CheckQuickenSpellLikeAbilityMonster(CasterLevel, SD, Spell, _messageXML); SpellChecker.CheckEmpowerSpellLikeAbilityMonster(CasterLevel, SD, Spell, _messageXML); if (SD.DC > 0) { gnomeBonus = 0; if (IsGnome && Spell.school.Contains("illusion")) { gnomeBonus = 1; } int computedDC = 10 + (Spell.SLA_Level ?? -1) + AbilityBonus + gnomeBonus; string formula = "10 +" + (Spell.SLA_Level ?? -1).ToString() + " Spell.SLA_Level +" + AbilityBonus.ToString() + " AbilityBonus (" + AbilityBonusName + ")"; if (gnomeBonus != 0) { formula += " +" + gnomeBonus.ToString() + " gnome magic"; } if (_monSBSearch.Race() == "Spriggan") { computedDC++; //Spriggan Magic } if (_monSBSearch.HasSubType("sahkil") && (Spell.descriptor.Contains("emotion") || Spell.descriptor.Contains("fear"))) { computedDC += 2; } if (computedDC == SD.DC) { _messageXML.AddPass("SLA DC-" + SD.Name); } else { _messageXML.AddFail("SLA DC-" + SD.Name, computedDC.ToString(), SD.DC.ToString(), formula); } } if (SLA_SaveFail(SD, Spell)) { _messageXML.AddFail("SLA Save-" + SD.Name, Spell.saving_throw, SD.DC.ToString()); } } else { _messageXML.AddInfo("SLA: Missing Spell-" + search); } } } }
public void ParseConstantSpells() { string text = _sbCheckerBaseInput.MonsterSB.SpellLikeAbilities; string CR = Environment.NewLine; _spellsData.ConstantSpells = new List <string>(); if (!text.Contains("Constant")) { return; } int Pos = text.IndexOf("Constant"); int Pos3 = text.IndexOf(CR); if (Pos3 == -1) { Pos3 = text.Length; } ISpellStatBlock spell = null; bool found = false; _sbCheckerBaseInput.IndvSB = new IndividualStatBlock_Combat(); _sbCheckerBaseInput.IndvSB.HD = _sbCheckerBaseInput.MonsterSB.HD; List <IndividualStatBlock_Combat> list = new List <IndividualStatBlock_Combat> { _sbCheckerBaseInput.IndvSB }; int tempPos = Pos3 - Pos; if (tempPos < 0) { tempPos = text.Length - Pos; } string hold = text.Substring(Pos, tempPos); if (hold.Contains(CR)) { Pos = hold.IndexOf(CR); hold = hold.Substring(0, Pos).Trim(); } hold = hold.Replace("Constant-", string.Empty).Trim(); List <string> spells = hold.Split(',').ToList(); foreach (string magic in spells) { string search = magic.Trim(); if (search.Contains(PathfinderConstants.PAREN_LEFT)) { search = search.Substring(0, search.IndexOf(PathfinderConstants.PAREN_LEFT)); } search = Utility.SearchMod(search); spell = _spellStatBlockBusiness.GetSpellByName(search); if (spell != null) { try { _sbCheckerBaseInput.IndvSB.CastSpell(spell.name, FindSpellCasterLevel(magic), list); found = true; _spellsData.ConstantSpells.Add(spell.name); } catch (Exception ex) { _sbCheckerBaseInput.MessageXML.AddFail("ParseConstantSpells", ex.Message); } } if (!found) { _sbCheckerBaseInput.MessageXML.AddInfo("Constant Spell: Issue with " + magic); } found = false; } if (_spellsData.ConstantSpells.Any()) { string temp = string.Join(", ", _spellsData.ConstantSpells.ToArray()); _sbCheckerBaseInput.MessageXML.AddInfo("Constant Spells In Effect: " + temp); } }
public static void CheckEmpowerSpellLikeAbilityMonster(int casterLevel, SpellData spellData, ISpellStatBlock spell, StatBlockMessageWrapper _messageXML) { if ((spellData.metaMagicPowers & StatBlockInfo.MetaMagicPowers.empowered) == StatBlockInfo.MetaMagicPowers.empowered) { int MinCasterLevelNeeded = -1; switch (spell.SLA_Level) { case 0: MinCasterLevelNeeded = 4; break; case 1: MinCasterLevelNeeded = 6; break; case 2: MinCasterLevelNeeded = 8; break; case 3: MinCasterLevelNeeded = 10; break; case 4: MinCasterLevelNeeded = 12; break; case 5: MinCasterLevelNeeded = 14; break; case 6: MinCasterLevelNeeded = 16; break; case 7: MinCasterLevelNeeded = 18; break; case 8: MinCasterLevelNeeded = 20; break; } if (casterLevel >= MinCasterLevelNeeded) { _messageXML.AddPass("Empower spell-Like Ability-" + spellData.Name); } else { _messageXML.AddFail("Empower spell-Like Ability-" + spellData.Name, MinCasterLevelNeeded.ToString(), casterLevel.ToString()); } } }
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); }
public void ApplyBeforeCombatMagic() { if (!_spellsData.BeforeCombatMagic.Any()) { return; } ISpellStatBlock spell = null; MagicItemStatBlock magicItem = null; _sbCheckerBaseInput.IndvSB.HD = _sbCheckerBaseInput.MonsterSB.HD; List <IndividualStatBlock_Combat> list = new List <IndividualStatBlock_Combat> { _sbCheckerBaseInput.IndvSB }; Dictionary <string, int> Overrides = new Dictionary <string, int>(); bool found = false; _spellsData.MagicInEffect = new List <string>(); foreach (string magic in _spellsData.BeforeCombatMagic) { string search = magic; bool Potion = false; bool Oil = false; Oil = magic.Contains("oil"); Potion = magic.Contains("potion"); search = Utility.SearchMod(search); spell = _spellStatBlockBusiness.GetSpellByName(search); if (spell != null && !Potion && !Oil) { try { int CL = FindSpellCasterLevel(magic); if (magic == "effortless armor") { int ACPmod = 1; if (CL >= 5) { ACPmod++; } if (CL >= 10) { ACPmod++; } if (CL >= 15) { ACPmod++; } if (CL >= 20) { ACPmod++; } _armorClassData.TotalArmorCheckPenalty += ACPmod; _sbCheckerBaseInput.MessageXML.AddInfo("effortless armor mod " + ACPmod.ToString()); } _sbCheckerBaseInput.IndvSB.CastSpell(spell.name, CL, list); found = true; _spellsData.MagicInEffect.Add(spell.name + " CL: " + CL.ToString()); } catch (Exception ex) { _sbCheckerBaseInput.MessageXML.AddFail("ApplyBeforeCombatMagic", "ApplyBeforeCombatMagic: Issue with " + magic + "-- " + ex.Message); } } else { magicItem = _magicItemStatBlockBusiness.GetMagicItemByName(magic); if (magicItem != null) { found = true; } else { if (spell != null) { int CL = 0; try { found = UseMagicalEquipment(ref spell, list, Overrides, magic, ref CL); } catch (Exception ex) { _sbCheckerBaseInput.MessageXML.AddInfo("Before Combat Magic: Issue with " + magic + " --" + ex.Message); } if (found) { _spellsData.MagicInEffect.Add(spell.name + " CL: " + CL.ToString()); } } } } if (!found) { _sbCheckerBaseInput.MessageXML.AddInfo("Before Combat Magic: Issue with " + magic); } found = false; } if (_sbCheckerBaseInput.IndvSB.GetOnGoingStatBlockModsCount() > 0) { List <OnGoingStatBlockModifier> mods = _sbCheckerBaseInput.IndvSB.GetOnGoingStatBlockMods(); if (Overrides.Any()) { foreach (KeyValuePair <string, int> kvp in Overrides) { for (int a = mods.Count - 1; a > 0; a--) { if (mods[a].Name.ToLower().Contains(kvp.Key.ToString())) { mods[a].Modifier = kvp.Value; } } } } foreach (OnGoingStatBlockModifier mod in mods) { //if (mod.ModType == OnGoingStatBlockModifier.StatBlockModifierTypes.AC) //{ // ACMods_Computed.AddModEffect(mod); //} if (mod.ModType == OnGoingStatBlockModifier.StatBlockModifierTypes.Attack) { _onGoingAttackMod += mod.Modifier; } } } List <OnGoingStatBlockModifier> onGoingMods = _sbCheckerBaseInput.IndvSB.GetOnGoingStatBlockMods(); //remove all ability mods since they have been already incorperated into the SB and we don't want to add them twice for (int a = onGoingMods.Count - 1; a >= 0; a--) { if (onGoingMods[a].ModType == OnGoingStatBlockModifier.StatBlockModifierTypes.Ability) { onGoingMods.RemoveAt(a); } } if (_spellsData.MagicInEffect.Any()) { string temp = string.Join(", ", _spellsData.MagicInEffect.ToArray()); _sbCheckerBaseInput.MessageXML.AddInfo("Magic In Effect: " + temp); } }
private bool UseMagicalEquipment(ref ISpellStatBlock spell, List <IndividualStatBlock_Combat> list, Dictionary <string, int> Overrides, string magic, ref int CL) { bool found = false; foreach (KeyValuePair <IEquipment, int> kvp in _equipementRoster) { if (kvp.Key.ToString() == magic) { switch (kvp.Key.EquipmentType) { case EquipmentType.Potion: Potion potion = (Potion)kvp.Key; if (potion.ValueOverride > 0) { Overrides.Add(potion.PotionOf, potion.ValueOverride); } string temp = Utility.SearchMod(potion.PotionOf); spell = _spellStatBlockBusiness.GetSpellByName(temp); if (spell != null) { try { CL = potion.PotionCasterLevel(spell.GetSpellLevel()); _sbCheckerBaseInput.IndvSB.CastSpell(spell.name, CL, list); found = true; } catch (Exception ex) { throw new Exception("UseMagicalEquipment--" + ex.Message); } } break; case EquipmentType.Wand: Wand wand = (Wand)kvp.Key; spell = _spellStatBlockBusiness.GetSpellByName(wand.WandOf); if (spell != null) { _sbCheckerBaseInput.IndvSB.CastSpell(spell.name, FindSpellCasterLevel(wand.WandOf), list); found = true; } break; case EquipmentType.Scroll: Scroll scroll = (Scroll)kvp.Key; spell = _spellStatBlockBusiness.GetSpellByName(scroll.ScrollOf); if (spell != null) { CL = FindSpellCasterLevel(scroll.ScrollOf); _sbCheckerBaseInput.IndvSB.CastSpell(spell.name, CL, list); found = true; } break; case EquipmentType.Oil: Oil oil = (Oil)kvp.Key; string temp2 = Utility.SearchMod(oil.OilOf); spell = _spellStatBlockBusiness.GetSpellByName(temp2); if (spell != null) { CL = oil.CasterLevel; _sbCheckerBaseInput.IndvSB.CastSpell(spell.name, CL, list); found = true; } break; } } if (found) { return(found); } } return(found); }