コード例 #1
0
        public static void createWeaponTypes()
        {
            var dagger              = library.Get <BlueprintWeaponType>("07cc1a7fceaee5b42b3e43da960fe76d");
            var starknife           = library.Get <BlueprintWeaponType>("5a939137fc039084580725b2b0845c3f");
            var all_throwable_types = new BlueprintWeaponType[] { dagger, starknife };
            var strength_thrown     = library.Get <BlueprintWeaponEnchantment>("c4d213911e9616949937e1520c80aaf3");

            thrown_type_blueprints = new Dictionary <WeaponCategory, BlueprintWeaponType>();
            var seed_guid = "a8bb69f6793a40f68fe34125f44c7684";

            foreach (var type in all_throwable_types)
            {
                var thrown_type = library.CopyAndAdd <BlueprintWeaponType>(type, "Thrown" + type.name, Helpers.MergeIds(type.AssetGuid, seed_guid));

                Helpers.SetField(thrown_type, "m_TypeNameText", Helpers.CreateString(thrown_type.name + "TypeName", thrown_type.TypeName + " (Thrown)"));
                Helpers.SetField(thrown_type, "m_DefaultNameText", Helpers.CreateString(thrown_type.name + "DefaultName", thrown_type.DefaultName + " (Thrown)"));
                Helpers.SetField(thrown_type, "m_AttackType", AttackType.Ranged);
                Helpers.SetField(thrown_type, "m_AttackRange", FeetExtension.Feet(20.0f));

                WeaponVisualParameters new_wp = thrown_type.VisualParameters.CloneObject();
                Helpers.SetField(new_wp, "m_Projectiles", new BlueprintProjectile[] { thrown_weapon_proj });
                if (thrown_type.Category == WeaponCategory.Dagger)
                {
                    Helpers.SetField(new_wp, "m_WeaponAnimationStyle", WeaponAnimationStyle.ThrownStraight);
                }

                Helpers.SetField(thrown_type, "m_VisualParameters", new_wp);

                thrown_type_blueprints.Add(thrown_type.Category, thrown_type);

                var thrown_type_enchantments = Helpers.GetField <BlueprintWeaponEnchantment[]>(thrown_type, "m_Enchantments").AddToArray(strength_thrown);
                Helpers.SetField(thrown_type, "m_Enchantments", thrown_type_enchantments);
            }
        }
コード例 #2
0
        static void fixMartialExoticWeapons()
        {
            var bastard_sword_type = library.Get <BlueprintWeaponType>("d2fe2c5516b56f04da1d5ea51ae3ddfe");

            Helpers.SetField(bastard_sword_type, "m_IsTwoHanded", true);
            WeaponVisualParameters bs_visuals = Helpers.GetField <WeaponVisualParameters>(bastard_sword_type, "m_VisualParameters");

            Helpers.SetField(bs_visuals, "m_WeaponAnimationStyle", WeaponAnimationStyle.SlashingTwoHanded);
            fixFullWeaponCategory(WeaponCategory.BastardSword, WeaponCategory.Greatsword,
                                  Helpers.Create <HoldingItemsMechanics.CanHoldIn1Hand>(c =>
            {
                c.category = WeaponCategory.BastardSword;
                c.require_full_proficiency = true;
                c.except_types             = new BlueprintWeaponType[]
                {
                    library.Get <BlueprintWeaponType>("1e460a2dc830cf546939b2723aa875e7"),                    //oversized bastard sword
                    library.Get <BlueprintWeaponType>("58dcff8d1dd5d094eb345e8eeb2e4626"),                    //oversized bastard sword no penalty
                };
            }));

            var dwarven_waraxe_type = library.Get <BlueprintWeaponType>("a6925f5f897801449a648d865637e5a0");

            Helpers.SetField(dwarven_waraxe_type, "m_IsTwoHanded", true);
            WeaponVisualParameters dw_visuals = Helpers.GetField <WeaponVisualParameters>(dwarven_waraxe_type, "m_VisualParameters");

            Helpers.SetField(dw_visuals, "m_WeaponAnimationStyle", WeaponAnimationStyle.SlashingTwoHanded);
            fixFullWeaponCategory(WeaponCategory.DwarvenWaraxe, WeaponCategory.Battleaxe,
                                  Helpers.Create <HoldingItemsMechanics.CanHoldIn1Hand>(c => { c.category = WeaponCategory.DwarvenWaraxe; c.require_full_proficiency = true; }));



            var bastard_sword_proficiency = library.Get <BlueprintFeature>("57299a78b2256604dadf1ab9a42e2873");

            bastard_sword_proficiency.SetDescription(bastard_sword_proficiency.Description + "\nA character can use a bastard sword two-handed as a martial weapon, without exotic weapon proficiency.");

            var dwarven_waraxe_proficiency = library.Get <BlueprintFeature>("bd0d7feca087d2247b12965c1467790c");

            dwarven_waraxe_proficiency.SetDescription(dwarven_waraxe_proficiency.Description + "\nA character can use a swarven waraxe two-handed as a martial weapon, without exotic weapon proficiency.");

            var duelling_sword_proficiency = library.Get <BlueprintFeature>("9c37279588fd9e34e9c4cb234857492c");

            fixFullWeaponCategory(WeaponCategory.DuelingSword, WeaponCategory.Longsword,
                                  Helpers.Create <NewMechanics.ConsiderAsFinessable>(c => c.category = WeaponCategory.DuelingSword));
            duelling_sword_proficiency.SetDescription(duelling_sword_proficiency.Description + "\nAn dueling sword can be used as a martial weapon (in which case it functions as a longsword), but if you have the feat Exotic Weapon Proficiency (dueling sword), you can use the Weapon Finesse feat to apply your Dexterity modifier instead of your Strength modifier to attack rolls with a dueling sword sized for you, even though it isn’t a light weapon.");

            //remove duelling sword from list of finessable weapons
            var info = typeof(WeaponCategoryExtension).GetField("Data", BindingFlags.NonPublic | BindingFlags.Static);
            var data = (Array)info.GetValue(null);

            foreach (var dd in data)
            {
                var category = Helpers.GetField <WeaponCategory>(dd, "Category");
                if (category == WeaponCategory.DuelingSword)
                {
                    var subcategories = Helpers.GetField <WeaponSubCategory[]>(dd, "SubCategories");
                    subcategories = subcategories.RemoveFromArray(WeaponSubCategory.Finessable);
                    Helpers.SetField(dd, "SubCategories", subcategories);
                    break;
                }
            }
        }
コード例 #3
0
        static void fixMartialExoticWeapons()
        {
            var oversized_bastard_sword_types = new BlueprintWeaponType[]
            {
                library.Get <BlueprintWeaponType>("1e460a2dc830cf546939b2723aa875e7"),                                //oversized bastard sword
                library.Get <BlueprintWeaponType>("58dcff8d1dd5d094eb345e8eeb2e4626"),                                //oversized bastard sword no penalty
            };
            var bastard_sword_type = library.Get <BlueprintWeaponType>("d2fe2c5516b56f04da1d5ea51ae3ddfe");

            Helpers.SetField(bastard_sword_type, "m_IsTwoHanded", true);
            WeaponVisualParameters bs_visuals = Helpers.GetField <WeaponVisualParameters>(bastard_sword_type, "m_VisualParameters");

            Helpers.SetField(bs_visuals, "m_WeaponAnimationStyle", WeaponAnimationStyle.SlashingTwoHanded);
            fixFullWeaponCategory(WeaponCategory.BastardSword, WeaponCategory.Greatsword,
                                  Helpers.Create <HoldingItemsMechanics.CanHoldIn1Hand>(c =>
            {
                c.category = WeaponCategory.BastardSword;
                c.require_full_proficiency = true;
                c.except_types             = oversized_bastard_sword_types;
            }));

            var dwarven_waraxe_type = library.Get <BlueprintWeaponType>("a6925f5f897801449a648d865637e5a0");

            Helpers.SetField(dwarven_waraxe_type, "m_IsTwoHanded", true);
            WeaponVisualParameters dw_visuals = Helpers.GetField <WeaponVisualParameters>(dwarven_waraxe_type, "m_VisualParameters");

            Helpers.SetField(dw_visuals, "m_WeaponAnimationStyle", WeaponAnimationStyle.SlashingTwoHanded);
            fixFullWeaponCategory(WeaponCategory.DwarvenWaraxe, WeaponCategory.Battleaxe,
                                  Helpers.Create <HoldingItemsMechanics.CanHoldIn1Hand>(c => { c.category = WeaponCategory.DwarvenWaraxe; c.require_full_proficiency = true; }));



            var bastard_sword_proficiency = library.Get <BlueprintFeature>("57299a78b2256604dadf1ab9a42e2873");

            bastard_sword_proficiency.SetDescription(bastard_sword_proficiency.Description + "\nA character can use a bastard sword two-handed as a martial weapon, without exotic weapon proficiency.");

            var dwarven_waraxe_proficiency = library.Get <BlueprintFeature>("bd0d7feca087d2247b12965c1467790c");

            dwarven_waraxe_proficiency.SetDescription(dwarven_waraxe_proficiency.Description + "\nA character can use a dwarven waraxe two-handed as a martial weapon, without exotic weapon proficiency.");

            var duelling_sword_proficiency = library.Get <BlueprintFeature>("9c37279588fd9e34e9c4cb234857492c");

            fixFullWeaponCategory(WeaponCategory.DuelingSword, WeaponCategory.Longsword,
                                  Helpers.Create <NewMechanics.ConsiderAsFinessable>(c => c.category = WeaponCategory.DuelingSword));
            duelling_sword_proficiency.SetDescription(duelling_sword_proficiency.Description + "\nA dueling sword can be used as a martial weapon (in which case it functions as a longsword), but if you have the feat Exotic Weapon Proficiency (dueling sword), you can use the Weapon Finesse feat to apply your Dexterity modifier instead of your Strength modifier to attack rolls with a dueling sword sized for you, even though it isn’t a light weapon.");

            var estoc_type = library.Get <BlueprintWeaponType>("d516765b3c2904e4a939749526a52a9a");

            Helpers.SetField(estoc_type, "m_IsTwoHanded", true);

            var estoc_proficiency = library.Get <BlueprintFeature>("9dc64f0b9161a354c9471a631318e16c");

            fixFullWeaponCategory(WeaponCategory.Estoc, WeaponCategory.Greatsword,
                                  Helpers.Create <HoldingItemsMechanics.CanHoldIn1Hand>(c => { c.category = WeaponCategory.Estoc; c.require_full_proficiency = true; }),
                                  Helpers.Create <NewMechanics.ConsiderAsFinessable>(c => c.category = WeaponCategory.Estoc));
            estoc_proficiency.SetDescription(estoc_proficiency.Description + "\nLike the bastard sword, an estoc requires special training to use it one handed, but it can also be wielded as a two-handed martial weapon.\nWhen you wield an estoc with one hand, treat it as a one-handed weapon; when you wield an estoc with two hands, treat it as a two-handed weapon. If you can use the estoc proficiently with one hand, you can also use the Weapon Finesse feat to apply your Dexterity modifier instead of your Strength modifier on attack rolls when wielding an estoc sized for you with one or two hands, even though it isn’t a light weapon.");

            //remove duelling sword and estoc from list of finessable weapons
            var info = typeof(WeaponCategoryExtension).GetField("Data", BindingFlags.NonPublic | BindingFlags.Static);
            var data = (Array)info.GetValue(null);

            foreach (var dd in data)
            {
                var category = Helpers.GetField <WeaponCategory>(dd, "Category");
                if (category == WeaponCategory.DuelingSword || category == WeaponCategory.Estoc)
                {
                    var subcategories = Helpers.GetField <WeaponSubCategory[]>(dd, "SubCategories");
                    subcategories = subcategories.RemoveFromArray(WeaponSubCategory.Finessable);
                    Helpers.SetField(dd, "SubCategories", subcategories);
                    break;
                }
            }

            //fix kensai choosen weapon to give proficiency
            var kensai_choosen_weapon = library.Get <BlueprintParametrizedFeature>("c0b4ec0175e3ff940a45fc21f318a39a");

            kensai_choosen_weapon.AddComponent(Helpers.Create <AddFullWeaponProficiencyWeaponCategory>());
            AddFullWeaponProficiencyWeaponCategory.category_feature_map = new Dictionary <WeaponCategory, BlueprintFeature>()
            {
                { WeaponCategory.BastardSword, library.Get <BlueprintFeature>("57299a78b2256604dadf1ab9a42e2873") },
                { WeaponCategory.DwarvenWaraxe, library.Get <BlueprintFeature>("bd0d7feca087d2247b12965c1467790c") },
                { WeaponCategory.DuelingSword, library.Get <BlueprintFeature>("9c37279588fd9e34e9c4cb234857492c") },
                { WeaponCategory.Estoc, library.Get <BlueprintFeature>("9dc64f0b9161a354c9471a631318e16c") }
            };


            //fix units
            var hendrick_bandit = library.Get <BlueprintUnit>("5d7122078d52ec34aa5cc34df345ed51");

            hendrick_bandit.Body.PrimaryHand = library.Get <BlueprintItemWeapon>("0ce4b3f4a3d70fa45851313a7f3d233f"); //battle axe +1 instead of bastard sword +1 since he does not have proficiency

            //fix all oversized bastard swords to require exotic weapon proficiency
            var oversized_bastard_swords = library.GetAllBlueprints().OfType <BlueprintItemWeapon>().Where(w => oversized_bastard_sword_types.Contains(w.Type)).ToArray();

            foreach (var obs in oversized_bastard_swords)
            {
                obs.AddComponent(Helpers.Create <NewMechanics.EquipmentRestrictionFeature>(e => e.feature = bastard_sword_proficiency));
            }
        }