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); } }
public void CheckACMath() { string CheckName = "AC Math"; int ComputedAC = ACMods_SB.ComputeAC(); string formula = ACMods_SB.ComputeACFormula(); if (CharacterClasses.HasClass("monk")) { //int MonkLevel = CharacterClasses.FindClassLevel("monk"); //ComputedAC += MonkLevel / 4; } else if (_monSBSearch.HasGear("monk's robe")) { ComputedAC += 1; //monk level 5 ac bonus } //inlcude in Dex mod //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; // } // ComputedAC += Mod; // } //} if (_monSBSearch.HasClassArchetype("daredevil")) { int BardLevel = CharacterClasses.FindClassLevel("bard"); } string temp = AC; if (AC.Contains(CR)) //2nd AC block { int Pos2 = AC.IndexOf(CR); temp = temp.Substring(0, Pos2).Trim(); Pos2 = temp.IndexOf(")"); temp = temp.Substring(Pos2 + 1).Trim(); } try { temp = temp.Substring(0, temp.IndexOf(",")); temp = temp.Replace("AC", string.Empty); } catch (Exception ex) { throw new Exception("CheckACMath-- missing comma " + ex.Message); } int Pos = temp.IndexOf("("); if (Pos >= 0) { temp = temp.Substring(0, Pos).Trim(); } try { int SB_AC = Convert.ToInt32(temp); if (SB_AC != ComputedAC) { _messageXML.AddFail(CheckName, ComputedAC.ToString(), SB_AC.ToString(), formula); } else { _messageXML.AddPass(CheckName); } } catch (Exception ex) { _messageXML.AddFail(CheckName, ex.Message); } }
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); } }
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 = _sbCheckerBaseInput.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 = _sbCheckerBaseInput.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 = weapon.NamedWeapon ? weapon.BaseWeaponName.ToLower() : weapon.search_name.ToLower(); if (_monSBSearch.HasFeat("Weapon Specialization (" + hold + PathfinderConstants.PAREN_RIGHT)) { formula += " +2 Weapon Specialization"; damageComputed.Modifier += 2; } if (_monSBSearch.HasFeat("Greater Weapon Specialization (" + hold + PathfinderConstants.PAREN_RIGHT)) { 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(_sbCheckerBaseInput, _equipmentData, _naturalWeaponBusiness); weaponCommon.GetOnGoingDamageMods(MagicWeapon, GreaterMagicWeapon, _indvSB, ref formula, ref damageComputed, ref ignoreEnhancement); weaponsDamage = weaponsDamage.Replace(PathfinderConstants.PAREN_LEFT, string.Empty).Replace(PathfinderConstants.PAREN_RIGHT, string.Empty) .Replace("nonlethal", string.Empty); int Pos = weaponsDamage.IndexOf("/"); string weaponCrit; 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" && _sbCheckerBaseInput.CharacterClasses.HasClass("alchemist")) { damageComputed = new StatBlockInfo.HDBlockInfo(); damageComputed.HDType = StatBlockInfo.HitDiceCategories.d6; int alchemistLevel = _sbCheckerBaseInput.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); //} }