public StatBlockInfo.ShieldProficiencies GetAllKnownShieldProficiencies()
        {
            StatBlockInfo.ShieldProficiencies temp = StatBlockInfo.ShieldProficiencies.None;

            foreach (ClassWrapper wrapper in Classes)
            {
                temp |= wrapper.ClassInstance.ShieldProficiencies;
            }

            return(temp);
        }
        public void ParseEquipment(IMonSBSearch _monSBSearch)
        {
            string gear      = _sbCheckerBaseInput.MonsterSB.Gear.Replace("*", string.Empty).Trim();
            string otherGear = _sbCheckerBaseInput.MonsterSB.OtherGear.Replace("*", string.Empty).Trim();

            Utility.ParenCommaFix(ref otherGear);
            Utility.ParenCommaFix(ref gear);

            if (gear.Contains("CL "))
            {
                // HandleCLCommas(ref gear);
            }

            List <string> gearHold = gear.Split(',').ToList();

            if (otherGear != null)
            {
                gearHold.AddRange(otherGear.Split(',').ToList());
            }

            if (_sbCheckerBaseInput.MonsterSB.Environment.Length > 0)
            {
                if (_sbCheckerBaseInput.MonsterSB.Treasure.Contains("NPC Gear"))
                {
                    gear = _sbCheckerBaseInput.MonsterSB.Treasure;
                    int Pos = gear.IndexOf(PathfinderConstants.PAREN_LEFT);
                    if (Pos != -1)
                    {
                        gear = gear.Replace(gear.Substring(0, Pos - 1), string.Empty);
                        Pos  = gear.IndexOf(PathfinderConstants.PAREN_RIGHT);
                        gear = gear.Substring(0, Pos);
                        gear = gear.Replace(PathfinderConstants.PAREN_LEFT, string.Empty);
                        gearHold.AddRange(gear.Split(',').ToList());
                    }
                }
                if (_sbCheckerBaseInput.MonsterSB.Treasure.Contains("standard ("))
                {
                    gear = _sbCheckerBaseInput.MonsterSB.Treasure;
                    int Pos = gear.IndexOf(PathfinderConstants.PAREN_LEFT);
                    gear = gear.Replace(gear.Substring(0, Pos - 1), string.Empty);
                    Pos  = gear.IndexOf(PathfinderConstants.PAREN_RIGHT);
                    gear = gear.Substring(0, Pos);
                    gear = gear.Replace(PathfinderConstants.PAREN_LEFT, string.Empty);
                    gearHold.AddRange(gear.Split(',').ToList());
                }
                else if (_sbCheckerBaseInput.MonsterSB.Treasure.Contains(" ("))
                {
                    gear = _sbCheckerBaseInput.MonsterSB.Treasure;
                    int Pos = gear.IndexOf(PathfinderConstants.PAREN_LEFT);
                    gear = gear.Replace(gear.Substring(0, Pos - 1), string.Empty);
                    Pos  = gear.IndexOf(PathfinderConstants.PAREN_RIGHT);
                    gear = gear.Substring(0, Pos);
                    gear = gear.Replace(PathfinderConstants.PAREN_LEFT, string.Empty);
                    gearHold.AddRange(gear.Split(',').ToList());
                }
            }


            gearHold.ForEach(x => x = x.Trim());
            gearHold.RemoveAll(x => x == string.Empty);

            foreach (string super in _sbCheckerBaseInput.SourceSuperScripts)
            {
                for (int a = 0; a < gearHold.Count; a++)
                {
                    gearHold[a] = gearHold[a].Replace(super, string.Empty);
                }
            }

            try
            {
                _equipmentData.Weapons = Equipment_Parse.ParseWeaponsSimple(gearHold, _weaponBusiness, _magicItemStatBlockBusiness);
            }
            catch (Exception ex)
            {
                _sbCheckerBaseInput.MessageXML.AddFail("ParseEquipment", ex.Message);
            }

            Weapon weapon = Equipment_Parse.GetUnarmedStrikeWeapon(_weaponBusiness);  //everyone can do unarmed strike

            if (_sbCheckerBaseInput.MonsterSB.Melee.Contains("incorporeal touch"))
            {
                IncorporealTouch incorporealTouch = Equipment_Parse.GetIncorporealTouchWeapon();
                int    posIncorporealTouchStart   = _sbCheckerBaseInput.MonsterSB.Melee.IndexOf("incorporeal touch");
                int    posIncorporealTouchStop    = _sbCheckerBaseInput.MonsterSB.Melee.IndexOf(PathfinderConstants.PAREN_RIGHT, posIncorporealTouchStart);
                string incorporealTouchString     = _sbCheckerBaseInput.MonsterSB.Melee.Substring(posIncorporealTouchStart, posIncorporealTouchStop - posIncorporealTouchStart);
                incorporealTouch.DameageStrings = incorporealTouchString.Split(new string[] { " plus " }, StringSplitOptions.RemoveEmptyEntries).ToList();

                _equipmentData.Weapons.Add(incorporealTouch, 1);
            }


            if (_sbCheckerBaseInput.MonsterSB.Class.Contains("monk") || _sbCheckerBaseInput.MonsterSB.Class.Contains("brawler"))
            {
                int    naturalWeaponMod = 0;
                string naturalWeaponString;
                if (_monSBSearch.HasGear("amulet of mighty fists"))
                {
                    naturalWeaponString = _monSBSearch.GetGearString("amulet of mighty fists");
                    if (naturalWeaponString.Contains("+"))
                    {
                        List <string> specialAbilities = CommonMethods.GetAmuletOfMightFistsSpecialAbilities();
                        foreach (string ability in specialAbilities)
                        {
                            if (naturalWeaponString.Contains(ability))
                            {
                                naturalWeaponString = naturalWeaponString.Replace(ability, string.Empty);
                            }
                        }
                        int Pos = naturalWeaponString.IndexOf("+");
                        naturalWeaponMod = int.Parse(naturalWeaponString.Substring(Pos + 1));
                    }
                }
                Weapon weapon2 = Equipment_Parse.GetUnarmedStrikeWeapon(_weaponBusiness);
                StatBlockInfo.HDBlockInfo MonkUAD = FindSpecialClassUnarmedDamage(_sizeData.SizeCat);
                weapon2.damage_medium = MonkUAD.ToString();
                weapon2.damage_small  = MonkUAD.ToString();
                weapon2.WeaponSize    = _sizeData.SizeCat;
                naturalWeaponString   = "flurry of blows";
                if (naturalWeaponMod > 0)
                {
                    naturalWeaponString      = "+" + naturalWeaponMod.ToString() + PathfinderConstants.SPACE + naturalWeaponString;
                    weapon2.EnhancementBonus = naturalWeaponMod;
                    weapon2.Masterwork       = true;
                }
                weapon2.name        = naturalWeaponString;
                weapon2.search_name = "flurry of blows";

                _equipmentData.Weapons.Add(weapon2, 1);

                int monkLevel = _sbCheckerBaseInput.CharacterClasses.FindClassLevel("Monk");
                if (monkLevel == 0)
                {
                    monkLevel = _sbCheckerBaseInput.CharacterClasses.FindClassLevel("brawler");
                }
                if (_monSBSearch.HasGear("monk's robe"))
                {
                    monkLevel += 5;
                }
                StatBlockInfo.HDBlockInfo MonkUAD2 = StatBlockInfo.GetSpecialClassUnarmedDamage(monkLevel, _sizeData.SizeCat);
                naturalWeaponString = "unarmed strike";
                if (naturalWeaponMod > 0)
                {
                    naturalWeaponString     = "+" + naturalWeaponMod.ToString() + PathfinderConstants.SPACE + naturalWeaponString;
                    weapon.EnhancementBonus = naturalWeaponMod;
                    weapon.Masterwork       = true;
                }
                weapon.name        = naturalWeaponString;
                weapon.search_name = "unarmed strike";
                StatBlockInfo.HDBlockInfo tempUAD = StatBlockInfo.GetSpecialClassUnarmedDamage(monkLevel, StatBlockInfo.SizeCategories.Medium);
                weapon.damage_medium = tempUAD.ToString();
                tempUAD             = StatBlockInfo.GetSpecialClassUnarmedDamage(monkLevel, StatBlockInfo.SizeCategories.Small);
                weapon.damage_small = tempUAD.ToString();
                weapon.WeaponSize   = _sizeData.SizeCat;
            }

            _equipmentData.Weapons.Add(weapon, 1);

            if (_sbCheckerBaseInput.MonsterSB.Class.Contains("barbarian"))
            {
                if (_sbCheckerBaseInput.MonsterSB.Melee.Contains("bite"))
                {
                    _equipmentData.Weapons.Add(Equipment_Parse.GetBarbarianBite(), 1);
                }
            }

            if (_sbCheckerBaseInput.MonsterSB.Class.Contains("alchemist"))
            {
                if (_sbCheckerBaseInput.MonsterSB.Ranged.Contains("bomb"))
                {
                    _equipmentData.Weapons.Add(Equipment_Parse.GetBomb(), 1);
                }
            }

            if (_sbCheckerBaseInput.MonsterSB.SpecialAttacks.Contains("rock throwing"))
            {
                _equipmentData.Weapons.Add(Equipment_Parse.AddRockAsWeapon(), 1);
            }


            _equipmentData.Armor = Equipment_Parse.ParseArmorSimple(gearHold, _armorBusiness);
            _monSBSearch.Armor   = _equipmentData.Armor;

            StatBlockInfo.ArmorProficiencies  tempArmorPro  = _sbCheckerBaseInput.CharacterClasses.GetAllKnownArmorProficiencies();
            StatBlockInfo.ShieldProficiencies tempShieldPro = _sbCheckerBaseInput.CharacterClasses.GetAllKnownShieldProficiencies();

            if (_monSBSearch.HasFeat("Light _equipmentData.Armor Proficiency"))
            {
                tempArmorPro |= StatBlockInfo.ArmorProficiencies.Light;
            }
            if (_monSBSearch.HasFeat("Medium _equipmentData.Armor Proficiency"))
            {
                tempArmorPro |= StatBlockInfo.ArmorProficiencies.Medium;
            }
            if (_monSBSearch.HasFeat("Heavy _equipmentData.Armor Proficiency"))
            {
                tempArmorPro |= StatBlockInfo.ArmorProficiencies.Heavy;
            }

            if (_monSBSearch.HasFeat("Shield Proficiency"))
            {
                tempShieldPro |= StatBlockInfo.ShieldProficiencies.Shield;
            }
            if (_monSBSearch.HasFeat("Tower Shield Proficiency"))
            {
                tempShieldPro |= StatBlockInfo.ShieldProficiencies.Tower;
            }

            Armor armor;

            foreach (KeyValuePair <IEquipment, int> kvp in _equipmentData.Armor)
            {
                if (kvp.Key is Armor)
                {
                    armor = (Armor)kvp.Key;
                    if (armor.category == "shield")
                    {
                        StatBlockInfo.ShieldProficiencies shieldCategory = armor.GetShieldCategory();
                        if ((!tempShieldPro.HasFlag(shieldCategory) && (_sbCheckerBaseInput.MonsterSB.DontUseRacialHD || (_sbCheckerBaseInput.Race_Base != null && _sbCheckerBaseInput.Race_Base.RaceBaseType == RaceBase.RaceType.Race))))
                        {
                            if (tempShieldPro.HasFlag(StatBlockInfo.ShieldProficiencies.Extra))
                            {
                                List <string> extraShield = _sbCheckerBaseInput.CharacterClasses.GetAllShieldProficienciesExtra();
                                if (!extraShield.Contains(armor.name))
                                {
                                    _sbCheckerBaseInput.MessageXML.AddFail("Missing Shield Proficiency", armor.name + " needs " + shieldCategory.ToString());
                                }
                            }
                            else
                            {
                                _sbCheckerBaseInput.MessageXML.AddFail("Missing Shield Proficiency", armor.name + " needs " + shieldCategory.ToString());
                            }
                        }
                    }
                    if (armor.category.Contains("armor"))
                    {
                        StatBlockInfo.ArmorProficiencies armorCategory = armor.GetArmorCategory();
                        if ((tempArmorPro & armorCategory) != armorCategory && (_sbCheckerBaseInput.MonsterSB.DontUseRacialHD || (_sbCheckerBaseInput.Race_Base != null && _sbCheckerBaseInput.Race_Base.RaceBaseType == RaceBase.RaceType.Race)))
                        {
                            _sbCheckerBaseInput.MessageXML.AddFail("Missing _equipmentData.Armor Proficiency", armor.name + " needs " + armorCategory.ToString());
                        }
                    }
                }
                else if (kvp.Key is Weapon) //shield as weapon
                {
                    _equipmentData.Weapons.Add(kvp.Key, kvp.Value);
                }
            }

            _equipmentData.EquipementRoster = Equipment_Parse.ParseMagicItems(gearHold, _equipmentData.EquipementRoster,
                                                                              _magicItemStatBlockBusiness, _weaponBusiness, _armorBusiness, _equipmentGoodsBusiness);

            foreach (KeyValuePair <IEquipment, int> kvp in _equipmentData.EquipementRoster)
            {
                IEquipment hold = kvp.Key;
                if (hold.EquipmentType == EquipmentType.MagicItem)
                {
                    ApplyMagicItem(hold);
                }
            }

            foreach (string missing in gearHold)
            {
                _sbCheckerBaseInput.MessageXML.AddInfo("Missing Gear Info: " + missing);
            }
        }
Example #3
0
        public void ParseFeats()
        {
            string workingFeat = null;

            try
            {
                bool   found     = false;
                string holdFeats = _sbCheckerBaseInput.MonsterSB.Feats;
                Utility.ParenCommaFix(ref holdFeats);
                List <string> tempFeats = holdFeats.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries).ToList();

                string startFeatName = string.Empty;
                for (int a = tempFeats.Count - 1; a >= 0; a--)
                {
                    if (tempFeats[a].Contains("|"))
                    {
                        int Pos = tempFeats[a].IndexOf(PathfinderConstants.PAREN_LEFT);
                        startFeatName = tempFeats[a].Substring(0, Pos + 1).Trim();
                        holdFeats     = tempFeats[a].Substring(Pos);
                        holdFeats     = holdFeats.Replace(PathfinderConstants.PAREN_RIGHT, string.Empty);
                        holdFeats     = holdFeats.Replace(PathfinderConstants.PAREN_LEFT, string.Empty).Trim();
                        List <string> subFeatsList = holdFeats.Split('|').ToList();
                        //1st one
                        tempFeats[a] = startFeatName + subFeatsList[0].Trim() + PathfinderConstants.PAREN_RIGHT;
                        subFeatsList.Remove(subFeatsList[0]);
                        foreach (string sub in subFeatsList)
                        {
                            tempFeats.Add(startFeatName + sub.Trim() + PathfinderConstants.PAREN_RIGHT);
                        }
                    }
                }

                for (int a = 0; a < tempFeats.Count; a++)
                {
                    found = false;
                    foreach (string script in _sbCheckerBaseInput.SourceSuperScripts)
                    {
                        if (tempFeats[a].EndsWith(script))
                        {
                            tempFeats[a] = tempFeats[a].Substring(0, tempFeats[a].Length - script.Length).Trim();
                            found        = true;
                        }

                        if (tempFeats[a].Contains(script) && !found)
                        {
                            tempFeats[a] = tempFeats[a].Replace(script, string.Empty).Trim();
                            found        = true;
                        }
                    }
                    if (tempFeats[a].EndsWith("M") && !found)
                    {
                        tempFeats[a] = tempFeats[a].Substring(0, tempFeats[a].Length - 1).Trim();
                    }
                }


                StatBlockInfo.ArmorProficiencies tempArmorPro = _sbCheckerBaseInput.CharacterClasses.GetAllKnownArmorProficiencies();
                if ((tempArmorPro & StatBlockInfo.ArmorProficiencies.Light) == StatBlockInfo.ArmorProficiencies.Light)
                {
                    tempFeats.Add("Light Armor Proficiency");
                }
                if ((tempArmorPro & StatBlockInfo.ArmorProficiencies.Medium) == StatBlockInfo.ArmorProficiencies.Medium)
                {
                    tempFeats.Add("Medium Armor Proficiency");
                }
                if ((tempArmorPro & StatBlockInfo.ArmorProficiencies.Heavy) == StatBlockInfo.ArmorProficiencies.Heavy)
                {
                    tempFeats.Add("Heavy Armor Proficiency");
                }
                StatBlockInfo.ShieldProficiencies tempShieldPro = _sbCheckerBaseInput.CharacterClasses.GetAllKnownShieldProficiencies();
                if ((tempShieldPro & StatBlockInfo.ShieldProficiencies.Shield) == StatBlockInfo.ShieldProficiencies.Shield)
                {
                    tempFeats.Add("Shield Proficiency");
                }
                if ((tempShieldPro & StatBlockInfo.ShieldProficiencies.Tower) == StatBlockInfo.ShieldProficiencies.Tower)
                {
                    tempFeats.Add("Tower Shield Proficiency");
                }
                StatBlockInfo.WeaponProficiencies tempWeaponPro = _sbCheckerBaseInput.CharacterClasses.GetAllKnownWeaponsProficiencies();
                if ((tempWeaponPro & StatBlockInfo.WeaponProficiencies.Simple) == StatBlockInfo.WeaponProficiencies.Simple)
                {
                    tempFeats.Add("Simple Weapon Proficiency");
                }
                if ((tempWeaponPro & StatBlockInfo.WeaponProficiencies.Martial) == StatBlockInfo.WeaponProficiencies.Martial)
                {
                    tempFeats.Add("Martial Weapon Proficiency");
                }
                if ((tempWeaponPro & StatBlockInfo.WeaponProficiencies.Exotic) == StatBlockInfo.WeaponProficiencies.Exotic)
                {
                    tempFeats.Add("Exotic Weapon Proficiency");
                }

                string         hold         = string.Empty;
                string         selectedItem = string.Empty;
                bool           bonusFeat;
                IFeatStatBlock featSB;
                List <string>  FailedFeats = new List <string>();
                tempFeats.RemoveAll(p => p == string.Empty);
                tempFeats.RemoveAll(p => p == " *");
                tempFeats.RemoveAll(p => p == PathfinderConstants.SPACE);

                foreach (string tempFeat in tempFeats)
                {
                    hold        = tempFeat.Trim();
                    workingFeat = hold;
                    // hold = hold.Replace("'", string.Empty);
                    bonusFeat = false;
                    if (hold.EndsWith("B"))
                    {
                        hold      = hold.Substring(0, hold.Length - 1);
                        bonusFeat = true;
                    }
                    else if (hold.Contains("B "))
                    {
                        hold      = hold.Replace("B ", PathfinderConstants.SPACE);
                        bonusFeat = true;
                    }
                    selectedItem = string.Empty;
                    int Pos = hold.IndexOf(PathfinderConstants.PAREN_LEFT);
                    if (Pos >= 0)
                    {
                        selectedItem = hold.Substring(Pos);
                        hold         = hold.Replace(selectedItem, string.Empty).Trim();
                        selectedItem = Utility.RemoveParentheses(selectedItem);
                    }
                    hold = hold.Replace("**", string.Empty);
                    hold = hold.Replace("*", string.Empty);

                    if (hold.EndsWith("[M]"))
                    {
                        // hold = hold.Substring(0, hold.Length - 1);
                        hold   = hold.Replace("[M]", string.Empty);
                        featSB = _featStatBlockBusiness.GetMythicFeatByName(hold);
                    }
                    else
                    {
                        featSB = _featStatBlockBusiness.GetFeatByName(hold);
                    }
                    if (featSB != null)
                    {
                        _featManager.AddFeatData(new FeatData(featSB.name, featSB.prerequisites, featSB.prerequisite_feats, bonusFeat, selectedItem, featSB.type, featSB.prerequisite_skills));
                    }
                    else
                    {
                        FailedFeats.Add(hold);
                    }
                }

                if (FailedFeats.Any())
                {
                    _sbCheckerBaseInput.MessageXML.AddFail("ParseFeats", "Feats: " + string.Join(", ", FailedFeats.ToArray()) + " not defined");
                }

                //_featManager = new FeatMaster(temp);
            }
            catch (Exception ex)
            {
                if (_featManager == null)
                {
                    _featManager = new FeatMaster(new List <string>());
                }
                _sbCheckerBaseInput.MessageXML.AddFail("Parse Feats", "Working Feat : " + workingFeat + "   " + ex.Message);
            }
        }