StatusEffectDataBuilder - rspforhp/WildfrostModdingDocumentation GitHub Wiki
CardDataBuilder(WildfrostMod mod)
- The builder for creating StatusEffectData.
- Status effects range from effects written on a card's textbox, statuses displayed as icons, or even invisible effects.
- To see the classes that derive from StatusEffectData, use a decompiler on the game's source code. See Basic Project Setup and Tutorial 0 for more details.
- A list of all status effects in the base game can be found in references.
- The naming convention for status effects is capitalize every word and include space (e.g. "Trigger Against Attacker When Hit").
The following are two examples of using the builder to make an in-game status effect. The first is a prominent status: snow. The second is an effect found on some leaders: gain attack on kill. Observe that we specify a StatusEffectData-derived class when using Create, unlike what the CardDataBuilder does.
//'this' refers to an instance of a WildfrostMod class
//'assets' is a list of DataFiles to be loaded into the game
//The snow effect. See Tutorial 2 (Making Status Icons) for the visual icon.
assets.Add(new StatusEffectDataBuilder(this)
.Create<StatusEffectSnow>("Snow")
.WithVisible(true) //Creates an icon of its `type` when applied
.WithIconGroupName("counter")
.WithType("snow") //Determines the SFX/VFX for applying the status.
.WithKeyword("snow") //Used only in apply formats, ie "Apply X" descriptions
.WithIsStatus(true) //Surprisingly affects very little
.SubscribeToAfterAllBuildEvent<StatusEffectSnow>(data =>
{
data.applyFormatKey = Extensions.GetLocalizedString("Card Text", "Apply X"); // Requires `WithKeyword`, and displays the specific keyword
data.removeOnDiscard = true;
})
);
//A "gain attack on kill" effect found on some leaders
assets.Add(new StatusEffectDataBuilder(this)
.Create<StatusEffectApplyXOnKill>("On Kill Apply Attack To Self")
.WithText("Gain {0} on kill")
.WithTextInsert("<+{a}><keyword=attack>") //TextInsert will replace the {0} in the line above. <keyword=blah> gives a keyword pop-up on hover. {a} is the current number of stacks.
.WithCanBeBoosted(true)
.SubscribeToAfterAllBuildEvent<StatusEffectApplyXOnKill>(data =>
{
data.effectToApply = Get<StatusEffectData>("Increase Attack");
data.applyToFlags = StatusEffectApplyX.ApplyToFlags.Self;
})
);
//Loading these assets is done through an overridden Load and AddAssets methods.
//See Tutorial 2 for more details.Note
Some methods inherited from DataFileBuilder are not shown. They can be found in Builders.
Create(string name)
OR
Create<T>(string name) where T is a class that inherits from StatusEffectData
- Used to create a status effect.
-
nameis the internal name for your status effect. -
Tis a class that inherits from StatusEffectData (e.g. StatusEffectApplyXOnKill) - If you want to modify properties unique to a specific StatusEffectData class, use DataFileBuilder's (from which StatusEffectDataBuilder inherits) FreeModify<T>()
- You can find existing StatusEffectData classes by using a decompiler and looking through the source code of the game.
- You can create your own StatusEffectData classes.
FreeModify<T>(Action<T> action) where T is a class that inherits from StatusEffectData
- The DataFileBuilder is wrapped around the DataFile instance you are trying to edit. This method allows you to edit the data directly.
- This is useful for when you need to edit fields of a derived class of
StatusEffectData, such asStatusEffectApplyX. -
Tideally should match theTused inCreate<T>. - Important variables to edit with
FreeModify:-
eventPriority: influences the order in which effects activate. A highereventPrioritymeans the effect will activate before others. Default is 0. -
effectToApply(for StatusEffectApplyX classes): determines the sub-effect your effect will apply. -
applyToFlags(for StatusEffectApplyX classes): determines who the sub-effect applies to. This is a flag enum, so you can assign multiple flags by separating them with a bar "|".
-
Warning
If you want to reference your modded status effects or cards, DO NOT use FreeModify<T>. Use SubscribeToAfterAllBuildEvent instead.
WithCanBeBoosted(bool value)
- Used to set your status effect's
canBeBoostedproperty. - Determines whether your effect can be boosted (e.g. lumin ring, frostbite shard, or lumin vase).
-
canBeBoostedis false by dafault.
WithDoesDamage(bool value)
- Used to set your status effect's
doesDamageproperty. -
doesDamageproperty is only used for checking TargetConstraintDoesKill (e.g. Pinch Charm). -
doesDamageis false by default.
WithIconGroupName(string type)
- Used to set your status effect's
iconGroupNameproperty. - Determines where to show the effect icon if the effect is a visible one (e.g. Frost & Spice next to Attack, Snow Resist & Frenzy next to Counter, etc.).
- Existing iconGroupNames are: "health", "damage", "counter", "crown".
WithIsKeyword(bool value)
- Used to set your status effect's
isKeywordproperty - Among the vanilla status effects,
isKeywordis set to false for all except "Temporary [Trait]". - Tells the game that this status effect indirectly adds (keyword) descriptions.
- Its only purpose is to allow effects to be copied from/onto another card (they check if the effect has description)
- ...this lets effects be copied by Instant Summon Copy and CardScriptCopyEffectsFromOtherCardInDeck (Mime Charm)
-
isKeywordis false by default.
WithIsReaction(bool value)
- Used to set your status effect's
isReactionproperty. - If a status effect is a reaction, the card that has it will gain the reaction icon in the counter icon group.
-
isReactionis false by default. - This method does not set the text colors. You must manually do this by setting the data's
.descColorHex = "F99C61". e.g.
//'this' refers to an instance of a WildfrostMod class
//'assets' is a list of DataFile objects to be loaded into the game
assets.Add(new StatusEffectDataBuilder(this)
.Create<StatusEffectTriggerWhenAllyAttacks>("Trigger When Ally Attacks") // internal name
.WithText("Trigger when an ally attacks") // text shown to the player
.SubscribeToAfterAllBuildEvent(delegate (StatusEffectData d)
{
StatusEffectTriggerWhenAllyAttacks data = (StatusEffectTriggerWhenAllyAttacks)d;
data.descColorHex = "F99C61"; // the color hex of reaction effect text (brown)
})
);
//Loading these assets is done through an overridden Load and AddAssets methods.
//See Tutorial 2 for more details.WithIsStatus(bool value)
- Used to set your status effect's
isStatusproperty. - A "status" is an effect that is made to be applied to and removed from cards (e.g. snow, frost, shell, etc.)
- If a status effect is a status, is visible, and is offensive, it will be cleared by cleanse.
-
isStatusis false by default.
WithKeyword(string type)
- Used to set your status effect's
keywordproperty. - The only vanilla status effects that use this are statuses (snow, frost, shell) or effectively statuses (instant apply scrap).
- Used only with apply formats of attackEffects, eg "Apply X" descriptions, to show "Apply <keyword=...>".
- Prevents text from showing for startWithEffects.
WithMakesOffensive(bool value)
- Used to set your status effect's
makesOffensiveproperty. - Determines whether or not the card with this as a status effect is offensive.
- Charms that apply a status effect that has
makesOffensivewill give the target card an attack stat (of 0). -
makesOffensiveis false by default.
WithOffensive(bool value)
- Used to set your status effect's
offensiveproperty. - Determines whether or not the card with this as an attack effect is offensive (negative for the recipient of the effect).
- Determines the "offensiveness" of a hit from a card with this as a status effect. (which in turn is used for camera shake intensity calculations).
- If a status effect is a status, is visible, and is offensive, it will be cleared by cleanse.
-
offensiveis false by default.
WithOrder(int order)
- Used to set your status effect's
textOrderproperty. - Determines where your status effect description is placed if there are multiple (the default order is the same order you add the effects).
- This does not change the order in which effects resolve. See
FreeModify. -
textorderis 0 by default.
WithStackable(bool value)
- Used to set your status effect's
stackableproperty - Determines whether status effects with the same name combine their counts together or stay as separate effects.
-
stackableis true by default.
WithText(string title, SystemLanguage lang)
- Used to set your status effect's in-game text
-
titleis the text shown to the player. - Some supported features are:
- <Blah> will highlight the "Blah" yellow.
- "<sprite name=Blah>" will produce the corresponding sprite for Blah.
- "<card=Blah>" will show a pop-up for the card Blah (e.g. JunJun card pop-up when hovering over JunJun mask).
- "<keyword=Blah> will show a pop-up for the keyword Blad.
- {a} will be displayed as the current number of stacks for this effect. Note that this number will display as double its value whenever Lumin is applied, even if the effect is not boostable.
- {0} will be displayed as the text insert (see below).
-
langis set to SystemLanguage.English by default.
WithTextInsert(string value)
- Used to set your status effect's
textInsertproperty - Determines what to replace {0} in your card description with.
- Has similarly supported features as the
WithTextmethod above.
WithType(string type)
- Used to set your status effect's
typeproperty - Determines what sfx and vfx to use when the status effect is triggered.
- Some examples are "snow", "frost", "max counter up", and "".
- A full list of vanilla types can be found in references.
WithVisible(bool value)
- Used to set your status effect's
visibleproperty - Determines whether your status effect has an icon or not.
- The icon the game finds will be of the same type defined in
WithType. -
visibleis false by default.