Skip to content

Targeting

The target field on an action decides which side and slot the resulting Showdown volatile is registered against. The volatile’s onStart fires when the Pokémon in that slot switches in, so picking the right target is what determines who receives the effect.

target = "SELF" # default

Five modes are supported. The differences mostly matter for asymmetric effects — “I burn the foe’s lead”, “Kyogre sets rain for everyone” — where you need the volatile to attach to a side or slot that isn’t the Pokémon that triggered the match.


ModeSideSlotUse when…
SELFmatched trainer’s side0The matched Pokémon itself receives the effect. (Default.)
ALLIESmatched trainer’s side0Same as SELF in singles; in doubles/triples it’s the lead-position slot.
FOESopposing side0The opponent’s lead receives the effect at switch-in. Use for “Magmar burns the foe”, “Intimidate on send-out”, etc.
EVERYONEmatched trainer’s side0Currently equivalent to SELF (per-actor iteration). Reserved for future expansion.
FIELDmatched trainer’s side0The matched trainer’s slot, but the effect block typically uses weather / terrain for global field state.

The “side” is one of p1 or p2 — ShowdownActions resolves the matched actor’s index in the battle and uses p1 for index 0, p2 for index 1. FOES flips it.


A guard is auto-applied inside the switch-in hook so an effect doesn’t bleed onto a different Pokémon when the host switches out. The guard checks species, form, type, ability, held item, tera type, and level bounds against the switching-in Pokémon.

Whether the guard is generated depends on the target:

  • SELF, ALLIES, EVERYONE — guard is generated. The effect is identity-tied; it must only fire for the matching Pokémon.
  • FOES — no guard. The effect fires on the opposing side, where the identity check makes no sense (the foe has its own species, not yours).
  • FIELD — no guard. The effect is field-level (weather/terrain); it doesn’t matter which Pokémon is in the slot.

If you write a tier-3 showdown {} block, no guard is generated regardless of target — you control the entire effect. Add your own identity check inside the hook if your effect needs one.


Lycanroc transforms to its Dusk variant and gets a stat boost when it switches in at dusk:

id = "lycanroc_dusk"
target = "SELF"
match {
species = "lycanroc"
sugar { time = "dusk" }
}
apply {
aspect = "dusk"
boosts { spe = 1, atk = 1 }
}

The volatile registers on the trainer’s side, slot 0. When Lycanroc switches in there, the auto-guard verifies species and the effect fires.

A Magmar that burns the opponent’s lead at battle start:

id = "magmar_burn_foe"
target = "FOES"
match {
species = "magmar"
}
apply {
status = "brn"
message = "{name} radiates intense heat!"
}

The volatile registers on the opposing side, slot 0. No guard is generated — the effect should fire whoever the foe sends in, regardless of their species. pokemon.trySetStatus('brn', pokemon) will respect the foe’s type immunity (a fire-type lead can’t be burned), so you don’t have to special-case it.

A Kyogre that always sets Rain Dance on switch-in:

id = "kyogre_rain"
target = "FIELD"
match {
species = "kyogre"
}
apply {
weather = "raindance"
message = "{name} commands the storm!"
}

The volatile registers on the trainer’s side, slot 0 (same as SELF). What makes it FIELD is the conventional intent: the effect changes global field state, not anything about a specific Pokémon. The auto-guard is skipped because re-applying rain when the trainer switches their lead out and a different Pokémon in is fine — the field setter is idempotent.

In singles, ALLIES is identical to SELF. In doubles or triples, ALLIES routes the volatile to the trainer’s slot 0 (the lead position) regardless of which slot the matched Pokémon was actually in. Use it when you want a side-wide effect tied to the matcher’s team but anchored at the lead slot.

id = "team_safeguard_on_match"
target = "ALLIES"
match {
species = "clefable"
ability = "magicguard"
}
apply {
volatile = "safeguard"
}

(safeguard is a registered Showdown side condition; addVolatile on a side slot promotes it to side-level, depending on the volatile.)


target resolves to a Showdown side and slot at battle start:

  • SELF, ALLIES, EVERYONE, FIELD map to the matched trainer’s side, slot 0 (p1/p2 depending on which actor index they hold).
  • FOES maps to the other side, slot 0.

Every matched action’s effect is queued on the resolved side+slot for the duration of the battle. When the Pokémon in that slot switches in, Showdown attaches the queued volatiles and runs each one’s onStart.

In this Cobblemon environment, Showdown’s onStart re-fires on every switch-in, not just the first. That’s why sugar effects targeting SELF/ALLIES/EVERYONE come with an auto-applied guard — without it, the same effect would re-apply when the slot changes hands. FOES and FIELD skip the guard because the effect is intended to fire regardless of who’s in the slot.


If the effect is…Use
Modifying the matched Pokémon’s stats / status / aspectSELF
Targeting the opponent’s leadFOES
Setting field-wide state (weather, terrain)FIELD
A side condition you want anchored at the lead slot in doublesALLIES
You’re not sureSELF — it’s the default for a reason

EVERYONE exists as a placeholder for future expansion (multi-side effects without per-actor iteration). For now it behaves identically to SELF; don’t use it unless you specifically want the future semantics.