trigger-driven-abilities

Implements battle abilities by splitting detection listeners from trigger-driven effect listeners.

2|1|Updated Jun 28, 2026
One-click install
npx skills add https://github.com/lxsmnsyc/overwander --skill trigger-driven-abilities-lxsmnsyc
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: trigger-driven-abilities
Source: https://github.com/lxsmnsyc/overwander/tree/main/.agents/skills/trigger-driven-abilities
Command: npx skills add https://github.com/lxsmnsyc/overwander --skill trigger-driven-abilities-lxsmnsyc

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? When implementing Pokémon battle abilities in src/battle/abilities, it is easy to tangle activation detection with effect logic in one listener, producing code that is hard to test and reason about. This Skill defines when and how to split an ability into a detection listener that fires triggerAbility and a separate effect listener on UnitTriggerAbility. ## Core Features & Use Cases - Detection/effect split pattern: Detection listeners guard conditions and call triggerAbility; effect listeners ride UnitTriggerAbility at EventPriority.Exact and apply the effect using only event.source, event.ability, and closure state. - Field-presence abilities: Maintains a closure Set of on-field holders (Unnerve, Cloud Nine, Damp) via UnitEntersField/UnitLeavesField/UnitFaints so suppression checks reduce to holders.size > 0. - Inline exceptions: Documents when to keep effects inline — when the effect mutates the detection event (Shield Dust, Run Away), needs context the trigger cannot carry (Static, Pickup, Synchronize), or one ability id covers multiple effect contexts (Dry Skin). - Use Case: While refactoring Flash Fire, you move its chance roll and condition guards into the detection listener and its boost logic into a UnitTriggerAbility effect listener, keeping the visual cue firing only on real-attempt events. ## Quick Start Refactor the ability in src/battle/abilities to split its detection listener from its effect listener using the trigger-driven pattern.

Frequently Asked Questions about trigger-driven-abilities

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I implement a battle ability with separate detection and effect listeners?▼

Create a detection listener on the relevant battle event that checks activation conditions and calls event.source.triggerAbility, then add an effect listener on UnitTriggerAbility at EventPriority.Exact that matches the ability id and applies the effect to event.source.

When should an ability effect stay inline instead of using triggerAbility?▼

Keep the effect inline when it mutates the detection event (Shield Dust, Run Away), needs context the trigger event cannot carry (Static, Pickup, Synchronize), or one ability id covers multiple distinct effect contexts like Dry Skin. Fire triggerAbility only as the visual cue.

How do field-presence abilities like Unnerve or Cloud Nine track holders?▼

Keep a closure Set of on-field holders: UnitEntersField adds the holder, while UnitLeavesField, UnitFaints, and UnitRemoveAbility remove it. Suppression checks then reduce to holders.size > 0 instead of scanning every unit.

What event priority should the UnitTriggerAbility effect listener use?▼

Effect listeners on UnitTriggerAbility use EventPriority.Exact, which is the trigger's canonical resolution point. Post priority stays free for observers such as the visual layer and tests.

Why does the effect listener not need to check the unit has the ability?▼

Unit.triggerAbility already verifies the unit has the ability before firing, so the effect listener only needs to match the ability id. It may use event.source, event.ability, and closure state, but chance rolls and guards belong in detection.