Example #1
0
 public Ability(StatBlockInfo.AbilityName Name, int Score)
 {
     this.Name       = Name;
     this.Score      = Score;
     ScoreTemp       = Score;
     AbilityModifier = 0;
     Modifiers       = new List <StatBlockModifier>();
     AbilityModifier = StatBlockInfo.GetAbilityModifier(Score);
 }
        public override MonsterStatBlock ApplyTemplate(MonsterStatBlock MonSB)
        {
            int ChaValue = MonSB.GetAbilityScoreValue(StatBlockInfo.CHA) + 4;
            int ChaMod   = StatBlockInfo.GetAbilityModifier(ChaValue);

            TemplateCommon.ChangeHD(MonSB, StatBlockInfo.HitDiceCategories.d8);
            // MonSB.AbilitiyScores
            // MonSB.AC_Mods = StatBlockInfo.ChangeAC_Mod(MonSB.AC_Mods, "deflection", ChaMod, true);
            return(MonSB);
        }
        public override MonsterStatBlock ApplyTemplate(MonsterStatBlock MonSB)
        {
            if (!MonSB.DontUseRacialHD)
            {
                TemplateCommon.ChangeHD(MonSB, StatBlockInfo.HitDiceCategories.d8);

                StatBlockInfo.HDBlockInfo tempHDInfo = new StatBlockInfo.HDBlockInfo();
                tempHDInfo.ParseHDBlock(MonSB.HD);
                //tempHDInfo.HDType = StatBlockInfo.HitDiceCategories.d8; //keeps HD, change to d8
                //tempHDInfo.Modifier = 0;
                //MonSB.HD = tempHDInfo.ToString();
                CreatureTypeFoundation CreatureType = CreatureTypeDetailsWrapper.GetRaceDetailClass("undead");
                int fort = StatBlockInfo.ParseSaveBonues(tempHDInfo.Multiplier, CreatureType.FortSaveType);
                CreatureTypeMaster CreatureTypeMaster = new CreatureTypeMaster();
                CreatureTypeMaster.CreatureTypeInstance = CreatureType;
                fort      += StatBlockInfo.GetAbilityModifier(MonSB.GetAbilityScoreValue(CreatureTypeMaster.CreatureTypeInstance.FortMod()));
                MonSB.Fort = fort.ToString();
                int refValue = StatBlockInfo.ParseSaveBonues(tempHDInfo.Multiplier, CreatureType.RefSaveType);
                refValue += StatBlockInfo.GetAbilityModifier(MonSB.GetAbilityScoreValue(StatBlockInfo.DEX));
                MonSB.Ref = refValue.ToString();
                int will = StatBlockInfo.ParseSaveBonues(tempHDInfo.Multiplier, CreatureType.WillSaveType);
                will      += StatBlockInfo.GetAbilityModifier(MonSB.GetAbilityScoreValue(StatBlockInfo.WIS));
                MonSB.Will = will.ToString();
            }


            MonSB.AC_Mods = StatBlockInfo.ChangeAC_Mod(MonSB.AC_Mods, "natural", 6, true);

            MonSB.Feats = StatBlockInfo.AddFeat(MonSB.Feats, "AlertnessB");
            MonSB.Feats = StatBlockInfo.AddFeat(MonSB.Feats, "Combat ReflexesB");
            MonSB.Feats = StatBlockInfo.AddFeat(MonSB.Feats, "DodgeB");
            MonSB.Feats = StatBlockInfo.AddFeat(MonSB.Feats, "Improved InitiativeB");
            MonSB.Feats = StatBlockInfo.AddFeat(MonSB.Feats, "Lightning ReflexesB");
            MonSB.Feats = StatBlockInfo.AddFeat(MonSB.Feats, "ToughnessB");

            MonSB.RacialMods = StatBlockInfo.AddRacialMod(MonSB.RacialMods, "+8 Bluff");
            MonSB.RacialMods = StatBlockInfo.AddRacialMod(MonSB.RacialMods, "+8 Perception");
            MonSB.RacialMods = StatBlockInfo.AddRacialMod(MonSB.RacialMods, "+8 Sense Motive");
            MonSB.RacialMods = StatBlockInfo.AddRacialMod(MonSB.RacialMods, "+8 Stealth");

            TemplateCommon.AddDR(MonSB, "magic and silver", 10);

            TemplateCommon.AddResistance(MonSB, "cold ", 10);
            TemplateCommon.AddResistance(MonSB, "electricity ", 10);

            return(MonSB);
        }
Example #4
0
        public override MonsterStatBlock ApplyTemplate(MonsterStatBlock MonSB)
        {
            TemplateCommon.ChangeHD(MonSB, StatBlockInfo.HitDiceCategories.d8);

            int ACMod = StatBlockInfo.GetAbilityModifier(MonSB.GetAbilityScoreValue(StatBlockInfo.AbilityName.Charisma)) / 2;

            if (ACMod < 1)
            {
                ACMod = 1;
            }

            MonSB.AC_Mods = StatBlockInfo.ChangeAC_Mod(MonSB.AC_Mods, "deflection", ACMod, true);

            MonSB.RacialMods = StatBlockInfo.AddRacialMod(MonSB.RacialMods, "+8 Perception");
            MonSB.RacialMods = StatBlockInfo.AddRacialMod(MonSB.RacialMods, "+8 Intimidate");
            MonSB.RacialMods = StatBlockInfo.AddRacialMod(MonSB.RacialMods, "+8 Stealth");


            return(MonSB);
        }
        public int RaceWill()
        {
            switch (BaseRaceType)
            {
            case RaceType.Race:
                return(0);

            case RaceType.StatBlock:
            case RaceType.BestiaryStatBlock:
                // if (IsHumanoid) return 0; // determined by class
                if (!UseRacialHD)
                {
                    return(0);                  // determined by class
                }
                if (_useTemplateValues)
                {
                    int modWill = StatBlockInfo.GetAbilityModifier(GetAbilityScore(StatBlockInfo.WIS));
                    return(Convert.ToInt32(Race_SB.Will) - modWill);
                }
                else
                {
                    if (WillOverride == StatBlockInfo.SaveBonusType.None)
                    {
                        StatBlockInfo.HDBlockInfo racialHDInfo = new StatBlockInfo.HDBlockInfo();
                        racialHDInfo.ParseHDBlock(RacialHD());
                        return(CreatureTypeMaster.GetWillSaveValue(racialHDInfo.Multiplier));
                    }
                    else
                    {
                        return(StatBlockInfo.ParseSaveBonues(RacialHDValue(), WillOverride));
                    }
                }

            case RaceType.None:
                return(0);
            }
            return(-1);
        }
Example #6
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);
                            }
                        }
                    }
                }
            }
        }
Example #7
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);
                    }
                }
            }
        }
Example #8
0
        public void CheckCMB()
        {
            string CheckName = "CMB";
            int    CMB       = 0;

            AbilityScores.AbilityScores.AbilityName abilityName = AbilityScores.AbilityScores.AbilityName.Strength;


            if (SizeCat <= StatBlockInfo.SizeCategories.Tiny)
            {
                abilityName = AbilityScores.AbilityScores.AbilityName.Dexterity;
            }
            else if (_sbCheckerBaseInput.MonsterSBSearch.HasFeat("Agile Maneuvers"))
            {
                abilityName = AbilityScores.AbilityScores.AbilityName.Dexterity;
            }
            else if (_sbCheckerBaseInput.MonsterSBSearch.HasDefensiveAbility("incorporeal"))
            {
                abilityName = AbilityScores.AbilityScores.AbilityName.Dexterity;
            }

            int AbilityMod = StatBlockInfo.GetAbilityModifier(_sbCheckerBaseInput.MonsterSBSearch.GetAbilityScoreValue(abilityName));
            // int BAB = Convert.ToInt32(Utility.GetNonParenValue(BaseAtk));
            int BAB = _sbCheckerBaseInput.CharacterClasses.GetBABValue() + (_sbCheckerBaseInput.CharacterClasses.HasClass("animal companion") ? 0 : _sbCheckerBaseInput.Race_Base.RaceBAB());

            //was taken out before, added back in 11/8/2014
            if (HasMonk)
            {
                int MonkLevel = _sbCheckerBaseInput.CharacterClasses.FindClassLevel("Monk");
                if (MonkLevel >= 3)
                {
                    BAB = MonkLevel + _sbCheckerBaseInput.CharacterClasses.GetNonMonkBABValue() + _sbCheckerBaseInput.Race_Base.RaceBAB();
                }
            }

            CMB = BAB + (SizeMod * -1) + AbilityMod + OnGoing;
            string formula = BAB.ToString() + " BAB " + CommonMethods.GetPlusSign(SizeMod * -1) + (SizeMod * -1).ToString() + " SizeMod +" + AbilityMod.ToString() + PathfinderConstants.SPACE + abilityName.ToString() + " AbilityMod";

            if (OnGoing != 0)
            {
                formula += "+" + OnGoing.ToString() + " (" + formulaOnGoing + ") OnGoingAttackMod";
            }

            _sbCheckerBaseInput.MessageXML.AddInfo("Base BAB: " + (BAB + (SizeMod) + AbilityMod).ToString());

            if (_sbCheckerBaseInput.MonsterSBSearch.HasSubType("swarm"))
            {
                CMB     = 0;
                formula = "0 swarm";
            }


            string holdCMB = Utility.GetNonParenValue(CMBString);

            if (holdCMB == "-")
            {
                holdCMB = "0";
            }
            if (CMB == Convert.ToInt32(holdCMB))
            {
                _sbCheckerBaseInput.MessageXML.AddPass(CheckName, formula);
            }
            else
            {
                _sbCheckerBaseInput.MessageXML.AddFail(CheckName, CMB.ToString(), holdCMB, formula);
            }
        }
        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 CheckSpellDC(bool isGnome)
        {
            List <string> classNames = _characterClasses.GetClassNames();
            SpellList     SL;
            string        formula = string.Empty;
            Dictionary <string, SpellList> classSpellsClone = new Dictionary <string, SpellList>(_classSpells);

            foreach (string className in classNames)
            {
                formula = string.Empty;
                if (_characterClasses.CanClassCastSpells(className.ToLower()))
                {
                    if (classSpellsClone.ContainsKey(className))
                    {
                        SL = CkeckClassSpellDCs(isGnome, ref formula, className);
                        classSpellsClone.Remove(className);
                    }
                }
            }

            if (!classNames.Any() && classSpellsClone.Any() && _monsterSB.SpellsPrepared.Length > 0)
            {
                string temp = _monsterSB.SpellsPrepared;
                temp = temp.Substring(0, temp.IndexOf(PathfinderConstants.SPACE));
                if (classSpellsClone.ContainsKey(temp))
                {
                    SL = _classSpells[temp];
                    List <SpellData> listOfSpells = SL.ListOfSpells;
                    int abilityBonus = StatBlockInfo.GetAbilityModifier(_monsterSB.GetAbilityScoreValue(_characterClasses.GetSpellBonusAbility(temp)));

                    foreach (SpellData spellData in listOfSpells)
                    {
                        if (spellData.DC > 0)
                        {
                            int computedDC = 10 + spellData.Level + abilityBonus;
                            formula = "10 +" + spellData.Level.ToString() + " spell level +" + abilityBonus.ToString() + " ability bonus";
                            if (computedDC == spellData.DC)
                            {
                                _messageXML.AddPass("Spell DC-" + spellData.Name);
                            }
                            else
                            {
                                _messageXML.AddFail("Spell DC-" + spellData.Name, computedDC.ToString(), spellData.DC.ToString(), formula);
                            }
                        }
                    }
                    classSpellsClone.Remove(temp);
                }
            }

            if (!classNames.Any() && classSpellsClone.Any() && _monsterSB.SpellsKnown.Length > 0)
            {
                string temp = _monsterSB.SpellsKnown;
                temp = temp.Substring(0, temp.IndexOf(PathfinderConstants.SPACE));
                if (classSpellsClone.ContainsKey(temp))
                {
                    SL = _classSpells[temp];
                    List <SpellData> listOfSpells = SL.ListOfSpells;
                    if (temp == "Spells")
                    {
                        temp = "Sorcerer";
                    }
                    int abilityBonus = StatBlockInfo.GetAbilityModifier(_monsterSB.GetAbilityScoreValue(_characterClasses.GetSpellBonusAbility(temp)));

                    foreach (SpellData spellData in listOfSpells)
                    {
                        if (spellData.DC > 0)
                        {
                            int computedDC = 10 + spellData.Level + abilityBonus;
                            formula = "10 +" + spellData.Level.ToString() + " spell level +" + abilityBonus.ToString() + " ability bonus";
                            if (computedDC == spellData.DC)
                            {
                                _messageXML.AddPass("Spell DC-" + spellData.Name);
                            }
                            else
                            {
                                _messageXML.AddFail("Spell DC-" + spellData.Name, computedDC.ToString(), spellData.DC.ToString(), formula);
                            }
                        }
                    }
                }
                classSpellsClone.Remove(temp);
            }

            if (classSpellsClone.Any())
            {
                _messageXML.AddFail("Spell DC-", " Can't find Spell Block(s) for these classes: " + string.Join(", ", classSpellsClone.Keys.ToArray()));
            }
        }
Example #11
0
        public void CheckAbilityBaseScores(int hdModifier)
        {
            string CheckName  = "Ability Base Scores";
            int    origConMod = -10;
            int    origHDMod  = -100;

            if (_sbCheckerBaseInput.MonsterSB.BaseStatistics.Length == 0)
            {
                if (_sbCheckerBaseInput.CharacterClasses.HasClass("barbarian") && _armorClassData.ACMods_SB.Rage != 0)//must account for rage
                {
                    int holdScore = _sbCheckerBaseInput.MonsterSB.GetAbilityScoreValue(StatBlockInfo.STR);
                    _sbCheckerBaseInput.AbilityScores.UpdateAbilityScoreBaseValue(AbilityScores.AbilityScores.AbilityName.Strength, holdScore - 4);
                    holdScore = _sbCheckerBaseInput.MonsterSB.GetAbilityScoreValue(StatBlockInfo.CON);
                    _sbCheckerBaseInput.AbilityScores.UpdateAbilityScoreBaseValue(AbilityScores.AbilityScores.AbilityName.Constitution, holdScore - 4);
                    _sbCheckerBaseInput.MonsterSBSearch.UpdateAbilityScore(_sbCheckerBaseInput.AbilityScores);
                }
                return;
            }

            string        BaseStatistics = _sbCheckerBaseInput.MonsterSB.BaseStatistics;
            List <string> AbilityNames   = new List <string> {
                "Str ", "Dex ", "Con ", "Int ", "Wis ", "Cha "
            };
            int    Pos = 0;
            string AbilityStartName = string.Empty;
            bool   HasAC            = BaseStatistics.Contains("AC ");

            foreach (string name in AbilityNames)
            {
                Pos = BaseStatistics.IndexOf(name);
                if (HasAC)
                {
                    int ACPos = BaseStatistics.IndexOf("AC ");
                    ACPos = BaseStatistics.IndexOf(PathfinderConstants.PAREN_RIGHT, ACPos);
                    if (ACPos != -1)
                    {
                        Pos = BaseStatistics.IndexOf(name, ACPos);
                    }
                }
                AbilityStartName = name;
                if (Pos >= 0)
                {
                    break;
                }
            }

            if (Pos == -1)
            {
                return;            //no ability base statisitcs
            }
            int Pos3 = BaseStatistics.IndexOf("hp ");
            //   if (Pos3 > Pos) return;
            int Pos2 = BaseStatistics.IndexOf(";", Pos);

            if (Pos2 == -1)
            {
                Pos2 = BaseStatistics.IndexOf(".", Pos);
            }
            if (Pos2 == -1)
            {
                Pos2 = BaseStatistics.Length;
            }

            List <string> BaseBlock = BaseStatistics.Substring(Pos, Pos2 - Pos).Split(',').ToList();

            int Str = _sbCheckerBaseInput.MonsterSB.GetAbilityScoreValue(StatBlockInfo.STR);
            int Int = _sbCheckerBaseInput.MonsterSB.GetAbilityScoreValue(StatBlockInfo.INT);
            int Wis = _sbCheckerBaseInput.MonsterSB.GetAbilityScoreValue(StatBlockInfo.WIS);
            int Dex = _sbCheckerBaseInput.MonsterSB.GetAbilityScoreValue(StatBlockInfo.DEX);
            int Con = _sbCheckerBaseInput.MonsterSB.GetAbilityScoreValue(StatBlockInfo.CON);
            int Cha = _sbCheckerBaseInput.MonsterSB.GetAbilityScoreValue(StatBlockInfo.CHA);

            int StrBase = Str;
            int IntBase = Int;
            int WisBase = Wis;
            int DexBase = Dex;
            int ConBase = Con;
            int ChaBase = Cha;

            string temp = string.Empty;
            int    hold = 0;

            for (int a = 0; a <= BaseBlock.Count - 1; a++)
            {
                BaseBlock[a] = BaseBlock[a].Trim();
            }
            foreach (string ability in BaseBlock)
            {
                try
                {
                    Pos  = ability.IndexOf(PathfinderConstants.SPACE);
                    temp = ability.Substring(0, Pos + 1);
                    if (!AbilityNames.Contains(temp))
                    {
                        return;
                    }
                    int.TryParse(ability.Replace(temp, string.Empty).Trim(), out hold);
                    if (hold > 0)
                    {
                        switch (temp.Trim())
                        {
                        case StatBlockInfo.STR:
                            StrBase = hold;
                            _sbCheckerBaseInput.AbilityScores.UpdateAbilityScoreBaseValue(AbilityScores.AbilityScores.AbilityName.Strength, hold);
                            break;

                        case StatBlockInfo.INT:
                            IntBase = hold;
                            _sbCheckerBaseInput.AbilityScores.UpdateAbilityScoreBaseValue(AbilityScores.AbilityScores.AbilityName.Intelligence, hold);
                            break;

                        case StatBlockInfo.WIS:
                            WisBase = hold;
                            _sbCheckerBaseInput.AbilityScores.UpdateAbilityScoreBaseValue(AbilityScores.AbilityScores.AbilityName.Wisdom, hold);
                            break;

                        case StatBlockInfo.DEX:
                            DexBase = hold;
                            _sbCheckerBaseInput.AbilityScores.UpdateAbilityScoreBaseValue(AbilityScores.AbilityScores.AbilityName.Dexterity, hold);
                            break;

                        case StatBlockInfo.CON:
                            ConBase = hold;
                            _sbCheckerBaseInput.AbilityScores.UpdateAbilityScoreBaseValue(AbilityScores.AbilityScores.AbilityName.Constitution, hold);
                            break;

                        case StatBlockInfo.CHA:
                            ChaBase = hold;
                            _sbCheckerBaseInput.AbilityScores.UpdateAbilityScoreBaseValue(AbilityScores.AbilityScores.AbilityName.Charisma, hold);
                            break;
                        }
                    }
                }
                catch (Exception ex)
                {
                    throw new Exception(CheckName + " Issue with ability base " + ability + " --" + ex.Message);
                }
            }

            _sbCheckerBaseInput.MonsterSBSearch.UpdateAbilityScore(_sbCheckerBaseInput.AbilityScores);
            origConMod = StatBlockInfo.GetAbilityModifier(ConBase);

            int HPBase = 0;

            try
            {
                Pos = BaseStatistics.IndexOf("hp ");
                if (Pos != -1)
                {
                    Pos2 = BaseStatistics.IndexOf(";", Pos);
                    if (Pos2 == -1)
                    {
                        Pos2 = BaseStatistics.IndexOf(".", Pos);
                    }
                    if (Pos2 == -1)
                    {
                        Pos2 = BaseStatistics.Length;
                    }
                    temp = BaseStatistics.Substring(Pos, Pos2 - Pos);
                    temp = temp.Replace("hp no temporary hit points", "0");
                    Pos  = temp.IndexOf(",");
                    if (Pos != -1)
                    {
                        temp = temp.Substring(0, Pos);
                    }
                    Pos = temp.IndexOf(PathfinderConstants.PAREN_LEFT);
                    if (Pos > 0)
                    {
                        temp = temp.Substring(0, Pos).Trim();
                    }
                    temp   = temp.Replace("each", string.Empty);
                    HPBase = int.Parse(temp.Replace("hp", string.Empty));
                    int HPDiff = int.Parse(_sbCheckerBaseInput.MonsterSB.HP) - HPBase;
                    origHDMod = hdModifier - HPDiff;
                }
            }
            catch (Exception ex)
            {
                throw new Exception(CheckName + " Issue with hp --" + ex.Message);
            }

            int tempMod           = 0;
            int RageMod           = 0;
            int mutagenBonusStr   = 0;
            int mutagenBonusDex   = 0;
            int mutagenBonusCon   = 0;
            int mutagenPenaltyInt = 0; //Str
            int mutagenPenaltyWis = 0; //Dex
            int mutagenPenaltyCha = 0; //Con

            if (_sbCheckerBaseInput.IndvSB != null)
            {
                tempMod = _sbCheckerBaseInput.IndvSB.GetOnGoingStatBlockModValue(OnGoingStatBlockModifier.StatBlockModifierTypes.Ability,
                                                                                 OnGoingStatBlockModifier.StatBlockModifierSubTypes.Ability_Str);
            }

            if (_sbCheckerBaseInput.CharacterClasses.HasClass("barbarian") && _armorClassData.ACMods_SB.Rage != 0)
            {
                RageMod = 4;
            }

            if (_sbCheckerBaseInput.CharacterClasses.HasClass("alchemist"))  //mutagen mods
            {
                if ((StrBase - Str) == -4)
                {
                    mutagenBonusStr   = 4;
                    mutagenPenaltyInt = -2;
                }
                if ((DexBase - Dex) == -4)
                {
                    mutagenBonusDex   = 4;
                    mutagenPenaltyWis = -2;
                }
                if ((ConBase - Con) == -4)
                {
                    mutagenBonusCon   = 4;
                    mutagenPenaltyCha = -2;
                }
            }

            if (Math.Abs(StrBase + RageMod - Str + mutagenBonusStr) != tempMod)
            {
                _sbCheckerBaseInput.MessageXML.AddFail(CheckName + " Str", (StrBase + tempMod).ToString(), (Str).ToString());
            }

            tempMod = 0;
            if (_sbCheckerBaseInput.IndvSB != null)
            {
                tempMod = _sbCheckerBaseInput.IndvSB.GetOnGoingStatBlockModValue(OnGoingStatBlockModifier.StatBlockModifierTypes.Ability,
                                                                                 OnGoingStatBlockModifier.StatBlockModifierSubTypes.Ability_Int);
            }

            if (Math.Abs(IntBase - Int + mutagenPenaltyInt) != tempMod)
            {
                _sbCheckerBaseInput.MessageXML.AddFail(CheckName + " Int", (IntBase + tempMod).ToString(), (Int).ToString());
            }


            tempMod = 0;
            if (_sbCheckerBaseInput.IndvSB != null)
            {
                tempMod = _sbCheckerBaseInput.IndvSB.GetOnGoingStatBlockModValue(OnGoingStatBlockModifier.StatBlockModifierTypes.Ability,
                                                                                 OnGoingStatBlockModifier.StatBlockModifierSubTypes.Ability_Wis);
            }

            if (Math.Abs(WisBase - Wis + mutagenPenaltyWis) != tempMod)
            {
                _sbCheckerBaseInput.MessageXML.AddFail(CheckName + " Wis", (WisBase + tempMod).ToString(), (Wis).ToString());
            }

            tempMod = 0;
            if (_sbCheckerBaseInput.IndvSB != null)
            {
                tempMod = _sbCheckerBaseInput.IndvSB.GetOnGoingStatBlockModValue(OnGoingStatBlockModifier.StatBlockModifierTypes.Ability,
                                                                                 OnGoingStatBlockModifier.StatBlockModifierSubTypes.Ability_Dex);
            }

            if (Math.Abs(DexBase - Dex + mutagenBonusDex) != tempMod)
            {
                _sbCheckerBaseInput.MessageXML.AddFail(CheckName + " Dex", (DexBase + tempMod).ToString(), (Dex).ToString());
            }

            tempMod = 0;
            if (_sbCheckerBaseInput.IndvSB != null)
            {
                tempMod = _sbCheckerBaseInput.IndvSB.GetOnGoingStatBlockModValue(OnGoingStatBlockModifier.StatBlockModifierTypes.Ability,
                                                                                 OnGoingStatBlockModifier.StatBlockModifierSubTypes.Ability_Con);
            }

            if (Math.Abs(ConBase + RageMod - Con + mutagenBonusCon) != tempMod)
            {
                _sbCheckerBaseInput.MessageXML.AddFail(CheckName + " Con", (ConBase + tempMod).ToString(), (Con).ToString());
            }

            tempMod = 0;
            if (_sbCheckerBaseInput.IndvSB != null)
            {
                tempMod = _sbCheckerBaseInput.IndvSB.GetOnGoingStatBlockModValue(OnGoingStatBlockModifier.StatBlockModifierTypes.Ability,
                                                                                 OnGoingStatBlockModifier.StatBlockModifierSubTypes.Ability_Cha);
            }

            if (Math.Abs(ChaBase - Cha + mutagenPenaltyCha) != tempMod)
            {
                _sbCheckerBaseInput.MessageXML.AddFail(CheckName + " Cha", (ChaBase + tempMod).ToString(), (Cha).ToString());
            }
        }