Esempio n. 1
0
        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";
            }
        }