Skip to content

Tutorial Field Effects

johnjohto edited this page Jul 25, 2026 · 1 revision

Tutorial: Field Effects (Weather, Hazards, Screens)

Battle-wide state as plain records on the hook machinery -- nothing hardcoded.

{
 "id": "field_effect:rain", "name": "RAIN",
 "scope": "global", "channel": "weather",
 "hooks": {"on_modify_damage": "script:rain_boost"}
}
  • Global effects hold a named channel (setting a new weather replaces the old -- replacement is the channel's semantics).
  • Side effects belong to one side and can stack (max_layers, Spikes-style) or time out (duration in turns -- the engine counts down and clears).

Handlers set and clear them with two intents: field_set("self", "field_effect:rain") and field_clear("self", "weather") -- from any ability, item, or other field effect. The effect's own hooks then run ownerless after both monsters' abilities, reading the same state() view (field.weather, self.effect.spikes, self.max_hp, self.type1, and -- on damage hooks -- move_type/move_category).

A rain that boosts water moves:

if is_attacker and move_type == "WATER" { return damage * 3 / 2 }
if is_attacker and move_type == "FIRE" { return damage / 2 }
return damage

Project Vermilion ships the full modern set (rain/sun/sand/hail, Stealth Rock, Spikes, Reflect, Light Screen) as readable examples in its overlay -- copy and adapt freely; they're original scripts.

Clone this wiki locally