示例#1
0
        private void CheckSpellCount(List <int> Levels, List <int> LevelFrequency, SpellList SL, string name, string SpellBonusAbility,
                                     int SpellBonusAbilityValue, List <int> SpellBonus, int overloadClassLevel, bool IsInquisitor)
        {
            int        BloodlineLevels   = CharacterClasses.GetClassBloodlineSpellLevels(name, overloadClassLevel);
            int        MysteryLevels     = CharacterClasses.GetClassMysterySpellLevels(name);
            int        BloatMageLevels   = CharacterClasses.FindClassLevel("BloatMage");
            int        NewArcanaLevels   = 0;
            int        DomainSpellCount  = CharacterClasses.GetDomainSpellCount(name.ToLower());
            List <int> OracleCurseSpells = new List <int>()
            {
                0
            };
            int ExpandedArcanaCount = 0;

            if (_monSBSearch.HasFeat("Expanded Arcana"))
            {
                ExpandedArcanaCount = _monSBSearch.FeatItemCount("Expanded Arcana");
            }

            if (_monSBSearch.HasCurse("haunted"))
            {
                int oracleLevel = CharacterClasses.FindClassLevel("oracle");
                OracleCurseSpells = new List <int> {
                    2
                };                                      //mage hand and ghost sound 0th
                if (oracleLevel >= 5)
                {
                    OracleCurseSpells.AddRange(new List <int> {
                        0, 2
                    });                                                                    //levitate and minor image 2nd level
                }
                if (oracleLevel >= 10)
                {
                    OracleCurseSpells.AddRange(new List <int> {
                        0, 0, 1
                    });                                                                   // telekinesis 5th
                }
                if (oracleLevel >= 15)
                {
                    OracleCurseSpells.AddRange(new List <int> {
                        0, 1
                    });                                                                   //  reverse gravity 7th
                }
            }

            if (_monSBSearch.HasSQ("new arcana"))
            {
                int sorcererLevel = CharacterClasses.FindClassLevel("sorcerer");
                if (sorcererLevel >= 9)
                {
                    NewArcanaLevels++;
                }
                if (sorcererLevel >= 13)
                {
                    NewArcanaLevels++;
                }
                if (sorcererLevel >= 17)
                {
                    NewArcanaLevels++;
                }
            }

            List <SpellData> ListOfSpells = SL.ListOfSpells;
            int    SBLevelCount           = 0;
            string formula = null;

            for (int SpellLevelIndex = 0; SpellLevelIndex <= Levels.Count - 1; SpellLevelIndex++)
            {
                SBLevelCount = 0;
                formula      = null;
                string freq = null;

                ComputeSpellFrequency(ListOfSpells, ref SBLevelCount, SpellLevelIndex, ref freq);

                if (freq != null)
                {
                    int        tempFreq            = int.Parse(freq);
                    List <int> FrequencySpellBonus = StatBlockInfo.GetSpellBonus(SpellBonusAbilityValue, IsInquisitor);
                    int        bonus = FrequencySpellBonus.Count - 1 >= SpellLevelIndex ? FrequencySpellBonus[SpellLevelIndex] : 0;
                    if (LevelFrequency.Any())
                    {
                        if (LevelFrequency[SpellLevelIndex] + bonus == tempFreq)
                        {
                            _messageXML.AddPass("CheckSpellCount--Spell Frequency Level =" + SpellLevelIndex.ToString());
                        }
                        else
                        {
                            string formua = "Base Freq " + LevelFrequency[SpellLevelIndex].ToString();
                            if (bonus > 0)
                            {
                                formua += " + " + SpellBonusAbility + " Bonus " + bonus.ToString();
                            }
                            _messageXML.AddFail("CheckSpellCount--Spell Frequency Level =" + SpellLevelIndex.ToString(), (LevelFrequency[SpellLevelIndex] + bonus).ToString(), freq, formua);
                        }
                    }
                }

                int ClassLevelCount = Levels[SpellLevelIndex];
                formula = "Level Base: " + ClassLevelCount.ToString();

                if (SpellBonus.Count - 1 >= SpellLevelIndex)
                {
                    ClassLevelCount += SpellBonus[SpellLevelIndex];
                    if (name == "Oracle")
                    {
                        formula += " + " + SpellBonus[SpellLevelIndex].ToString() + " cure/inflict Bonus";
                    }
                    else
                    {
                        formula += " + " + SpellBonus[SpellLevelIndex].ToString() + " Spell Bonus";
                    }
                }
                if (name == "Oracle" && OracleCurseSpells.Count - 1 >= SpellLevelIndex)
                {
                    ClassLevelCount += OracleCurseSpells[SpellLevelIndex];
                    formula         += " + " + OracleCurseSpells[SpellLevelIndex].ToString() + " Oracle Curse Spells";
                }

                if (ClassLevelCount < SBLevelCount)
                {
                    if (BloodlineLevels > 0) //assume bloodline spells are diff
                    {
                        int diff = SBLevelCount - ClassLevelCount;
                        ClassLevelCount++;
                        BloodlineLevels--;
                        formula += " + 1 Bloodline Spell";
                        //if (diff <= BloodlineLevels)
                        //{
                        //    ClassLevelCount += diff;
                        //    BloodlineLevels -= diff;
                        //}
                    }

                    if (MysteryLevels > 0) //assume mystery spells are diff
                    {
                        int diff = SBLevelCount - ClassLevelCount;
                        if (diff <= MysteryLevels)
                        {
                            ClassLevelCount += diff;
                            MysteryLevels   -= diff;
                            formula         += " + " + diff.ToString() + " Mystery Levels";
                        }
                    }

                    if (DomainSpellCount > 0) //assume domain spells are diff
                    {
                        int diff = SBLevelCount - ClassLevelCount;
                        if (diff <= DomainSpellCount)
                        {
                            ClassLevelCount  += diff;
                            DomainSpellCount -= diff;
                            formula          += " + " + diff.ToString() + " Domain Spell Count";
                        }
                    }

                    if (NewArcanaLevels > 0) //assume New Arcana spells are diff
                    {
                        int diff = SBLevelCount - ClassLevelCount;
                        if (diff <= NewArcanaLevels)
                        {
                            ClassLevelCount += diff;
                            NewArcanaLevels -= diff;
                            formula         += " + " + diff.ToString() + " New Arcana Levels";
                        }
                    }
                    if (SBLevelCount - ClassLevelCount > 0 && ExpandedArcanaCount > 0)
                    {
                        int diff = SBLevelCount - ClassLevelCount;
                        ClassLevelCount += diff;
                        ExpandedArcanaCount--;
                        formula += " + 1 Expanded Arcana Levels";
                    }
                }


                if (ClassLevelCount == SBLevelCount && ClassLevelCount != 0)
                {
                    if (SpellLevelIndex + 10 > SpellBonusAbilityValue)
                    {
                        _messageXML.AddFail("Spell Ability Score", "Lacks Ability Score to cast Level " + SpellLevelIndex.ToString() + " spells with "
                                            + SpellBonusAbility + " " + SpellBonusAbilityValue.ToString() + ", but has spells");
                    }
                    else
                    {
                        _messageXML.AddPass("Spell Count-" + name + " Level: " + SpellLevelIndex.ToString(), ClassLevelCount.ToString() + " " + SBLevelCount.ToString() + " " + formula);
                    }
                }
                else
                {
                    if (SpellLevelIndex + 10 > SpellBonusAbilityValue)
                    {
                        _messageXML.AddInfo("Lacks Ability Score to cast Level " + SpellLevelIndex.ToString() + " spells with " + SpellBonusAbility + " " + SpellBonusAbilityValue.ToString());
                    }
                    else if (SBLevelCount != ClassLevelCount)
                    {
                        _messageXML.AddFail("Spell Count-" + name + " Level: " + SpellLevelIndex.ToString(), ClassLevelCount.ToString(), SBLevelCount.ToString() + " " + formula);
                    }
                }
            }
        }