private bool FlagSet(ShieldSpecialAbilitiesEnum value)
 {
     return((ShieldSpecialAbilityValues & value) == value);
 }
예제 #2
0
        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);

            //}
        }
 public void AddShieldSpecialAbility(ShieldSpecialAbilitiesEnum value)
 {
     ShieldSpecialAbilityValues |= value;
 }