static BlueprintFeature CreateBloodlinePower(BlueprintProgression bloodline, int level, BlueprintProgression crossbloodline)
        {
            var power   = EldritchHeritage.GetBloodlinePower(bloodline, level);
            var entries = EldritchHeritage.CollectLevelEntries(level, power, bloodline);

            if (entries.Count == 1)
            {
                return(CreateCrossbloodedFeature(entries[0].Item2, crossbloodline));
            }

            var name = power.name;

            if (name.EndsWith("1"))
            {
                name = name.Substring(0, power.name.Length - 1);
            }

            var feature = Helpers.CreateFeature($"{name}Cross", power.Name, power.Description,
                                                Helpers.MergeIds(power.AssetGuid, "3b983f0653914618844275e20d9fe561"),
                                                power.Icon, FeatureGroup.None);

            var components = new List <BlueprintComponent> {
                crossbloodline.PrerequisiteFeature()
            };

            for (int i = 0; i < entries.Count; i++)
            {
                var e = entries[i];
                components.Add(AddFactOnBloodlineLevel.Create(e.Item2, $"${i}", e.Item1));
            }
            feature.SetComponents(components);
            return(feature);
        }
Exemple #2
0
        static BlueprintFeature CreateHeritageFeat(
            BlueprintProgression bloodline, BlueprintFeature power, int powerLevel,
            String name, String displayName, Sprite icon, String assetId,
            List <BlueprintComponent> components)
        {
            var entries     = CollectLevelEntries(powerLevel, power, bloodline);
            var description = bloodline.Description + $"\n{power.Description}";

            if (entries.Count == 1)
            {
                var feat = library.CopyAndAdd(power, name, assetId);
                feat.Groups = new FeatureGroup[] { FeatureGroup.Feat };
                feat.SetNameDescriptionIcon(displayName, description, icon);
                if (feat is BlueprintFeatureSelection)
                {
                    feat.AddComponents(components);
                }
                else
                {
                    components.Add(feat.CreateAddFact());
                    feat.SetComponents(components);
                }
                return(feat);
            }
            else
            {
                var feat = Helpers.CreateFeature(name, displayName, description, assetId, icon, FeatureGroup.Feat);
                for (int i = 0; i < entries.Count; i++)
                {
                    var e = entries[i];
                    components.Add(AddFactOnBloodlineLevel.Create(e.Item2, $"${i}", e.Item1));
                }
                feat.SetComponents(components);
                return(feat);
            }
        }