StatusEffectDataBuilder - rspforhp/WildfrostModdingDocumentation GitHub Wiki

StatusEffectDataBuilder

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").

Example

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.

Methods

Note

Some methods inherited from DataFileBuilder are not shown. They can be found in Builders.

Create (Inherited from DataFileBuilder)

Create(string name) OR Create<T>(string name) where T is a class that inherits from StatusEffectData

  • Used to create a status effect.
  • name is the internal name for your status effect.
  • T is 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 (Inherited from DataFileBuilder)

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 as StatusEffectApplyX.
  • T ideally should match the T used in Create<T>.
  • Important variables to edit with FreeModify:
    • eventPriority: influences the order in which effects activate. A higher eventPriority means 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

WithCanBeBoosted(bool value)

  • Used to set your status effect's canBeBoosted property.
  • Determines whether your effect can be boosted (e.g. lumin ring, frostbite shard, or lumin vase).
  • canBeBoosted is false by dafault.

WithDoesDamage

WithDoesDamage(bool value)

  • Used to set your status effect's doesDamage property.
  • doesDamage property is only used for checking TargetConstraintDoesKill (e.g. Pinch Charm).
  • doesDamage is false by default.

WithIconGroupName

WithIconGroupName(string type)

  • Used to set your status effect's iconGroupName property.
  • 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

WithIsKeyword(bool value)

  • Used to set your status effect's isKeyword property
  • Among the vanilla status effects, isKeyword is 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)
  • isKeyword is false by default.

WithIsReaction

WithIsReaction(bool value)

  • Used to set your status effect's isReaction property.
  • If a status effect is a reaction, the card that has it will gain the reaction icon in the counter icon group.
  • isReaction is 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

WithIsStatus(bool value)

  • Used to set your status effect's isStatus property.
  • 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.
  • isStatus is false by default.

WithKeyword

WithKeyword(string type)

  • Used to set your status effect's keyword property.
  • 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

WithMakesOffensive(bool value)

  • Used to set your status effect's makesOffensive property.
  • Determines whether or not the card with this as a status effect is offensive.
  • Charms that apply a status effect that has makesOffensive will give the target card an attack stat (of 0).
  • makesOffensive is false by default.

WithOffensive

WithOffensive(bool value)

  • Used to set your status effect's offensive property.
  • 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.
  • offensive is false by default.

WithOrder

WithOrder(int order)

  • Used to set your status effect's textOrder property.
  • 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.
  • textorder is 0 by default.

WithStackable

WithStackable(bool value)

  • Used to set your status effect's stackable property
  • Determines whether status effects with the same name combine their counts together or stay as separate effects.
  • stackable is true by default.

WithText

WithText(string title, SystemLanguage lang)

  • Used to set your status effect's in-game text
  • title is 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).
  • lang is set to SystemLanguage.English by default.

WithTextInsert

WithTextInsert(string value)

  • Used to set your status effect's textInsert property
  • Determines what to replace {0} in your card description with.
  • Has similarly supported features as the WithText method above.

WithType

WithType(string type)

  • Used to set your status effect's type property
  • 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

WithVisible(bool value)

  • Used to set your status effect's visible property
  • Determines whether your status effect has an icon or not.
  • The icon the game finds will be of the same type defined in WithType.
  • visible is false by default.
⚠️ **GitHub.com Fallback** ⚠️