Пример #1
0
        /// <summary>
        /// Builds the RoomModifierData represented by this builders's parameters recursively;
        /// </summary>
        /// <returns>The newly created RoomModifierData</returns>
        public RoomModifierData Build()
        {
            RoomModifierData roomModifierData = new RoomModifierData();

            BuilderUtils.ImportStandardLocalization(this.DescriptionKey, this.Description);
            AccessTools.Field(typeof(RoomModifierData), "descriptionKey").SetValue(roomModifierData, this.DescriptionKey);
            BuilderUtils.ImportStandardLocalization(this.ExtraTooltipBodyKey, this.ExtraTooltipBody);
            AccessTools.Field(typeof(RoomModifierData), "extraTooltipBodyKey").SetValue(roomModifierData, this.ExtraTooltipBodyKey);
            BuilderUtils.ImportStandardLocalization(this.ExtraTooltipTitleKey, this.ExtraTooltipTitle);
            AccessTools.Field(typeof(RoomModifierData), "extraTooltipTitleKey").SetValue(roomModifierData, this.ExtraTooltipTitleKey);
            AccessTools.Field(typeof(RoomModifierData), "icon").SetValue(roomModifierData, this.Icon);
            AccessTools.Field(typeof(RoomModifierData), "paramInt").SetValue(roomModifierData, this.ParamInt);
            AccessTools.Field(typeof(RoomModifierData), "paramStatusEffects").SetValue(roomModifierData, this.ParamStatusEffects);
            AccessTools.Field(typeof(RoomModifierData), "paramSubtype").SetValue(roomModifierData, this.ParamSubtype);
            AccessTools.Field(typeof(RoomModifierData), "roomStateModifierClassName").SetValue(roomModifierData, this.RoomStateModifierClassName);
            return(roomModifierData);
        }
Пример #2
0
        /// <summary>
        /// Builds the CardTriggerEffectData represented by this builder's parameters recursively;
        /// i.e. all CardEffectBuilders in cardEffects will also be built.
        /// </summary>
        /// <returns>The newly created CardTriggerEffectData</returns>
        public CardTriggerEffectData Build()
        {
            foreach (var builder in this.CardEffectBuilders)
            {
                this.CardEffects.Add(builder.Build());
            }

            CardTriggerEffectData cardTriggerEffectData = new CardTriggerEffectData();

            AccessTools.Field(typeof(CardTriggerEffectData), "cardEffects").SetValue(cardTriggerEffectData, this.CardEffects);
            AccessTools.Field(typeof(CardTriggerEffectData), "cardTriggerEffects").SetValue(cardTriggerEffectData, this.CardTriggerEffects);
            BuilderUtils.ImportStandardLocalization(this.DescriptionKey, this.Description);
            AccessTools.Field(typeof(CardTriggerEffectData), "descriptionKey").SetValue(cardTriggerEffectData, this.DescriptionKey);
            AccessTools.Field(typeof(CardTriggerEffectData), "trigger").SetValue(cardTriggerEffectData, this.Trigger);

            return(cardTriggerEffectData);
        }
        /// <summary>
        /// Builds the EnhancerData represented by this builder's parameters.
        /// </summary>
        /// <returns>The newly created EnhancerData</returns>
        public EnhancerData Build()
        {
            EnhancerData enhancerData = new EnhancerData();
            var          t            = Traverse.Create(enhancerData);

            // Set the name for the unity object
            enhancerData.name = this.ID;

            // Upgrades are contained within a relic effect - this is mandatory or the game will crash
            List <RelicEffectData> Effects = new List <RelicEffectData>
            {
                new RelicEffectDataBuilder
                {
                    relicEffectClassName  = "RelicEffectCardUpgrade",
                    ParamCardUpgradeData  = Upgrade.Build(),
                    ParamCardType         = CardType,
                    ParamCharacterSubtype = "SubtypesData_None",
                }.Build()
            };

            t.Field("effects").SetValue(Effects);

            // Grab the LinkedClass from the ClanID
            this.LinkedClass = ProviderManager.SaveManager.GetAllGameData().FindClassData(this.ClanID);
            t.Field("linkedClass").SetValue(LinkedClass);

            // Take care of the localized strings
            BuilderUtils.ImportStandardLocalization(this.DescriptionKey, this.Description);
            t.Field("descriptionKey").SetValue(DescriptionKey);

            BuilderUtils.ImportStandardLocalization(this.NameKey, this.Name);
            t.Field("nameKey").SetValue(NameKey);

            // Create the icon from the asset path
            if (this.AssetPath != null)
            {
                Sprite iconSprite = CustomAssetManager.LoadSpriteFromPath(this.BaseAssetPath + "/" + this.AssetPath);
                t.Field("icon").SetValue(iconSprite);
            }

            // A steak pun is a rare medium well done.
            t.Field("rarity").SetValue(Rarity);

            return(enhancerData);
        }
        /// <summary>
        /// Builds the CharacterTriggerData represented by this builders's parameters recursively;
        /// all Builders represented in this class's various fields will also be built.
        /// </summary>
        /// <returns>The newly created CardTraitData</returns>
        public CharacterTriggerData Build()
        {
            foreach (var builder in this.EffectBuilders)
            {
                this.Effects.Add(builder.Build());
            }
            CharacterTriggerData characterTriggerData = new CharacterTriggerData(this.Trigger, null);

            BuilderUtils.ImportStandardLocalization(this.AdditionalTextOnTriggerKey, this.AdditionalTextOnTrigger);
            AccessTools.Field(typeof(CharacterTriggerData), "additionalTextOnTriggerKey").SetValue(characterTriggerData, this.AdditionalTextOnTriggerKey);
            BuilderUtils.ImportStandardLocalization(this.DescriptionKey, this.Description);
            AccessTools.Field(typeof(CharacterTriggerData), "descriptionKey").SetValue(characterTriggerData, this.DescriptionKey);
            AccessTools.Field(typeof(CharacterTriggerData), "displayEffectHintText").SetValue(characterTriggerData, this.DisplayEffectHintText);
            AccessTools.Field(typeof(CharacterTriggerData), "effects").SetValue(characterTriggerData, this.Effects);
            AccessTools.Field(typeof(CharacterTriggerData), "hideTriggerTooltip").SetValue(characterTriggerData, this.HideTriggerTooltip);
            AccessTools.Field(typeof(CharacterTriggerData), "trigger").SetValue(characterTriggerData, this.Trigger);
            return(characterTriggerData);
        }
        /// <summary>
        /// Builds the RelicData represented by this builder's parameters recursively;
        /// all Builders represented in this class's various fields will also be built.
        /// </summary>
        /// <returns>The newly created RelicData</returns>
        public CollectableRelicData Build()
        {
            foreach (var builder in this.EffectBuilders)
            {
                this.Effects.Add(builder.Build());
            }

            if (this.LinkedClass == null)
            {
                this.LinkedClass = CustomClassManager.GetClassDataByID(this.ClanID);
            }

            var relicData = ScriptableObject.CreateInstance <CollectableRelicData>();

            AccessTools.Field(typeof(GameData), "id").SetValue(relicData, this.CollectableRelicID);
            relicData.name = this.CollectableRelicID;
            // RelicData fields
            BuilderUtils.ImportStandardLocalization(this.DescriptionKey, this.Description);
            AccessTools.Field(typeof(RelicData), "descriptionKey").SetValue(relicData, this.DescriptionKey);
            AccessTools.Field(typeof(RelicData), "effects").SetValue(relicData, this.Effects);
            if (this.IconPath != null)
            {
                Sprite iconSprite = CustomAssetManager.LoadSpriteFromPath(this.FullAssetPath);
                AccessTools.Field(typeof(RelicData), "icon").SetValue(relicData, iconSprite);
            }
            BuilderUtils.ImportStandardLocalization(this.NameKey, this.Name);
            AccessTools.Field(typeof(RelicData), "nameKey").SetValue(relicData, this.NameKey);
            AccessTools.Field(typeof(RelicData), "relicActivatedKey").SetValue(relicData, this.RelicActivatedKey);
            AccessTools.Field(typeof(RelicData), "relicLoreTooltipKeys").SetValue(relicData, this.RelicLoreTooltipKeys);

            // CollectableRelicData fields
            AccessTools.Field(typeof(CollectableRelicData), "fromStoryEvent").SetValue(relicData, this.FromStoryEvent);
            AccessTools.Field(typeof(CollectableRelicData), "isBossGivenRelic").SetValue(relicData, this.IsBossGivenRelic);
            AccessTools.Field(typeof(CollectableRelicData), "linkedClass").SetValue(relicData, this.LinkedClass);
            AccessTools.Field(typeof(CollectableRelicData), "rarity").SetValue(relicData, this.Rarity);
            AccessTools.Field(typeof(CollectableRelicData), "unlockLevel").SetValue(relicData, this.UnlockLevel);
            return(relicData);
        }
 /// <summary>
 /// Add a status effect to this character's starting status effect array.
 /// </summary>
 /// <param name="statusEffectID">ID of the status effect, most easily retrieved using the helper class "MTStatusEffectIDs"</param>
 /// <param name="stackCount">Number of stacks to apply</param>
 public void AddStartingStatusEffect(string statusEffectID, int stackCount)
 {
     this.StartingStatusEffects = BuilderUtils.AddStatusEffect(statusEffectID, stackCount, this.StartingStatusEffects);
 }
        /// <summary>
        /// Builds the CharacterData represented by this builder's parameters recursively;
        /// all Builders represented in this class's various fields will also be built.
        /// </summary>
        /// <returns>The newly created CharacterData</returns>
        public CharacterData Build()
        {
            CharacterData characterData = ScriptableObject.CreateInstance <CharacterData>();

            characterData.name = this.CharacterID;

            foreach (var builder in this.TriggerBuilders)
            {
                this.Triggers.Add(builder.Build());
            }
            foreach (var builder in this.RoomModifierBuilders)
            {
                this.RoomModifiers.Add(builder.Build());
            }

            var guid = GUIDGenerator.GenerateDeterministicGUID(this.CharacterID);

            AccessTools.Field(typeof(CharacterData), "id").SetValue(characterData, guid);
            AccessTools.Field(typeof(CharacterData), "animationController").SetValue(characterData, this.AnimationController);
            AccessTools.Field(typeof(CharacterData), "ascendsTrainAutomatically").SetValue(characterData, this.AscendsTrainAutomatically);
            AccessTools.Field(typeof(CharacterData), "attackDamage").SetValue(characterData, this.AttackDamage);
            AccessTools.Field(typeof(CharacterData), "attackTeleportsToDefender").SetValue(characterData, this.AttackTeleportsToDefender);
            AccessTools.Field(typeof(CharacterData), "bossActionGroups").SetValue(characterData, this.BossActionGroups);
            AccessTools.Field(typeof(CharacterData), "bossRoomSpellCastVFX").SetValue(characterData, this.BossRoomSpellCastVFX);
            AccessTools.Field(typeof(CharacterData), "bossSpellCastVFX").SetValue(characterData, this.BossSpellCastVFX);
            AccessTools.Field(typeof(CharacterData), "canAttack").SetValue(characterData, this.CanAttack);
            AccessTools.Field(typeof(CharacterData), "canBeHealed").SetValue(characterData, this.CanBeHealed);
            AccessTools.Field(typeof(CharacterData), "characterChatterData").SetValue(characterData, this.CharacterChatterData);
            AccessTools.Field(typeof(CharacterData), "characterLoreTooltipKeys").SetValue(characterData, this.CharacterLoreTooltipKeys);
            if (this.CharacterPrefabVariantRef == null)
            {
                if (this.CharacterPrefabVariantRefBuilder == null)
                {
                    if (this.BundleLoadingInfo != null)
                    {
                        this.BundleLoadingInfo.PluginPath     = this.BaseAssetPath;
                        this.CharacterPrefabVariantRefBuilder = new AssetRefBuilder
                        {
                            AssetLoadingInfo = this.BundleLoadingInfo
                        };
                    }
                    else
                    {
                        var assetLoadingInfo = new AssetLoadingInfo()
                        {
                            FilePath   = this.AssetPath,
                            PluginPath = this.BaseAssetPath,
                            AssetType  = AssetRefBuilder.AssetTypeEnum.Character
                        };
                        this.CharacterPrefabVariantRefBuilder = new AssetRefBuilder
                        {
                            AssetLoadingInfo = assetLoadingInfo
                        };
                    }
                }
                this.CharacterPrefabVariantRef = this.CharacterPrefabVariantRefBuilder.BuildAndRegister();
            }
            AccessTools.Field(typeof(CharacterData), "characterPrefabVariantRef").SetValue(characterData, this.CharacterPrefabVariantRef);
            AccessTools.Field(typeof(CharacterData), "characterSoundData").SetValue(characterData, this.CharacterSoundData);
            AccessTools.Field(typeof(CharacterData), "characterSpriteCache").SetValue(characterData, this.CharacterSpriteCache);
            AccessTools.Field(typeof(CharacterData), "deathSlidesBackwards").SetValue(characterData, this.DeathSlidesBackwards);
            AccessTools.Field(typeof(CharacterData), "deathType").SetValue(characterData, this.DeathType);
            AccessTools.Field(typeof(CharacterData), "deathVFX").SetValue(characterData, this.DeathVFX);
            AccessTools.Field(typeof(CharacterData), "fallbackData").SetValue(characterData, this.FallBackData);
            AccessTools.Field(typeof(CharacterData), "health").SetValue(characterData, this.Health);
            AccessTools.Field(typeof(CharacterData), "impactVFX").SetValue(characterData, this.ImpactVFX);
            AccessTools.Field(typeof(CharacterData), "isMiniboss").SetValue(characterData, this.IsMiniboss);
            AccessTools.Field(typeof(CharacterData), "isOuterTrainBoss").SetValue(characterData, this.IsOuterTrainBoss);
            BuilderUtils.ImportStandardLocalization(this.NameKey, this.Name);
            AccessTools.Field(typeof(CharacterData), "nameKey").SetValue(characterData, this.NameKey);
            AccessTools.Field(typeof(CharacterData), "projectilePrefab").SetValue(characterData, this.ProjectilePrefab);
            AccessTools.Field(typeof(CharacterData), "roomModifiers").SetValue(characterData, this.RoomModifiers);
            AccessTools.Field(typeof(CharacterData), "size").SetValue(characterData, this.Size);
            AccessTools.Field(typeof(CharacterData), "startingStatusEffects").SetValue(characterData, this.StartingStatusEffects);
            AccessTools.Field(typeof(CharacterData), "statusEffectImmunities").SetValue(characterData, this.StatusEffectImmunities);
            //AccessTools.Field(typeof(CardData), "stringBuilder").SetValue(cardData, this.);
            if (this.PriorityDraw)
            {
                this.SubtypeKeys.Add("SubtypesData_Chosen");
            }
            AccessTools.Field(typeof(CharacterData), "subtypeKeys").SetValue(characterData, this.SubtypeKeys);
            AccessTools.Field(typeof(CharacterData), "triggers").SetValue(characterData, this.Triggers);

            return(characterData);
        }
Пример #8
0
        /// <summary>
        /// Builds the ClassData represented by this builder's parameters recursively;
        /// all Builders represented in this class's various fields will also be built.
        /// </summary>
        /// <returns>The newly created ClassData</returns>
        public ClassData Build()
        {
            ClassData classData = ScriptableObject.CreateInstance <ClassData>();

            classData.name = this.ClassID;

            AccessTools.Field(typeof(ClassData), "id").SetValue(classData, GUIDGenerator.GenerateDeterministicGUID(this.ClassID));
            AccessTools.Field(typeof(ClassData), "cardStyle").SetValue(classData, this.CardStyle);
            AccessTools.Field(typeof(ClassData), "classUnlockCondition").SetValue(classData, this.ClassUnlockCondition);
            AccessTools.Field(typeof(ClassData), "classUnlockParam").SetValue(classData, this.ClassUnlockParam);
            AccessTools.Field(typeof(ClassData), "classUnlockPreviewTexts").SetValue(classData, this.ClassUnlockPreviewTexts);
            BuilderUtils.ImportStandardLocalization(this.DescriptionLoc, this.Description);
            AccessTools.Field(typeof(ClassData), "descriptionLoc").SetValue(classData, this.DescriptionLoc);
            var icons = new List <Sprite>();

            foreach (string iconPath in this.IconAssetPaths)
            {
                icons.Add(CustomAssetManager.LoadSpriteFromPath(this.BaseAssetPath + "/" + iconPath));
            }
            Type iconSetType = AccessTools.Inner(typeof(ClassData), "IconSet");
            var  iconSet     = Activator.CreateInstance(iconSetType);

            AccessTools.Field(iconSetType, "small").SetValue(iconSet, icons[0]);
            AccessTools.Field(iconSetType, "medium").SetValue(iconSet, icons[1]);
            AccessTools.Field(iconSetType, "large").SetValue(iconSet, icons[2]);
            AccessTools.Field(iconSetType, "silhouette").SetValue(iconSet, icons[3]);
            AccessTools.Field(typeof(ClassData), "icons").SetValue(classData, iconSet);
            AccessTools.Field(typeof(ClassData), "champions").SetValue(classData, this.Champions);
            BuilderUtils.ImportStandardLocalization(this.SubclassDescriptionLoc, this.SubclassDescription);
            AccessTools.Field(typeof(ClassData), "subclassDescriptionLoc").SetValue(classData, this.SubclassDescriptionLoc);
            BuilderUtils.ImportStandardLocalization(this.TitleLoc, this.Name);
            AccessTools.Field(typeof(ClassData), "titleLoc").SetValue(classData, this.TitleLoc);
            AccessTools.Field(typeof(ClassData), "uiColor").SetValue(classData, this.UiColor);
            AccessTools.Field(typeof(ClassData), "uiColorDark").SetValue(classData, this.UiColorDark);
            //AccessTools.Field(typeof(ClassData), "UNLOCK_KEYS").SetValue(classData, this.);


            // Card Frame
            if (this.CardFrameSpellPath != null && this.CardFrameUnitPath != null)
            {
                Sprite cardFrameSpellSprite = CustomAssetManager.LoadSpriteFromPath(this.BaseAssetPath + "/" + this.CardFrameSpellPath);
                Sprite cardFrameUnitSprite  = CustomAssetManager.LoadSpriteFromPath(this.BaseAssetPath + "/" + this.CardFrameUnitPath);
                CustomClassManager.CustomClassFrame.Add(GUIDGenerator.GenerateDeterministicGUID(this.ClassID), new List <Sprite>()
                {
                    cardFrameUnitSprite, cardFrameSpellSprite
                });
            }

            // Draft Icon
            if (this.DraftIconPath != null)
            {
                Sprite draftIconSprite = CustomAssetManager.LoadSpriteFromPath(this.BaseAssetPath + "/" + this.DraftIconPath);
                CustomClassManager.CustomClassDraftIcons.Add(GUIDGenerator.GenerateDeterministicGUID(this.ClassID), draftIconSprite);
            }
            // Class select character IDs
            CustomClassManager.CustomClassSelectScreenCharacterIDsMain.Add(GUIDGenerator.GenerateDeterministicGUID(this.ClassID), this.ClassSelectScreenCharacterIDsMain);
            CustomClassManager.CustomClassSelectScreenCharacterIDsSub.Add(GUIDGenerator.GenerateDeterministicGUID(this.ClassID), this.ClassSelectScreenCharacterIDsSub);


            return(classData);
        }
Пример #9
0
        /// <summary>
        /// Builds the RelicEffectData represented by this builder's parameters recursively;
        /// all Builders represented in this class's various fields will also be built.
        /// </summary>
        /// <returns>The newly created RelicEffectData</returns>
        public RelicEffectData Build()
        {
            foreach (var builder in this.EffectConditionBuilders)
            {
                this.EffectConditions.Add(builder.Build());
            }
            foreach (var builder in this.TraitBuilders)
            {
                this.Traits.Add(builder.Build());
            }
            foreach (var builder in this.TriggerBuilders)
            {
                this.Triggers.Add(builder.Build());
            }
            foreach (var builder in this.ParamCardEffectBuilders)
            {
                this.ParamCardEffects.Add(builder.Build());
            }

            RelicEffectData relicEffectData = new RelicEffectData();

            AccessTools.Field(typeof(RelicEffectData), "additionalTooltips").SetValue(relicEffectData, this.AdditionalTooltips);
            AccessTools.Field(typeof(RelicEffectData), "appliedVfx").SetValue(relicEffectData, this.AppliedVfx);
            AccessTools.Field(typeof(RelicEffectData), "effectConditions").SetValue(relicEffectData, this.EffectConditions);
            AccessTools.Field(typeof(RelicEffectData), "excludedTraits").SetValue(relicEffectData, this.ExcludedTraits);
            AccessTools.Field(typeof(RelicEffectData), "paramBool").SetValue(relicEffectData, this.ParamBool);
            AccessTools.Field(typeof(RelicEffectData), "paramCardEffects").SetValue(relicEffectData, this.ParamCardEffects);
            AccessTools.Field(typeof(RelicEffectData), "paramCardFilter").SetValue(relicEffectData, this.ParamCardFilter);
            AccessTools.Field(typeof(RelicEffectData), "paramCardPool").SetValue(relicEffectData, this.ParamCardPool);
            AccessTools.Field(typeof(RelicEffectData), "paramCardSetBuilder").SetValue(relicEffectData, this.ParamCardSetBuilder);
            AccessTools.Field(typeof(RelicEffectData), "paramCardType").SetValue(relicEffectData, this.ParamCardType);
            AccessTools.Field(typeof(RelicEffectData), "paramCardUpgradeData").SetValue(relicEffectData, this.ParamCardUpgradeData);
            AccessTools.Field(typeof(RelicEffectData), "paramCharacters").SetValue(relicEffectData, this.ParamCharacters);
            AccessTools.Field(typeof(RelicEffectData), "paramCharacterSubtype").SetValue(relicEffectData, this.ParamCharacterSubtype);
            AccessTools.Field(typeof(RelicEffectData), "paramExcludeCharacterSubtypes").SetValue(relicEffectData, this.ParamExcludeCharacterSubtypes);
            AccessTools.Field(typeof(RelicEffectData), "paramFloat").SetValue(relicEffectData, this.ParamFloat);
            AccessTools.Field(typeof(RelicEffectData), "paramInt").SetValue(relicEffectData, this.ParamInt);
            AccessTools.Field(typeof(RelicEffectData), "paramMaxInt").SetValue(relicEffectData, this.ParamMaxInt);
            AccessTools.Field(typeof(RelicEffectData), "paramMinInt").SetValue(relicEffectData, this.ParamMinInt);
            AccessTools.Field(typeof(RelicEffectData), "paramRelic").SetValue(relicEffectData, this.ParamRelic);
            AccessTools.Field(typeof(RelicEffectData), "paramReward").SetValue(relicEffectData, this.ParamReward);
            AccessTools.Field(typeof(RelicEffectData), "paramRoomData").SetValue(relicEffectData, this.ParamRoomData);
            AccessTools.Field(typeof(RelicEffectData), "paramSourceTeam").SetValue(relicEffectData, this.ParamSourceTeam);
            AccessTools.Field(typeof(RelicEffectData), "paramSpecialCharacterType").SetValue(relicEffectData, this.ParamSpecialCharacterType);
            AccessTools.Field(typeof(RelicEffectData), "paramStatusEffects").SetValue(relicEffectData, this.ParamStatusEffects);
            AccessTools.Field(typeof(RelicEffectData), "paramString").SetValue(relicEffectData, this.ParamString);
            AccessTools.Field(typeof(RelicEffectData), "paramTargetMode").SetValue(relicEffectData, this.ParamTargetMode);
            AccessTools.Field(typeof(RelicEffectData), "paramTrigger").SetValue(relicEffectData, this.ParamTrigger);
            AccessTools.Field(typeof(RelicEffectData), "paramUseIntRange").SetValue(relicEffectData, this.ParamUseIntRange);
            AccessTools.Field(typeof(RelicEffectData), "relicEffectClassName").SetValue(relicEffectData, this.RelicEffectClassName);
            AccessTools.Field(typeof(RelicEffectData), "sourceCardTraitParam").SetValue(relicEffectData, this.SourceCardTraitParam);
            AccessTools.Field(typeof(RelicEffectData), "targetCardTraitParam").SetValue(relicEffectData, this.TargetCardTraitParam);
            BuilderUtils.ImportStandardLocalization(this.TooltipBodyKey, this.TooltipBody);
            AccessTools.Field(typeof(RelicEffectData), "tooltipBodyKey").SetValue(relicEffectData, this.TooltipBodyKey);
            BuilderUtils.ImportStandardLocalization(this.TooltipTitleKey, this.TooltipTitle);
            AccessTools.Field(typeof(RelicEffectData), "tooltipTitleKey").SetValue(relicEffectData, this.TooltipTitleKey);
            AccessTools.Field(typeof(RelicEffectData), "traits").SetValue(relicEffectData, this.Traits);
            AccessTools.Field(typeof(RelicEffectData), "triggers").SetValue(relicEffectData, this.Triggers);
            AccessTools.Field(typeof(RelicEffectData), "triggerTooltipsSuppressed").SetValue(relicEffectData, this.TriggerTooltipsSuppressed);
            return(relicEffectData);
        }
Пример #10
0
        public CardUpgradeData Build()
        {
            CardUpgradeData cardUpgradeData = ScriptableObject.CreateInstance <CardUpgradeData>();

            foreach (var builder in this.TraitDataUpgradeBuilders)
            {
                this.TraitDataUpgrades.Add(builder.Build());
            }
            foreach (var builder in this.TriggerUpgradeBuilders)
            {
                this.TriggerUpgrades.Add(builder.Build());
            }
            foreach (var builder in this.CardTriggerUpgradeBuilders)
            {
                this.CardTriggerUpgrades.Add(builder.Build());
            }
            foreach (var builder in this.RoomModifierUpgradeBuilders)
            {
                this.RoomModifierUpgrades.Add(builder.Build());
            }
            foreach (var builder in this.FiltersBuilders)
            {
                this.Filters.Add(builder.Build());
            }
            foreach (var builder in this.UpgradesToRemoveBuilders)
            {
                this.UpgradesToRemove.Add(builder.Build());
            }

            AccessTools.Field(typeof(CardUpgradeData), "bonusDamage").SetValue(cardUpgradeData, this.BonusDamage);
            AccessTools.Field(typeof(CardUpgradeData), "bonusHeal").SetValue(cardUpgradeData, this.BonusHeal);
            AccessTools.Field(typeof(CardUpgradeData), "bonusHP").SetValue(cardUpgradeData, this.BonusHP);
            AccessTools.Field(typeof(CardUpgradeData), "bonusSize").SetValue(cardUpgradeData, this.BonusSize);
            AccessTools.Field(typeof(CardUpgradeData), "cardTriggerUpgrades").SetValue(cardUpgradeData, this.CardTriggerUpgrades);
            AccessTools.Field(typeof(CardUpgradeData), "costReduction").SetValue(cardUpgradeData, this.CostReduction);
            AccessTools.Field(typeof(CardUpgradeData), "filters").SetValue(cardUpgradeData, this.Filters);
            AccessTools.Field(typeof(CardUpgradeData), "hideUpgradeIconOnCard").SetValue(cardUpgradeData, this.HideUpgradeIconOnCard);
            AccessTools.Field(typeof(CardUpgradeData), "removeTraitUpgrades").SetValue(cardUpgradeData, this.RemoveTraitUpgrades);
            AccessTools.Field(typeof(CardUpgradeData), "roomModifierUpgrades").SetValue(cardUpgradeData, this.RoomModifierUpgrades);
            AccessTools.Field(typeof(CardUpgradeData), "statusEffectUpgrades").SetValue(cardUpgradeData, this.StatusEffectUpgrades);
            AccessTools.Field(typeof(CardUpgradeData), "traitDataUpgrades").SetValue(cardUpgradeData, this.TraitDataUpgrades);
            AccessTools.Field(typeof(CardUpgradeData), "triggerUpgrades").SetValue(cardUpgradeData, this.TriggerUpgrades);
            BuilderUtils.ImportStandardLocalization(this.UpgradeDescriptionKey, this.UpgradeDescription);
            AccessTools.Field(typeof(CardUpgradeData), "upgradeDescriptionKey").SetValue(cardUpgradeData, this.UpgradeDescriptionKey);
            if (this.UpgradeIconPath != null && this.UpgradeIconPath != "")
            {
                AccessTools.Field(typeof(CardUpgradeData), "upgradeIcon").SetValue(cardUpgradeData, CustomAssetManager.LoadSpriteFromPath(this.BaseAssetPath + "/" + this.UpgradeIconPath));
            }
            BuilderUtils.ImportStandardLocalization(this.UpgradeNotificationKey, this.UpgradeNotification);
            AccessTools.Field(typeof(CardUpgradeData), "upgradeNotificationKey").SetValue(cardUpgradeData, this.UpgradeNotificationKey);
            AccessTools.Field(typeof(CardUpgradeData), "upgradesToRemove").SetValue(cardUpgradeData, this.UpgradesToRemove);
            BuilderUtils.ImportStandardLocalization(this.UpgradeTitleKey, this.UpgradeTitle);
            AccessTools.Field(typeof(CardUpgradeData), "upgradeTitleKey").SetValue(cardUpgradeData, this.UpgradeTitleKey);
            AccessTools.Field(typeof(CardUpgradeData), "useUpgradeHighlightTextTags").SetValue(cardUpgradeData, this.UseUpgradeHighlightTextTags);
            AccessTools.Field(typeof(CardUpgradeData), "xCostReduction").SetValue(cardUpgradeData, this.XCostReduction);

            cardUpgradeData.name = UpgradeTitleKey;
            Traverse.Create(cardUpgradeData).Field("id").SetValue(UpgradeTitleKey);

            // If CardUpgrades are not added to allGameData, there are many troubles.
            var field       = Traverse.Create(ProviderManager.SaveManager.GetAllGameData()).Field("cardUpgradeDatas");
            var upgradeList = field.GetValue <List <CardUpgradeData> >();

            upgradeList.Add(cardUpgradeData);
            field.SetValue(upgradeList);

            return(cardUpgradeData);
        }
 /// <summary>
 /// Add a status effect to this effect's status effect array.
 /// </summary>
 /// <param name="statusEffectID">ID of the status effect, most easily retrieved using the helper class "MTStatusEffectIDs"</param>
 /// <param name="stackCount">Number of stacks to apply</param>
 public CardEffectDataBuilder AddStatusEffect(string statusEffectID, int stackCount)
 {
     this.ParamStatusEffects = BuilderUtils.AddStatusEffect(statusEffectID, stackCount, this.ParamStatusEffects);
     return(this);
 }