Beispiel #1
0
        private int GetMagicItemSaveMods(ref string formula)
        {
            int mod = 0;

            foreach (MagicItemAbilitiesWrapper wrapper in _equipmentData.MagicItemAbilities)
            {
                if (wrapper != null)
                {
                    foreach (OnGoing.IOnGoing SBMods in wrapper.OnGoingStatBlockModifiers)
                    {
                        if (SBMods.OnGoingType == OnGoingType.StatBlock)
                        {
                            OnGoingStatBlockModifier Mod = (OnGoingStatBlockModifier)SBMods;
                            if (Mod.ModType == OnGoingStatBlockModifier.StatBlockModifierTypes.SavingThrow)
                            {
                                formula += " +" + Mod.Modifier.ToString() + PathfinderConstants.SPACE + Mod.Name;
                                //  calcluation += " + " + Mod.Modifier.ToString();
                                mod += Mod.Modifier;
                            }
                        }
                    }
                }
            }

            return(mod);
        }
        public override List <OnGoingStatBlockModifier> GetRaceOnGoingModifiers()
        {
            List <OnGoingStatBlockModifier> mods = new List <OnGoingStatBlockModifier>();
            OnGoingStatBlockModifier        mod  = new OnGoingStatBlockModifier(0, OnGoingStatBlockModifier.StatBlockModifierTypes.SavingThrow, OnGoingStatBlockModifier.StatBlockModifierSubTypes.SavingThrow_Fort,
                                                                                "Halfling Fort", 1, string.Empty);

            mods.Add(mod);

            mod = new OnGoingStatBlockModifier(0, OnGoingStatBlockModifier.StatBlockModifierTypes.SavingThrow, OnGoingStatBlockModifier.StatBlockModifierSubTypes.SavingThrow_Ref,
                                               "Halfling Ref", 1, string.Empty);
            mods.Add(mod);

            mod = new OnGoingStatBlockModifier(0, OnGoingStatBlockModifier.StatBlockModifierTypes.SavingThrow, OnGoingStatBlockModifier.StatBlockModifierSubTypes.SavingThrow_Will,
                                               "Halfling Will", 1, string.Empty);
            mods.Add(mod);
            return(mods);
        }
Beispiel #3
0
        private void ComputeMagicItemResistance(Dictionary <string, int> MissingResistance)
        {
            foreach (MagicItemAbilitiesWrapper wrapper in _equipmentData.MagicItemAbilities)
            {
                if (wrapper != null)
                {
                    foreach (OnGoing.IOnGoing SBMods in wrapper.OnGoingStatBlockModifiers)
                    {
                        if (SBMods.OnGoingType == OnGoingType.StatBlock)
                        {
                            OnGoingStatBlockModifier Mod = (OnGoingStatBlockModifier)SBMods;
                            if (Mod.ModType == OnGoingStatBlockModifier.StatBlockModifierTypes.Resist)
                            {
                                string tempResist = null;


                                switch (Mod.SubType)
                                {
                                case OnGoingStatBlockModifier.StatBlockModifierSubTypes.Resist_Acid:
                                    tempResist = "acid";
                                    break;

                                case OnGoingStatBlockModifier.StatBlockModifierSubTypes.Resist_Cold:
                                    tempResist = "cold";
                                    break;

                                case OnGoingStatBlockModifier.StatBlockModifierSubTypes.Resist_Electricity:
                                    tempResist = "electricity";
                                    break;

                                case OnGoingStatBlockModifier.StatBlockModifierSubTypes.Resist_Fire:
                                    tempResist = "fire";
                                    break;

                                case OnGoingStatBlockModifier.StatBlockModifierSubTypes.Resist_Sonic:
                                    tempResist = "sonic";
                                    break;
                                }
                                CompareOneValues(new KeyValuePair <string, int>(tempResist, Mod.Modifier), MissingResistance);
                            }
                        }
                    }
                }
            }
        }
Beispiel #4
0
        //public static IndividualStatBlock_Combat GetByID(int ID)
        //{
        //    IndividualStatBlock SB = IndividualStatBlock_Select.GetByID(ID);
        //    Type type = SB.GetType();
        //    type = type.BaseType;
        //    type = type.BaseType;
        //    IndividualStatBlock_Combat SBC = new IndividualStatBlock_Combat();
        //    StatBlockGlobals.UpdateForType(type, SB, SBC);
        //    return SBC;
        //}

        public void AddOnGoingStatBlockMod(OnGoingStatBlockModifier SBM)
        {
            StatBlockGlobals.StatBlockModifierTotal temp;

            OnGoingStatBlockMods.Add(SBM);

            if (StatBlockModTotalList.ContainsKey(SBM.Name))
            {
                temp              = StatBlockModTotalList[SBM.Name];
                temp.Modifier     = temp.Modifier + SBM.Modifier;
                temp.ModifierList = temp.ModifierList + ", " + SBM.Modifier.ToString() + PathfinderConstants.SPACE + SBM.Name;
                StatBlockModTotalList[SBM.Name] = temp;
            }
            else //new
            {
                temp              = new StatBlockGlobals.StatBlockModifierTotal();
                temp.Modifier     = SBM.Modifier;
                temp.ModifierList = SBM.Modifier.ToString() + PathfinderConstants.SPACE + SBM.Name;
                StatBlockModTotalList[SBM.Name] = temp;
            }
        }
        public void ParseACMods()
        {
            Armor  armor;
            Weapon weapon;
            double Bonus;

            StatBlockInfo.ACMods acMods_Computed = new StatBlockInfo.ACMods();

            foreach (KeyValuePair <IEquipment, int> kvp in _equipmentData.Armor)
            {
                if (kvp.Key is Armor)
                {
                    armor = (Armor)kvp.Key;
                    if (armor.category == "shield")
                    {
                        if (armor.bonus.HasValue)
                        {
                            Bonus = Convert.ToInt32(armor.bonus);
                            if (armor.Broken)
                            {
                                Bonus = Math.Floor(Bonus / 2);
                            }
                            acMods_Computed.Shield += Convert.ToInt32(Bonus) + armor.EnhancementBonus;
                        }
                    }
                    if (armor.category.Contains("armor"))
                    {
                        if (armor.bonus.HasValue)
                        {
                            Bonus = Convert.ToInt32(armor.bonus);
                            if (armor.Broken)
                            {
                                Bonus = Math.Floor(Bonus / 2);
                            }
                            acMods_Computed.Armor += Convert.ToInt32(Bonus) + armor.EnhancementBonus;
                        }
                    }
                }
            }
            foreach (KeyValuePair <IEquipment, int> kvp in _equipmentData.Weapons)
            {
                weapon = (Weapon)kvp.Key;
                if ((weapon.WeaponSpecialAbilities.WeaponSpecialAbilitiesValue & WeaponSpecialAbilitiesEnum.Defending) == WeaponSpecialAbilitiesEnum.Defending)
                {
                    if (_sbCheckerBaseInput.MonsterSB.AC_Mods.Contains("defending"))
                    {
                        _acDefendingMod           += weapon.EnhancementBonus;
                        acMods_Computed.Defending += weapon.EnhancementBonus;
                    }
                }
            }


            if (_sbCheckerBaseInput.MonsterSBSearch.HasArchetype("free hand fighter")) //Elusive
            {
                int FighterLevel = _sbCheckerBaseInput.CharacterClasses.FindClassLevel("fighter");
                if (FighterLevel >= 3)
                {
                    acMods_Computed.Dodge++;
                }
                if (FighterLevel >= 7)
                {
                    acMods_Computed.Dodge++;
                }
                if (FighterLevel >= 11)
                {
                    acMods_Computed.Dodge++;
                }
                if (FighterLevel >= 15)
                {
                    acMods_Computed.Dodge++;
                }
                if (FighterLevel >= 19)
                {
                    acMods_Computed.Dodge++;
                }
            }

            if (_sbCheckerBaseInput.CharacterClasses.HasClass("monk"))
            {
                acMods_Computed.Wis += _abilityScores.WisMod;
                int MonkLevel = _sbCheckerBaseInput.CharacterClasses.FindClassLevel("monk");
                if (_sbCheckerBaseInput.MonsterSBSearch.HasGear("monk's robe"))
                {
                    MonkLevel += 5;
                }
                acMods_Computed.Monk += MonkLevel / 4;
            }
            else if (_sbCheckerBaseInput.MonsterSBSearch.HasGear("monk's robe"))
            {
                acMods_Computed.Monk += 1; //level 5 monk, no wis mod
            }

            if (_sbCheckerBaseInput.CharacterClasses.HasClass("psychic") && _sbCheckerBaseInput.MonsterSB.PsychicDiscipline == "self-perfection")
            {
                acMods_Computed.Wis += _abilityScores.WisMod;
            }

            if (_sbCheckerBaseInput.CharacterClasses.HasClass("sorcerer"))
            {
                if (_sbCheckerBaseInput.MonsterSBSearch.HasBloodline("serpentine"))
                {
                    int SorcererLevel = _sbCheckerBaseInput.CharacterClasses.FindClassLevel("sorcerer");
                    if (SorcererLevel >= 9)
                    {
                        acMods_Computed.Natural++;
                    }
                    if (SorcererLevel >= 13)
                    {
                        acMods_Computed.Natural++;
                    }
                    if (SorcererLevel >= 17)
                    {
                        acMods_Computed.Natural++;
                    }
                }
            }

            if (_sbCheckerBaseInput.CharacterClasses.HasClass("animal companion"))
            {
                int animalCompanionLevel = _sbCheckerBaseInput.CharacterClasses.FindClassLevel("animal companion");
                int animalCompanionMod   = StatBlockInfo.AnimalCompanionNaturalArmorBonus(animalCompanionLevel);

                acMods_Computed.Natural += animalCompanionMod;
            }

            if (_sbCheckerBaseInput.MonsterSBSearch.HasBloodline("aquatic"))
            {
                int bloodlineLevel = _sbCheckerBaseInput.CharacterClasses.FindClassLevel("sorcerer");
                if (bloodlineLevel >= 9)
                {
                    acMods_Computed.Natural++;
                }
            }

            if (_sbCheckerBaseInput.CharacterClasses.HasClass("dragon disciple"))
            {
                int dragonDiscipleLevel = _sbCheckerBaseInput.CharacterClasses.FindClassLevel("dragon disciple");
                if (dragonDiscipleLevel >= 1)
                {
                    acMods_Computed.Natural++;
                }
                if (dragonDiscipleLevel >= 3)
                {
                    acMods_Computed.Natural++;
                }
                if (dragonDiscipleLevel >= 7)
                {
                    acMods_Computed.Natural++;
                }
            }

            if (_sbCheckerBaseInput.CharacterClasses.HasClass("bloatmage"))
            {
                int BloatMageLevel = _sbCheckerBaseInput.CharacterClasses.FindClassLevel("bloatmage");
                if (BloatMageLevel >= 3)
                {
                    acMods_Computed.Natural++;
                }
                if (BloatMageLevel >= 7)
                {
                    acMods_Computed.Natural++;
                }
            }

            acMods_Computed.Dex = _armorClassData.MaxDexMod < _abilityScores.DexMod ? _armorClassData.MaxDexMod : _abilityScores.DexMod;

            if (_sbCheckerBaseInput.MonsterSB.DefensiveAbilities.Contains("incorporeal"))
            {
                int incorporealMod = _abilityScores.ChaMod <= 0 ? 1 : _abilityScores.ChaMod;
                acMods_Computed.Deflection += incorporealMod;
            }

            if (_sbCheckerBaseInput.MonsterSBSearch.HasFeat("Snapping Turtle Style"))
            {
                acMods_Computed.Shield++;
            }
            if (_sbCheckerBaseInput.MonsterSBSearch.HasFeat("Dodge"))
            {
                acMods_Computed.Dodge++;
                if (_sbCheckerBaseInput.MonsterSBSearch.HasMythicFeat("Dodge"))
                {
                    acMods_Computed.Dodge++;
                }
            }
            if (_sbCheckerBaseInput.MonsterSBSearch.HasFeat("Shield Focus"))
            {
                acMods_Computed.Shield++;
            }
            if (_sbCheckerBaseInput.MonsterSBSearch.HasFeat("Greater Shield Focus"))
            {
                acMods_Computed.Shield++;
            }
            if (_sbCheckerBaseInput.MonsterSBSearch.HasFeat("Two-Weapon Defense"))
            {
                acMods_Computed.Shield++;
            }
            if (_sbCheckerBaseInput.MonsterSBSearch.HasFeat("Improved Natural Armor"))
            {
                acMods_Computed.Natural++;
            }

            //if (_sbCheckerBaseInput.MonsterSBSearch.HasFeat("Combat Expertise"))
            //{
            //    acMods_Computed.Dodge++;
            //    acMods_Computed.Dodge += int.Parse(_sbCheckerBaseInput.MonsterSB.BaseAtk) / 4;
            //}


            if (_sbCheckerBaseInput.MonsterSB.Class.Contains("barbarian"))
            {
                acMods_Computed.Rage = -2;
                //ranged AC mod only
                //if (_sbCheckerBaseInput.MonsterSBSearch.HasSpecialAttackGeneral("rolling dodge"))
                //{
                //    int BarbarianLevel = _sbCheckerBaseInput.CharacterClasses.FindClassLevel("barbarian");
                //    if (BarbarianLevel >= 6) acMods_Computed.Dodge++;
                //    if (BarbarianLevel >= 12) acMods_Computed.Dodge++;
                //    if (BarbarianLevel >= 18) acMods_Computed.Dodge++;
                //}
            }

            if (_sbCheckerBaseInput.MonsterSB.Class.Contains("bloodrager"))
            {
                acMods_Computed.BloodRage = -2;
            }

            if (_sbCheckerBaseInput.MonsterSBSearch.HasClassArchetype("savage barbarian"))
            {
                int BarbarianLevel = _sbCheckerBaseInput.CharacterClasses.FindClassLevel("barbarian");
                //Naked Courage (Ex)
                if (BarbarianLevel >= 3)
                {
                    acMods_Computed.Natural++;
                }
                if (BarbarianLevel >= 9)
                {
                    acMods_Computed.Natural++;
                }
                if (BarbarianLevel >= 15)
                {
                    acMods_Computed.Natural++;
                }

                //Natural Toughness (Ex)
                if (BarbarianLevel >= 7)
                {
                    acMods_Computed.Natural++;
                }
                if (BarbarianLevel >= 10)
                {
                    acMods_Computed.Natural++;
                }
                if (BarbarianLevel >= 13)
                {
                    acMods_Computed.Natural++;
                }
                if (BarbarianLevel >= 16)
                {
                    acMods_Computed.Natural++;
                }
                if (BarbarianLevel >= 19)
                {
                    acMods_Computed.Natural++;
                }
            }

            if (_sbCheckerBaseInput.MonsterSBSearch.HasSQ("mutagen"))
            {
                acMods_Computed.Natural += 2;
                if (_sbCheckerBaseInput.MonsterSBSearch.HasSQ("greater mutagen"))
                {
                    acMods_Computed.Natural += 2;
                    if (_sbCheckerBaseInput.MonsterSBSearch.HasSQ("grand mutagen"))
                    {
                        acMods_Computed.Natural += 2;
                    }
                }
            }

            if (_sbCheckerBaseInput.MonsterSBSearch.HasSQ("otherworldly insight"))
            {
                acMods_Computed.Insight += 10;
            }

            if (_sbCheckerBaseInput.MonsterSBSearch.HasMystery("bones"))
            {
                int oracleLevel = _sbCheckerBaseInput.CharacterClasses.FindClassLevel("oracle");
                acMods_Computed.Armor += 4;
                if (oracleLevel >= 7)
                {
                    acMods_Computed.Armor += 2;
                }
                if (oracleLevel >= 11)
                {
                    acMods_Computed.Armor += 2;
                }
                if (oracleLevel >= 15)
                {
                    acMods_Computed.Armor += 2;
                }
                if (oracleLevel >= 19)
                {
                    acMods_Computed.Armor += 2;
                }
            }

            if (_sbCheckerBaseInput.IndvSB != null)
            {
                acMods_Computed.Shield      += _sbCheckerBaseInput.IndvSB.GetOnGoingStatBlockModValue(OnGoingStatBlockModifier.StatBlockModifierTypes.AC, OnGoingStatBlockModifier.StatBlockModifierSubTypes.AC_Shield);
                acMods_Computed.Armor       += _sbCheckerBaseInput.IndvSB.GetOnGoingStatBlockModValue(OnGoingStatBlockModifier.StatBlockModifierTypes.AC, OnGoingStatBlockModifier.StatBlockModifierSubTypes.AC_Armor);
                acMods_Computed.Deflection  += _sbCheckerBaseInput.IndvSB.GetOnGoingStatBlockModValueStackable(OnGoingStatBlockModifier.StatBlockModifierTypes.AC, OnGoingStatBlockModifier.StatBlockModifierSubTypes.AC_Deflection, true);
                acMods_Computed.Dodge       += _sbCheckerBaseInput.IndvSB.GetOnGoingStatBlockModValue(OnGoingStatBlockModifier.StatBlockModifierTypes.AC, OnGoingStatBlockModifier.StatBlockModifierSubTypes.AC_Dodge);
                acMods_Computed.Natural     += _sbCheckerBaseInput.IndvSB.GetOnGoingStatBlockModValue(OnGoingStatBlockModifier.StatBlockModifierTypes.AC, OnGoingStatBlockModifier.StatBlockModifierSubTypes.AC_Natural);
                acMods_Computed.Enhancement += _sbCheckerBaseInput.IndvSB.GetOnGoingStatBlockModValue(OnGoingStatBlockModifier.StatBlockModifierTypes.AC, OnGoingStatBlockModifier.StatBlockModifierSubTypes.AC_Enhancement);
                acMods_Computed.Insight     += _sbCheckerBaseInput.IndvSB.GetOnGoingStatBlockModValue(OnGoingStatBlockModifier.StatBlockModifierTypes.AC, OnGoingStatBlockModifier.StatBlockModifierSubTypes.AC_Insight);
            }

            //if (_sbCheckerBaseInput.MonsterSB.DefensiveAbilities.Contains("uncanny dodge"))
            //{
            //  //  acMods_Computed.Dodge++;
            //}

            if (_sbCheckerBaseInput.MonsterSBSearch.Race() == "kasatha")
            {
                acMods_Computed.Dodge += 2;
            }

            try
            {
                acMods_Computed.Natural += _sbCheckerBaseInput.Race_Base.RaceNaturalArmor();
            }
            catch (Exception ex)
            {
                _sbCheckerBaseInput.MessageXML.AddFail("Race_Base.RaceNaturalArmor", ex.Message);
            }
            acMods_Computed.Size = _sizeMod;

            foreach (MagicItemAbilitiesWrapper wrapper in _equipmentData.MagicItemAbilities)
            {
                if (wrapper != null)
                {
                    foreach (OnGoing.IOnGoing SBMods in wrapper.OnGoingStatBlockModifiers)
                    {
                        if (SBMods.OnGoingType == OnGoingType.StatBlock)
                        {
                            OnGoingStatBlockModifier Mod = (OnGoingStatBlockModifier)SBMods;
                            if (Mod.ModType == OnGoingStatBlockModifier.StatBlockModifierTypes.AC)
                            {
                                acMods_Computed.AddModEffect(Mod);
                            }
                        }
                    }
                }
            }


            _armorClassData.ACMods_Computed = acMods_Computed;
        }
        public void GetOnGoingAttackMods(ref int weaponBonusComputed, ref string formula, bool MagicWeapon, bool GreaterMagicWeapon, out bool ignoreEnhancement)
        {
            ignoreEnhancement = false;
            List <OnGoingStatBlockModifier> Mods = _sbCheckerBaseInput.IndvSB.GetOnGoingStatBlockMods();

            foreach (OnGoingStatBlockModifier mod in Mods)
            {
                if (mod.ModType == OnGoingStatBlockModifier.StatBlockModifierTypes.Attack)
                {
                    if (mod.Name.Contains(GREATER_MAGIC_WEAPON) && GreaterMagicWeapon)
                    {
                        ignoreEnhancement = true;
                    }
                    if (mod.Name.Contains(MAGIC_WEAPON) && MagicWeapon && !mod.Name.Contains(GREATER_MAGIC_WEAPON))
                    {
                        ignoreEnhancement = true;
                    }
                    bool ignore = false;
                    if (mod.Name.Contains(GREATER_MAGIC_WEAPON) && !GreaterMagicWeapon)
                    {
                        ignore = true;
                    }
                    else if (mod.Name.Contains(MAGIC_WEAPON) && !MagicWeapon && !mod.Name.Contains(GREATER_MAGIC_WEAPON))
                    {
                        ignore = true;
                    }

                    if (!ignore)
                    {
                        weaponBonusComputed += mod.Modifier;
                        formula             += " +" + mod.Modifier.ToString() + PathfinderConstants.SPACE + mod.Name;
                    }
                }
            }

            List <MagicItemAbilitiesWrapper> magicItemAbilities = _sbCheckerBaseInput.IndvSB.GetMagicItemAbilities();

            foreach (MagicItemAbilitiesWrapper ability in magicItemAbilities)
            {
                List <IOnGoing> abilityMods = ability.OnGoingStatBlockModifiers;
                foreach (IOnGoing mod in abilityMods)
                {
                    if (mod.OnGoingType == OnGoingType.StatBlock)
                    {
                        OnGoingStatBlockModifier Mod = (OnGoingStatBlockModifier)mod;
                        if (Mod.ModType == OnGoingStatBlockModifier.StatBlockModifierTypes.Attack)
                        {
                            if (Mod.Name.Contains(GREATER_MAGIC_WEAPON) && GreaterMagicWeapon)
                            {
                                ignoreEnhancement = true;
                            }
                            if (Mod.Name.Contains(MAGIC_WEAPON) && MagicWeapon && !Mod.Name.Contains(GREATER_MAGIC_WEAPON))
                            {
                                ignoreEnhancement = true;
                            }

                            bool ignore = false;
                            if (Mod.Name.Contains(GREATER_MAGIC_WEAPON) && GreaterMagicWeapon)
                            {
                                ignore = true;
                            }
                            else if (Mod.Name.Contains(MAGIC_WEAPON) && MagicWeapon)
                            {
                                ignore = true;
                            }

                            if (!ignore)
                            {
                                weaponBonusComputed += Mod.Modifier;
                                formula             += " +" + Mod.Modifier.ToString() + PathfinderConstants.SPACE + Mod.Name;
                            }
                        }
                    }
                }
            }
        }