private int GetRefOnGoingMods()
        {
            int OnGoingMods = 0;

            if (_indvSB != null)
            {
                OnGoingMods  = _indvSB.GetOnGoingStatBlockModValue(OnGoingStatBlockModifier.StatBlockModifierTypes.SavingThrow, OnGoingStatBlockModifier.StatBlockModifierSubTypes.None);
                OnGoingMods += _indvSB.GetOnGoingStatBlockModValue(OnGoingStatBlockModifier.StatBlockModifierTypes.SavingThrow, OnGoingStatBlockModifier.StatBlockModifierSubTypes.SavingThrow_Ref);
            }
            return(OnGoingMods);
        }
Beispiel #2
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);
                            }
                        }
                    }
                }
            }
        }
Beispiel #3
0
        public void CheckFortValue()
        {
            string CheckName = "Fort";

            try
            {
                int    ClassMod          = CharacterClasses.GetFortSaveValue();
                int    OnGoingMods       = 0;
                string onGoingModFormula = string.Empty;
                if (_indvSB != null)
                {
                    OnGoingMods  = _indvSB.GetOnGoingStatBlockModValue(OnGoingStatBlockModifier.StatBlockModifierTypes.SavingThrow, OnGoingStatBlockModifier.StatBlockModifierSubTypes.None, false, ref onGoingModFormula);
                    OnGoingMods += _indvSB.GetOnGoingStatBlockModValue(OnGoingStatBlockModifier.StatBlockModifierTypes.SavingThrow, OnGoingStatBlockModifier.StatBlockModifierSubTypes.SavingThrow_Fort, false, ref onGoingModFormula);
                }
                int    RaceMod    = CharacterClasses.HasClass("animal companion") ? 0 : Race_Base.RaceFort();
                int    AbilityMod = GetAbilityScoreMod(Race_Base.FortMod());
                int    FortMod    = ClassMod + RaceMod + AbilityMod + OnGoingMods;
                string formula    = "+" + ClassMod.ToString() + " ClassMod " + " +" + RaceMod.ToString() + " RaceMod "
                                    + " +" + AbilityMod.ToString() + " AbilityMod ";

                if (OnGoingMods != 0)
                {
                    formula += " +" + OnGoingMods.ToString() + " OnGoingMods(" + onGoingModFormula + ")";
                }
                if (_monSBSearch.HasFeat("Great Fortitude"))
                {
                    FortMod += 2;
                    formula += " +2 Great Fortitude";
                }
                if (_monSBSearch.HasTrait("Forlorn"))
                {
                    FortMod += 1;
                    formula += " +1 Forlorn";
                }
                if (MonSB.SubType.IndexOf("nightshade") >= 0)
                {
                    FortMod += 2;
                    formula += " +2 nightshade";
                }
                if (_monSBSearch.HasSQ("lore of true stamina"))
                {
                    FortMod += 2;
                    formula += " +2 lore of true stamina";
                }

                if (_monSBSearch.HasSQ("spirit (champion)"))
                {
                    int mediumLevel = CharacterClasses.FindClassLevel("medium");
                    int bonus       = 1;
                    if (mediumLevel >= 4)
                    {
                        bonus++;
                    }
                    if (mediumLevel >= 8)
                    {
                        bonus++;
                    }
                    if (mediumLevel >= 12)
                    {
                        bonus++;
                    }
                    if (mediumLevel >= 15)
                    {
                        bonus++;
                    }
                    if (mediumLevel >= 19)
                    {
                        bonus++;
                    }

                    FortMod += bonus;
                    formula += " +" + bonus.ToString() + " spirit (champion)";
                }

                if (_monSBSearch.HasDomain("Protection"))
                {
                    int clericLevel = CharacterClasses.FindClassLevel("cleric");
                    if (clericLevel == 0)
                    {
                        clericLevel = CharacterClasses.FindClassLevel("druid");
                    }
                    int tempMod = (clericLevel / 5) + 1;
                    FortMod += tempMod;
                    formula += " +" + tempMod.ToString() + " Protection domain";
                }

                if (Race_Base.Name() == "Svirfneblin")
                {
                    FortMod += 2;
                    formula += " +2 Svirfneblin";
                }

                string FamiliarString = _monSBSearch.FindFamiliarString(CharacterClasses.HasClass("witch"));

                if (FamiliarString == "rat")
                {
                    FortMod += 2;
                    formula += " +2 rat familiar";
                }

                if (CharacterClasses.HasClass("Paladin"))
                {
                    int level = CharacterClasses.FindClassLevel("paladin");
                    if (level >= 2) //Divine Grace
                    {
                        FortMod += _abilityScores.ChaMod;
                        formula += " + " + _abilityScores.ChaMod.ToString() + " Divine Grace";
                    }
                }

                if (CharacterClasses.HasClass("Antipaladin"))
                {
                    int level = CharacterClasses.FindClassLevel("Antipaladin");
                    if (level >= 2) //Unholy Resilience
                    {
                        FortMod += _abilityScores.ChaMod;
                        formula += " + " + _abilityScores.ChaMod.ToString() + " Unholy Resilience";
                    }
                }

                if (CharacterClasses.HasClass("prophet of kalistrade"))
                {
                    int level = CharacterClasses.FindClassLevel("prophet of kalistrade");
                    //Auspicious Display --assumes the bling is present
                    int mod = 1;
                    if (level >= 4)
                    {
                        mod++;
                    }
                    if (level >= 7)
                    {
                        mod++;
                    }
                    if (level >= 10)
                    {
                        mod++;
                    }
                    FortMod += mod;
                    formula += " + " + mod.ToString() + " Auspicious Display";
                }

                if (_monSBSearch.HasTemplate("graveknight"))
                {
                    FortMod += 2;
                    formula += " + 2 Sacrilegious Aura";
                }

                if (_monSBSearch.HasGear("heartstone"))
                {
                    FortMod += 2;
                    formula += " + 2 heartstone";
                }

                if (_monSBSearch.HasArchetype("Sharper"))//Lucky Save
                {
                    int rogueLevel = CharacterClasses.FindClassLevel("rogue");
                    int tempMod    = 0;
                    if (rogueLevel >= 3)
                    {
                        tempMod++;
                    }
                    if (rogueLevel >= 9)
                    {
                        tempMod++;
                    }
                    if (rogueLevel >= 15)
                    {
                        tempMod++;
                    }
                    if (tempMod > 0)
                    {
                        FortMod += tempMod;
                        formula += " + " + tempMod.ToString() + " Lucky Save";
                    }
                }


                FortMod += GetMagicItemSaveMods(ref formula);

                int FortSB = Convert.ToInt32(Utility.GetNonParenValue(MonSB.Fort));

                if (FortMod == FortSB)
                {
                    _messageXML.AddPass(CheckName, formula);
                }
                else
                {
                    _messageXML.AddFail(CheckName, FortMod.ToString(), FortSB.ToString(), formula);
                }
            }
            catch (Exception ex)
            {
                _messageXML.AddFail("CheckFortValue", ex.Message);
            }
        }
Beispiel #4
0
        private void CheckOneWeaponMeleeNatural(NaturalWeapon natural_weapon, ref int weaponBonusComputed,
                                                ref List <string> Bonuses, string MW, bool NaturalMultipleWepons, ref string formula, int MeleeWeaponCount)
        {
            int    BAB             = 0;
            string weaponBonus     = string.Empty;
            string weaponsDamage   = string.Empty;
            string holdMeleeWeapon = string.Empty;
            int    AbilityBonus    = _abilityScores.StrMod;

            BAB = Convert.ToInt32(Utility.GetNonParenValue(BaseAtk));

            if (_monSBSearch.HasDefensiveAbility("incorporeal"))
            {
                AbilityBonus = _abilityScores.DexMod;
            }

            if (_monSBSearch.HasFeat("Weapon Finesse")) //Natural weapons are considered light weapons
            {
                AbilityBonus = _abilityScores.DexMod;
            }

            weaponBonusComputed = BAB + AbilityBonus + SizeMod;
            formula             = BAB.ToString() + " BAB +" + AbilityBonus.ToString() + " AbilityBonus " + Utility.GetStringValue(SizeMod) + " SizeMod";
            int MultiWeaponPenalty = -5;

            if (_monSBSearch.HasFeat("Multiattack"))
            {
                MultiWeaponPenalty = -2;
                formula           += " -2 Multiattack";
            }

            if (!_monSBSearch.HasSQ("multiweapon mastery"))
            {
                if ((natural_weapon.attack_type == "Secondary" && MeleeWeaponCount != 1) || NaturalMultipleWepons)
                {
                    weaponBonusComputed += MultiWeaponPenalty;
                    formula             += " " + MultiWeaponPenalty.ToString() + " Secondary";
                }
            }

            //if (_monSBSearch.HasFeat("Combat Expertise"))
            //{
            //    int mod = -1;
            //    mod -= BAB / 4;
            //    weaponBonusComputed += mod;
            //    formula += " -" + mod.ToString() + "  Combat Expertise";
            //}

            int    WeaponFocusMod = 0;
            string weaponName     = natural_weapon.name.ToLower();

            if (weaponName == "talons")
            {
                weaponName = "talon";
            }

            if (_monSBSearch.HasFeat("Weapon Focus (" + weaponName + ")"))
            {
                weaponBonusComputed++;
                WeaponFocusMod++;
                formula += " +1 Weapon Focus";
            }

            if (_monSBSearch.HasFeat("Greater Weapon Focus (" + weaponName + ")"))
            {
                weaponBonusComputed++;
                WeaponFocusMod++;
                formula += " +1 Greater Weapon Focus";
            }

            if (_monSBSearch.IsMythic)
            {
                if (_monSBSearch.HasMythicFeat("Weapon Focus (" + weaponName + ")"))
                {
                    weaponBonusComputed -= WeaponFocusMod;
                    weaponBonusComputed += WeaponFocusMod * 2;
                    formula             += " +" + ((WeaponFocusMod * 2) - WeaponFocusMod).ToString() + " Mythic Weapon Focus";
                }
            }

            if (_indvSB != null)
            {
                weaponBonusComputed += _indvSB.GetOnGoingStatBlockModValue(OnGoingStatBlockModifier.StatBlockModifierTypes.NaturalAttack,
                                                                           OnGoingStatBlockModifier.StatBlockModifierSubTypes.None, false, ref formula);
            }

            holdMeleeWeapon = MW.Trim();
            _weaponChecker.ParseSingleNaturalWeapon(natural_weapon, ref weaponBonus, ref weaponsDamage, ref holdMeleeWeapon, ref Bonuses);
        }
        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);
        }