Example #1
0
        public void CheckSpellsLevels()
        {
            List <string> Names              = CharacterClasses.GetClassNames();
            List <int>    Levels             = new List <int>();
            List <int>    LevelFrequency     = new List <int>();
            SpellList     SL                 = null;
            string        spellsHold         = string.Empty;
            string        spellLevelHold     = string.Empty;
            string        CR                 = string.Empty;
            string        SpellBlock         = string.Empty;
            int           overloadLevel      = 0;
            int           overloadClassLevel = 0;

            foreach (string name in Names)
            {
                if (CharacterClasses.CanClassCastSpells(name.ToLower()))
                {
                    SL = null;
                    if (ClassSpells.ContainsKey(name))
                    {
                        SL = GetClassSpellsByClassName(name);
                    }

                    if (SL != null)
                    {
                        int casterLevel = SL.CasterLevel;
                        int classLevel  = CharacterClasses.FindClassLevel(name);
                        switch (name.ToLower())
                        {
                        case "antipaladin":
                            classLevel -= 3;
                            break;

                        case "paladin":
                            classLevel -= 3;
                            break;

                        case "ranger":
                            classLevel -= 3;
                            break;
                        }

                        overloadLevel = 0;
                        CharacterClasses.GetSpellOverLoadsForPrestigeClasses(out overloadLevel, out overloadClassLevel);
                        GetSpellOverLoads(ref overloadLevel, ref overloadClassLevel, casterLevel, classLevel);

                        classLevel += overloadLevel;

                        if (casterLevel != classLevel)
                        {
                            _messageXML.AddFail("Caster Level", "Character level not equal to caster level for " + name);
                        }

                        GetSpellLevels(ref Levels, name, overloadLevel);
                        LevelFrequency = CharacterClasses.GetClassSpellsPerDay(name.ToLower(), overloadLevel);
                    }
                    string     SpellBonusAbility      = CharacterClasses.GetSpellBonusAbility(name.ToLower());
                    int        SpellBonusAbilityValue = MonSB.GetAbilityScoreValue(SpellBonusAbility);
                    bool       IsInquisitor           = name == "Inquisitor";
                    List <int> SpellBonus             = StatBlockInfo.GetSpellBonus(SpellBonusAbilityValue, IsInquisitor);

                    switch (name)
                    {
                    case "Bard":
                    case "Skald":
                    case "Sorcerer":
                    case "Summoner":
                    case "Inquisitor":
                    case "Red Mantis Assassin":
                    case "Arcanist":
                        SpellBonus = new List <int>()
                        {
                            0
                        };
                        break;

                    case "Oracle":     //cure or inflict bonus
                        SpellBonus = new List <int> {
                            0, 1, 1, 1, 1, 1, 1, 1, 1
                        };
                        break;
                    }


                    if (Levels != null)
                    {
                        if (SL != null)
                        {
                            CheckSpellCount(Levels, LevelFrequency, SL, name, SpellBonusAbility, SpellBonusAbilityValue, SpellBonus, overloadClassLevel, IsInquisitor);
                            CheckBonusSpells(SL, name, CharacterClasses.FindClassLevel(name));
                        }
                        else if (Levels.Any() && SpellBonusAbilityValue <= 10)
                        {
                            _messageXML.AddInfo("Lacks Ability Score to cast spells with " + SpellBonusAbility + " " + SpellBonusAbilityValue.ToString());
                        }
                    }
                    else
                    {
                        _messageXML.AddFail("CheckSpellsLevels", "Failed to load GetSpellLevels() for " + name);
                    }
                }
            }
        }
Example #2
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);
                    }
                }
            }
        }
        public void CheckSpellsLevels()
        {
            List <string> classNames     = _characterClasses.GetClassNames();
            List <int>    levels         = new List <int>();
            List <int>    levelFrequency = new List <int>();
            SpellList     spellList;
            int           overloadLevel      = 0;
            int           overloadClassLevel = 0;

            foreach (string name in classNames)
            {
                if (_characterClasses.CanClassCastSpells(name.ToLower()))
                {
                    spellList = null;
                    if (_classSpells.ContainsKey(name))
                    {
                        spellList = GetClassSpellsByClassName(name);
                    }

                    if (spellList != null)
                    {
                        int casterLevel = spellList.CasterLevel;
                        int classLevel  = _characterClasses.FindClassLevel(name);
                        switch (name.ToLower())
                        {
                        case "antipaladin":
                            classLevel -= 3;
                            break;

                        case "paladin":
                            classLevel -= 3;
                            break;

                        case "ranger":
                            classLevel -= 3;
                            break;
                        }

                        overloadLevel = 0;
                        _characterClasses.GetSpellOverLoadsForPrestigeClasses(out overloadLevel, out overloadClassLevel);
                        classLevel += overloadLevel;

                        if (casterLevel != classLevel)
                        {
                            _messageXML.AddFail("Caster Level", "Character level not equal to caster level for " + name);
                        }

                        GetSpellLevels(ref levels, name, overloadLevel);
                        levelFrequency = _characterClasses.GetClassSpellsPerDay(name.ToLower(), overloadLevel);
                    }
                    string     SpellBonusAbility      = _characterClasses.GetSpellBonusAbility(name.ToLower());
                    int        SpellBonusAbilityValue = _monsterSB.GetAbilityScoreValue(SpellBonusAbility);
                    bool       IsInquisitor           = name == "Inquisitor";
                    List <int> SpellBonus             = StatBlockInfo.GetSpellBonus(SpellBonusAbilityValue, IsInquisitor);

                    switch (name)
                    {
                    case "Bard":
                    case "Skald":
                    case "Sorcerer":
                    case "Summoner":
                    case "Inquisitor":
                    case "Red Mantis Assassin":
                    case "Arcanist":
                        SpellBonus = new List <int>()
                        {
                            0
                        };
                        break;

                    case "Oracle":     //cure or inflict bonus
                        SpellBonus = new List <int> {
                            0, 1, 1, 1, 1, 1, 1, 1, 1
                        };
                        break;
                    }


                    if (levels != null)
                    {
                        if (spellList != null)
                        {
                            CheckSpellCount(levels, levelFrequency, spellList, name, SpellBonusAbility, SpellBonusAbilityValue, SpellBonus, overloadClassLevel, IsInquisitor);
                            CheckBonusSpells(spellList, name, _characterClasses.FindClassLevel(name));
                        }
                        else if (levels.Any() && SpellBonusAbilityValue <= 10)
                        {
                            _messageXML.AddInfo("Lacks Ability Score to cast spells with " + SpellBonusAbility + PathfinderConstants.SPACE + SpellBonusAbilityValue.ToString());
                        }
                    }
                    else
                    {
                        _messageXML.AddFail("CheckSpellsLevels", "Failed to load GetSpellLevels() for " + name);
                    }
                }
            }
        }