build_troop_page
Create a troop battle-event page from a compact trigger object—conditions, commands, and run span—then land it with add_troop_page.
Instructions
Build a troop battle-event page { conditions, list, span } from a compact trigger — no hand-built 12-field conditions object. when keys (ANDed, at least one): turn [a, b] (turn a + bX; b 0 = only turn a), enemyHpBelow [enemyIndex, pct] (0-based troop slot, NOT enemy id), actorHpBelow [actorId, pct], switch id, turnEnd true. span: battle (runs once per battle, default), turn (once per turn), moment (re-runs while the condition holds — guard it with a switch). Timing (turn-based battles): an enemy action pattern with conditionType 1 / [a, b] is chosen during turn N's input phase (troop turnCount N-1, +1) and a troop page turn [a, b] is checked once turn N's action phase starts (turnCount N), so matching [a, b] land on the same battle turn N — the page runs before anyone acts; add turnEnd: true to run it after that turn resolves instead (the classic telegraph: warn at the end of the wind-up turn, strike next turn). Turn 0 = battle start. With b > 0 use span "turn", or a "battle" page fires only once. commands come from the build_ tools (build_show_text, build_battle_command, …); the end marker is appended. Read-only: returns { page } — land it with add_troop_page (or create_troop/update_troop pages).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| span | No | How often the page may run (default battle) | |
| when | Yes | Trigger; every key given is ANDed, at least one required | |
| commands | No | The page's event commands (e.g. from build_* tools); default empty |