private int NonNaturalWeaponCount(List <string> WeaponsList) { int count = 0; Weapon weapon = null; NaturalWeapon natural_weapon = null; foreach (string MW in WeaponsList) { weapon = null; natural_weapon = null; bool MagicWeapon; bool GreaterMagicWeapon; WeaponCommon weaponCommon = new WeaponCommon(magicInEffect, Weapons, _indvSB, _messageXML, _monSBSearch, CharacterClasses, RaceName, DontUseRacialHD, RaceBaseType, HasRaceBase, RacialHDValue); if (weaponCommon.FindWeapon(ref weapon, ref natural_weapon, MW.Trim(), out MagicWeapon, out GreaterMagicWeapon)) { if (weapon != null && weapon.name != "bite") { count++; } if (natural_weapon != null) { } } } return(count); }
private int NonNaturalWeaponCount(List <string> weaponsList) { int count = 0; Weapon weapon = null; NaturalWeapon natural_weapon = null; foreach (string MW in weaponsList) { weapon = null; natural_weapon = null; bool MagicWeapon; bool GreaterMagicWeapon; WeaponCommon weaponCommon = new WeaponCommon(_sbCheckerBaseInput, _equipmentData, _naturalWeaponBusiness); if (weaponCommon.FindWeapon(ref weapon, ref natural_weapon, MW.Trim(), out MagicWeapon, out GreaterMagicWeapon)) { if (weapon != null && weapon.name != "bite") { count++; } if (natural_weapon != null) { } } } return(count); }
protected bool NaturalDamage(NPC n) { if (NaturalWeapon != null) { return(NaturalWeapon.Damage(n)); } else { return(n.damage(CalcHandDamage())); } }
private void CheckOneRangedOrBlock(string rangedWeapon) { List <string> Found = new List <string>(); List <string> Ranged = new List <string>(); string[] temp2 = new string[] { " and" }; if (rangedWeapon.Contains(" and ")) { Ranged = rangedWeapon.Split(temp2, StringSplitOptions.RemoveEmptyEntries).ToList(); } else if (rangedWeapon.Contains(", ")) { temp2 = new string[] { ", " }; Ranged = rangedWeapon.Split(temp2, StringSplitOptions.RemoveEmptyEntries).ToList(); } else { Ranged.Add(rangedWeapon); } bool SimpleOne = false; foreach (string ranged in Ranged) { Weapon weapon = null; NaturalWeapon natural_weapon = null; WeaponCommon weaponCommon = new WeaponCommon(_sbCheckerBaseInput, _equipmentData, _naturalWeaponBusiness); bool MagicWeapon; bool GreaterMagicWeapon; if (weaponCommon.FindWeapon(ref weapon, ref natural_weapon, ranged.Trim(), out MagicWeapon, out GreaterMagicWeapon)) { Found.Add(ranged.Trim()); CheckOneRangedWeaponFound(weapon, ranged.Trim(), MagicWeapon, GreaterMagicWeapon, ref SimpleOne, _raceWeapons); } else { _sbCheckerBaseInput.MessageXML.AddFail("Ranged Attack", "Missing Weapon-" + rangedWeapon.Trim()); } } }
private void CheckOneRangedOrBlock(string rangedWeapon) { List <string> Found = new List <string>(); List <string> Ranged = new List <string>(); string[] temp2 = new string[] { " and" }; if (rangedWeapon.Contains(" and ")) { Ranged = rangedWeapon.Split(temp2, StringSplitOptions.RemoveEmptyEntries).ToList <string>(); } else if (rangedWeapon.Contains(", ")) { temp2 = new string[] { ", " }; Ranged = rangedWeapon.Split(temp2, StringSplitOptions.RemoveEmptyEntries).ToList <string>(); } else { Ranged.Add(rangedWeapon); } bool SimpleOne = false; foreach (string ranged in Ranged) { Weapon weapon = null; NaturalWeapon natural_weapon = null; WeaponCommon weaponCommon = new WeaponCommon(magicInEffect, Weapons, _indvSB, _messageXML, _monSBSearch, CharacterClasses, RaceName, DontUseRacialHD, RaceBaseType, HasRaceBase, RacialHDValue); bool MagicWeapon; bool GreaterMagicWeapon; if (weaponCommon.FindWeapon(ref weapon, ref natural_weapon, ranged.Trim(), out MagicWeapon, out GreaterMagicWeapon)) { Found.Add(ranged.Trim()); CheckOneRangedWeaponFound(weapon, ranged.Trim(), MagicWeapon, GreaterMagicWeapon, ref SimpleOne, RaceWeapons); } else { _messageXML.AddFail("Ranged Attack", "Missing Weapon-" + rangedWeapon.Trim()); } } }
public void ParseSingleNaturalWeapon(NaturalWeapon natural_weapon, ref string weaponBonus, ref string weaponsDamage, ref string holdWeapon, ref List <string> Bonuses) { int Pos2 = holdWeapon.IndexOf("("); if (Pos2 == -1) { throw new Exception("ParseSingleNaturalWeapon: damage missing parens-- " + holdWeapon); } string temp = holdWeapon.Substring(0, Pos2); int Pos = temp.IndexOf("+"); if (Pos == -1) { Pos = temp.IndexOf("-"); } weaponBonus = temp.Substring(Pos); weaponBonus = weaponBonus.Replace("touch", string.Empty); weaponBonus = weaponBonus.Replace("+", string.Empty).Trim(); Bonuses = weaponBonus.Split('/').ToList <string>(); weaponsDamage = holdWeapon.Substring(Pos2).Trim(); }
private bool HasNonNaturalWeapon(List <string> WeaponsList) { Weapon weapon = null; NaturalWeapon natural_weapon = null; foreach (string MW in WeaponsList) { weapon = null; natural_weapon = null; bool MagicWeapon; bool GreaterMagicWeapon; WeaponCommon weaponCommon = new WeaponCommon(magicInEffect, Weapons, _indvSB, _messageXML, _monSBSearch, CharacterClasses, RaceName, DontUseRacialHD, RaceBaseType, HasRaceBase, RacialHDValue); if (weaponCommon.FindWeapon(ref weapon, ref natural_weapon, MW.Trim(), out MagicWeapon, out GreaterMagicWeapon)) { if (weapon != null) { return(true); } } } return(false); }
private bool HasNonNaturalWeapon(List <string> weaponsList) { Weapon weapon = null; NaturalWeapon natural_weapon = null; foreach (string MW in weaponsList) { weapon = null; natural_weapon = null; bool MagicWeapon; bool GreaterMagicWeapon; WeaponCommon weaponCommon = new WeaponCommon(_sbCheckerBaseInput, _equipmentData, _naturalWeaponBusiness); if (weaponCommon.FindWeapon(ref weapon, ref natural_weapon, MW.Trim(), out MagicWeapon, out GreaterMagicWeapon)) { if (weapon != null) { return(true); } } } return(false); }
private static natural_weapon MapThisToNaturalWeaponObject(NaturalWeapon SB) { return(Mapper.Map <NaturalWeapon, natural_weapon>(SB)); }
private void CheckOneMeleeOrBlock(List <string> Found, string meleeWeapon) { NaturalWeapon natural_weapon = null; Weapon weapon = null; bool TwoWeaponFighting = false; bool MultipleWepons = false; bool NaturalMultipleWepons = false; bool LightWeapon = false; bool BiteAttack = false; List <string> Melee2 = new List <string>(); string[] temp2 = new string[] { " and" }; Utility.ParenCommaFix(ref meleeWeapon); if (FindNonParenAnd(meleeWeapon)) { Melee2 = meleeWeapon.Split(temp2, StringSplitOptions.RemoveEmptyEntries).ToList <string>(); } else if (meleeWeapon.IndexOf(", ") >= 0) { temp2 = new string[] { ", " }; Melee2 = meleeWeapon.Split(temp2, StringSplitOptions.RemoveEmptyEntries).ToList <string>(); } else { Melee2.Add(meleeWeapon); } LightWeapon = false; BiteAttack = false; if (Melee2.Count > 1) { MultipleWepons = true; foreach (string weap in Melee2) { if (weap.IndexOf("bite") >= 0) { BiteAttack = true; } if (FindLightWeapon(weap)) { LightWeapon = true; } } if (NonNaturalWeaponCount(Melee2) != 1) { TwoWeaponFighting = true; } } Found.Add(meleeWeapon); if (HasNonNaturalWeapon(Melee2)) { NaturalMultipleWepons = true; } int weaponIndex = 0; bool SimpleOne = false; foreach (string MW in Melee2) // loop on "and" blocks { weapon = null; natural_weapon = null; weaponIndex++; bool MagicWeapon; bool GreaterMagicWeapon; WeaponCommon weaponCommon = new WeaponCommon(magicInEffect, Weapons, _indvSB, _messageXML, _monSBSearch, CharacterClasses, RaceName, DontUseRacialHD, RaceBaseType, HasRaceBase, RacialHDValue); if (weaponCommon.FindWeapon(ref weapon, ref natural_weapon, MW.Trim(), out MagicWeapon, out GreaterMagicWeapon)) { Found.Add(MW); CheckOneMeleeWeaponFound(natural_weapon, weapon, TwoWeaponFighting, MultipleWepons, LightWeapon, BiteAttack, Melee2.Count, weaponIndex, MW, MagicWeapon, GreaterMagicWeapon, ref SimpleOne, RaceWeapons, NaturalMultipleWepons); } else { _messageXML.AddFail("Melee Attack", "Missing Weapon-" + MW.Trim()); } } }
private void CheckOneWeaponMeleeNatural(NaturalWeapon natural_weapon, ref int weaponBonusComputed, ref List <string> Bonuses, string MW, bool NaturalMultipleWepons, ref string formula, int MeleeWeaponCount) { int BAB = 0; string weaponBonus = string.Empty; string weaponsDamage = string.Empty; string holdMeleeWeapon = string.Empty; int AbilityBonus = _abilityScores.StrMod; BAB = Convert.ToInt32(Utility.GetNonParenValue(BaseAtk)); if (_monSBSearch.HasDefensiveAbility("incorporeal")) { AbilityBonus = _abilityScores.DexMod; } if (_monSBSearch.HasFeat("Weapon Finesse")) //Natural weapons are considered light weapons { AbilityBonus = _abilityScores.DexMod; } weaponBonusComputed = BAB + AbilityBonus + SizeMod; formula = BAB.ToString() + " BAB +" + AbilityBonus.ToString() + " AbilityBonus " + Utility.GetStringValue(SizeMod) + " SizeMod"; int MultiWeaponPenalty = -5; if (_monSBSearch.HasFeat("Multiattack")) { MultiWeaponPenalty = -2; formula += " -2 Multiattack"; } if (!_monSBSearch.HasSQ("multiweapon mastery")) { if ((natural_weapon.attack_type == "Secondary" && MeleeWeaponCount != 1) || NaturalMultipleWepons) { weaponBonusComputed += MultiWeaponPenalty; formula += " " + MultiWeaponPenalty.ToString() + " Secondary"; } } //if (_monSBSearch.HasFeat("Combat Expertise")) //{ // int mod = -1; // mod -= BAB / 4; // weaponBonusComputed += mod; // formula += " -" + mod.ToString() + " Combat Expertise"; //} int WeaponFocusMod = 0; string weaponName = natural_weapon.name.ToLower(); if (weaponName == "talons") { weaponName = "talon"; } if (_monSBSearch.HasFeat("Weapon Focus (" + weaponName + ")")) { weaponBonusComputed++; WeaponFocusMod++; formula += " +1 Weapon Focus"; } if (_monSBSearch.HasFeat("Greater Weapon Focus (" + weaponName + ")")) { weaponBonusComputed++; WeaponFocusMod++; formula += " +1 Greater Weapon Focus"; } if (_monSBSearch.IsMythic) { if (_monSBSearch.HasMythicFeat("Weapon Focus (" + weaponName + ")")) { weaponBonusComputed -= WeaponFocusMod; weaponBonusComputed += WeaponFocusMod * 2; formula += " +" + ((WeaponFocusMod * 2) - WeaponFocusMod).ToString() + " Mythic Weapon Focus"; } } if (_indvSB != null) { weaponBonusComputed += _indvSB.GetOnGoingStatBlockModValue(OnGoingStatBlockModifier.StatBlockModifierTypes.NaturalAttack, OnGoingStatBlockModifier.StatBlockModifierSubTypes.None, false, ref formula); } holdMeleeWeapon = MW.Trim(); _weaponChecker.ParseSingleNaturalWeapon(natural_weapon, ref weaponBonus, ref weaponsDamage, ref holdMeleeWeapon, ref Bonuses); }
private void CheckOneMeleeWeaponFound(NaturalWeapon natural_weapon, Weapon weapon, bool TwoWeaponFighting, bool MultipleWepons, bool LightWeapon, bool BiteAttack, int Melee2Count, int weaponIndex, string MW, bool MagicWeapon, bool GreaterMagicWeapon, ref bool SimpleOne, string RaceWeapons, bool NaturalMultipleWepons) { List <string> Bonuses = new List <string>(); int weaponBonusComputed = 0; int weaponBonusSB = 0; string formula = string.Empty; if (weapon != null) { CheckOneWeaponMeleeNonNatural(weapon, ref weaponBonusComputed, TwoWeaponFighting, LightWeapon, BiteAttack, ref Bonuses, MW, Melee2Count, weaponIndex, ref formula, MagicWeapon, GreaterMagicWeapon); } if (natural_weapon != null) { CheckOneWeaponMeleeNatural(natural_weapon, ref weaponBonusComputed, ref Bonuses, MW, NaturalMultipleWepons, ref formula, Melee2Count); } weaponBonusSB = Convert.ToInt32(Bonuses.First()); if (Bonuses.Count > 1) { bool containsHaste = magicInEffect.Exists(y => y.Contains("Haste")) || magicInEffect.Exists(y => y.Contains("haste")); for (int w = 0; w < Bonuses.Count - 1; w++) { if (Convert.ToInt32(Bonuses[w]) != Convert.ToInt32(Bonuses[w + 1]) + 5 && !weapon.name.Contains("flurry of blows") && !weapon.name.Contains("unarmed strike") && !containsHaste) { _messageXML.AddFail("Melee Multiple Attack Bonus-", "not 5 difference"); break; } } } if (weapon != null) { WeaponCommon weaponCommon = new WeaponCommon(magicInEffect, Weapons, _indvSB, _messageXML, _monSBSearch, CharacterClasses, RaceName, DontUseRacialHD, RaceBaseType, HasRaceBase, RacialHDValue); weaponCommon.CheckWeaponProficiency(weapon, ref weaponBonusComputed, ref formula, ref SimpleOne, RaceWeapons); } if (weaponBonusComputed == weaponBonusSB) { if (weapon != null) { _messageXML.AddPass("Melee Attack Bonus-" + weapon.Weapon_FullName(), formula); } else { _messageXML.AddPass("Melee Attack Bonus-" + natural_weapon.name, formula); } } else { if (weapon != null) { _messageXML.AddFail("Melee Attack Bonus-" + weapon.Weapon_FullName(), weaponBonusComputed.ToString(), weaponBonusSB.ToString(), formula); } else { _messageXML.AddFail("Melee Attack Bonus-" + natural_weapon.name, weaponBonusComputed.ToString(), weaponBonusSB.ToString(), formula); } } }
public bool FindWeapon(ref Weapon weapon, ref NaturalWeapon naturalWeapon, string weaponText, out bool isMagicWeapon, out bool isGreaterMagicWeapon) { isMagicWeapon = false; isGreaterMagicWeapon = false; try { weaponText = weaponText.Replace(Environment.NewLine, PathfinderConstants.SPACE); int enchancement = 0; int weaponCount = 1; bool isMasterwork = weaponText.Contains("mwk") || weaponText.Contains("masterwork"); if (!isMasterwork && weaponText.Contains(" of ") && !weaponText.Contains("flurry of blows")) { isMasterwork = true; } weaponText = weaponText.Replace("hand of the apprentice", string.Empty).Trim(); int Pos = weaponText.IndexOf(PathfinderConstants.SPACE); string temp = string.Empty; string temp2 = weaponText.Substring(0, 2); if ((Pos == 1 || Pos == 2) && !temp2.Contains("+")) //get rid of weapon count { weaponCount = int.Parse(weaponText.Substring(0, Pos)); weaponText = weaponText.Substring(Pos).Trim(); } Pos = weaponText.IndexOf("+"); if (Pos == 0) { Pos = weaponText.IndexOf(PathfinderConstants.SPACE); temp = weaponText.Substring(0, Pos); Pos = temp.IndexOf("/"); if (Pos != -1) { temp = temp.Substring(0, Pos); } enchancement = Convert.ToInt32(temp); if (enchancement > 0) { isMasterwork = true; } } if (weaponText.Contains("flurry of blows")) { weaponText = weaponText.Replace("flurry of blows", string.Empty); if (!weaponText.Contains("unarmed strike")) { weaponText = "unarmed strike " + weaponText.Trim(); _sbCheckerBaseInput.MessageXML.AddFail("Missing Unarmed Strike Text", "Missing 'Unarmed Strike' in flurry of blows text"); } } bool foundWeapon = FindWeaponInList(ref weapon, weaponText, enchancement, isMasterwork, ref temp, 0, false); if (foundWeapon) { return(foundWeapon); } foreach (string magic in _sbCheckerBaseInput.MagicInEffect) { if (magic.Contains("Magic Weapon, Greater")) { Pos = magic.IndexOf("CL"); temp = magic.Substring(Pos); List <OnGoingStatBlockModifier> mods = _sbCheckerBaseInput.IndvSB.GetOnGoingStatBlockMods(); var attackMod = from x in mods where x.Name == "Greater Magic Weapon- Attack Bonus" select x.Modifier; foundWeapon = FindWeaponInList(ref weapon, weaponText, enchancement, isMasterwork, ref temp, attackMod.FirstOrDefault(), true); if (foundWeapon) { isGreaterMagicWeapon = true; return(foundWeapon); } } else if (magic.Contains(MAGIC_WEAPON)) { Pos = magic.IndexOf("CL"); temp = magic.Substring(Pos); List <OnGoingStatBlockModifier> mods = _sbCheckerBaseInput.IndvSB.GetOnGoingStatBlockMods(); var attackMod = from x in mods where x.Name == "Magic Weapon- Attack Bonus" select x.Modifier; foundWeapon = FindWeaponInList(ref weapon, weaponText, enchancement, isMasterwork, ref temp, attackMod.FirstOrDefault(), true); if (foundWeapon) { isMagicWeapon = true; return(foundWeapon); } } } Pos = weaponText.IndexOf("+"); if (Pos >= 0) { temp = weaponText.Substring(0, Pos).Trim(); temp = temp.Replace("incorporeal", string.Empty).Replace("claws", "claw").Replace("tentacles", "tentacle") .Replace("slams", "slam").Replace("wings", "wing").Replace("stomp", "stomps").Replace("bites", "bite").Trim(); NaturalWeapon natural_weapon = _naturalWeaponBusiness.GetNaturalWeaponByName(temp); if (natural_weapon != null) { _equipmentData.Weapons.Add(natural_weapon, weaponCount); naturalWeapon = (NaturalWeapon)natural_weapon; return(true); } } return(false); } catch (Exception ex) { _sbCheckerBaseInput.MessageXML.AddFail("FindWeapon", ex.Message); return(false); } }
public Scorpion(Square pLocation) : base(pLocation, 3, 3) { mFirstSlot = new NaturalWeapon(this); }
public Firefly(Square pLocation) : base(pLocation, 3, 2) { mFirstSlot = new NaturalWeapon(this); }
private void CheckOneMeleeOrBlock(List <string> foundWeapons, string meleeWeapon) { NaturalWeapon natural_weapon = null; Weapon weapon = null; bool twoWeaponFighting = false; bool multipleWepons = false; bool naturalMultipleWepons = false; bool lightWeapon; bool biteAttack; List <string> meleeList = new List <string>(); string[] splitFind = new string[] { " and" }; meleeWeapon = meleeWeapon.Replace('\n', ' '); //find "and"s in parenths int posAnd = meleeWeapon.IndexOf("and"); if (posAnd > 0) { int startPos = 0;; while (posAnd <= meleeWeapon.Length || posAnd == -1) { int openparen = meleeWeapon.IndexOf(PathfinderConstants.PAREN_LEFT, startPos); if (openparen < 0) { break; } int closeparen = meleeWeapon.IndexOf(PathfinderConstants.PAREN_RIGHT, openparen); if (posAnd > openparen && openparen < closeparen) { meleeWeapon = meleeWeapon.Insert(posAnd, "|"); } posAnd = meleeWeapon.IndexOf("and", closeparen); startPos = closeparen; } } Utility.ParenCommaFix(ref meleeWeapon); if (FindNonParenAnd(meleeWeapon)) { meleeList = meleeWeapon.Split(splitFind, StringSplitOptions.RemoveEmptyEntries).ToList(); for (int a = 0; a <= meleeList.Count - 1; a++) { meleeList[a] = meleeList[a].Replace("|", string.Empty); } } else if (meleeWeapon.Contains(", ")) { splitFind = new string[] { ", " }; meleeList = meleeWeapon.Split(splitFind, StringSplitOptions.RemoveEmptyEntries).ToList(); } else { meleeList.Add(meleeWeapon); } lightWeapon = false; biteAttack = false; if (meleeList.Any()) { multipleWepons = true; foreach (string weap in meleeList) { if (weap.Contains("bite")) { biteAttack = true; } if (FindLightWeapon(weap)) { lightWeapon = true; } } if (NonNaturalWeaponCount(meleeList) != 1) { twoWeaponFighting = true; } } foundWeapons.Add(meleeWeapon); if (HasNonNaturalWeapon(meleeList)) { naturalMultipleWepons = true; } int weaponIndex = 0; bool SimpleOne = false; foreach (string MW in meleeList) // loop on "and" blocks { weapon = null; natural_weapon = null; weaponIndex++; bool MagicWeapon; bool GreaterMagicWeapon; WeaponCommon weaponCommon = new WeaponCommon(_sbCheckerBaseInput, _equipmentData, _naturalWeaponBusiness); if (weaponCommon.FindWeapon(ref weapon, ref natural_weapon, MW.Trim(), out MagicWeapon, out GreaterMagicWeapon)) { foundWeapons.Add(MW); CheckOneMeleeWeaponFound(natural_weapon, weapon, twoWeaponFighting, multipleWepons, lightWeapon, biteAttack, meleeList.Count, weaponIndex, MW, MagicWeapon, GreaterMagicWeapon, ref SimpleOne, _raceWeapons, naturalMultipleWepons); } else { _sbCheckerBaseInput.MessageXML.AddFail("Melee Attack", "Missing Weapon-" + MW.Trim()); } } }