public int GetWillSaveValue(int HD)
 {
     if (CreatureTypeInstance != null)
     {
         return(StatBlockInfo.ParseSaveBonues(HD, CreatureTypeInstance.WillSaveType));
     }
     return(-1);
 }
        public int GetWillSaveValue()
        {
            int Count = 0;

            foreach (ClassWrapper wrapper in Classes)
            {
                Count += StatBlockInfo.ParseSaveBonues(wrapper.Level, wrapper.ClassInstance.WillSaveType);
            }
            return(Count);
        }
        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 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);
        }