diff --git a/packages/chess/src/ui/__snapshots__/ParamField.snapshot.test.tsx.snap b/packages/chess/src/ui/__snapshots__/ParamField.snapshot.test.tsx.snap index 08bb4c1..9579c1e 100644 --- a/packages/chess/src/ui/__snapshots__/ParamField.snapshot.test.tsx.snap +++ b/packages/chess/src/ui/__snapshots__/ParamField.snapshot.test.tsx.snap @@ -194,198 +194,3 @@ exports[`ParamField rendering (T14 regression baseline) > set-capture-flag rende "flag": 1 }
Sets CAN_CAPTURE_OWN — the piece may capture its own color's pieces.
" `; - -exports[`ParamField rendering (T14 regression baseline) absorb-damage-with-attribute renders attr + rate 1`] = ` -"Declares that incoming damage should first deplete a user-chosen counter (rate points per damage) before touching HP. You must seed the counter itself with seed-attribute — this primitive only wires the absorb mechanic, not the charge supply.
{
- "attr": "ShieldCharges",
- "rate": 1
-}Pair with seed-attribute {attr: 'ShieldCharges', value: 3}. Each damage point consumes one charge; after 3 damage, HP starts taking hits.
{
- "attr": "ArmorPlates",
- "rate": 2
-}Each damage point consumes 2 ArmorPlates instead of HP — makes plates deplete twice as fast but with the same absorption curve.
Radiates a numeric contribution to targetAttr onto every piece within \`radius\` (Chebyshev / king-move distance — radius 1 = 8 neighbours). Recomputes after every move; pieces moving out of range lose the contribution on the next pass. Self-application is skipped. Multiple auras to the same targetAttr from different sources accumulate additively.
{
- "radius": 2,
- "targetAttr": "HpBonus",
- "delta": 1
-}Every friendly or enemy piece within 2 squares of this piece gains +1 HpBonus while in range.
{
- "radius": 1,
- "targetAttr": "RangeBonus",
- "delta": 1
-}Anyone standing next to this piece (8 neighbouring squares) gets +1 to range.
Appends one or more color-relative named directions into the piece's DirectionAdditions array, deduplicated by name. Composes with the built-in Direction Additions modifier — both write to the same fact. Valid directions: forward, backward, left, right, diagonal-fl, diagonal-fr, diagonal-bl, diagonal-br.
{
- "directions": [
- "backward"
- ]
-}Lets a pawn step backward as well as forward.
{
- "directions": [
- "forward",
- "backward",
- "left",
- "right"
- ]
-}Adds all 4 orthogonal directions in one primitive. Diagonal names are listed separately if you need them.
Reads the current numeric value of attr (0 if unset) and writes existing + delta. Delta may be negative. Composes additively with other primitives and built-in modifiers — multiple add-to-attribute primitives for the same attr simply accumulate.
{
- "attr": "HpBonus",
- "delta": 2
-}Adds 2 to whatever HpBonus is already there.
{
- "attr": "Hp",
- "delta": 1
-}Wrapped in on-turn-start, restores 1 HP to this piece at the start of its color's turn.
Branches on a condition. If true → runs every primitive in \`then\`; if false and \`else\` is set → runs \`else\`. Condition types: attr-lt (numeric less-than), attr-gt (numeric greater-than), attr-eq (exact match against string/number/boolean/null), always (unconditional then), never (forces else path only).
{
- "condition": {
- "type": "attr-lt",
- "attr": "Hp",
- "value": 2
- },
- "then": [
- {
- "kind": "set-capture-flag",
- "params": {
- "flag": 2
- }
- }
- ]
-}When Hp drops below 2, the piece gains CANNOT_BE_CAPTURED — a last-stand invulnerability.
{
- "condition": {
- "type": "always"
- },
- "then": [
- {
- "kind": "reflect-damage",
- "params": {
- "percentage": 10
- }
- }
- ]
-}Equivalent to applying reflect-damage unconditionally; useful as a template you can later tighten.
Adds delta to the piece's RangeBonus. Composes additively with the built-in Range Bonus modifier and with other modify-movement-range primitives. Delta is clamped to integer range [-7, 7]. Rook/bishop/queen sliding is extended/reduced by this amount; knight/king ranges are treated by their own pipeline.
{
- "delta": 1
-}A rook's horizontal slide reaches one square further than its baseline.
{
- "delta": -2
-}Cuts 2 squares from the piece's reach (useful for 'slowed' tokens).
Reads the existing numeric value of attr and writes existing * factor. No-op if the attribute is unset — it does NOT treat absent as 1. Use after seed-attribute or add-to-attribute when you need a baseline to scale.
{
- "attr": "Hp",
- "factor": 2
-}If the piece already has 4 HP, becomes 8 HP.
{
- "attr": "RangeBonus",
- "factor": 0.5
-}If RangeBonus is already 4, becomes 2 (rounded per attr consumer). Silently skipped if RangeBonus is unset.
Wraps nested primitives that fire when this piece captures another. Typical uses: 'vampire' lifesteal (heal on capture), stacking buffs, or power-up triggers. Fires only on actual captures, not on quiet moves.
{
- "primitives": [
- {
- "kind": "add-to-attribute",
- "params": {
- "attr": "Hp",
- "delta": 1
- }
- }
- ]
-}Every time this piece captures an enemy, it gains 1 HP. Stacks over a long game.
Wraps nested primitives that fire whenever this piece takes damage. Useful for reactive behaviours: auto-thorns, emergency buffs, or conditional transformations when HP crosses a threshold (combine with \`conditional\`).
{
- "primitives": [
- {
- "kind": "reflect-damage",
- "params": {
- "percentage": 25
- }
- }
- ]
-}When this piece takes damage, reflects 25% back to the attacker for that hit.
Wraps a list of nested primitives that fire at the start of this piece's color's turn. Use for recurring buffs/healing/debuffs tied to turn cadence. The editor's Parameter Inspector accepts the nested \`primitives\` array as JSON; copy snippets from the simpler primitives into that array.
{
- "primitives": [
- {
- "kind": "add-to-attribute",
- "params": {
- "attr": "Hp",
- "delta": 1
- }
- }
- ]
-}At the start of every turn, this piece regains 1 HP (until capped by its damage pipeline).
Reflects a percentage of incoming damage back to the attacker. Integer percent, 0-100. Multiple reflect primitives on the same piece do NOT stack — the most recent value wins. Great inside on-damaged if you want a one-time thorns reaction instead of a permanent aura.
{
- "percentage": 50
-}50% of incoming damage is dealt back to the attacker.
{
- "percentage": 100
-}Full reflection — the attacker takes whatever they dealt.
Writes { attr, value } directly onto the piece, overwriting any existing value. Use to introduce new attributes (like a custom ShieldCharges counter) or to force a baseline (e.g. set HP to an exact number regardless of inheritance). Pair with add-to-attribute / multiply-attribute to build up a final value.
{
- "attr": "Hp",
- "value": 5
-}Piece always starts with 5 HP regardless of baseline.
{
- "attr": "ShieldCharges",
- "value": 3
-}Creates a 3-charge counter. Combine with absorb-damage-with-attribute to make each charge soak one damage point.
Turns on one capture-flag bit. Flags combine (OR) so stacking multiple primitives is fine. Supported: 1 = CAN_CAPTURE_OWN (piece may capture its own color), 2 = CANNOT_BE_CAPTURED (untargetable by enemies), 4 = EN_PASSANT (piece participates in en-passant capture resolution).
{
- "flag": 2
-}Sets CANNOT_BE_CAPTURED — no enemy move can target this piece.
{
- "flag": 1
-}Sets CAN_CAPTURE_OWN — the piece may capture its own color's pieces.