public int AbilityScoreSum()
        {
            List <string> AbilityNames = new List <string> {
                StatBlockInfo.STR, StatBlockInfo.INT, StatBlockInfo.WIS, StatBlockInfo.DEX, StatBlockInfo.CON, StatBlockInfo.CHA
            };
            int sum = 0;

            foreach (string name in AbilityNames)
            {
                sum += Race_SB.GetAbilityScoreValue(name);
            }
            return(sum);
        }
        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);
        }
        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);
        }
Пример #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);
        }
Пример #5
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);
                            }
                        }
                    }
                }
            }
        }
        public RaceBase(object RaceValue, CreatureTypeFoundation creatureType, bool isBestiaryStatBlock,
                        IndividualStatBlock_Combat IndivSB, string searchName, IMonsterStatBlockBusiness monsterStatBlockBusiness)
        {
            BaseRaceType = RaceType.None;
            if (RaceValue == null)
            {
                return;
            }
            _indvSB = IndivSB;

            CreatureTypeMaster = new CreatureTypeMaster();
            CreatureTypeMaster.CreatureTypeInstance = creatureType;
            try
            {
                RaceFoundationType = (RaceFoundation)RaceValue;
                BaseRaceType       = RaceType.Race;
                Race_SB            = monsterStatBlockBusiness.GetBestiaryMonsterByNamePathfinderDefault(RaceFoundationType.Name);
                if (Race_SB == null)
                {
                    if (!string.IsNullOrEmpty(searchName) && searchName != RaceFoundationType.Name)
                    {
                        Race_SB = monsterStatBlockBusiness.GetBestiaryMonsterByNamePathfinderDefault(searchName);
                        if (Race_SB == null)
                        {
                            throw new Exception(RaceFoundationType.Name + " has no Core Race entry");
                        }
                    }
                    else
                    {
                        throw new Exception(RaceFoundationType.Name + " has no Core Race entry");
                    }
                }
                //  IsHumanoid = true;
            }
            catch
            {
                try
                {
                    Race_SB = (MonsterStatBlock)RaceValue;
                    if (Race_SB.Environment.Length > 0 && isBestiaryStatBlock)
                    {
                        BaseRaceType = RaceType.BestiaryStatBlock;
                    }
                    else
                    {
                        BaseRaceType = RaceType.StatBlock;
                    }
                    if (Race_SB.Race.Contains("humanoid") || Race_SB.Type.Contains("humanoid"))
                    {
                        //   IsHumanoid = true;
                    }
                    UseRacialHD = Race_SB.DontUseRacialHD ? false : true;

                    int HD = RacialHDValue();
                    if (CreatureTypeMaster.GetSaveType("will") == StatBlockInfo.SaveBonusType.Varies)
                    {
                        int Will = Convert.ToInt32(Race_SB.Will);
                        if (HasFeat("Iron Will"))
                        {
                            Will -= 2;
                        }
                        WillOverride = StatBlockInfo.ComputeSaveBonusType(HD, Race_SB.GetAbilityScoreValue(StatBlockInfo.WIS), Will);
                    }
                    if (CreatureTypeMaster.GetSaveType("ref") == StatBlockInfo.SaveBonusType.Varies)
                    {
                        int Ref = Convert.ToInt32(Race_SB.Ref);
                        if (HasFeat("Lightning Reflexes"))
                        {
                            Ref -= 2;
                        }
                        Ref        -= GetRefOnGoingMods();
                        RefOverride = StatBlockInfo.ComputeSaveBonusType(HD, Race_SB.GetAbilityScoreValue(StatBlockInfo.DEX), Ref);
                    }
                    if (CreatureTypeMaster.GetSaveType("fort") == StatBlockInfo.SaveBonusType.Varies)
                    {
                        int Fort = Convert.ToInt32(Race_SB.Fort);
                        if (HasFeat("Great Fortitude"))
                        {
                            Fort -= 2;
                        }

                        FortOverride = StatBlockInfo.ComputeSaveBonusType(HD, Race_SB.GetAbilityScoreValue(StatBlockInfo.CON), Fort);
                    }
                    BaseBABType = StatBlockInfo.ComputeBABType(RacialHDValue(), Convert.ToInt32(Race_SB.BaseAtk));
                    ParseSkills();
                }
                catch
                {
                }
            }
        }
        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()));
            }
        }