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"; } }
public void CheckMeleeWeaponDamage(Weapon weapon, string weaponsDamage, bool TwoWeaponFighting, bool BiteAttack, int weaponCount, int weaponIndex, string Size, AbilityScores.AbilityScores _abilityScores, MonSBSearch _monSBSearch, StatBlockMessageWrapper _messageXML, int FighterLevel, int ACDefendingMod, bool MagicWeapon, bool GreaterMagicWeapon, IndividualStatBlock_Combat _indvSB) { string formula = string.Empty; bool hasSizeDifference = false; StatBlockInfo.SizeCategories MonSize = StatBlockInfo.GetSizeEnum(Size); StatBlockInfo.SizeCategories WeaponSize = weapon.WeaponSize; if (MonSize != WeaponSize) { hasSizeDifference = true; } if (_monSBSearch.HasSQ("undersized weapons")) { MonSize = StatBlockInfo.ReduceSize(MonSize); } StatBlockInfo.HDBlockInfo damageComputed = new StatBlockInfo.HDBlockInfo(); ShieldSpecialAbilitiesEnum shieldSA = weapon.ShieldSpecialAbilities.ShieldSpecialAbilityValues; bool ShieldBashBoost = false; if ((shieldSA & ShieldSpecialAbilitiesEnum.Bashing) == ShieldSpecialAbilitiesEnum.Bashing) { ShieldBashBoost = true; MonSize = StatBlockInfo.IncreaseSize(MonSize); MonSize = StatBlockInfo.IncreaseSize(MonSize); } bool HasNewWeaponDamge = false; Weapon weaponDamage = null; if (weapon.search_name.ToLower() == "halfling sling staff") { weaponDamage = _weaponBusiness.GetWeaponByName("club"); HasNewWeaponDamge = true; } 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(); if (weaponsDamage.Contains("|")) { Pos = weaponsDamage.IndexOf("|"); weaponsDamage = weaponsDamage.Substring(0, Pos); } damageSB.ParseHDBlock(weaponsDamage.Trim()); if (weapon.@double) { //for double weapons assume the damage in the string is one of the ends if (weapon.damage_medium.Contains(damageSB.HDType.ToString())) { weapon.damage_medium = damageSB.Multiplier.ToString() + damageSB.HDType.ToString(); } if (weapon.damage_small.Contains(damageSB.HDType.ToString())) { weapon.damage_small = damageSB.Multiplier.ToString() + damageSB.HDType.ToString(); } } if (MonSize == StatBlockInfo.SizeCategories.Medium && !ShieldBashBoost && !hasSizeDifference) { if (HasNewWeaponDamge) { damageComputed.ParseHDBlock(weapon.damage_medium); } else { damageComputed.ParseHDBlock(weapon.damage_medium); } } else if (MonSize == StatBlockInfo.SizeCategories.Small && !ShieldBashBoost && !hasSizeDifference) { if (HasNewWeaponDamge) { damageComputed.ParseHDBlock(weapon.damage_small); } else { damageComputed.ParseHDBlock(weapon.damage_small); } } else if (!hasSizeDifference) { if (HasNewWeaponDamge) { damageComputed.ParseHDBlock(StatBlockInfo.ChangeWeaponDamageSize(weaponDamage.damage_medium, MonSize)); } else { damageComputed.ParseHDBlock(StatBlockInfo.ChangeWeaponDamageSize(weapon.damage_medium, MonSize)); } } else { //hasSizeDifference = true if (MonSize == StatBlockInfo.SizeCategories.Small) { damageComputed.ParseHDBlock(weapon.damage_small); } else { StatBlockInfo.SizeCategories tempSize = StatBlockInfo.SizeCategories.Medium; if (WeaponSize == tempSize) { tempSize = MonSize; } damageComputed.ParseHDBlock(StatBlockInfo.ChangeWeaponDamageSize(weapon.damage_medium, tempSize)); } } double StrBonus; bool OneHandedAsTwo; string ModUsed = ComputeStrBonus(weapon, TwoWeaponFighting, BiteAttack, weaponCount, weaponIndex, _monSBSearch, _abilityScores, out StrBonus, out OneHandedAsTwo); formula += " +" + StrBonus.ToString() + PathfinderConstants.SPACE + ModUsed + " Bonus Used"; damageComputed.Modifier += Convert.ToInt32(StrBonus); if (weapon.WeaponSpecialMaterial == WeaponSpecialMaterials.AlchemicalSilver && (weapon.slashing || weapon.piercing)) { damageComputed.Modifier--; formula += " -1 Alchemical Silver"; } if (_monSBSearch.HasSQ("hulking changeling")) { damageComputed.Modifier++; formula += " +1 hulking changeling"; } string hold2 = weapon.NamedWeapon ? weapon.BaseWeaponName : weapon.search_name; if (_monSBSearch.HasSpecialAttackGeneral("weapon training")) { damageComputed.Modifier += _monSBSearch.GetWeaponsTrainingModifier(hold2, ref formula); } damageComputed.Modifier += PoleArmTraingMods(weapon, _monSBSearch, FighterLevel, ref formula); bool ignoreEnhancement = false; if (weapon.name.ToLower() == "unarmed strike") { damageComputed.Modifier += _monSBSearch.GetOnGoingStatBlockModValue(OnGoingStatBlockModifier.StatBlockModifierTypes.NaturalDamage, OnGoingStatBlockModifier.StatBlockModifierSubTypes.None, ref formula); } else { WeaponCommon weaponCommon = new WeaponCommon(_sbCheckerBaseInput, _equipmentData, _naturalWeaponBusiness); weaponCommon.GetOnGoingDamageMods(MagicWeapon, GreaterMagicWeapon, _indvSB, ref formula, ref damageComputed, ref ignoreEnhancement); } if ((weapon.WeaponSpecialAbilities.WeaponSpecialAbilitiesValue & WeaponSpecialAbilitiesEnum.Furious) == WeaponSpecialAbilitiesEnum.Furious) { damageComputed.Modifier += 2; formula += " +1 furious"; } string hold = weapon.NamedWeapon ? weapon.BaseWeaponName.ToLower() : weapon.search_name.ToLower(); if (hold.Contains("aldori")) { hold = hold.Replace("aldori", "Aldori"); } if (_sbCheckerBaseInput.CharacterClasses.HasClass("aldori swordlord")) { if (hold.Contains("dueling sword")) { int tenpMod = _monSBSearch.GetAbilityMod(AbilityScores.AbilityScores.AbilityName.Dexterity); formula += " +" + tenpMod.ToString() + " Deft Strike"; damageComputed.Modifier += tenpMod; } } 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 (_monSBSearch.HasTemplate("graveknight")) { damageComputed.Modifier += 2; formula += " +2 Sacrilegious Aura"; } if (_monSBSearch.HasFeat("Shield Master") && weapon.name.Contains("shield")) { formula += " +" + weapon.EnhancementBonus + " Shield Master"; damageComputed.Modifier += weapon.EnhancementBonus; } //no enchantment bonus for shield bash if (weapon.EnhancementBonus > 0 && ACDefendingMod == 0 && !weapon.name.Contains("shield") && !ignoreEnhancement) { formula += " +" + weapon.EnhancementBonus.ToString() + " Enhancement Bonus"; damageComputed.Modifier += weapon.EnhancementBonus; } if (weapon.Broken) { formula += " -2 Broken"; damageComputed.Modifier -= 2; } if (damageSB.Equals(damageComputed)) { _messageXML.AddPass("Melee Attack Damage-" + weapon.Weapon_FullName(), formula); } else { int temp5 = damageComputed.Modifier - 1; if (OneHandedAsTwo && damageSB.Modifier == temp5 && !_monSBSearch.HasShield()) // not all SB use two handed weapons; not error, their choice { _messageXML.AddInfo(weapon.Weapon_FullName() + " could be used two-handed for extra damage"); _messageXML.AddPass("Melee Attack Damage-" + weapon.Weapon_FullName()); } else { _messageXML.AddFail("Melee Attack Damage-" + weapon.Weapon_FullName(), damageComputed.ToString(), damageSB.ToString(), formula); if (OneHandedAsTwo) { _messageXML.AddFail("Melee Attack Damage-", "Weapon could be used As Two-Handed?"); } } } string tempWeaponCrit = weapon.critical.Replace("/×2", string.Empty); tempWeaponCrit = tempWeaponCrit.Replace((char)(8211), char.Parse("-")); //if (tempWeaponCrit == weaponCrit) //{ // _messageXML.AddPass("Melee Attack Critical- " + weapon.Weapon_FullName()); //} //else //{ // _messageXML.AddFail("Melee Attack Critical- " + weapon.Weapon_FullName(), weapon.critical, weaponCrit); //} }