コード例 #1
0
        static void createElementalFocus()
        {
            var kineticist               = library.Get <BlueprintCharacterClass>("42a455d9ec1ad924d889272429eb8391");
            var elemental_foci           = new List <BlueprintFeature>();
            var elemental_focus_standard = library.Get <BlueprintFeatureSelection>("1f3a15a3ae8a5524ab8b97f469bf4e3d");

            foreach (var efs in elemental_focus_standard.AllFeatures)
            {
                var progression = efs as BlueprintProgression;

                var focus = Helpers.CreateProgression("ElementalAscetic" + progression.name,
                                                      progression.Name,
                                                      progression.Description,
                                                      "",
                                                      progression.Icon,
                                                      progression.Groups[0]);
                focus.LevelEntries = new LevelEntry[] { progression.LevelEntries[0] };
                elemental_foci.Add(focus);
                efs.AddComponent(Helpers.Create <NewMechanics.FeatureReplacement>(f => f.replacement_feature = focus)); //to work correctly with 2nd, 3rd element
            }

            elemental_focus = library.CopyAndAdd(elemental_focus_standard, "ElementalAscetic" + elemental_focus_standard.name, "");

            elemental_focus.AllFeatures = elemental_foci.ToArray();
            elemental_focus.RemoveComponents <NewMechanics.FeatureReplacement>();
            elemental_focus_standard.AddComponent(Helpers.Create <NewMechanics.FeatureReplacement>(f => f.replacement_feature = elemental_focus));

            //we need to hide all basic base blasts from elemental ascetic
            var kientic_blade_infusion = library.Get <BlueprintFeature>("9ff81732daddb174aa8138ad1297c787");

            foreach (var c in kientic_blade_infusion.GetComponents <AddFeatureIfHasFact>())
            {
                var blast_base = c.CheckedFact as BlueprintAbility;

                var standard_blast = blast_base.Variants[0];
                standard_blast.AddComponent(Helpers.Create <NewMechanics.AbilityShowIfCasterHasNoFact>(s => s.UnitFact = elemental_focus));
            }

            //done after havocker, so should no longer have AbilityShowIfCasterHasFact but only AbilityShowIfCasterHasFactsFromList
            var abilities = library.GetAllBlueprints().OfType <BlueprintAbility>().Where(a =>
            {
                var comp = a.GetComponent <NewMechanics.AbilityShowIfCasterHasFactsFromList>();
                return(comp != null && comp.UnitFacts.Contains(elemental_focus_standard));
            }
                                                                                         );

            foreach (var a in abilities)
            {
                var comp = a.GetComponent <NewMechanics.AbilityShowIfCasterHasFactsFromList>();
                comp.UnitFacts = comp.UnitFacts.AddToArray(elemental_focus);
            }
        }