public StatBlockInfo.WeaponProficiencies GetAllKnownWeaponsProficiencies() { StatBlockInfo.WeaponProficiencies temp = StatBlockInfo.WeaponProficiencies.None; foreach (ClassWrapper wrapper in Classes) { temp |= wrapper.ClassInstance.WeaponProficiencies; } return(temp); }
public void CheckWeaponProficiency(Weapon weapon, ref int weaponBonusComputed, ref string formula, ref bool SimpleOne, string raceWeaponsText) { bool isProficient = false; StatBlockInfo.WeaponProficiencies knownWeaponsProficiencies = _sbCheckerBaseInput.CharacterClasses.GetAllKnownWeaponsProficiencies(); StatBlockInfo.WeaponProficiencies weaponCat = weapon.GetWeaponCategory(); if (SimpleOne) { knownWeaponsProficiencies ^= StatBlockInfo.WeaponProficiencies.SimpleOne; } if (RaceName != null) { switch (RaceName) { case "Half-Elf": if (raceWeaponsText.Contains(weapon.search_name.ToLower())) { isProficient = true; } break; case "Elf": if (raceWeaponsText.Contains(weapon.search_name.ToLower())) { isProficient = true; } if (weapon.name.Contains("elven")) { weaponCat = StatBlockInfo.WeaponProficiencies.Martial; } break; case "Gnome": if (weapon.name.Contains("gnome")) { weaponCat = StatBlockInfo.WeaponProficiencies.Martial; } break; case "Half-Orc": if (raceWeaponsText.Contains(weapon.search_name.ToLower())) { isProficient = true; } if (weapon.name.Contains("orc")) { weaponCat = StatBlockInfo.WeaponProficiencies.Martial; } break; case "Halfling": if (raceWeaponsText.Contains(weapon.search_name.ToLower())) { isProficient = true; } if (weapon.name.Contains("halfling")) { weaponCat = StatBlockInfo.WeaponProficiencies.Martial; } break; case "Dwarf": if (weapon.name.Contains("dwarven")) { weaponCat = StatBlockInfo.WeaponProficiencies.Martial; } if (raceWeaponsText.Contains(weapon.search_name.ToLower())) { isProficient = true; } break; default: if (raceWeaponsText.Contains(weapon.search_name.ToLower())) { isProficient = true; } break; } } if (weapon.group == "Exotic Weapon") { string tempWeaponName = weapon.search_name.ToLower(); if (tempWeaponName.Contains("scorpion")) { tempWeaponName = tempWeaponName.Replace("scorpion", string.Empty).Trim(); } if (_sbCheckerBaseInput.MonsterSBSearch.HasFeat("Exotic Weapon Proficiency (" + tempWeaponName + PathfinderConstants.PAREN_RIGHT)) { isProficient = true; } } if (weapon.group == "Martial Weapon") { if (_sbCheckerBaseInput.MonsterSBSearch.HasFeat("Martial Weapon Proficiency (" + weapon.search_name.ToLower() + PathfinderConstants.PAREN_RIGHT)) { isProficient = true; } } if (!isProficient && (_sbCheckerBaseInput.CharacterClasses.HasClass("hellknight signifer"))) { //hell knight order } if (!isProficient && (_sbCheckerBaseInput.CharacterClasses.HasClass("cleric") || _sbCheckerBaseInput.CharacterClasses.HasClass("inquisitor"))) { isProficient = GetDeityProficienccy(weapon); } if (knownWeaponsProficiencies.HasFlag(weaponCat)) { isProficient = true; } if (_sbCheckerBaseInput.MonsterSBSearch.HasSQ("skill at arms")) { isProficient = true; //battle mystery } if (!isProficient) { if ((knownWeaponsProficiencies & weaponCat) != weaponCat && (DontUseRacialHD || (HasRaceBase && RaceBaseType != RaceBase.RaceType.BestiaryStatBlock))) { bool ExtraPro = false; if (knownWeaponsProficiencies.HasFlag(StatBlockInfo.WeaponProficiencies.Extra)) { List <string> Extra = _sbCheckerBaseInput.CharacterClasses.GetAllWeaponProficienciesExtra(); if (Extra.Contains(weapon.search_name.ToLower())) { ExtraPro = true; } if (weapon.BaseWeaponName.Length > 0 && !ExtraPro) { if (Extra.Contains(weapon.BaseWeaponName.ToLower())) { ExtraPro = true; } } } if ((knownWeaponsProficiencies & StatBlockInfo.WeaponProficiencies.SimpleOne) == StatBlockInfo.WeaponProficiencies.SimpleOne) { if (weapon.group == "Simple Weapon") { // ExtraPro = true; SimpleOne = true; } } if (!ExtraPro && !_sbCheckerBaseInput.MonsterSBSearch.HasOnlyClassHitdice()) { weaponBonusComputed -= 4; formula += " -4 no weapon Proficiency"; _sbCheckerBaseInput.MessageXML.AddFail("Weapon Proficiency Missing", weapon.name + " needs " + weaponCat.ToString()); } } else { weaponBonusComputed -= 4; formula += " -4 no weapon Proficiency"; _sbCheckerBaseInput.MessageXML.AddFail("Weapon Proficiency Missing", weapon.name + " needs " + weaponCat.ToString()); } } }
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); } }