Пример #1
0
        private static string ComputeStrBonus(Weapon weapon, bool TwoWeaponFighting, bool hasBiteAttack, int weaponCount, int weaponIndex,
                                              MonSBSearch _monSBSearch, AbilityScores.AbilityScores _abilityScores, out double StrBonus, out bool OneHandedAsTwo)
        {
            int    meleeModUsed = _abilityScores.StrMod;
            string BonuesMod    = StatBlockInfo.STR;

            if (_monSBSearch.HasDefensiveAbility("incorporeal"))
            {
                meleeModUsed = _abilityScores.DexMod;
                BonuesMod    = StatBlockInfo.DEX;
            }

            StrBonus = meleeModUsed;

            if (TwoWeaponFighting && weaponIndex > 1)
            {
                if (StrBonus > 0)
                {
                    StrBonus /= 2;
                    StrBonus  = Math.Floor(StrBonus);
                }
            }
            if (_monSBSearch.HasFeat("Double Slice") && TwoWeaponFighting && weaponIndex > 1)
            {
                StrBonus = meleeModUsed;
            }

            if (hasBiteAttack && weapon.name == "bite")
            {
                StrBonus /= 2;
                StrBonus  = Math.Floor(StrBonus);
            }

            if (weapon.category.Contains("Two-Handed Melee") && !TwoWeaponFighting && !_monSBSearch.HasShield())
            {
                if (meleeModUsed > 0)
                {
                    StrBonus = 1.5 * StrBonus;
                    StrBonus = Math.Floor(StrBonus);
                }
            }

            OneHandedAsTwo = false;
            if (CanUseTwoHandedStrBonus(weapon, weaponCount, _monSBSearch, StrBonus))
            {
                StrBonus       = 1.5 * StrBonus;
                StrBonus       = Math.Floor(StrBonus);
                OneHandedAsTwo = true;
            }

            if (weapon.search_name.ToLower() == "aldori dueling sword" && !TwoWeaponFighting)
            {
                StrBonus = 1.5 * StrBonus;
                StrBonus = Math.Floor(StrBonus);
            }

            return(BonuesMod);
        }
Пример #2
0
        private static void ComputeRangeMod(Weapon weapon, AbilityScores.AbilityScores _abilityScores, MonSBSearch _monSBSearch, StatBlockMessageWrapper _messageXML,
                                            ref string formula, ref StatBlockInfo.HDBlockInfo damageComputed)
        {
            int    rangedModUsed      = _abilityScores.StrMod;
            string rangeModUsedString = " Str";

            if (_monSBSearch.HasDefensiveAbility("incorporeal"))
            {
                rangedModUsed      = 0; // _abilityScores.DexMod;
                rangeModUsedString = " Dex";
            }

            if (weapon.name.Contains("composite") && weapon.CompositeBonus == 0)
            {
                _messageXML.AddFail("Composite Weapon", "Str Bonus Missing");
            }

            if (!Utility.IsThrownWeapon(weapon.search_name.ToLower()))
            {
                if (!weapon.uses_ammunition || weapon.name == "Sling" || (weapon.name.Contains("composite") && weapon.CompositeBonus > 0))
                {
                    if (weapon.name.Contains("composite") && weapon.CompositeBonus > 0)
                    {
                        if (weapon.CompositeBonus >= rangedModUsed)
                        {
                            damageComputed.Modifier += Convert.ToInt32(rangedModUsed);
                            formula += " +" + rangedModUsed.ToString() + " composite";
                        }
                        else
                        {
                            damageComputed.Modifier += Convert.ToInt32(weapon.CompositeBonus);
                            formula += " +" + weapon.CompositeBonus.ToString() + " composite";
                        }
                    }
                    else
                    {
                        if (!weapon.name.ToLower().Contains("cross"))
                        {
                            damageComputed.Modifier += Convert.ToInt32(rangedModUsed);
                            formula += " +" + rangedModUsed.ToString() + rangeModUsedString;
                        }
                    }
                }
            }

            if (weapon.category == "Ranged Weapons" && !weapon.name.Contains("composite") && weapon.name.Contains("bow") && rangedModUsed < 0)
            {
                if (!weapon.name.ToLower().Contains("crossbow"))
                {
                    damageComputed.Modifier += Convert.ToInt32(rangedModUsed);
                    formula += " +" + rangedModUsed.ToString() + rangeModUsedString;
                }
            }
        }
Пример #3
0
        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);
        }
Пример #4
0
        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);

            //}
        }
Пример #5
0
        public void CheckCMB()
        {
            string CheckName = "CMB";
            int    CMB       = 0;

            AbilityScores.AbilityScores.AbilityName abilityName = AbilityScores.AbilityScores.AbilityName.Strength;


            if (SizeCat <= StatBlockInfo.SizeCategories.Tiny)
            {
                abilityName = AbilityScores.AbilityScores.AbilityName.Dexterity;
            }
            else if (_monSBSearch.HasFeat("Agile Maneuvers"))
            {
                abilityName = AbilityScores.AbilityScores.AbilityName.Dexterity;
            }
            else if (_monSBSearch.HasDefensiveAbility("incorporeal"))
            {
                abilityName = AbilityScores.AbilityScores.AbilityName.Dexterity;
            }

            int AbilityMod = StatBlockInfo.GetAbilityModifier(_monSBSearch.GetAbilityScoreValue(abilityName));
            // int BAB = Convert.ToInt32(Utility.GetNonParenValue(BaseAtk));
            int BAB = CharacterClasses.GetBABValue() + (CharacterClasses.HasClass("animal companion") ? 0 : Race_Base.RaceBAB());

            //was taken out before, added back in 11/8/2014
            if (HasMonk)
            {
                int MonkLevel = CharacterClasses.FindClassLevel("Monk");
                if (MonkLevel >= 3)
                {
                    BAB = MonkLevel + CharacterClasses.GetNonMonkBABValue() + Race_Base.RaceBAB();
                }
            }

            CMB = BAB + (SizeMod * -1) + AbilityMod + OnGoing;
            string formula = BAB.ToString() + " BAB " + Utility.GetPlusSign(SizeMod * -1) + (SizeMod * -1).ToString() + " SizeMod +" + AbilityMod.ToString() + " " + abilityName.ToString() + " AbilityMod";

            if (OnGoing != 0)
            {
                formula += "+" + OnGoing.ToString() + " (" + formulaOnGoing + ") OnGoingAttackMod";
            }

            _messageXML.AddInfo("Base BAB: " + (BAB + (SizeMod) + AbilityMod).ToString());

            if (_monSBSearch.HasSubType("swarm"))
            {
                CMB     = 0;
                formula = "0 swarm";
            }


            string holdCMB = Utility.GetNonParenValue(CMBString);

            if (holdCMB == "-")
            {
                holdCMB = "0";
            }
            if (CMB == Convert.ToInt32(holdCMB))
            {
                _messageXML.AddPass(CheckName, formula);
            }
            else
            {
                _messageXML.AddFail(CheckName, CMB.ToString(), holdCMB, formula);
            }
        }