private void CheckOneRangedWeaponFound(Weapon weapon, string rangedWeapon, bool MagicWeapon, bool GreaterMagicWeapon, ref bool SimpleOne, string _raceWeapons) { string holdRangedWeapon; List <string> Bonuses = null; string weaponsDamage = string.Empty; string weaponBonus = string.Empty; int weaponBonusComputed, AbilityBonus; int weaponBonusSB = 0; string formula = string.Empty; int RangeMod = 0; holdRangedWeapon = rangedWeapon; holdRangedWeapon = holdRangedWeapon.Replace("ranged touch", string.Empty); if (holdRangedWeapon.Contains("Rapid Shot")) { 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, _sbCheckerBaseInput.AbilityScores, _sbCheckerBaseInput.MonsterSBSearch, _sbCheckerBaseInput.MessageXML, MagicWeapon, GreaterMagicWeapon, _sbCheckerBaseInput.IndvSB); AbilityBonus = _sbCheckerBaseInput.AbilityScores.DexMod; string AbilityUsed = " Dex Mod "; if (rangedWeapon.Contains("hand of the acolyte")) { AbilityBonus = _sbCheckerBaseInput.AbilityScores.WisMod; AbilityUsed = " Wis Mod (hand of the acolyte) "; } if (holdRangedWeapon.Contains("/+")) { if (!_sbCheckerBaseInput.MonsterSBSearch.HasFeat("Quick Draw") && Utility.IsThrownWeapon(weapon.search_name.ToLower())) { _sbCheckerBaseInput.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 + _sbCheckerBaseInput.CharacterClasses.GetNonMonkBABValue() + _sbCheckerBaseInput.CharacterClasses.FindClassLevel("Monk") - 2; } weaponBonusComputed = BAB + AbilityBonus + _sizeMod + RangeMod; formula += BAB + " _baseAtk +" + AbilityBonus.ToString() + AbilityUsed + CommonMethods.GetStringValue(_sizeMod) + " _sizeMod +" + RangeMod.ToString() + " RangeMod"; if (weapon.name == "Sling" && _sbCheckerBaseInput.MonsterSBSearch.HasGear("stones")) { weaponBonusComputed--; formula += " -1 sling with stones"; } if (weapon.name == "rock" && _sbCheckerBaseInput.MonsterSBSearch.HasSpecialAttackGeneral("rock throwing")) { weaponBonusComputed++; formula += " +1 rock throwing"; } if (_sbCheckerBaseInput.MonsterSBSearch.HasClassArchetype("crossbowman")) { int fighterLevel = _sbCheckerBaseInput.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 (_sbCheckerBaseInput.MonsterSBSearch.HasClassArchetype("archer")) { int fighterLevel = _sbCheckerBaseInput.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 (_sbCheckerBaseInput.MonsterSBSearch.HasSQ("spirit (champion)")) { int mediumLevel = _sbCheckerBaseInput.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 (_sbCheckerBaseInput.MonsterSBSearch.HasFeat("Weapon Focus (" + hold + PathfinderConstants.PAREN_RIGHT)) { weaponBonusComputed++; formula += " +1 Weapon Focus"; } if (_sbCheckerBaseInput.MonsterSBSearch.HasFeat("Greater Weapon Focus (" + hold + PathfinderConstants.PAREN_RIGHT)) { weaponBonusComputed++; formula += " +1 Greater Weapon Focus"; } if (weapon.Masterwork && weapon.EnhancementBonus == 0) { weaponBonusComputed++; formula += " +1 Masterwork"; } if (_sbCheckerBaseInput.MonsterSBSearch.HasSpecialAttackGeneral("weapon training")) { weaponBonusComputed += _sbCheckerBaseInput.MonsterSBSearch.GetWeaponsTrainingModifier(weapon.search_name, ref formula); } try { weaponBonusSB = Convert.ToInt32(Bonuses.FirstOrDefault()); } catch { _sbCheckerBaseInput.MessageXML.AddFail("CheckOneRangedWeaponFound", "Failure to convert Bonus to Int from value of " + Bonuses.FirstOrDefault()); } WeaponCommon weaponCommon = new WeaponCommon(_sbCheckerBaseInput, _equipmentData, _naturalWeaponBusiness); bool ignore = false; if (_sbCheckerBaseInput.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 (_sbCheckerBaseInput.MonsterSBSearch.HasFeat("Rapid Shot") && weaponBonusComputed - 2 == weaponBonusSB & weapon.name.Contains("bow")) { weaponBonusComputed -= 2; } } if (weapon.name == "bomb" && _sbCheckerBaseInput.MonsterSBSearch.HasFeat("Throw Anything")) { weaponBonusComputed++; formula += " +1 Throw Anything"; } weaponCommon.CheckWeaponProficiency(weapon, ref weaponBonusComputed, ref formula, ref SimpleOne, _raceWeapons); if (weaponBonusComputed == weaponBonusSB) { _sbCheckerBaseInput.MessageXML.AddPass("Ranged Attack Bonus " + weapon.Weapon_FullName(), formula); } else { _sbCheckerBaseInput.MessageXML.AddFail("Ranged Attack Bonus " + weapon.Weapon_FullName(), weaponBonusComputed.ToString(), weaponBonusSB.ToString(), formula); } }
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"; } }