Пример #1
0
        static internal void FixPrestigeSpellbookSelection(string prestigeSpellbookSelectionId, string prestigeSpellbookSelectionWizardItemId, FeatureGroup group)
        {
            BlueprintFeatureSelection spellbookSelection = library.Get <BlueprintFeatureSelection>(prestigeSpellbookSelectionId);

            if (spellbookSelection == null)
            {
                string errorMsg = $"Error, Prestige Spellbook Selection {prestigeSpellbookSelectionId} not exist!";
                logger.Error(errorMsg);
                throw new Exception(errorMsg);
            }

            var wizardFeature = spellbookSelection.AllFeatures.Cast <BlueprintFeatureReplaceSpellbook>()
                                .First(f => f.AssetGuid == prestigeSpellbookSelectionWizardItemId);

            // Create a new feature for this archetype's spellbook
            string arcanistFeatureName = $"ArcanistClass{group.ToString()}ChosenItem";
            var    arcanistFeature     = library.CopyAndAdd <BlueprintFeatureReplaceSpellbook>(
                wizardFeature, arcanistFeatureName, OtherUtils.GetMd5(arcanistFeatureName));

            arcanistFeature.Spellbook = arcanist.Spellbook;
            arcanistFeature.SetName(arcanist.Name);

            var classSpellPreqComp = wizardFeature.GetComponent <PrerequisiteClassSpellLevel>();

            if (classSpellPreqComp == null)
            {
                classSpellPreqComp = Helpers.Create <PrerequisiteClassSpellLevel>(a => {
                    a.CharacterClass     = arcanist;
                    a.RequiredSpellLevel = 1;
                });
            }
            else
            {
                classSpellPreqComp = UnityEngine.Object.Instantiate(classSpellPreqComp);
                classSpellPreqComp.CharacterClass = arcanist;
            }
            // Update the prerequisites.
            arcanistFeature.SetComponents(new BlueprintComponent[] { classSpellPreqComp });

            // Add to the list of all features for this selector.
            var allFeatures = spellbookSelection.AllFeatures.ToList();

            allFeatures.Add(arcanistFeature);
            spellbookSelection.AllFeatures = allFeatures.ToArray();
        }
        static void FixSpellbookSelection(BlueprintArchetype archetype, String spellSelectionId, String sorcererSelectionId, FeatureGroup group)
        {
            var spellSelection = (BlueprintFeatureSelection)library.BlueprintsByAssetId[spellSelectionId];

            var sorcererClass   = archetype.GetParentClass();
            var sorcererFeature = spellSelection.AllFeatures.Cast <BlueprintFeatureReplaceSpellbook>()
                                  .First(f => f.AssetGuid == sorcererSelectionId);

            // Restrict sorcerer feat so it can't be selected with this archetype
            var sorcererPrereqs = sorcererFeature.ComponentsArray.ToList();

            sorcererPrereqs.Add(Helpers.Create <PrerequisiteNoArchetype>(p => { p.CharacterClass = sorcererClass; p.Archetype = archetype; }));
            sorcererFeature.SetComponents(sorcererPrereqs);

            // Create a new feature for this archetype's spellbook
            var spellbookFeature = library.CopyAndAdd(sorcererFeature, group.ToString().Replace("Spellbook", archetype.name),
                                                      sorcererFeature.AssetGuid, "7d400c2c080947ecb0a1052b453bc107");

            spellbookFeature.Spellbook = archetype.ReplaceSpellbook;
            spellbookFeature.SetName(archetype.LocalizedName);

            // Update the prerequisites.
            spellbookFeature.SetComponents(
                Helpers.Create <PrerequisiteArchetypeLevel>(p =>
            {
                p.CharacterClass = sorcererClass;
                p.Archetype      = archetype;
            }),
                Helpers.Create <PrerequisiteClassSpellLevel>(p =>
            {
                p.CharacterClass     = sorcererClass;
                p.RequiredSpellLevel = 1;
            }));

            // Add to the list of all features for this selector.
            var allFeatures = spellSelection.AllFeatures.ToList();

            allFeatures.Add(spellbookFeature);
            spellSelection.AllFeatures = allFeatures.ToArray();
        }
        public override string GetUIText()
        {
            string group_string = string.Concat(group.ToString().Select(x => Char.IsUpper(x) ? " " + char.ToLower(x) : x.ToString()));

            return("One" + group_string);
        }