示例#1
0
        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);
            }
        }