Skip to content

TraitTransformer

Namespace: Cwl.API.Processors;

Event raised when game creates a Trait. You may use this event to mutate the trait or check if certain trait is instantiated.

TraitTransform

cs
delegate void TraitTransform(ref string traitName, Card traitOwner);
// ->
static void MyTraitTransformer(ref string traitName, Card traitOwner)
{
    if (traitName == nameof(TraitUniqueChara) && traitOwner.id == "swordkeeper") {
        traitName = nameof(TraitUltimateBossForm);
    }
}

You may mutate the traitName to the type name of target Trait class. It doesn't need to be qualified, CWL will qualify it for you.

Register

cs
TraitTransformer.Add(MyTraitTransformer);