EFFECT TYPE constants and templates

This page contains a list of all possible effect type combinations that you can use when invoking the Effect.SetType function. These combinations consist of 1 or more EFFECT_TYPE constants, and each one of them allows you to implement a specific type of effect.

According to the official game terminology, effects are classified into several types: Continuous, Ignition, Quick, Trigger, and Flip. However, this does not mean that there is a corresponding constant for each of these categories. For example, there is no universal EFFECT_TYPE constant that handles all Trigger Effects. Instead, there exist multiple combinations that are specific to certain types of Trigger Effects.

Each time a new constant, or combination of constants, is introduced, a brief description of the type of effect it handles will be provided, along with a sample code block that shows the minimum essential components that you need to add when using that specific constant (or combination).

Stand-alone effect types
This section deals with EFFECT_TYPE constants that can be used on their own, without being combined with any other constants. Keep in mind that, even if a constant is listed here, it does not automatically mean that it cannot be used in a combination.

EFFECT_TYPE_SINGLE
TYPE_SINGLE effects are Continuous Effects (or, in general, non-activated effects) that only apply to their current handler. This constant is most commonly used to script effects that increase/decrease a particular statistic of the handler ("This card gains 100 ATK/DEF for each Spell/Trap on the field"), that grant it some form of protection ("Cannot be destroyed by battle or card effects"), and/or restrictions ("Cannot be used as Link Material").

Template
A basic template of a TYPE_SINGLE effect, containing all its mandatory components, is the following: As you can see, you need to specify the behaviour the effect will have on its handler by invoking the Effect.SetCode function: when you do that, you must pass an EFFECT constant.

While this is the bare minimum requirement, most of the times you'll need to add other components as well, even though they are not strictly required in all situations:


 * Effect.SetProperty: There are a few property flags that can be useful to script TYPE_SINGLE effects.
 * EFFECT_FLAG_SINGLE_RANGE: If this flag is set, and a range is specified, the effect will only be applied when the handler is in the specified location(s). Furthermore, when you create an effect object with an EFFECT_UPDATE_XXX or EFFECT_SET_XXX_FINAL constant as its code, and that is not registered by an activated effect, you must use this flag: the reason lies in the fact that statistic modifiers applied by a non-activated effect behave differently from those applied by activated effects, especially when interacting with other types of modifiers (primarily EFFECT_SET_XXX ones).
 * EFFECT_FLAG_UNCOPYABLE: If this flag is set, the effect won't be able to be copied by other cards. This property is required when the effect object in question corresponds to a condition in the card text.
 * EFFECT_FLAG_CANNOT_DISABLE: If this flag is set, the effect will keep applying even if the handler's effects are negated.This property is required when the effect object in question corresponds to a condition in the card text.
 * Effect.SetRange: If the EFFECT_FLAG_SINGLE_RANGE property was added, you can specify the location(s) the handler must be in, in order for the effect to take place.
 * Effect.SetValue: While some EFFECT constants automatically have a set default value, some actually require you to manually input one in order to define their specific behaviour. You can perform this step by invoking the Effect.SetValue function.
 * Effect.SetCondition: You can add a requirement that must be satisfied in order for the effect to apply. If you do so, remember that the condition function for TYPE_SINGLE effects only has 1 parameter, according to the parameters' scheme.

Variants
There exist two other constants that can be considered as variants of EFFECT_TYPE_SINGLE, since they are used to script the same kind of effects (non-activated effects that affect a single specific card); the only difference between the constants is the card the effect will be applied to:


 * EFFECT_TYPE_EQUIP: This variant applies the effect to the monster the handler is currently equipped to (e.g. "The equipped monster gains 500 ATK/DEF"). This type of effects is mostly found on Union Monsters and Equip Spells.
 * EFFECT_TYPE_XMATERIAL: This variant applies the effect to the Xyz Monster the handler is currently attached to (e.g. "An Xyz Monster that has this card as Xyz Material gains this effect: ..."). This type of effects is mostly found on the "Zoodiac" Main Deck monsters.

Note that, since these effects can only apply in predefined locations (the Spell & Trap Zones, and while attached to a monster, respectively), you do not need to invoke the Effect.SetRange function.

EFFECT_TYPE_FIELD
TYPE_FIELD effects are Continuous Effects (or, in general, non-activated effects) that can either affect cards in a specified location(s), or affect a player(s). This constant is also used to script the Summon Monster Effects (colloquially known as "inherent Special Summons") of monsters like "Cyber Dragon".

The difference with TYPE_SINGLE effects consists in the fact that TYPE_FIELD effects are not necessarily applied to a single specific card, but they can affect any card that meets the defined requirement as long as it remains in a location(s) that is under the influence of the effect (e.g. "All LIGHT monsters your opponent controls lose 500 ATK".).

Template
The purpose of each function is explained below:

Most of the times you'll need to add other optional components as well, even though they are not strictly required in all situations:
 * Effect.SetCode: Specifies the kind of effect that will actually be applied (for instance, a stat modifier, or a protection effect). You need to pass exactly 1 EFFECT constant.
 * Effect.SetRange: Specifies the location(s) the handler must be in, in order for the effect to apply. You need to pass a LOCATION constant, or a combination of them (separated by  or  ) in case you want the handler to be able to apply the effect from multiple locations.
 * Effect.SetTargetRange: The purpose of this function changes depending on whether the effect affects cards or players.
 * In the first case, you can invoke this function to specify the location(s) that will be reached by the effect: any card that is found in these locations will, in turn, be affected by the effect. You need to pass 2 arguments, both consisting of a LOCATION constant, a combination of them, or a : the first argument represents the location(s) of the current handler's controller that will be affected, whereas the second argument represents the location(s) of their opponent. If you do not want the effect to reach a certain player's locations, you can input   when you need to pass the argument corresponding to that player.
 * In the second case, you can invoke this function to specify the player(s) that will be affected by the effect. You need to pass 2 arguments, both integer, although the only accepted inputs are either  (the player will not be affected) or   (the player will be affected). The first argument represents the player that currently controls the handler, whereas the second argument represents their opponent.


 * Effect.SetProperty: There are a few property flags that can be useful to script TYPE_SINGLE effects.
 * EFFECT_FLAG_PLAYER_TARGET: If this flag is set, the effect will affect players rather than cards.
 * EFFECT_FLAG_SET_AVAILABLE: If this flag is set, the effect will also affect cards that are face-down.
 * EFFECT_FLAG_SPSUM_PARAM: Only useful in case you are scripting an "inherent Special Summon". If this flag is set, the pair of arguments passed when invoking the  function will represent, in order, the battle position and the field the handler will be Special Summoned to.
 * Effect.SetCondition: See EFFECT_TYPE_SINGLE
 * Effect.SetTarget: If you are scripting an effect that applies to cards rather than players, you can pass a function that further specifies which types of cards are affected. In the majority of cases, the function only has 2 parameters : the parameter   denotes the TYPE_FIELD effect itself, while   represents the card that is being checked by the function to verify whether it will be affected or not.
 * Effect.SetValue: While some EFFECT constants automatically have a set default value, some actually require you to manually input one in order to define their specific behaviour.

EFFECT_TYPE_ACTIVATE
TYPE_ACTIVATE effects are activated effects that can be registered to Spells/Traps, and they are applied when the Spell/Trap they are registered to is activated. If a Spell/Trap does not have a TYPE_ACTIVATE effect registered to it, then that card cannot be activated: this means that you need to include this type of effect in your script even if the Spell/Trap does nothing when it is activated, such as some Continuous Spells.

Template
The purpose of each function is explained below:


 * Effect.SetCode: Specifies the event that needs to occur in order for the card to be activated. You need to pass exactly 1 EVENT constant. If the card can be activated in an open gamestate (in other words, it does not need any particular event to occur), you can pass.
 * Effect.SetOperation: You can pass a function that defines the behaviour of the effect that is applied when the card resolves.

As for the optional components:


 * Effect.SetDescription: You can assign a string of text to the effect. It can be useful if the card has multiple effects that can be activated at the same time, so the the player can safely choose the correct effect they intend to use.
 * Effect.SetCategory: You can set the categories the effect belongs to. You must pass a CATEGORY constant, or a combination of them.
 * Effect.SetProperty: There are a few property flags that can be useful to script TYPE_SINGLE effects.
 * EFFECT_FLAG_CARD_TARGET: If this flag is set, the effect will target.
 * EFFECT_FLAG_DELAY: Prevents the effect from missing the timing.
 * EFFECT_FLAG_DAMAGE_STEP: Allows the card/effect to be activated during the Damage Step (excluding damage calculation).
 * EFFECT_FLAG_DAMAGE_CAL: Allows the card/effect to be activated during damage calculation.
 * Effect.SetCountLimit: You can set a limitation that regulates how many times you can use/activate the card during a single turn/Duel.
 * Effect.SetHintTiming: You can set the timings during which the game asks the player whether they want to activate the card.
 * Effect.SetCondition: See EFFECT_TYPE_SINGLE.
 * Effect.SetCost: You can pass a function that defines the cost that must be paid in order for the card to be activated.
 * Effect.SetTarget: You can pass a function that defines the condition that must be satisfied for a legal activation of the card, and the procedures that are executed at the time of activation (such as targeting)

EFFECT_TYPE_IGNITION
TYPE_IGNITION effects are the exact equivalent of Ignition Effects of monsters (and Ignition-like Effects of Spells/Traps): they are Spell Speed 1 Effects that can only be activated "manually" by the controller of the handler during their own Main Phase, and only during an open gamestate (which means they cannot be chained to the activation of another card or effect, but they can only be activated as Chain Link 1).

Template
The purpose of each function is explained below:


 * Effect.SetRange: Specifies the location the handler must be in, in order for the effect to be activated. You need to pass a LOCATION constant, or a combination of them.
 * Effect.SetOperation: You can pass a function that defines the behaviour of the effect that is applied when the card resolves.

As for the optional components:


 * Effect.SetDescription: See EFFECT_TYPE_ACTIVATE.
 * Effect.SetCategory: See EFFECT_TYPE_ACTIVATE.
 * Effect.SetProperty: Usually, you will only need to set the EFFECT_FLAG_CARD_TARGET flag.
 * Effect.SetCountLimit: You can set a limitation that regulates how many times you can use/activate the effect during a single turn/Duel.
 * Effect.SetCondition: See EFFECT_TYPE_SINGLE.
 * Effect.SetCost: See EFFECT_TYPE_ACTIVATE.
 * Effect.SetTarget: See EFFECT_TYPE_ACTIVATE.

EFFECT_TYPE_QUICK_O
TYPE_QUICK effects are the exact equivalent of Quick Effects of monsters (and the Fast Effects of Traps): they are Spell Speed 2 or higher Effects that can be activated in an open gamestate and during certain closed gamestate, as outlined by the Fast Effect Timing chart.

In particular, they...:


 * 1) Can be activated in response to the activation of other cards or effects (in other words, they can be activated as Chain Link 2 or higher)
 * 2) Can be activated in response to an action that does not start a Chain (like a Normal Summon/Set, a Spell/Trap Set, an inherent Special Summon, an attack declaration, or a battle position change)
 * 3) If a player would end their current Phase, their opponent can activate a Spell Speed 2 or higher effect before that happens.

Template
The purpose of each function is explained below:


 * Effect.SetCode: Specifies the event that needs to occur in order for the effect to be activated. If the effect can be activated in an open gamestate, you can input.
 * Effect.SetRange: Specifies the location the handler must be in, in order for the effect to be activated. You need to pass a LOCATION constant, or a combination of them.
 * Effect.SetOperation: You can pass a function that defines the behaviour of the effect that is applied when the card resolves.

As for the optional components:


 * Effect.SetDescription: See EFFECT_TYPE_ACTIVATE.
 * Effect.SetCategory: See EFFECT_TYPE_ACTIVATE.
 * Effect.SetProperty: Usually, you will only need to set the EFFECT_FLAG_CARD_TARGET, EFFECT_FLAG_DAMAGE_STEP, and EFFECT_FLAG_DAMAGE_CAL flags.
 * Effect.SetCountLimit: See EFFECT_TYPE_IGNITION.
 * Effect.SetCondition: See EFFECT_TYPE_SINGLE.
 * Effect.SetCost: See EFFECT_TYPE_ACTIVATE.
 * Effect.SetTarget: See EFFECT_TYPE_ACTIVATE.

Variants
The only variant is EFFECT_TYPE_QUICK_F: the only difference is that this constant scripts a mandatory Quick Effect, rather than an optional one. Mandatory Quick Effects are not a common occurrence in the TCG/OCG, but there exist a few notorious examples (such as the effects of Doomcaliber Knight, and Light and Darkness Dragon).

Combinations of effect types
This section lists all relevant combination of multiple EFFECT_TYPES constants. Each combination listed here corresponds to a specific type of effect in the TCG/OCG. Even though there exist some combinations that are not among the ones showed below, they do not come up in the majority of cases, and will be ignored for the purposes of this page.

It is worth remembering that you can combine multiple EFFECT_TYPE constants by using the  and/or   operators.

EFFECT_TYPE_SINGLE | EFFECT_TYPE_TRIGGER_O
Before explaining what this combination actually does, it is necesarry to introduce the concept of Trigger Effects. These effects are Spell Speed 1 Effects that can be activated when a specific event occurs. Because of their low Spell Speed, they cannot be chained in response to the activation of other card effects: the only exception to this rule is when multiple Trigger Effects can be activated at the same time, in which case they form a Chain according to a specific set of rules, depending on the format (SEGOC for the TCG, and "priority rules" for the OCG).

That said, the  combination is used to script optional Trigger Effects that can be activated when a specific event involves the handler of the effect itself. For the sake of brevity, we will call these effects Single Trigger Effects.

Some practical examples are listed below:


 * "When this card is Normal or Special Summoned: You can draw 1 card."
 * "If this card is sent from the hand or Deck to the GY: You can activate this effect; each player sends the top 5 cards of their Deck to the GY".
 * "If this Fusion Summoned card is sent to the GY by a card effect: You can Special Summon this card."

As you can see, the common pattern shared by all these effects is:. If the Trigger Effect you want to script also has this same "structure", then you are likely required to use this combination of effect types.

Template
The purpose of each function is explained below:


 * Effect.SetCode: Specifies the event that needs to occur in order for the effect to be activated.
 * Effect.SetOperation: You can pass a function that defines the behaviour of the effect that is applied when the card resolves.

As for the optional components:


 * Effect.SetDescription: See EFFECT_TYPE_ACTIVATE.
 * Effect.SetCategory: See EFFECT_TYPE_ACTIVATE.
 * Effect.SetProperty: See EFFECT_TYPE_ACTIVATE. Note that these effects can usually be activated during the Damage Step, and the game handles this rule automatically: this means that you do not need to use the EFFECT_FLAG_DAMAGE_STEP / EFFECT_FLAG_DAMAGE_CAL flags.
 * Effect.SetCountLimit: See EFFECT_TYPE_IGNITION.
 * Effect.SetCondition: See EFFECT_TYPE_SINGLE.
 * Effect.SetCost: See EFFECT_TYPE_ACTIVATE.
 * Effect.SetTarget: See EFFECT_TYPE_ACTIVATE.

Variants
There exist two variants of this combination.


 * EFFECT_TYPE_SINGLE | EFFECT_TYPE_TRIGGER_F: This combination is used to script a mandatory Single Trigger Effect, rather than an optional one. Mandatory Trigger Effects never use "When..." in their activation condition, but only "If..." ; they also do not have "You can..." in their texts.
 * EFFECT_TYPE_SINGLE | EFFECT_TYPE_CONTINUOUS: This combination is used to script a non-activated effect that applies when a specific event involves its handler. They are basically the same as Single Trigger Effects, but they do not start a Chain or create Chain Links, and can also apply during a Chain's resolution.

EFFECT_TYPE_FIELD | EFFECT_TYPE_TRIGGER_O
The  combination is used to script optional Trigger Effects that fall under any of the following categories. The boldened names are not official, and are only used to better designate each category. Below each element of the list, there are also some examples of Trigger Effects belonging to the corresponding category.


 * 1) Field Trigger Effects: Trigger Effects that can be activated when a specific event involves a certain card(s), not necessarily the handler.
 * 2) * "When another monster(s) is Normal or Special Summoned (except during the Damage Step): You can draw 1 card."
 * 3) * "If an EARTH Fairy monster(s) is sent from your hand or Deck to the GY (except during the Damage Step): You can activate this effect; each player sends the top 5 cards of their Deck to the GY."
 * 4) * "If a Spell/Trap you control is destroyed: You can Special Summon this card from your hand"
 * 5) Player Trigger Effects: Trigger Effects that can be activated when a specific event involves a player(s)
 * 6) * "When you take battle damage: You can draw 1 card."
 * 7) * "If your opponent adds a card(s) from their Deck to their hand: You can activate this effect; each player sends the top 5 cards of their Deck to the GY."
 * 8) * "If the turn player Special Summons a monster(s): You can Special Summon this card from your hand"
 * 9) Phase Trigger Effects: Trigger Effects that can be activated when a specific Phase, or Step, of the turn is reached.
 * 10) * "During your Standby Phase: You can draw 1 card."
 * 11) * "At the start of your opponent's Battle Phase: You can activate this effect; each player sends the top 5 cards of their Deck to the GY."
 * 12) * "During the End Phase: You can Special Summon this card from your hand"

Template
The purpose of each function is explained below:

Most Phase Trigger Effects will require you to use EVENT_PHASE (or EVENT_PHASE_START) combined with a PHASE constant. Furthermore, you will also need to set an activation limit (at least an OPT) to prevent the effect from being perpetually activatable during that Phase.
 * Effect.SetCode: Specifies the event that needs to occur in order for the effect to be activated.
 * Effect.SetRange: Specifies the location the handler must be in when the event occurs, in order for the effect to be activated
 * Effect.SetOperation: You can pass a function that defines the behaviour of the effect that is applied when the card resolves.

As for the optional components:


 * Effect.SetDescription: See EFFECT_TYPE_ACTIVATE.
 * Effect.SetCategory: See EFFECT_TYPE_ACTIVATE.
 * Effect.SetProperty: See EFFECT_TYPE_ACTIVATE. Note that these effects, differently from Single Trigger Effects, cannot always be activated during the Damage Ste: this means that, unless the EVENT constant you used is already related to the Damage Step itself, you need to insert the EFFECT_FLAG_DAMAGE_STEP / EFFECT_FLAG_DAMAGE_CAL flags.
 * Effect.SetCountLimit: See EFFECT_TYPE_IGNITION.
 * Effect.SetCondition: See EFFECT_TYPE_SINGLE.
 * Effect.SetCost: See EFFECT_TYPE_ACTIVATE.
 * Effect.SetTarget: See EFFECT_TYPE_ACTIVATE.

Variants
There exist two variants of this combination.


 * EFFECT_TYPE_FIELD | EFFECT_TYPE_TRIGGER_F: This combination is used to script a mandatory Field / Player / Phase Trigger Effect, rather than an optional one.
 * EFFECT_TYPE_FIELD | EFFECT_TYPE_CONTINUOUS: This combination is used to script non-activated effects that can be applied in any of the situations described at the start of this paragraph (Field, Player, Phase).

EFFECT_TYPE_SINGLE | EFFECT_TYPE_FLIP
The  combination is used to script a mandatory Flip Effect. These effects can only be owned by Flip Monsters, and they activate when the handler is flipped face-up in any way (by Flip Summoning it, via a card effect, or by game and battle mechanics).

Template
As you can see, unlike regular Trigger Effects, you do not specify the triggering event, since it is already defined by the effect's type itself. The purpose of each function is explained below:


 * Effect.SetOperation: You can pass a function that defines the behaviour of the effect that is applied when the card resolves.

As for the optional components:


 * Effect.SetDescription: See EFFECT_TYPE_ACTIVATE.
 * Effect.SetCategory: See EFFECT_TYPE_ACTIVATE.
 * Effect.SetProperty: You can assign property flags to these effects, although most of the time you will only need to use EFFECT_FLAG_CARD_TARGET.
 * Effect.SetCountLimit: See EFFECT_TYPE_IGNITION.
 * Effect.SetCondition: See EFFECT_TYPE_SINGLE.
 * Effect.SetCost: See EFFECT_TYPE_ACTIVATE.
 * Effect.SetTarget: See EFFECT_TYPE_ACTIVATE.

Variants
The  variant allows you to script an optional Flip Effect, rather than a mandatory one.

EFFECT_TYPE_EXAMPLE | EFFECT_TYPE_XMATERIAL
When the  constant is used in combination to other EFFECT_TYPE constants, the effect whose type is defined by those other constants will be able to be used by the Xyz Monster the handler of this effect is currently attached to. For example:


 * : The EFFECT_TYPE_FIELD effect is gained by the Xyz Monster, not by the handler itself.
 * : The Ignition Effect is gained, and can be activated, by the Xyz Monster, but not by the handler itself.

The structure of these effects depends on the EFFECT_TYPE constants, besides, that were used. The only common trait is that you do not have to invoke the  function, since the effect can only be activated by the Xyz Monster while it is on the field, and while it has the effect's handler attached to it.
 * : The Quick Effect is gained, and can be activated, by the Xyz Monster, but not by the handler itself.
 * : The Trigger Effect is gained, and can be activated, by the Xyz Monster, but not by the handler itself.

EFFECT_TYPE_FIELD | EFFECT_TYPE_GRANT
This combination can be used to make a certain card(s) gain a specific effect, while the handler of the EFFECT_TYPE_GRANT effect is in a given location(s). This kind of effect is pretty rare, and the most recognizable example is the effect shared by the "The Weather Canvas" Continuous Spells/Traps. "The Weather" Effect Monsters in your Main Monster Zones of this card's column and its adjacent columns gain this effect.

In this section, a special nomenclature will be used:
 * (Text describing the effect granted to the aforementioned monsters)


 * Granting effect: The  effect, which grants another effect to the specified cards.
 * Granted effect: The effect that is gained by the specified cards.

Template
In the following box, I wrote the structure of an  effect that gives an Ignition Effect  to any card located in my   locations and in my opponent's   locations, while the handler is in the   location. In this scenario,  is the granting effect, while   is the granted effect The structure of the granted effect depends on its type, and you can follow any of the templates listed in this page's previous paragraphs. The only thing you need to remember is that you must not register the granted effect to any card: as you can see, I did not invoke  after I finished building.

As for the granting effect, the purpose of each function is explained below:


 * Effect.SetRange: Specifies the location the handler must be in, in order for the effect(s) to be granted.
 * Effect.SetTargetRange: Specifies the location(s) that will be reached by the granting effect: any card that is found in these locations will, in turn, be granted the effect . You need to pass 2 arguments, both consisting of a LOCATION constant, a combination of them, or a  : the first argument represents the location(s) of the current handler's controller that will be affected, whereas the second argument represents the location(s) of their opponent. If you do not want the granting effect to reach a certain player's locations, you can input   when you need to pass the argument corresponding to that player.
 * Effect.SetLabelObject: Specifies the granted effect.

As for the optional components:


 * Effect.SetProperty
 * Effect.SetCondition: See EFFECT_TYPE_SINGLE.
 * Effect.SetTarget: You can further specifiy which types of cards will receive the granted effect. The function that you need to pass must have only 2 parameters : the parameter   denotes the   effect itself, while   represents the card that is being checked by the function to verify whether it will receive the effect or not.