Пример #1
0
        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);
                            }
                        }
                    }
                }
            }
        }
Пример #2
0
        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);
                    }
                }
            }
        }