示例#1
0
        private void ComputeSpellDC(bool IsGnome, ref string formula, string name, int AbilityBonus, ref int Bonus, SpellData SD, ISpellStatBlock Spell)
        {
            int Bloodline  = 0;
            int gnomeBonus = 0;

            int spellClassLevel = Spell.GetSpellLevelByClass(name, _monSBSearch.HasCurse("haunted"), _monSBSearch.HasFeat("Shade of the Uskwood"), _monSBSearch.HasArchetype("Razmiran priest"));

            if (SD.Domain)
            {
                spellClassLevel = SD.Level;
            }
            // if (spellClassLevel < 0 && SD.Domain) spellClassLevel = SD.Level;
            if (spellClassLevel < 0 && _monSBSearch.HasBloodline())
            {
                Dictionary <string, int> bloodlineBonusSpells = CharacterClasses.GetBloodlineBonusSpells();
                if (bloodlineBonusSpells.ContainsKey(Spell.name.ToLower()))
                {
                    spellClassLevel = SD.Level;
                }
            }

            if (spellClassLevel < 0 && _monSBSearch.HasMystery())
            {
                Dictionary <string, int> mysteryBonusSpells = CharacterClasses.GetMysteryBonusSpells();
                if (mysteryBonusSpells.ContainsKey(Spell.name.ToLower()))
                {
                    spellClassLevel = SD.Level;
                }
            }
            if (spellClassLevel < 0 && _monSBSearch.HasPatron())
            {
                List <string> patronBonusSpells = CharacterClasses.GetPatronBonusSpells();
                if (patronBonusSpells.Contains(Spell.name.ToLower()))
                {
                    spellClassLevel = SD.Level;
                }
            }
            if (IsGnome && Spell.school.Contains("illusion"))
            {
                gnomeBonus = 1;
            }
            if (_monSBSearch.HasBloodline("arcane"))
            {
                int sorcererLevel = CharacterClasses.FindClassLevel("sorcerer");
                if (sorcererLevel >= 15)
                {
                    string schoolPower = _monSBSearch.GetSQ("school power");
                    schoolPower = schoolPower.Replace("spells)", string.Empty).Trim();
                    int Pos = schoolPower.LastIndexOf(" ");
                    schoolPower = schoolPower.Substring(Pos).Trim();
                    if (Spell.school.Contains(schoolPower))
                    {
                        Bloodline += 2;
                    }
                }
            }
            if (_monSBSearch.HasBloodline("fey"))
            {
                if (Spell.subschool.Contains("compulsion"))
                {
                    Bloodline += 2;
                }
            }
            if (_monSBSearch.HasBloodline("stormborn"))
            {
                if (Spell.descriptor.Contains("electricity") || Spell.descriptor.Contains("sonic"))
                {
                    Bloodline += 1;
                }
            }
            if (_monSBSearch.HasBloodline("infernal"))
            {
                if (Spell.subschool.Contains("charm"))
                {
                    Bloodline += 2;
                }
            }
            if (_monSBSearch.HasClassArchetype("winter witch"))
            {
                if (Spell.descriptor.Contains("cold"))
                {
                    Bonus += 1;
                }
            }
            if (_monSBSearch.Race() == "kitsune" && Spell.school.Contains("enchantment"))
            {
                Bonus += 1;
            }
            if (_monSBSearch.HasSubType("sahkil") && (Spell.school.Contains("emotion") || Spell.school.Contains("fear")))
            {
                Bonus += 2;
            }

            List <string> School;

            if (_monSBSearch.HasElementalSkillFocusFeat(out School))
            {
                if (School.Contains(Spell.descriptor))
                {
                    Bonus++;
                }
                List <string> School2;
                if (_monSBSearch.HasGreaterElementalSkillFocusFeat(out School2))
                {
                    if (School2.Contains(Spell.descriptor))
                    {
                        Bonus++;
                    }
                }
            }

            int computedDC = 10 + spellClassLevel + AbilityBonus + Bonus + Bloodline + gnomeBonus;

            formula = "10 +" + spellClassLevel.ToString() + " spell class level +" + AbilityBonus.ToString() + " ability bonus";
            if (Bloodline != 0)
            {
                formula += " +" + Bloodline.ToString() + " bloodline";
            }
            if (gnomeBonus != 0)
            {
                formula += " +" + gnomeBonus.ToString() + " gnome magic";
            }
            if (Bonus != 0)
            {
                formula += " +" + Bonus.ToString() + " skill/spell focus 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 void CheckFeatCount(string Feats)
        {
            string CheckName = "Feat Count";

            string hold = Feats;

            Utility.ParenCommaFix(ref hold);
            List <string> MythicFeats = new List <string>();
            List <string> FeatsTemp   = hold.Replace("*", string.Empty).Split(',').ToList <string>();

            FeatsTemp.RemoveAll(p => p == string.Empty);
            List <string> NewFeats = new List <string>();

            FeatsTemp = RemoveSuperScripts(FeatsTemp); //not mythic M
            FeatsTemp.RemoveAll(p => p == " ");

            int Count = FeatsTemp.Count - 1;

            for (int a = Count; a >= 0; a--)
            {
                string feat = FeatsTemp[a];
                if (feat.Contains("- "))
                {
                    _messageXML.AddFail("Feat Spelling", "hyphen space in feat name");
                }
                if (feat.Contains("("))
                {
                    int    Pos   = feat.IndexOf("(");
                    string temp3 = feat.Substring(Pos);
                    temp3 = temp3.Replace("(", string.Empty);
                    temp3 = temp3.Replace(")", string.Empty);
                    int count;
                    int.TryParse(temp3, out count);
                    if (count > 0)
                    {
                        NewFeats.Add(feat);
                    }
                    else
                    {
                        if (temp3.Contains("|"))
                        {
                            List <string> MultipleFeats = temp3.Split('|').ToList <string>();

                            Pos = feat.IndexOf("(");
                            string baseFeat = feat.Substring(0, Pos).Trim();
                            FeatsTemp[a] = baseFeat + " (" + MultipleFeats[0].Trim() + ")";

                            for (int b = 1; b <= MultipleFeats.Count - 1; b++)
                            {
                                NewFeats.Add(baseFeat + " (" + MultipleFeats[b].Trim() + ")");
                            }
                        }
                    }
                }
                //if (feat.EndsWith("M") || feat.Contains("M "))
                if (feat.Contains("[M]"))
                {
                    string temp2 = feat.Replace("[M]", string.Empty);
                    if (temp2.EndsWith("M"))
                    {
                        temp2 = temp2.Substring(0, temp2.Length - 1);
                    }
                    string tempOld = temp2;
                    if (temp2.Contains("("))
                    {
                        int Pos = temp2.IndexOf("(");
                        temp2 = temp2.Substring(0, Pos).Trim();
                    }
                    temp2 = temp2.Trim();
                    MythicFeats.Add(temp2.Trim());
                    IFeatStatBlock tempFeat = StatBlockService.GetMythicFeatByName(temp2);
                    if (tempFeat != null && tempFeat.prerequisite_feats == temp2)
                    {
                        FeatsTemp[a] = tempOld;
                    }
                    else
                    {
                        FeatsTemp[a] = string.Empty;
                    }
                }
            }
            FeatsTemp.Remove(string.Empty);
            FeatsTemp.AddRange(NewFeats);
            if (_monSBSearch.IsMythic)
            {
                int value           = _monSBSearch.MythicValue;
                int MythicFeatCount = StatBlockInfo.GetMythicFeats(value);

                if (MythicFeatCount == MythicFeats.Count)
                {
                    _messageXML.AddPass("Mythic Feat Count");
                }
                else
                {
                    _messageXML.AddFail("Mythic Feat Count", MythicFeatCount.ToString(), MythicFeats.Count.ToString(), "");
                }
            }

            int    FeatCount = CharacterClasses.FindClassFeatCount();
            string formula   = FeatCount.ToString() + " classes";

            if ((FeatsTemp.Contains("AlertnessB") || FeatsTemp.Contains("Alertness")) && _monSBSearch.HasFamiliar())
            {
                FeatCount++;
                formula += " +1 Familiar bonus";
            }

            if (_monSBSearch.HasHex("cauldron"))
            {
                FeatCount++;
                formula += " +1 cauldron hex";
            }

            //if (Race_Base.RaceBaseType != RaceBase.RaceType.Race)
            //{
            int count2 = FeatsTemp.Count;

            for (int a = count2 - 1; a >= 0; a--)
            {
                if (FeatsTemp[a].LastIndexOf("B") == FeatsTemp[a].Length - 1)
                {
                    FeatsTemp.Remove(FeatsTemp[a]);
                }
                else if (FeatsTemp[a].Contains("("))
                {
                    string tempFeat = FeatsTemp[a].Substring(0, FeatsTemp[a].IndexOf("(")).Trim();
                    if (tempFeat.LastIndexOf("B") == tempFeat.Length - 1)
                    {
                        FeatsTemp.Remove(FeatsTemp[a]);
                    }
                }
                else if (FeatsTemp[a].Contains("B "))
                {
                    FeatsTemp.Remove(FeatsTemp[a]);
                }
            }
            //}

            if (_monSBSearch.HasSQ("secrets")) //loremaster
            {
                if (_monSBSearch.HasSQ("secret health"))
                {
                    FeatCount++;
                    formula += " +1 secret health";
                }
                if (_monSBSearch.HasSQ("applicable knowledge"))
                {
                    FeatCount++;
                    formula += " +1 applicable knowledge";
                }
            }

            if (_monSBSearch.HasSQ("slayer talents"))
            {
                if (_monSBSearch.HasSQ("combat trick"))
                {
                    FeatCount++;
                    formula += " +1 combat trick";
                }
            }

            if (_monSBSearch.HasSQ("rogue talent") || _monSBSearch.HasSQ("ninja tricks"))
            {
                if (_monSBSearch.HasSQ("combat trick"))
                {
                    FeatCount++;
                    formula += " +1 combat trick";
                }
                if (_monSBSearch.HasSQ("finesse rogue"))
                {
                    FeatCount++; //weapon finesse
                    formula += " +1 finesse rogue";
                }
                if (_monSBSearch.HasSQ("weapon training"))
                {
                    FeatCount++;
                    formula += " +1 weapon training";
                }
                if (_monSBSearch.HasSQ("feat"))
                {
                    FeatCount++;
                    formula += " +1 rogue talent feat";
                }
                if (_monSBSearch.HasSQ("card sharp"))
                {
                    FeatCount++;
                    formula += " +1 card sharp";
                }
                if (_monSBSearch.HasSQ("grit"))
                {
                    FeatCount += 2;
                    formula   += " +2 grit";
                }
            }

            if (_monSBSearch.HasCavalierOrder("order of the cockatrice"))
            {
                int cavalierLevels = CharacterClasses.FindClassLevel("cavalier");
                if (cavalierLevels >= 2)
                {
                    FeatCount++;
                    formula += " +1 order of the cockatrice";
                }
            }

            if (_monSBSearch.HasCavalierOrder("order of the whip"))
            {
                int cavalierLevels = CharacterClasses.FindClassLevel("cavalier");
                if (cavalierLevels >= 2)
                {
                    FeatCount++;
                    formula += " +1 order of the whip";
                }
            }

            if (_monSBSearch.HasSQ("revelations") && _monSBSearch.HasSQ("weapon mastery")) // oracle battle mystery
            {
                int OracleLevel = CharacterClasses.FindClassLevel("oracle");
                FeatCount++;
                formula += " +1 weapon focus";
                if (OracleLevel >= 8)
                {
                    FeatCount++;
                    formula += " +1 Improved Critical";
                }
                if (OracleLevel >= 12)
                {
                    FeatCount++;
                    formula += " +1 Greater Weapon Focus";
                }
            }

            if (_monSBSearch.HasSQ("revelations") && _monSBSearch.HasSQ("stone stability")) // oracle stone mystery
            {
                int OracleLevel = CharacterClasses.FindClassLevel("oracle");
                if (OracleLevel >= 5)
                {
                    FeatCount++;
                    formula += " +1  Improved Trip";
                }
                if (OracleLevel >= 10)
                {
                    FeatCount++;
                    formula += " +1 Greater Trip";
                }
            }

            if (_monSBSearch.HasSQ("revelations") && _monSBSearch.HasSQ("cinder dance")) // oracle flame mystery
            {
                int OracleLevel = CharacterClasses.FindClassLevel("oracle");
                if (OracleLevel >= 5)
                {
                    FeatCount++;
                    formula += " +1  Nimble Moves";
                }
                if (OracleLevel >= 10)
                {
                    FeatCount++;
                    formula += " +1 Acrobatic Steps";
                }
            }

            #region ClassArchetypes
            if (_monSBSearch.HasAnyClassArchetypes())
            {
                if (_monSBSearch.HasClassArchetype("unarmed fighter"))
                {
                    FeatCount++;
                    formula += " +1 Unarmed Style";
                }

                if (_monSBSearch.HasClassArchetype("pirate"))
                {
                    FeatCount++;
                    formula += " +1 Sea Legs";
                }

                if (_monSBSearch.HasClassArchetype("musketeer"))
                {
                    FeatCount += 2;
                    formula   += " +2 Musketeer Instruction";
                }

                if (_monSBSearch.HasClassArchetype("cad"))
                {
                    int CadLevels = CharacterClasses.FindClassLevel("fighter");
                    if (CadLevels >= 3)
                    {
                        FeatCount++;                 // Catch Off Guard
                    }
                    formula += " +1 Catch Off Guard";
                }

                if (_monSBSearch.HasClassArchetype("steel hound"))
                {
                    int investigatorLevels = CharacterClasses.FindClassLevel("investigator");
                    if (investigatorLevels >= 2)
                    {
                        FeatCount += 2;                          // Amateur Gunslinger and Gunsmithing
                    }
                    formula += " +2 Packing Heat";
                }

                if (_monSBSearch.HasClassArchetype("constable"))
                {
                    FeatCount++; // Apprehend (Ex)
                    formula += " +1 Apprehend";
                }

                if (_monSBSearch.HasClassArchetype("staff magus"))
                {
                    FeatCount++; // Quarterstaff Master (Ex)
                    formula += " +1 Quarterstaff Master";
                }

                if (_monSBSearch.HasClassArchetype("musket master"))
                {
                    FeatCount++; // Rapid Reloader
                    formula += " +1 Rapid Reloader";
                }

                if (_monSBSearch.HasClassArchetype("weapon adept"))
                {
                    int monkLevels = CharacterClasses.FindClassLevel("monk");
                    if (monkLevels >= 1)
                    {
                        FeatCount++;
                    }
                    formula += " +1 Perfect Strike";
                    if (monkLevels >= 2)
                    {
                        FeatCount++;
                        formula += " +1 Weapon Focus";
                    }
                }
            }
            #endregion ClassArchetypes

            if (_monSBSearch.HasSpellDomians())
            {
                int clericLevel = CharacterClasses.FindClassLevel("cleric");
                if (clericLevel == 0)
                {
                    clericLevel = CharacterClasses.FindClassLevel("druid");
                }
                if (_monSBSearch.HasSpellDomain("Nobility") && clericLevel >= 8)
                {
                    FeatCount++;
                    formula += " +1 Nobility";
                }
                if (_monSBSearch.HasSpellDomain("Rune"))
                {
                    FeatCount++;
                    formula += " +1 Rune";
                }
                if (_monSBSearch.HasSpellDomain("Darkness"))
                {
                    FeatCount++;
                    formula += " +1 Darkness";
                }
                if (_monSBSearch.HasSpellDomain("Persistence"))
                {
                    FeatCount++;  //step up
                    formula += " +1 Persistence";
                }
                if (_monSBSearch.HasSpellDomain("Black Powder"))
                {
                    FeatCount++;  //Gunsmithing  inquisition
                    formula += " +1 Black Powder";
                }
            }

            if (_monSBSearch.HasTemplate("worm that walks"))
            {
                FeatCount++;  //diehard
                formula += " +1 worm that walks";
            }

            if (CharacterClasses.HasClass("arcanist"))
            {
                if (_monSBSearch.HasSpecialAttack("metamagic knowledge"))
                {
                    FeatCount++;  //Metamagic Knowledge
                    formula += " +1 metamagic knowledge";
                }
            }

            if (CharacterClasses.HasClass("slayer"))
            {
                if (_monSBSearch.HasSQ("ranger combat style"))
                {
                    int slayerLevel = CharacterClasses.FindClassLevel("slayer");
                    int tempMod     = 0;

                    if (slayerLevel >= 2)
                    {
                        tempMod++;
                    }
                    if (slayerLevel >= 6)
                    {
                        tempMod++;
                    }
                    if (slayerLevel >= 10)
                    {
                        tempMod++;
                    }
                    if (slayerLevel >= 14)
                    {
                        tempMod++;
                    }
                    if (slayerLevel >= 18)
                    {
                        tempMod++;
                    }

                    if (tempMod > 0)
                    {
                        FeatCount += tempMod;
                        formula   += " +" + tempMod.ToString() + " ranger combat style";
                    }
                }

                if (_monSBSearch.HasSQ("weapon training"))
                {
                    FeatCount += 1;
                    formula   += " +1 weapon training";
                }
            }

            if (CharacterClasses.HasClass("hellknight signifer"))
            {
                int hellknightSigniferLevel = CharacterClasses.FindClassLevel("hellknight signifer");
                if (hellknightSigniferLevel >= 2 && _monSBSearch.HasFeat("Arcane Armor Training"))
                {
                    FeatCount++;  //Arcane Armor Mastery
                    formula += " +1 Arcane Armor Expertise";
                }
            }

            if (_monSBSearch.HasSQ("investigator talent") && _monSBSearch.HasSQ("bonus feat")) // oracle battle mystery
            {
                FeatCount++;                                                                   //Investigator Talents
                formula += " +1 Investigator Talent";
            }


            int temp = 0;
            if (Race_Base != null)
            {
                if (Race_Base.RaceBaseType == RaceBase.RaceType.StatBlock && Race_Base.UseRacialHD)
                {
                    if (!HasEnvirmonment)
                    {
                        temp       = Race_Base.BonusFeatCount();
                        formula   += " +" + temp.ToString() + " Race";
                        FeatCount += temp;
                    }
                }

                //FeatCount += StatBlockInfo.GetHDFeats(CharacterClasses.FindTotalClassLevels());
                temp       = StatBlockInfo.GetHDFeats(HDValue);
                formula   += " +" + temp.ToString() + " Hit Dice";
                FeatCount += temp;
                if (Race_Base.RaceBaseType == RaceBase.RaceType.Race)
                {
                    temp       = Race_Base.BonusFeatCount();
                    formula   += " +" + temp.ToString() + " Race";
                    FeatCount += temp;
                }
            }

            int SB_count = FeatsTemp.Count();

            if (IntAbilityScoreValue == 0)
            {
                FeatCount = 0;
                formula   = " Int=0";
            }

            if (SB_count == FeatCount)
            {
                _messageXML.AddPass(CheckName, formula);
            }
            else
            {
                _messageXML.AddFail(CheckName, FeatCount.ToString(), SB_count.ToString(), formula);
            }
        }
        private void CheckOneRangedWeaponFound(Weapon weapon, string rangedWeapon, bool MagicWeapon, bool GreaterMagicWeapon,
                                               ref bool SimpleOne, string RaceWeapons)
        {
            string        holdRangedWeapon    = string.Empty;
            List <string> Bonuses             = null;
            string        weaponsDamage       = string.Empty;
            string        weaponBonus         = string.Empty;
            int           weaponBonusComputed = 0;
            int           weaponBonusSB       = 0;
            int           AbilityBonus        = 0;
            int           RangeMod            = 0;
            string        formula             = string.Empty;

            RangeMod = 0;

            holdRangedWeapon = rangedWeapon;

            holdRangedWeapon = holdRangedWeapon.Replace("ranged touch", string.Empty);
            if (holdRangedWeapon.IndexOf("Rapid Shot") >= 0)
            {
                holdRangedWeapon = holdRangedWeapon.Replace("Rapid Shot", string.Empty).Trim();
                RangeMod        -= 2;
            }

            _weaponChecker.ParseSingleWeapon(weapon, ref weaponBonus, ref weaponsDamage, ref holdRangedWeapon, ref Bonuses);
            _weaponChecker.CheckRangedWeaponDamage(weapon, weaponsDamage, Size, _abilityScores, _monSBSearch, _messageXML, MagicWeapon, GreaterMagicWeapon, _indvSB);

            AbilityBonus = _abilityScores.DexMod;
            string AbilityUsed = " Dex Mod ";

            if (rangedWeapon.Contains("hand of the acolyte"))
            {
                AbilityBonus = _abilityScores.WisMod;
                AbilityUsed  = " Wis Mod (hand of the acolyte) ";
            }

            if (holdRangedWeapon.Contains("/+"))
            {
                if (!_monSBSearch.HasFeat("Quick Draw") && Utility.IsThrownWeapon(weapon.search_name.ToLower()))
                {
                    _messageXML.AddFail("Ranged Iterative Attacks", "No Quick Draw, so can't have Iterative Attacks for " + weapon.name);
                }
            }

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

            if (holdRangedWeapon.Contains("flurry of blows"))
            {
                holdRangedWeapon = holdRangedWeapon.Replace("flurry of blows", string.Empty).Trim();
                BAB = RacialHDValue + CharacterClasses.GetNonMonkBABValue() + CharacterClasses.FindClassLevel("Monk") - 2;
            }

            weaponBonusComputed = BAB + AbilityBonus + SizeMod + RangeMod;
            formula            += BAB + " BaseAtk +" + AbilityBonus.ToString() + AbilityUsed
                                  + Utility.GetStringValue(SizeMod) + " SizeMod +" + RangeMod.ToString() + " RangeMod";

            if (weapon.name == "Sling" && _monSBSearch.HasGear("stones"))
            {
                weaponBonusComputed--;
                formula += " -1 sling with stones";
            }

            if (weapon.name == "rock" && _monSBSearch.HasSpecialAttackGeneral("rock throwing"))
            {
                weaponBonusComputed++;
                formula += " +1 rock throwing";
            }

            if (_monSBSearch.HasClassArchetype("crossbowman"))
            {
                int fighterLevel = CharacterClasses.FindClassLevel("fighter");
                if (fighterLevel >= 5)
                {
                    int tempBonus = 1;
                    if (fighterLevel >= 9)
                    {
                        tempBonus++;
                    }
                    if (fighterLevel >= 13)
                    {
                        tempBonus++;
                    }
                    if (fighterLevel >= 17)
                    {
                        tempBonus++;
                    }
                    weaponBonusComputed += tempBonus;
                    formula             += " +" + tempBonus.ToString() + " crossbowman crossbow expert";
                }
            }

            if (_monSBSearch.HasClassArchetype("archer"))
            {
                int fighterLevel = CharacterClasses.FindClassLevel("fighter");
                if (fighterLevel >= 5)
                {
                    int tempBonus = 1;
                    if (fighterLevel >= 9)
                    {
                        tempBonus++;
                    }
                    if (fighterLevel >= 13)
                    {
                        tempBonus++;
                    }
                    if (fighterLevel >= 17)
                    {
                        tempBonus++;
                    }
                    weaponBonusComputed += tempBonus;
                    formula             += " +" + tempBonus.ToString() + " Expert Archer";
                }
            }

            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++;
                }

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

            string hold = null;

            if (weapon.NamedWeapon)
            {
                hold = weapon.BaseWeaponName.ToLower();
            }
            else
            {
                hold = weapon.search_name.ToLower();
            }

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

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

            if (weapon.Masterwork && weapon.EnhancementBonus == 0)
            {
                weaponBonusComputed++;
                formula += " +1 Masterwork";
            }

            if (_monSBSearch.HasSpecialAttackGeneral("weapon training"))
            {
                weaponBonusComputed += _monSBSearch.GetWeaponsTrainingModifier(weapon.search_name, ref formula);
            }

            try
            {
                weaponBonusSB = Convert.ToInt32(Bonuses.FirstOrDefault());
            }
            catch
            {
                _messageXML.AddFail("CheckOneRangedWeaponFound", "Failure to convert Bonus to Int from value of " + Bonuses.FirstOrDefault());
            }

            WeaponCommon weaponCommon = new WeaponCommon(magicInEffect, Weapons, _indvSB, _messageXML, _monSBSearch, CharacterClasses, RaceName, DontUseRacialHD, RaceBaseType, HasRaceBase, RacialHDValue);
            bool         ignore       = false;

            if (_indvSB != null)
            {
                weaponCommon.GetOnGoingAttackMods(ref weaponBonusComputed, ref formula, MagicWeapon, GreaterMagicWeapon, out ignore);
            }

            if (weapon.EnhancementBonus > 0 && !ignore)
            {
                weaponBonusComputed += weapon.EnhancementBonus;
                formula             += " +" + weapon.EnhancementBonus.ToString() + " Enhancement Bonus";
            }

            if (Bonuses.Count > 1)
            {
                if (_monSBSearch.HasFeat("Rapid Shot") && weaponBonusComputed - 2 == weaponBonusSB & weapon.name.Contains("bow"))
                {
                    weaponBonusComputed -= 2;
                }
            }

            if (weapon.name == "bomb" && _monSBSearch.HasFeat("Throw Anything"))
            {
                weaponBonusComputed++;
                formula += " +1 Throw Anything";
            }

            weaponCommon.CheckWeaponProficiency(weapon, ref weaponBonusComputed, ref formula, ref SimpleOne, RaceWeapons);

            if (weaponBonusComputed == weaponBonusSB)
            {
                _messageXML.AddPass("Ranged Attack Bonus " + weapon.Weapon_FullName(), formula);
            }
            else
            {
                _messageXML.AddFail("Ranged Attack Bonus " + weapon.Weapon_FullName(), weaponBonusComputed.ToString(), weaponBonusSB.ToString(), formula);
            }
        }
示例#4
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);
            }
        }
示例#5
0
        public void CheckACValue()
        {
            string CheckName     = "AC Value";
            int    FlatFootedMod = 0;
            int    DexBonus      = 0;
            int    DexUsed       = _monSBSearch.GetAbilityMod(AbilityScores.AbilityScores.AbilityName.Dexterity);
            int    DexMod        = DexUsed;
            int    Duelist       = 0;
            int    OnGoingMods   = 0;
            string formula       = string.Empty;

            if (CharacterClasses.HasClass("duelist")) //Canny Defense
            {
                int IntMod = _monSBSearch.GetAbilityMod(AbilityScores.AbilityScores.AbilityName.Intelligence);
                if (IntMod > 0)
                {
                    int Mod          = 0;
                    int DuelistLevel = CharacterClasses.FindClassLevel("duelist");
                    if (IntMod >= DuelistLevel)
                    {
                        Mod = DuelistLevel;
                    }
                    else
                    {
                        Mod = IntMod;
                    }
                    Duelist = Mod;
                }
            }

            if (MaxDexMod > -1) //negative number means no penalty
            {
                if (MaxDexMod < DexMod)
                {
                    DexUsed  = MaxDexMod;
                    formula += " MaxDex: was " + MaxDexMod.ToString() + " even though Dex mod is " + (DexMod).ToString();
                    // Duelist = 0;
                }
            }

            if (DexMod > 0)
            {
                DexBonus = DexUsed;
            }

            if (_monSBSearch.HasFeat("Uncanny Dodge"))
            {
                FlatFootedMod = DexUsed;
            }

            switch (Race)
            {
            case "kasatha":
                ACMods_Computed.Dodge += 2;
                break;

            case "Svirfneblin":
                ACMods_Computed.Dodge += 2;
                break;
            }

            if (_monSBSearch.HasSQ("void form"))
            {
                ACMods_Computed.Deflection += HD / 4;
            }

            if (_monSBSearch.HasSubType("clockwork"))
            {
                ACMods_Computed.Dodge += 2;
            }

            if (CharacterClasses.HasClass("sorcerer")) //Natural Armor Increase
            {
                if (_monSBSearch.HasBloodline("draconic"))
                {
                    int sorLevel = CharacterClasses.FindClassLevel("sorcerer");
                    if (sorLevel >= 3)
                    {
                        ACMods_Computed.Natural += 1;
                    }
                    if (sorLevel >= 9)
                    {
                        ACMods_Computed.Natural += 1;
                    }
                    if (sorLevel >= 15)
                    {
                        ACMods_Computed.Natural += 2;
                    }
                }
            }

            if (CharacterClasses.HasClass("oracle"))
            {
                if (_monSBSearch.HasMystery("ancestor") && _monSBSearch.HasSQ("spirit shield"))
                {
                    int oracleLevel = CharacterClasses.FindClassLevel("oracle");
                    if (oracleLevel >= 1)
                    {
                        ACMods_Computed.Armor += 4;
                    }
                    if (oracleLevel >= 7)
                    {
                        ACMods_Computed.Armor += 2;
                    }
                    if (oracleLevel >= 11)
                    {
                        ACMods_Computed.Armor += 2;
                    }
                    if (oracleLevel >= 15)
                    {
                        ACMods_Computed.Armor += 2;
                    }
                    if (oracleLevel >= 19)
                    {
                        ACMods_Computed.Armor += 2;
                    }
                }
            }

            if (CharacterClasses.HasClass("gunslinger")) //Nimble (Ex)
            {
                int gunslingerLevel = CharacterClasses.FindClassLevel("gunslinger");
                if (gunslingerLevel >= 2)
                {
                    ACMods_Computed.Dodge += 1;
                }
                if (gunslingerLevel >= 6)
                {
                    ACMods_Computed.Dodge += 1;
                }
                if (gunslingerLevel >= 10)
                {
                    ACMods_Computed.Dodge += 1;
                }
                if (gunslingerLevel >= 14)
                {
                    ACMods_Computed.Dodge += 1;
                }
                if (gunslingerLevel >= 18)
                {
                    ACMods_Computed.Dodge += 1;
                }
            }

            if (CharacterClasses.HasClass("swashbuckler")) //Nimble (Ex)
            {
                int swashbucklerLevel = CharacterClasses.FindClassLevel("swashbuckler");
                if (swashbucklerLevel >= 3)
                {
                    ACMods_Computed.Dodge += 1;
                }
                if (swashbucklerLevel >= 7)
                {
                    ACMods_Computed.Dodge += 1;
                }
                if (swashbucklerLevel >= 11)
                {
                    ACMods_Computed.Dodge += 1;
                }
                if (swashbucklerLevel >= 15)
                {
                    ACMods_Computed.Dodge += 1;
                }
                if (swashbucklerLevel >= 19)
                {
                    ACMods_Computed.Dodge += 1;
                }
            }

            if (CharacterClasses.HasClass("stalwart defender")) //AC Bonus (Ex)
            {
                int stalwartDefenderLevel = CharacterClasses.FindClassLevel("stalwart defender");
                if (stalwartDefenderLevel >= 1)
                {
                    ACMods_Computed.Dodge += 1;
                }
                if (stalwartDefenderLevel >= 4)
                {
                    ACMods_Computed.Dodge += 1;
                }
                if (stalwartDefenderLevel >= 7)
                {
                    ACMods_Computed.Dodge += 1;
                }
                if (stalwartDefenderLevel >= 10)
                {
                    ACMods_Computed.Dodge += 1;
                }
            }

            if (CharacterClasses.HasClass("ranger") && _monSBSearch.HasArchetype("shapeshifter"))
            {
                if (_monSBSearch.HasSQ("form of the dragon"))
                {
                    ACMods_Computed.Natural += 2;
                }
            }

            if (_monSBSearch.HasClassArchetype("staff magus")) //Quarterstaff Defense (Ex)
            {
                int magusLevel = CharacterClasses.FindClassLevel("magus");
                //TO DO
            }

            if (_monSBSearch.HasFeat("Aldori Dueling Mastery"))
            {
                ACMods_Computed.Shield += 2; //Aldori Dueling Mastery
            }

            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++;
                }
                ACMods_Computed.Dodge += mod;
            }

            //should be handled SBChecker.ParseACMods()
            //foreach (OnGoingStatBlockModifier mod in _onGoingMods)
            //{
            //    if (mod.ModType == OnGoingStatBlockModifier.StatBlockModifierTypes.AC)
            //    {
            //        OnGoingMods += mod.Modifier;
            //    }
            //}

            if (_monSBSearch.HasTemplate("worm that walks"))
            {
                int WisMod = _monSBSearch.GetAbilityMod(AbilityScores.AbilityScores.AbilityName.Wisdom);
                if (WisMod < 2)
                {
                    WisMod = 2;
                }

                ACMods_Computed.Insight += WisMod;
            }


            int OtherBonuses = ACMods_Computed.Enhancement + ACMods_Computed.Deflection + ACMods_Computed.Natural
                               + ACMods_Computed.Dodge + ACMods_Computed.Wis + ACMods_Computed.Defending + ACMods_Computed.Insight + SizeMod
                               + ACMods_Computed.Monk + Duelist + OnGoingMods;

            formula += " AC = 10 +" + ACMods_Computed.Armor.ToString() + " Armor +" + ACMods_Computed.Shield.ToString() + " Shield +"
                       + DexUsed.ToString() + " Dex Used +" + OtherBonuses.ToString() + " Other Bonuses +" + ACMods_Computed.Rage + " Rage +" + ACMods_Computed.BloodRage + " Bloodrage";

            if (OtherBonuses != 0)
            {
                formula += " Other Bonuses =";
                if (ACMods_Computed.Enhancement != 0)
                {
                    formula += " +" + ACMods_Computed.Enhancement.ToString() + " Enhancement";
                }
                if (ACMods_Computed.Deflection != 0)
                {
                    formula += " +" + ACMods_Computed.Deflection.ToString() + " Deflection";
                }
                if (ACMods_Computed.Natural != 0)
                {
                    formula += " +" + ACMods_Computed.Natural.ToString() + " Natural";
                }
                if (ACMods_Computed.Dodge != 0)
                {
                    formula += " +" + ACMods_Computed.Dodge.ToString() + " Dodge";
                }
                if (ACMods_Computed.Wis != 0)
                {
                    formula += " +" + ACMods_Computed.Wis.ToString() + " Wis";
                }
                if (ACMods_Computed.Defending != 0)
                {
                    formula += " +" + ACMods_Computed.Defending.ToString() + " defending";
                }
                formula += Utility.GetStringValue(SizeMod) + " SizeMod";
                if (ACMods_Computed.Monk != 0)
                {
                    formula += " +" + ACMods_Computed.Monk.ToString() + " Monk";
                }
                if (Duelist != 0)
                {
                    formula += " +" + Duelist.ToString() + " Duelist";
                }
                if (OnGoingMods != 0)
                {
                    formula += " +" + OnGoingMods.ToString() + " OnGoingMods";
                }
                if (ACMods_Computed.Insight != 0)
                {
                    formula += " +" + ACMods_Computed.Insight.ToString() + " Insight";
                }
            }

            int CompAC            = 10 + ACMods_Computed.Armor + ACMods_Computed.Shield + DexUsed + OtherBonuses + ACMods_Computed.Rage + ACMods_Computed.BloodRage;
            int CompTouchAC       = 10 + DexUsed + SizeMod + ACMods_Computed.Deflection + ACMods_Computed.Defending + DodgeBonus + ACMods_Computed.Rage + ACMods_Computed.BloodRage + ACMods_Computed.Wis + ACMods_Computed.Monk + Duelist + ACMods_Computed.Insight;
            int CompFlatFoootedAC = CompAC - DexBonus + FlatFootedMod - DodgeBonus - Duelist;

            int AC_SB         = 0;
            int Touch_SB      = 0;
            int Flatfooted_SB = 0;

            if (AC.Contains(CR)) //2nd AC block
            {
                int Pos5 = AC.IndexOf(CR);
                AC   = AC.Substring(0, Pos5).Trim();
                Pos5 = AC.IndexOf(")");
                AC   = AC.Substring(Pos5 + 1).Trim();
            }
            List <string> ACList_SB = AC.Split(',').ToList();

            if (ACList_SB[0].IndexOf("(") >= 0)
            {
                ACList_SB[0] = ACList_SB[0].Substring(0, ACList_SB[0].IndexOf("(")).Trim();
            }
            try
            {
                AC_SB = Convert.ToInt32(ACList_SB[0]);
            }
            catch (Exception ex)
            {
                _messageXML.AddFail(CheckName, ex.Message);
                return;
            }
            string temp = ACList_SB[1].Replace("touch", string.Empty);

            try
            {
                Touch_SB = Convert.ToInt32(temp);
            }
            catch
            {
                _messageXML.AddFail(CheckName, "Issue parsing touch AC");
                return;
            }
            temp = ACList_SB[2].Replace("flat-footed", string.Empty);
            try
            {
                Flatfooted_SB = Convert.ToInt32(temp);
            }
            catch
            {
                _messageXML.AddFail(CheckName, "Issue parsing flat-footed AC");
                return;
            }

            if (CompAC == AC_SB && CompTouchAC == Touch_SB && CompFlatFoootedAC == Flatfooted_SB)
            {
                _messageXML.AddPass(CheckName, formula);
                return;
            }
            if (CompAC != AC_SB)
            {
                _messageXML.AddFail(CheckName, CompAC.ToString() + " " + ACMods_Computed.ToString(), AC_SB.ToString(), formula);
            }
            if (CompTouchAC != Touch_SB)
            {
                _messageXML.AddFail(CheckName + " Touch ", CompTouchAC.ToString() + " " + ACMods_Computed.ToString(), Touch_SB.ToString(), formula);
            }
            if (CompFlatFoootedAC != Flatfooted_SB)
            {
                _messageXML.AddFail(CheckName + " Flat-Footed ", CompFlatFoootedAC.ToString() + " " + ACMods_Computed.ToString(), Flatfooted_SB.ToString(), formula);
            }
        }
示例#6
0
        private void CheckOneWeaponMeleeNonNatural(Weapon weapon, ref int weaponBonusComputed, bool TwoWeaponFighting, bool LightWeapon,
                                                   bool BiteAttack, ref List <string> Bonuses, string MW, int weaponCount, int weaponIndex, ref string formula, bool MagicWeapon, bool GreaterMagicWeapon)
        {
            string weaponBonus     = string.Empty;
            string weaponsDamage   = string.Empty;
            string holdMeleeWeapon = string.Empty;

            int SizeDifference = 0;

            StatBlockInfo.SizeCategories MonSize    = StatBlockInfo.GetSizeEnum(Size);
            StatBlockInfo.SizeCategories WeaponSize = weapon.WeaponSize;
            if (WeaponSize == StatBlockInfo.SizeCategories.Medium && MonSize != WeaponSize)
            {
                WeaponSize = MonSize;
            }
            if (MonSize != WeaponSize)
            {
                SizeDifference = Math.Abs(StatBlockInfo.GetSizeDifference(MonSize, WeaponSize));
            }

            holdMeleeWeapon = MW.Trim();
            int Pos = holdMeleeWeapon.IndexOf(" ");

            if (Pos == 1)
            {
                holdMeleeWeapon = holdMeleeWeapon.Substring(Pos).Trim();
            }

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

            if (holdMeleeWeapon.Contains("flurry of blows"))
            {
                holdMeleeWeapon = holdMeleeWeapon.Replace("flurry of blows", string.Empty).Trim();
                BAB             = RacialHDValue + CharacterClasses.GetNonMonkBABValue() + CharacterClasses.FindClassLevel("Monk") - 2;
            }


            _weaponChecker.ParseSingleWeapon(weapon, ref weaponBonus, ref weaponsDamage, ref holdMeleeWeapon, ref Bonuses);

            try
            {
                _weaponChecker.CheckMeleeWeaponDamage(weapon, weaponsDamage, TwoWeaponFighting, BiteAttack, weaponCount, weaponIndex,
                                                      Size, _abilityScores, _monSBSearch, _messageXML, CharacterClasses.FindClassLevel("fighter"), _acDefendingMod, MagicWeapon, GreaterMagicWeapon, _indvSB);
            }
            catch (Exception ex)
            {
                _messageXML.AddFail("CheckOneWeaponMeleeNonNatural - CheckMeleeWeaponDamage", ex.Message);
            }
            int AbilityBonus = _abilityScores.StrMod;

            if (_monSBSearch.HasFeat("Weapon Finesse"))
            {
                if (IsWeaponFinesseCategory(weapon))
                {
                    AbilityBonus = _abilityScores.DexMod;
                }
            }

            if (MW.Contains("dueling sword") && _monSBSearch.HasFeat("Weapon Finesse") && _monSBSearch.HasFeat("Exotic Weapon Proficiency (Aldori dueling sword)"))
            {
                AbilityBonus = _abilityScores.DexMod;
            }

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

            weaponBonusComputed = BAB + AbilityBonus + SizeMod;
            formula            += BAB.ToString() + " BAB +" + AbilityBonus.ToString() + " AbilityBonus +" + SizeMod.ToString() + " SizeMod";

            if (weapon.Broken)
            {
                weaponBonusComputed -= 2;
                formula             += " -2 Broken";
            }
            if (BiteAttack && weapon.name == "bite")
            {
                if (_monSBSearch.HasFeat("Multiattack"))
                {
                    weaponBonusComputed -= 2;
                    formula             += " -2 bite Multiattack ";
                }
                else
                {
                    weaponBonusComputed -= 5;
                    formula             += " -5 bite";
                }
            }

            if (weapon.name.ToLower() == "unarmed strike")
            {
                weaponBonusComputed += _monSBSearch.GetOnGoingStatBlockModValue(OnGoingStatBlockModifier.StatBlockModifierTypes.NaturalAttack,
                                                                                OnGoingStatBlockModifier.StatBlockModifierSubTypes.None, ref formula);
            }

            if ((weapon.WeaponSpecialAbilities.WeaponSpecialAbilitiesValue & WeaponSpecialAbilitiesEnum.Furious) == WeaponSpecialAbilitiesEnum.Furious)
            {
                weaponBonusComputed += 2;
                formula             += " +2 furious";
            }

            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++;
                }

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

            if (SizeDifference > 0)
            {
                //assume small CreatureTypeFoundation has small weapon
                if (!(MonSize == StatBlockInfo.SizeCategories.Small && WeaponSize == StatBlockInfo.SizeCategories.Medium))
                {
                    weaponBonusComputed -= SizeDifference * 2;
                    formula             += "-" + (SizeDifference * 2).ToString() + " weapon size difference";
                }
            }

            weaponBonusComputed += _weaponChecker.PoleArmTraingMods(weapon, _monSBSearch, CharacterClasses.FindClassLevel("fighter"), ref formula);

            string hold = null;

            if (weapon.NamedWeapon)
            {
                hold = weapon.BaseWeaponName.ToLower();
            }
            else
            {
                hold = weapon.search_name.ToLower();
            }


            if (hold.Contains("aldori"))
            {
                hold = hold.Replace("aldori", "Aldori");
            }

            if (hold == "flurry of blows")
            {
                hold = "unarmed strike"; //flurry of blows is a bunch of unarmed strikes
            }

            if (_monSBSearch.HasDefensiveAbility("weapon training"))
            {
                int fighterLevel = CharacterClasses.FindClassLevel("fighter");
                int harshMod     = 0;
                if (fighterLevel >= 5)
                {
                    harshMod++;
                }
                if (fighterLevel >= 9)
                {
                    harshMod++;
                }
                if (fighterLevel >= 13)
                {
                    harshMod++;
                }
                if (fighterLevel >= 17)
                {
                    harshMod++;
                }
                if (harshMod > 0)
                {
                    weaponBonusComputed += harshMod;
                    formula             += " +" + harshMod.ToString() + " weapon training";
                }
            }

            if (_monSBSearch.HasSQ("classic duelist") && (weapon.name.ToLower() == "rapier" || weapon.search_name.ToLower() == "short sword" || weapon.name.ToLower() == "cutlass"))
            {
                weaponBonusComputed++;
                formula += " +1 classic duelist";
            }

            string holdFocus = hold.Replace("scorpion", string.Empty).Trim();

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

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

            if (!BiteAttack)
            {
                if (TwoWeaponFighting && !_monSBSearch.HasSQ("multiweapon mastery"))
                {
                    if (_monSBSearch.HasFeat("Two-Weapon Fighting"))
                    {
                        if (LightWeapon)
                        {
                            weaponBonusComputed += -2;
                            formula             += " -2 Two-Weapon Fighting Feat-light";
                        }
                        else
                        {
                            weaponBonusComputed += -4;
                            formula             += " -4 Two-Weapon Fighting Feat-not light";
                        }
                    }
                    else
                    {
                        if (LightWeapon)
                        {
                            weaponBonusComputed += -4;
                            formula             += " -4 Two-Weapon Fighting-light";
                        }
                        else
                        {
                            weaponBonusComputed += -6;
                            formula             += " -6 Two-Weapon Fighting-not light";
                        }
                    }
                }
            }


            string hold2 = null;

            if (weapon.NamedWeapon)
            {
                hold2 = weapon.BaseWeaponName;
            }
            else
            {
                hold2 = weapon.search_name;
            }

            if (_monSBSearch.HasSpecialAttackGeneral("weapon training"))
            {
                weaponBonusComputed += _monSBSearch.GetWeaponsTrainingModifier(hold2, ref formula);
            }

            if (weapon.Masterwork && weapon.EnhancementBonus == 0)
            {
                weaponBonusComputed++;
                formula += " +1 masterwork";
            }

            if (_monSBSearch.HasFeat("Shield Master") && weapon.name.Contains("shield"))
            {
                formula             += " +" + weapon.EnhancementBonus.ToString() + " Shield Master";
                weaponBonusComputed += weapon.EnhancementBonus;
            }

            if (_monSBSearch.HasClassArchetype("weapon master"))
            {
                int level = CharacterClasses.FindClassLevel("Fighter");
                int count = 0;
                if (level >= 3)
                {
                    weaponBonusComputed++;
                    count++;
                }
                if (level >= 7)
                {
                    weaponBonusComputed++;
                    count++;
                }
                if (level >= 11)
                {
                    weaponBonusComputed++;
                    count++;
                }
                if (level >= 15)
                {
                    weaponBonusComputed++;
                    count++;
                }
                if (level >= 19)
                {
                    weaponBonusComputed++;
                    count++;
                }
                formula += " +" + count.ToString() + " weapon master";
            }

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

            bool ignore = false;

            if (_indvSB != null)
            {
                WeaponCommon weaponCommon = new WeaponCommon(magicInEffect, Weapons, _indvSB, _messageXML, _monSBSearch, CharacterClasses, RaceName, DontUseRacialHD, RaceBaseType, HasRaceBase, RacialHDValue);
                weaponCommon.GetOnGoingAttackMods(ref weaponBonusComputed, ref formula, MagicWeapon, GreaterMagicWeapon, out ignore);
            }
            bool amuletOfMightFists = formula.Contains("Amulet of Mighty Fists");

            //shield bash get no Enchantment Bonus
            if (weapon.EnhancementBonus > 0 && _acDefendingMod == 0 && !weapon.name.Contains("shield") && !amuletOfMightFists && !ignore)
            {
                weaponBonusComputed += weapon.EnhancementBonus;
                formula             += " +" + weapon.EnhancementBonus.ToString() + " Enhancement Bonus";
            }
        }
示例#7
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 (_monSBSearch.HasFeat("Agile Maneuvers"))
            {
                abilityName = AbilityScores.AbilityScores.AbilityName.Dexterity;
            }
            else if (_monSBSearch.HasDefensiveAbility("incorporeal"))
            {
                abilityName = AbilityScores.AbilityScores.AbilityName.Dexterity;
            }

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

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

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

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

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

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


            string holdCMB = Utility.GetNonParenValue(CMBString);

            if (holdCMB == "-")
            {
                holdCMB = "0";
            }
            if (CMB == Convert.ToInt32(holdCMB))
            {
                _messageXML.AddPass(CheckName, formula);
            }
            else
            {
                _messageXML.AddFail(CheckName, CMB.ToString(), holdCMB, formula);
            }
        }
示例#8
0
        public void CheckRangedWeaponDamage(Weapon weapon, string weaponsDamage, string size, AbilityScores.AbilityScores _abilityScores,
                                            MonSBSearch _monSBSearch, StatBlockMessageWrapper _messageXML, bool MagicWeapon, bool GreaterMagicWeapon, IndividualStatBlock_Combat _indvSB)
        {
            string formula = string.Empty;

            StatBlockInfo.SizeCategories MonSize = StatBlockInfo.GetSizeEnum(size);

            if (_monSBSearch.HasSQ("undersized weapons"))
            {
                MonSize = StatBlockInfo.ReduceSize(MonSize);
            }

            StatBlockInfo.HDBlockInfo damageComputed = new StatBlockInfo.HDBlockInfo();
            if (weapon.name == "Sling" && _monSBSearch.HasGear("stones"))
            {
                damageComputed.ParseHDBlock(weapon.damage_small);
            }
            else if (MonSize == StatBlockInfo.SizeCategories.Medium)
            {
                damageComputed.ParseHDBlock(weapon.damage_medium);
            }
            else if (MonSize == StatBlockInfo.SizeCategories.Small)
            {
                damageComputed.ParseHDBlock(weapon.damage_small);
            }
            else
            {
                damageComputed.ParseHDBlock(StatBlockInfo.ChangeWeaponDamageSize(weapon.damage_medium, MonSize));
            }

            if (!weaponsDamage.Contains("entangle"))
            {
                ComputeRangeMod(weapon, _abilityScores, _monSBSearch, _messageXML, ref formula, ref damageComputed);
            }

            if (_monSBSearch.HasSpecialAttackGeneral("weapon training"))
            {
                damageComputed.Modifier += _monSBSearch.GetWeaponsTrainingModifier(weapon.search_name, ref formula);
            }

            if (_monSBSearch.HasClassArchetype("crossbowman"))
            {
                int fighterLevel = _characterClasses.FindClassLevel("fighter");
                if (fighterLevel >= 3)
                {
                    int dexBonus = _abilityScores.DexMod / 2;
                    if (dexBonus <= 0)
                    {
                        dexBonus = 1;
                    }
                    damageComputed.Modifier += dexBonus;
                    formula += " +" + dexBonus.ToString() + " crossbowman deadshot";
                }

                if (fighterLevel >= 5)
                {
                    int tempBonus = 1;
                    if (fighterLevel >= 9)
                    {
                        tempBonus++;
                    }
                    if (fighterLevel >= 13)
                    {
                        tempBonus++;
                    }
                    if (fighterLevel >= 17)
                    {
                        tempBonus++;
                    }
                    damageComputed.Modifier += tempBonus;
                    formula += " +" + tempBonus.ToString() + " crossbowman crossbow expert";
                }
            }

            if (_monSBSearch.HasClassArchetype("archer"))
            {
                int fighterLevel = _characterClasses.FindClassLevel("fighter");

                if (fighterLevel >= 5)
                {
                    int tempBonus = 1;
                    if (fighterLevel >= 9)
                    {
                        tempBonus++;
                    }
                    if (fighterLevel >= 13)
                    {
                        tempBonus++;
                    }
                    if (fighterLevel >= 17)
                    {
                        tempBonus++;
                    }
                    damageComputed.Modifier += tempBonus;
                    formula += " +" + tempBonus.ToString() + " Expert Archer";
                }
            }

            string hold = null;

            if (weapon.NamedWeapon)
            {
                hold = weapon.BaseWeaponName.ToLower();
            }
            else
            {
                hold = weapon.search_name.ToLower();
            }

            if (_monSBSearch.HasFeat("Weapon Specialization (" + hold + ")"))
            {
                formula += " +2 Weapon Specialization";
                damageComputed.Modifier += 2;
            }

            if (_monSBSearch.HasFeat("Greater Weapon Specialization (" + hold + ")"))
            {
                formula += " +2 Greater Weapon Specialization";
                damageComputed.Modifier += 2;
            }

            if (weapon.WeaponSpecialMaterial == WeaponSpecialMaterials.AlchemicalSilver && (weapon.slashing || weapon.piercing))
            {
                damageComputed.Modifier--;
                formula += " -1 Alchemical Silver";
            }

            if (weapon.EnhancementBonus > 0)
            {
                damageComputed.Modifier += weapon.EnhancementBonus;
                formula += " +" + weapon.EnhancementBonus.ToString() + " Enhancement Bonus";
            }

            if (_abilityScores.StrMod != 0 && Utility.IsThrownWeapon(weapon.search_name.ToLower()))
            {
                int MeleeModUsed = _abilityScores.StrMod;

                if (_monSBSearch.HasDefensiveAbility("incorporeal"))
                {
                    MeleeModUsed = _abilityScores.DexMod;
                }
                formula += " +" + MeleeModUsed.ToString() + " Str Bonus Used- Thrown";
                damageComputed.Modifier += Convert.ToInt32(MeleeModUsed);
            }

            if (weapon.name.Contains("bow") && !weapon.name.ToLower().Contains("composite") && !weapon.name.ToLower().Contains("cross") && _abilityScores.StrMod < 0)
            {
                damageComputed.Modifier += _abilityScores.StrMod;
            }

            bool         ignoreEnhancement = false;
            WeaponCommon weaponCommon      = new WeaponCommon(magicInEffect, Weapons, _indvSB, _messageXML, _monSBSearch, _characterClasses, RaceName, DontUseRacialHD, RaceBaseType, HasRaceBase, RacialHDValue);

            weaponCommon.GetOnGoingDamageMods(MagicWeapon, GreaterMagicWeapon, _indvSB, ref formula, ref damageComputed, ref ignoreEnhancement);

            weaponsDamage = weaponsDamage.Replace("(", string.Empty);
            weaponsDamage = weaponsDamage.Replace(")", string.Empty);
            weaponsDamage = weaponsDamage.Replace("nonlethal", string.Empty);
            int    Pos        = weaponsDamage.IndexOf("/");
            string weaponCrit = string.Empty;

            if (Pos >= 0)
            {
                weaponCrit    = weaponsDamage.Substring(Pos + 1);
                weaponsDamage = weaponsDamage.Substring(0, Pos);
            }
            StatBlockInfo.HDBlockInfo damageSB = new StatBlockInfo.HDBlockInfo();
            damageSB.ParseHDBlock(weaponsDamage.Trim());

            if (weapon.name == "rock" && _monSBSearch.HasSpecialAttackGeneral("rock throwing"))
            {
                if (damageComputed.Modifier != (_abilityScores.StrMod * 1.5))
                {
                    _messageXML.AddFail("Ranged Attack Damage- Rock ", (_abilityScores.StrMod * 1.5).ToString(), damageComputed.Modifier.ToString());
                }
            }


            if (weapon.name == "bomb" && _characterClasses.HasClass("alchemist"))
            {
                damageComputed        = new StatBlockInfo.HDBlockInfo();
                damageComputed.HDType = StatBlockInfo.HitDiceCategories.d6;
                int alchemistLevel = _characterClasses.FindClassLevel("alchemist");
                damageComputed.Multiplier = ((alchemistLevel - 1) / 2) + 1;
                damageComputed.Modifier   = _abilityScores.IntMod;

                formula = "+" + _abilityScores.IntMod.ToString() + " Int mod";
            }

            if (damageSB.Equals(damageComputed))
            {
                _messageXML.AddPass("Ranged Attack Damage " + weapon.Weapon_FullName(), formula);
            }
            else
            {
                _messageXML.AddFail("Ranged Attack Damage " + weapon.Weapon_FullName(), damageComputed.ToString(), damageSB.ToString(), formula);
            }

            //string tempWeaponCrit = weapon.critical.Replace("/×2", string.Empty);
            //tempWeaponCrit = tempWeaponCrit.Replace((char)(8211), Char.Parse("-"));
            //if (tempWeaponCrit == weaponCrit)
            //{
            //    _messageXML.AddPass("Ranged Attack Critical- " + weapon.Weapon_FullName());
            //}
            //else
            //{
            //    _messageXML.AddFail("Ranged Attack Critical- " + weapon.Weapon_FullName(), weapon.critical, weaponCrit);

            //}
        }