Beispiel #1
0
            private static void AddQuiver(BlueprintActivatableAbility ability, BlueprintBuff buff, string guid, PhysicalDamageMaterial material)
            {
#if PATCH21_BETA
                var component = SerializedScriptableObject.CreateInstance <AddOutgoingPhysicalDamageProperty>();
#else
                var component = ScriptableObject.CreateInstance <AddOutgoingPhysicalDamageProperty>();
#endif
                component.AddMaterial = true;
                component.Material    = material;

#if PATCH21_BETA
                var quiverBuff = (BlueprintBuff)SerializedScriptableObject.Instantiate(buff);
#else
                var quiverBuff = Object.Instantiate(buff);
#endif
                quiverBuff.ComponentsArray = new BlueprintComponent[] { component };
                Main.Accessors.SetBlueprintUnitFactDisplayName(quiverBuff) = new L10NString($"craftMagicItems-mundane-{material.ToString().ToLower()}-quiver-name");
                Main.Accessors.SetBlueprintUnitFactDescription(quiverBuff) = new L10NString($"craftMagicItems-mundane-{material.ToString().ToLower()}-quiver-description");
#if PATCH21_BETA
                quiverBuff.OnEnable();
                foreach (var c in quiverBuff.ComponentsArray)
                {
                    c.OnEnable();
                }
#endif

                var buffGuid = $"{guid}#CraftMagicItems({material.ToString()}QuiverBuff)";

                Main.Accessors.SetBlueprintScriptableObjectAssetGuid(quiverBuff) = buffGuid;
                ResourcesLibrary.LibraryObject.BlueprintsByAssetId?.Add(buffGuid, quiverBuff);
                ResourcesLibrary.LibraryObject.GetAllBlueprints()?.Add(quiverBuff);

#if PATCH21_BETA
                var quiverAbility = (BlueprintActivatableAbility)SerializedScriptableObject.Instantiate(ability);
#else
                var quiverAbility = Object.Instantiate(ability);
#endif
                quiverAbility.Buff = quiverBuff;
                Main.Accessors.SetBlueprintUnitFactDisplayName(quiverAbility) = new L10NString($"craftMagicItems-mundane-{material.ToString().ToLower()}-quiver-name");
                Main.Accessors.SetBlueprintUnitFactDescription(quiverAbility) = new L10NString($"craftMagicItems-mundane-{material.ToString().ToLower()}-quiver-description");
#if PATCH21_BETA
                quiverBuff.OnEnable();
                foreach (var c in quiverAbility.ComponentsArray)
                {
                    c.OnEnable();
                }
#endif

                var abilityGuid = $"{guid}#CraftMagicItems({material.ToString()}QuiverAbility)";

                Main.Accessors.SetBlueprintScriptableObjectAssetGuid(quiverAbility) = abilityGuid;
                ResourcesLibrary.LibraryObject.BlueprintsByAssetId?.Add(abilityGuid, quiverAbility);
                ResourcesLibrary.LibraryObject.GetAllBlueprints()?.Add(quiverAbility);
            }
 public static T Create <T>(Action <T> init = null) where T : SerializedScriptableObject, new()
 {
     var result = SerializedScriptableObject.CreateInstance <T>();