enjine 0.5.0 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (120) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +146 -1
  3. data/README.md +12 -3
  4. data/SUPPORTED.md +44 -17
  5. data/docs/ARCHITECTURE.md +7 -2
  6. data/docs/MECHANICS_COVERAGE.md +10 -8
  7. data/docs/guides/api.md +2 -1
  8. data/docs/guides/card-data-format.md +40 -8
  9. data/docs/reference/abilities.md +254 -13
  10. data/docs/reference/costs.md +36 -0
  11. data/docs/reference/decisions.md +3 -1
  12. data/docs/reference/effects.md +93 -10
  13. data/docs/reference/filters.md +11 -1
  14. data/docs/reference/keywords.md +42 -0
  15. data/docs/reference/subtypes.md +18 -0
  16. data/docs/reference/triggers.md +69 -8
  17. data/docs/reference/types.md +20 -0
  18. data/lib/enjine/actions/special_action.rb +4 -0
  19. data/lib/enjine/actions/turn_face_up.rb +25 -0
  20. data/lib/enjine/actions/unlock.rb +23 -0
  21. data/lib/enjine/card_definition.rb +50 -12
  22. data/lib/enjine/card_face_down.rb +31 -0
  23. data/lib/enjine/card_faces.rb +4 -2
  24. data/lib/enjine/card_rooms.rb +86 -0
  25. data/lib/enjine/catalog.rb +9 -3
  26. data/lib/enjine/cli/text.rb +1 -0
  27. data/lib/enjine/color_identity.rb +34 -1
  28. data/lib/enjine/decisions/casting.rb +6 -3
  29. data/lib/enjine/engine/ability_layers.rb +8 -0
  30. data/lib/enjine/engine/casting/alt_casting.rb +12 -4
  31. data/lib/enjine/engine/casting/cast_choices.rb +8 -1
  32. data/lib/enjine/engine/casting/casting.rb +18 -22
  33. data/lib/enjine/engine/casting/costs.rb +8 -1
  34. data/lib/enjine/engine/casting/payment.rb +47 -9
  35. data/lib/enjine/engine/casting/permissions.rb +6 -3
  36. data/lib/enjine/engine/characteristics.rb +8 -9
  37. data/lib/enjine/engine/combat.rb +19 -7
  38. data/lib/enjine/engine/copies.rb +2 -1
  39. data/lib/enjine/engine/crimes.rb +46 -0
  40. data/lib/enjine/engine/damage.rb +36 -1
  41. data/lib/enjine/engine/face_down_permanents.rb +108 -0
  42. data/lib/enjine/engine/faces.rb +6 -3
  43. data/lib/enjine/engine/mana_sources.rb +18 -3
  44. data/lib/enjine/engine/options_memo.rb +140 -0
  45. data/lib/enjine/engine/permanent_designations.rb +29 -0
  46. data/lib/enjine/engine/resolution.rb +25 -5
  47. data/lib/enjine/engine/rooms.rb +86 -0
  48. data/lib/enjine/engine/rules.rb +2 -1
  49. data/lib/enjine/engine/state_based_actions.rb +25 -4
  50. data/lib/enjine/engine/triggers.rb +20 -5
  51. data/lib/enjine/engine/turn_history.rb +28 -5
  52. data/lib/enjine/engine/zones.rb +32 -6
  53. data/lib/enjine/engine.rb +5 -1
  54. data/lib/enjine/events.rb +9 -0
  55. data/lib/enjine/frames.rb +3 -0
  56. data/lib/enjine/fuzz.rb +3 -0
  57. data/lib/enjine/game.rb +3 -1
  58. data/lib/enjine/mechanics/abilities/cost_changes.rb +32 -10
  59. data/lib/enjine/mechanics/abilities/damage_replacements.rb +1 -1
  60. data/lib/enjine/mechanics/abilities/designated.rb +57 -0
  61. data/lib/enjine/mechanics/abilities/life_replacements.rb +74 -0
  62. data/lib/enjine/mechanics/abilities/mana_ability.rb +10 -4
  63. data/lib/enjine/mechanics/abilities/player_rules.rb +1 -1
  64. data/lib/enjine/mechanics/abilities/stack_abilities.rb +12 -7
  65. data/lib/enjine/mechanics/abilities/static.rb +18 -5
  66. data/lib/enjine/mechanics/card_spec.rb +12 -3
  67. data/lib/enjine/mechanics/costs/base.rb +3 -2
  68. data/lib/enjine/mechanics/costs/behold.rb +10 -3
  69. data/lib/enjine/mechanics/costs/choose_creature_type.rb +3 -3
  70. data/lib/enjine/mechanics/costs/collect_evidence.rb +60 -0
  71. data/lib/enjine/mechanics/costs/exile_permanent.rb +41 -0
  72. data/lib/enjine/mechanics/effects/base.rb +26 -5
  73. data/lib/enjine/mechanics/effects/choose_cards.rb +44 -14
  74. data/lib/enjine/mechanics/effects/copy.rb +2 -2
  75. data/lib/enjine/mechanics/effects/counters.rb +12 -6
  76. data/lib/enjine/mechanics/effects/delayed_triggers.rb +13 -6
  77. data/lib/enjine/mechanics/effects/may.rb +4 -2
  78. data/lib/enjine/mechanics/effects/pay.rb +20 -6
  79. data/lib/enjine/mechanics/filters/any_target.rb +6 -3
  80. data/lib/enjine/mechanics/filters/base.rb +14 -5
  81. data/lib/enjine/mechanics/filters/permanents.rb +7 -0
  82. data/lib/enjine/mechanics/keywords/alternative_costs.rb +70 -16
  83. data/lib/enjine/mechanics/keywords/cards_have.rb +4 -2
  84. data/lib/enjine/mechanics/keywords/craft.rb +132 -0
  85. data/lib/enjine/mechanics/keywords/cycling.rb +46 -7
  86. data/lib/enjine/mechanics/keywords/extort.rb +2 -0
  87. data/lib/enjine/mechanics/keywords/face_down.rb +165 -0
  88. data/lib/enjine/mechanics/keywords/impending.rb +75 -0
  89. data/lib/enjine/mechanics/keywords/increment.rb +2 -0
  90. data/lib/enjine/mechanics/keywords/infinity.rb +46 -0
  91. data/lib/enjine/mechanics/keywords/miracle.rb +142 -0
  92. data/lib/enjine/mechanics/keywords/ninjutsu.rb +101 -0
  93. data/lib/enjine/mechanics/keywords/offspring.rb +48 -0
  94. data/lib/enjine/mechanics/keywords/persist_and_undying.rb +42 -0
  95. data/lib/enjine/mechanics/keywords/split_second.rb +29 -0
  96. data/lib/enjine/mechanics/keywords/storm_and_cascade.rb +5 -0
  97. data/lib/enjine/mechanics/keywords/void.rb +34 -0
  98. data/lib/enjine/mechanics/linked.rb +2 -2
  99. data/lib/enjine/mechanics/mana_spent.rb +1 -1
  100. data/lib/enjine/mechanics/selector.rb +30 -9
  101. data/lib/enjine/mechanics/subtypes/case.rb +68 -0
  102. data/lib/enjine/mechanics/triggers/base.rb +13 -4
  103. data/lib/enjine/mechanics/triggers/crime.rb +28 -0
  104. data/lib/enjine/mechanics/triggers/damage.rb +33 -18
  105. data/lib/enjine/mechanics/triggers/draw_and_discard.rb +19 -6
  106. data/lib/enjine/mechanics/triggers/rooms.rb +49 -0
  107. data/lib/enjine/mechanics/triggers/zone_changes.rb +24 -9
  108. data/lib/enjine/mechanics/types/battle.rb +130 -0
  109. data/lib/enjine/mechanics/values.rb +74 -27
  110. data/lib/enjine/replacements.rb +18 -0
  111. data/lib/enjine/rules_monitor.rb +49 -75
  112. data/lib/enjine/snapshot/deep_copy.rb +23 -0
  113. data/lib/enjine/snapshot/player_checks.rb +10 -2
  114. data/lib/enjine/snapshot.rb +2 -1
  115. data/lib/enjine/state.rb +2 -2
  116. data/lib/enjine/verify.rb +10 -3
  117. data/lib/enjine/version.rb +1 -1
  118. data/lib/enjine/view.rb +49 -13
  119. data/lib/enjine.rb +1 -1
  120. metadata +29 -1
data/docs/ARCHITECTURE.md CHANGED
@@ -52,21 +52,26 @@ lib/enjine/
52
52
  characteristics.rb # CR 613 layer pipeline for P/T, continuous effects, cleanup
53
53
  rules.rb copies.rb faces.rb ... # player rules and control; copies (CR 707); faces; sagas, phasing, speed ...
54
54
  commander.rb # CR 903 (Duel Commander): command zone, tax, 903.9 returns, commander damage
55
+ face_down_permanents.rb # CR 708: face-down spells and permanents (manifest, cloak, morph, disguise), turning up
56
+ rooms.rb permanent_designations.rb crimes.rb # CR 709.5 doors; solved/harnessed designations; CR 700.13 crimes
57
+ options_memo.rb # per-decision memo and quick nos while legal options are computed (same answers)
55
58
  steps.rb # 12 step objects with turn-based actions
56
59
  events.rb # typed, serializable events + per-viewer redaction
57
60
  decisions/ # one class per decision kind
58
61
  priority play_or_draw mulligan bottom discard casting(choose_target, pay_cost) combat(...)
59
62
  actions/ # options offered at priority
60
- pass play_land activate_mana_ability cast(cast, activate)
61
- snapshot.rb # export/import + full consistency validation (also the fuzz invariant)
63
+ pass play_land activate_mana_ability cast(cast, activate) turn_face_up unlock
64
+ snapshot.rb snapshot/deep_copy.rb # export/import + full consistency validation (also the fuzz invariant)
62
65
  view.rb history.rb # per-viewer views and histories
63
66
 
64
67
  # ---- tooling (no game logic) ----
65
68
  docs.rb # generates docs/reference/*.md + SUPPORTED.md from the Registry
66
69
  agents/random.rb fuzz.rb # random legal player, invariant-checking fuzzer
70
+ rules_monitor.rb verify.rb # independent rules checks during play; --verify play-tests a folder of cards
67
71
  cli.rb cli/text.rb # interactive hot-seat CLI + text renderer, --validate
68
72
  deck_builder.rb # OPT-IN random constructed decks from a card pool
69
73
  exe/enjine
74
+ script/determinism_digest.rb # per-game digests of seeded games: a speedup must leave them unchanged
70
75
  examples/ # ready-to-play decks and a card pool (not in the gem)
71
76
  spec/ unit/ integration/ e2e/ support/scenario.rb fixtures/cards/ (the test and fuzz cards)
72
77
  docs/ DESIGN.md ARCHITECTURE.md MECHANICS_COVERAGE.md SUPPORTED.md(root) reference/ guides/
@@ -21,16 +21,18 @@ Comprehensive Rules (measured by the rule numbers the code implements and cites,
21
21
  | --- | --- |
22
22
  | Core game rules (CR 1–6: turns, priority, the stack, casting, combat, state-based actions, layers, replacement and prevention, copies) | essentially complete for two players |
23
23
  | Mechanics on Standard-legal cards (14 sets, Foundations to Star Trek) | the goal; nearly all can be written today, with the remaining gaps listed per set in [plans/standard.md](plans/standard.md#mechanics-gaps) |
24
- | Keyword actions (CR 701), all of Magic's history | about half (36 of 71), including every one used in Standard |
25
- | Keyword abilities (CR 702), all of Magic's history | about a third (62 of 195), including every one used in Standard |
26
- | Special card rules (CR 703–734) | those Standard uses: double-faced, meld, Sagas, Adventures, Classes, Omens, station, prepare, coin flips and dice, ending the turn |
24
+ | Keyword actions (CR 701), all of Magic's history | more than half (about 40 of 71), including every one used in Standard, plus manifest, manifest dread, cloak and collect evidence |
25
+ | Keyword abilities (CR 702), all of Magic's history | over a third (about 70 of 195), including every one used in Standard, plus split second, persist, undying, miracle, ninjutsu, morph, disguise, craft, offspring and impending |
26
+ | Special card rules (CR 703–734) | those Standard uses: double-faced, meld, Sagas, Adventures, Classes, Omens, station, prepare, coin flips and dice, ending the turn; also face-down spells and permanents (708), Rooms (709.5) and Cases (720) |
27
27
 
28
28
  **Not supported:**
29
- - Mechanics found only on cards outside Standard, for example morph and other
30
- face-down cards (CR 708), madness, delve, persist, undying, infect, toxic,
31
- ninjutsu, cumulative upkeep, echo, bestow, mutate, split and flip cards,
32
- levelers, Prototype, Cases, day/night, the monarch and the initiative.
33
- - Battles and dungeons; multiplayer and casual variants (multiplayer Commander,
29
+ - Mechanics found only on cards outside Standard, for example madness, delve,
30
+ infect, toxic, cumulative upkeep, echo, bestow, mutate, megamorph, split and
31
+ flip cards, levelers, Prototype, day/night, the monarch and the initiative.
32
+ - Partly supported: face-down cards (no megamorph, non-mana morph costs or
33
+ "as this is turned face up"), Rooms (no effects that lock or unlock doors),
34
+ miracle (the reveal is automatic).
35
+ - Dungeons; multiplayer and casual variants (multiplayer Commander,
34
36
  Planechase, Archenemy, Conspiracy); ante; matches and sideboarding. Two-player
35
37
  **Duel Commander** is supported (CR 903, see below).
36
38
 
data/docs/guides/api.md CHANGED
@@ -563,7 +563,8 @@ More in the [deck builder guide](deck-builder.md).
563
563
  `Enjine::RulesMonitor` is an independent rules checker: it re-derives from raw
564
564
  state and events what must be true after each decision (life totals, mana
565
565
  emptying, lethal damage, summoning sickness, land plays, P/T, ...), without using
566
- the engine's rules code.
566
+ the engine's rules code. What each permanent is (types, keywords, abilities: layers
567
+ 1-6) it reads from the engine's layer pass; layer 7 power/toughness it recomputes.
567
568
 
568
569
  ```ruby
569
570
  monitor = Enjine::RulesMonitor.new(game)
@@ -39,7 +39,8 @@ Tips:
39
39
  report) is normalized and round-trips exactly.
40
40
  - **Record the printing, not a vendor id.** The set code and collector number printed on
41
41
  the card (`trk`, `12`) can be looked up in any card source.
42
- - **Multi-face cards** (split, adventure, MDFC, transform) aren't modelled yet.
42
+ - **Multi-face cards** (transform, modal double-faced, adventure, omen, prepare, meld,
43
+ Rooms) have a `layout` and `faces` (section 4.17).
43
44
 
44
45
  ---
45
46
 
@@ -52,10 +53,11 @@ Tips:
52
53
  | `mana_cost` | castable cards | string | `"{2}{W}{W}"`. Symbols: `{N}` generic, `{W}{U}{B}{R}{G}`, `{C}`, `{X}` (announced while casting; use the amount `"x"` in effects, see 4.7). Lands must **not** have one. A card without one can't be cast. Two-color hybrid `{R/G}` is supported (paid with either color, CR 107.4e), and so is monocolored hybrid `{2/B}` (one black mana or two mana of any type; mana value 2, CR 202.3f); Phyrexian and `{S}` are not yet. |
53
54
  | `supertypes` | no | list | `basic` (exempt from the 4-copy rule). `legendary` and `snow`: not yet. |
54
55
  | `subtypes` | no | list | Lowercase, spaces become `_`: `["human", "wizard"]`. Free-form labels, except the basic land types `plains island swamp mountain forest`, which grant their mana ability automatically (CR 305.6) and are valid only on lands. |
55
- | `keywords` | no | list | Keyword abilities, lowercase: see `SUPPORTED.md` → *Keyword abilities*. |
56
+ | `keywords` | no | list | Keyword abilities, lowercase: see `SUPPORTED.md` → *Keyword abilities*. A keyword listed twice is one instance (redundant, CR 702.2f), except where each instance triggers separately: `cascade`, `storm`, `extort` and `increment` get one ability per listing ("cascade, cascade" is `["cascade", "cascade"]`, CR 702.85c). |
56
57
  | `power`, `toughness` | creatures | integer or amount | Required for creatures; not allowed on other types. A `*` defined by the card ("power is equal to the number of …", CR 604.3) is an amount, see 4.10. |
57
58
  | `colors` | no | list | `W U B R G`. Only for a color indicator or a token's colors (CR 202.2e, 111.3); otherwise colors come from the mana cost. |
58
59
  | `loyalty` | planeswalkers | integer | Starting loyalty. |
60
+ | `defense` | battles | integer | Printed defense: it enters with that many defense counters (CR 310.4). A battle needs the subtype `siege` (its protector is an opponent; defeated, it exiles itself and its controller may cast its back face free, CR 310.12), so write a Siege as a `transform` card with the battle on the front face. |
59
61
  | `abilities` | no | list | Section 4. |
60
62
  | `rules_text` | no | string | Informational only (shown in the CLI). Never interpreted. |
61
63
  | `deck_limit` | no | `"any"` or integer | CR 100.2a exception: "A deck can have any number of cards named ~" is `"deck_limit": "any"`; "up to seven cards named ~" is `7`. Without it a deck may hold four (basic lands: any number). |
@@ -275,7 +277,7 @@ whose qualities must all match:
275
277
  | `{ "target": 0 }` | "target …" (the 1st declared target; `1` is the 2nd, …) |
276
278
  | `"you"` | "you" ("you gain 3 life", "draw a card") |
277
279
  | `"each_opponent"` | "each opponent" |
278
- | `"self"` | "this creature" / the card's own name, on a permanent; "this card" for an ability that works from a graveyard, exile or a hand ("{4}{B}: Return this card from your graveyard to the battlefield tapped") |
280
+ | `"self"` | "this creature" / the card's own name, on a permanent; "this card" for an ability that works from a graveyard, exile or a hand ("{4}{B}: Return this card from your graveyard to the battlefield tapped"); in its own leaves-the-battlefield trigger, the card in the public zone it went to while it's still there ("When this dies, exile it", CR 400.7e). Amounts (`{ "power": "self" }`, `{ "counters": { "of": "self" } }`) still read the permanent as it last existed |
279
281
  | `"attached"` | "equipped creature" / "enchanted creature", on an Equipment or Aura |
280
282
  | `{ "each": "creature", "controller": "you" }` | "creatures you control", "each creature you control" |
281
283
  | `{ "each": "creature", "controller": "opponent" }` | "creatures your opponents control" |
@@ -288,8 +290,14 @@ whose qualities must all match:
288
290
  Every effect records the objects it moved or created (the new object ids, CR 400.7).
289
291
  A later effect of the same effect list names them with `{ "result": n }`, where `n`
290
292
  is the earlier effect's index (inside a mode: the index within that mode's list).
291
- Lists nested in a `may` or a `delayed_trigger` see the results of their parent's
292
- earlier effects.
293
+ Lists nested in an effect (`may`, `pay`, `choose_cards`, `reflexive_trigger`,
294
+ `delayed_trigger`) see the results of their parent's earlier effects, and number their own
295
+ after them: in a list nested in effect `i`, `{ "result": n }` (and `{ "this_way": n }`) with
296
+ `n < i` is the parent's effect `n`, and `i + j` is the nested list's own effect `j`. A `may`'s
297
+ `effects` and `then` share one numbering (`then` follows `effects`); `otherwise` starts again
298
+ at `i`. ("You may sacrifice a creature. If you do, you gain life equal to its power", as effect 0:
299
+ `{ "may": { "effects": [{ "sacrifice_choice": { "filter": "creature" } }], "then": [{ "gain_life":
300
+ { "amount": { "power": { "result": 0 } } } }] } }`.) Only `repeat` restarts at 0 for each pass.
293
301
 
294
302
  ```json
295
303
  [{ "exile": { "to": { "target": 0 } } },
@@ -325,7 +333,7 @@ is a flicker ("exile …, then return it to the battlefield under its owner's co
325
333
  | a nonland card name chosen as it enters / spells or sources with that name | ability `{ "choose_card_name": { "not": ["land"] } }` / `"name": "chosen"` on `cast` or `activates_ability` |
326
334
  | triggers at most once per turn | `"limit": "once_each_turn"` on the `triggered` ability |
327
335
  | a triggered ability that works from the graveyard ("return this card from your graveyard") | `"zone": "graveyard"` on the `triggered` ability (CR 113.6k) |
328
- | "that creature", "that player", "that many" | selectors `{ "triggering": "object" }`, `{ "triggering": "player" }`, amount `{ "triggering": "amount" }` |
336
+ | "that creature", "that player", "that many" | selectors `{ "triggering": "object" }`, `{ "triggering": "player" }`, amount `{ "triggering": "amount" }`. A permanent that left the battlefield is read as it last existed by amounts: "the +1/+1 counters it had" is `{ "counters": { "of": { "triggering": "object" }, "kind": "+1/+1" } }`, and `power`, `toughness` and `mana_value` likewise (CR 603.10a) |
329
337
  | the triggering spell is a Saga | condition `{ "triggering": { "spell": { "subtypes": ["saga"] } } }` |
330
338
  | the targeted creature dying later this turn | `{ "delayed_trigger": { "when": { "dies": { "subject": "watched" } }, "watch": { "target": 0 }, "this_turn": true, "effects": [...] } }`; effects name the watched objects with the selector `"watched"` |
331
339
  | each of your creatures entering for the rest of the turn | `delayed_trigger` with `"this_turn": true` (it triggers each time until the turn ends) |
@@ -926,6 +934,27 @@ Not yet: casting another face from outside the hand, casting a card transformed,
926
934
  value of a back face (CR 202.3b), day/night (CR 702.145), meld (CR 713), convert
927
935
  (CR 701.28) and an "as this enters" choice on a modal card's land face.
928
936
 
937
+ ### 4.17a Rooms, Cases, Infinity cards, face-down permanents, ninjutsu and crimes
938
+
939
+ | Oracle words | Data |
940
+ | --- | --- |
941
+ | A Room (two doors, CR 709.5) | `"layout": "room"`, `"faces": [left door, right door]`; each door has its own `name`, `mana_cost` and `abilities` and the same `types`/`subtypes` (`["enchantment"]`, `["room"]`). Off the battlefield the card has both halves combined (mana value of both); it's cast as one door (`{type: "cast", object, face: 1 \| 2}`); the permanent has only its unlocked doors (both locked: no name, mana value 0). Unlocking is the special action `{type: "unlock", object, door: "left" \| "right"}` |
942
+ | "When you unlock this door" | `{ "triggered": { "when": { "unlocks_door": {} }, … } }` on that door (it also triggers when that door is cast) |
943
+ | "Whenever you fully unlock a Room" | `"when": { "unlocks_door": { "door": "any", "fully": true, "subject": { "each": "permanent", "controller": "you" } } }` |
944
+ | "To solve — [condition]" (CR 720.3a) | `{ "to_solve": condition }`, e.g. `{ "to_solve": { "amount": { "life_gained_this_turn": "you" }, "at_least": 5 } }` |
945
+ | "Solved — [ability]" (CR 702.169) | `{ "solved": { "activated" \| "triggered" \| "static": { … } } }`; condition `{ "solved": true }` |
946
+ | "Harness [this]" / "∞ — [ability]" (CR 701.64, 702.186) | effect `{ "harness": {} }`; `{ "infinity": { "triggered" \| "activated" \| "static": { … } } }`; condition `{ "harnessed": true }` |
947
+ | "Exile a creature you control" (a cost) | `{ "exile_permanent": { "filter": "creature" } }` (`other`, `count`) |
948
+ | "Ninjutsu {1}{U}" (CR 702.49) | `{ "ninjutsu": { "cost": "{1}{U}" } }`: activated from the hand once blockers are declared; the card enters tapped and attacking (not cast) |
949
+ | "Manifest the top card of your library" / "cloak" / "manifest dread" | effects `{ "manifest": {} }`, `{ "cloak": {} }` (`amount`, `to`: players), `{ "manifest_dread": {} }`; the new permanents are the effect's results (`{ "result": n }`) |
950
+ | "Morph {cost}" / "Disguise {cost}" | `{ "morph": { "cost": "{1}{G}" } }` / `{ "disguise": { "cost": "{4}{G}" } }`: cast face down for {3} (`via: "alt:<ref>"`), turned face up for `cost` |
951
+ | "When this creature is turned face up" | `"when": { "turned_face_up": {} }`; special action `{type: "turn_face_up", object, via: "mana_cost" \| "morph" \| "disguise"}` |
952
+ | "if a permanent entered the battlefield face down under your control this turn" / "you turned a permanent face up this turn" | amounts `{ "entered_face_down_this_turn": "you" }`, `{ "turned_face_up_this_turn": "you" }` |
953
+ | "Whenever you commit a crime" (CR 700.13) | `"when": { "commits_crime": {} }` (`controller`: you \| opponent \| any); amount `{ "crimes_this_turn": "you" }` |
954
+
955
+ Not yet: effects that unlock or lock a door, an "as this is turned face up" replacement (CR 708.11), megamorph's
956
+ counter, morph costs other than mana, and turning a face-down permanent face up with an effect.
957
+
929
958
  ### 4.18 Mana spent to cast a spell (converge)
930
959
 
931
960
  The mana paid for a spell is recorded by type as it is paid (CR 601.2h), and the permanent the
@@ -1582,7 +1611,10 @@ It must be a legendary creature, Vehicle, or Spacecraft with power and toughness
1582
1611
  (CR 903.3). There is one copy of each card, except basic lands (CR 903.5b), and
1583
1612
  every card's **color identity** must be inside the commander's (CR 903.5c). A card's
1584
1613
  identity is the colors of every mana symbol in its data (mana cost, ability costs,
1585
- produced mana, kicker, and so on), plus `colors`, the colors of its basic land types
1614
+ produced mana, kicker, and so on; a mana choice among some colors, `"color": "any_one",
1615
+ "colors": ["B", "G"]`, counts as "{B} or {G}", while mana of the chosen color counts nothing:
1616
+ `"color": "chosen"` and a fixed color gated by `"only_if": { "chosen": "<that color>" }`, as on a
1617
+ Thriving land), plus `colors`, the colors of its basic land types
1586
1618
  (CR 903.5d) and those of all its faces (CR 903.4d–e). `rules_text` is never read
1587
1619
  (reminder text doesn't count, CR 903.4c). For the odd card whose identity the data
1588
1620
  can't show, a card or face may state it with `"color_identity"`.
@@ -1600,7 +1632,7 @@ bundle exec exe/enjine --validate cards.json
1600
1632
  `cards.json` is a JSON array of card blocks (or a single block). The report:
1601
1633
 
1602
1634
  ```json
1603
- { "rules_version": "2026-11-06", "engine_version": "0.3.0",
1635
+ { "rules_version": "2026-11-06", "engine_version": "0.6.0",
1604
1636
  "valid": [ { "index": 0, "id": "lightning_bolt", "name": "Lightning Bolt", "card": { ...canonical... } } ],
1605
1637
  "invalid": [ { "index": 1, "name": "Gale Drifter", "errors": ["keywords[0]: unknown keyword \"flyng\" ..."] } ] }
1606
1638
  ```
@@ -20,7 +20,7 @@ Rules: CR 602.1, CR 602.2, CR 602.5b, CR 602.5d, CR 702.177a, CR 702.193a, CR 70
20
20
  | `power_up` | true: "Power-up — [cost]: [effect]" (CR 702.193a) |
21
21
  | `boast` | true: "Boast — [cost]: [effect]" (CR 702.142a) |
22
22
  | `zone` | "exile" | "graveyard" | "hand" (CR 113.6b; default: the battlefield, or the zone a cost moves the card from) |
23
- | `cost_reduction` | {"amount": amount, "if": condition}: "this ability costs {N} less to activate" (CR 601.2f, 602.2b) |
23
+ | `cost_reduction` | {"amount": amount, "if": condition}: "this ability costs {N} less to activate" (CR 601.2f, 602.2b); the amount may name its targets ({"target": 0}) |
24
24
 
25
25
  ```json
26
26
  {
@@ -206,7 +206,7 @@ Rules: CR 702.26a, CR 502.1, CR 604.1
206
206
 
207
207
  ## cards_have
208
208
 
209
- While this permanent is on the battlefield, cards you own in `zone` (graveyard (default), hand or exile) matching `cards` have the keyword alternative cost `ability` (flashback, harmonize, mayhem, web_slinging or sneak) and may be cast with it from that zone. Cast option `via: "alt:cards_have:<permanent>:<ref>"`.
209
+ While this permanent is on the battlefield, cards you own in `zone` (graveyard (default), hand or exile) matching `cards` have the keyword alternative cost `ability` (flashback, harmonize, mayhem, web_slinging, sneak or miracle) and may be cast with it from that zone. Cast option `via: "alt:cards_have:<permanent>:<ref>"`.
210
210
 
211
211
  Rules: CR 611.3a, CR 604.1, CR 118.9, CR 601.2b, CR 702.190a
212
212
 
@@ -436,7 +436,7 @@ Rules: CR 717.2a, CR 717.2b, CR 717.2d, CR 717.3, CR 602.5d
436
436
 
437
437
  ## cost_modifier
438
438
 
439
- While on the battlefield: spells cast by `caster` (you, opponent or any; default you) whose card types match `spells` ({"any_of": [types], "not": [types]}, default all spells; `subtypes` and `colors` narrow it: "Dragon spells", "red spells") cost `reduce` less or `increase` more generic mana. `from` / `not_from`: only spells cast from (not from) that zone (hand | graveyard | exile | library | outside).
439
+ While on the battlefield: spells cast by `caster` (you, opponent or any; default you) whose card types match `spells` ({"any_of": [types], "not": [types]}, default all spells; `subtypes`, `colors` and `name` narrow it: "Dragon spells", "red spells"; `"subtypes": "chosen"`: of the type chosen for this permanent, `"name": "chosen"`: with the name its source chose) cost `reduce` less or `increase` more generic mana. `from` / `not_from`: only spells cast from (not from) that zone (hand | graveyard | exile | library | outside).
440
440
 
441
441
  Rules: CR 601.2f, CR 118.7a, CR 604.1, CR 601.2a
442
442
 
@@ -484,6 +484,32 @@ Rules: CR 601.2f, CR 118.7a, CR 702.41a
484
484
  }
485
485
  ```
486
486
 
487
+ ## craft
488
+
489
+ Craft with `materials` `cost`: pay `cost`, exile this permanent and exile the materials (`count` (default 1) permanents you control and/or cards in your graveyard matching the card spec `card`; `or_more: true`: that many or more), chosen with `choose_cost`: return this card to the battlefield transformed under its owner's control. Sorcery speed. The exiled materials are the selector "exiled_for_cost".
490
+
491
+ Rules: CR 702.167a, CR 702.167b, CR 702.167c, CR 712.11a, CR 602.2b, CR 406.1
492
+
493
+ | Parameter | Description |
494
+ | --- | --- |
495
+ | `cost` | mana cost string, or a list of costs |
496
+ | `materials` | {"card": card spec, "count": n, "or_more": true} |
497
+
498
+ ```json
499
+ {
500
+ "craft": {
501
+ "cost": "{3}{W}",
502
+ "materials": {
503
+ "card": {
504
+ "types": [
505
+ "artifact"
506
+ ]
507
+ }
508
+ }
509
+ }
510
+ }
511
+ ```
512
+
487
513
  ## crew
488
514
 
489
515
  Crew N: tap any number of other untapped creatures you control with total power N or more (chosen one at a time; `done` once the total is enough): this permanent becomes an artifact creature until end of turn. A Vehicle has its printed power and toughness only while it's a creature.
@@ -504,13 +530,13 @@ Rules: CR 702.122a, CR 702.122b, CR 702.122e, CR 301.7, CR 301.7a, CR 301.7b, CR
504
530
 
505
531
  ## cycling
506
532
 
507
- Cycling: pay `cost` and discard this card from your hand to draw a card. With `for` it is typecycling: instead search your library for a card matching `for`, reveal it, put it into your hand, then shuffle.
533
+ Cycling: pay `cost` and discard this card from your hand to draw a card. With `for` it is typecycling: instead search your library for a card matching `for`, reveal it, put it into your hand, then shuffle. `cost` is a mana cost string (it may hold {X}, announced as it's activated) or a list of costs (`[{"pay_life": 2}]`). "When you cycle this card" is a triggered ability with `zone: "graveyard"` and the trigger `{"cycles": {"self": true}}`; its X is the cycling ability's.
508
534
 
509
- Rules: CR 702.29a, CR 702.29b, CR 702.29e, CR 702.29f, CR 113.6m, CR 602.2a
535
+ Rules: CR 702.29a, CR 702.29b, CR 702.29c, CR 702.29d, CR 702.29e, CR 702.29f, CR 113.6m, CR 602.2a, CR 107.3
510
536
 
511
537
  | Parameter | Description |
512
538
  | --- | --- |
513
- | `cost` | mana cost string, e.g. "{2}" |
539
+ | `cost` | mana cost string, e.g. "{2}" or "{X}{G}{G}", or a list of costs |
514
540
  | `for` | optional card spec for typecycling (see search_library) |
515
541
 
516
542
  ```json
@@ -628,6 +654,24 @@ Rules: CR 702.82a, CR 702.82b, CR 702.82c, CR 614.12, CR 701.21a
628
654
  }
629
655
  ```
630
656
 
657
+ ## disguise
658
+
659
+ Disguise: you may cast this card face down as a nameless colorless 2/2 creature spell with ward {2} by paying {3} rather than its mana cost (cast option `via: "alt:<ref>"`). Any time you have priority you may turn the face-down permanent face up by paying `cost` (special action `{type: "turn_face_up", via: "disguise"}`).
660
+
661
+ Rules: CR 702.168a, CR 702.168b, CR 702.168c, CR 702.168d, CR 708.2, CR 708.4, CR 708.8, CR 116.2b
662
+
663
+ | Parameter | Description |
664
+ | --- | --- |
665
+ | `cost` | mana cost string: the cost to turn it face up |
666
+
667
+ ```json
668
+ {
669
+ "disguise": {
670
+ "cost": "{4}{G}"
671
+ }
672
+ }
673
+ ```
674
+
631
675
  ## double_counters
632
676
 
633
677
  While this permanent is on the battlefield, if its controller would put one or more counters (only `counter`, if given) on a permanent matching `affects` ({"each": filter, "controller": you|opponent|any}, relative to this permanent's controller), the number put is doubled. This includes counters a permanent enters with.
@@ -969,13 +1013,13 @@ Rules: CR 705.3, CR 604.1
969
1013
 
970
1014
  ## flashback
971
1015
 
972
- Flashback: you may cast this instant or sorcery card from your graveyard by paying `cost` rather than its mana cost; then it's exiled whenever it would leave the stack. `cost` is a mana cost string or a list of costs (`[{"mana": "{1}{U}"}, {"tap_permanents": {"count": 3}}]`). Cast option `via: "alt:<ref>"`.
1016
+ Flashback: you may cast this instant or sorcery card from your graveyard by paying `cost` rather than its mana cost; then it's exiled whenever it would leave the stack. `cost` is a mana cost string or a list of costs (`[{"mana": "{1}{U}"}, {"tap_permanents": {"count": 3}}]`), or `"mana_cost"`: the card's own mana cost ("its flashback cost is equal to its mana cost", e.g. granted with `grant_ability`). Cast option `via: "alt:<ref>"`.
973
1017
 
974
- Rules: CR 702.34a, CR 118.9, CR 601.2b, CR 601.2f, CR 601.2h
1018
+ Rules: CR 702.34a, CR 118.9, CR 118.6, CR 601.2b, CR 601.2f, CR 601.2h
975
1019
 
976
1020
  | Parameter | Description |
977
1021
  | --- | --- |
978
- | `cost` | mana cost string, or a list of costs |
1022
+ | `cost` | mana cost string, a list of costs, or "mana_cost" |
979
1023
 
980
1024
  ```json
981
1025
  {
@@ -1079,6 +1123,58 @@ Rules: CR 702.75a, CR 406.3, CR 607.2a
1079
1123
  }
1080
1124
  ```
1081
1125
 
1126
+ ## impending
1127
+
1128
+ Impending `amount`—`cost`: you may cast this card by paying `cost` rather than its mana cost. If you do, it enters with `amount` time counters, and while its impending cost was paid and it has a time counter on it, it isn't a creature. At the beginning of your end step, remove a time counter from it (a triggered ability that comes with the keyword). Cast option `via: "alt:<ref>"`; `{"cast_with": "impending"}` reads it.
1129
+
1130
+ Rules: CR 702.176a, CR 118.9, CR 601.2b, CR 601.2f, CR 601.2h, CR 613.1d, CR 613.6, CR 122.6
1131
+
1132
+ | Parameter | Description |
1133
+ | --- | --- |
1134
+ | `amount` | integer >= 1: the time counters |
1135
+ | `cost` | mana cost string, or a list of costs |
1136
+
1137
+ ```json
1138
+ {
1139
+ "impending": {
1140
+ "amount": 4,
1141
+ "cost": "{1}{G}{G}"
1142
+ }
1143
+ }
1144
+ ```
1145
+
1146
+ ## infinity
1147
+
1148
+ An Infinity card's "∞ — [ability]": one static, triggered or activated ability that works only while this permanent is harnessed. Condition `{"harnessed": true}` reads the designation.
1149
+
1150
+ Rules: CR 702.186a, CR 702.186b, CR 701.64b
1151
+
1152
+ | Parameter | Description |
1153
+ | --- | --- |
1154
+ | `(ability)` | {"static" | "triggered" | "activated": {...}} |
1155
+
1156
+ ```json
1157
+ {
1158
+ "infinity": {
1159
+ "triggered": {
1160
+ "when": {
1161
+ "step_begins": {
1162
+ "step": "upkeep",
1163
+ "whose": "your"
1164
+ }
1165
+ },
1166
+ "effects": [
1167
+ {
1168
+ "draw": {
1169
+ "amount": 1
1170
+ }
1171
+ }
1172
+ ]
1173
+ }
1174
+ }
1175
+ }
1176
+ ```
1177
+
1082
1178
  ## kicker
1083
1179
 
1084
1180
  Kicker: as you cast this spell you may also pay `cost` (mana and/or chosen costs such as `sacrifice_permanent`). The spell is then kicked: `{"kicked": true}` conditions hold and its `kicked_targets` are used.
@@ -1101,6 +1197,28 @@ Rules: CR 702.33a, CR 702.33d, CR 702.33g, CR 601.2b, CR 601.2f, CR 601.2h
1101
1197
  }
1102
1198
  ```
1103
1199
 
1200
+ ## life_gain_replacement
1201
+
1202
+ While this permanent is on the battlefield, each time `player` (you (default) | opponent | any, relative to its controller) would gain life, instead: `multiply` (2 = "twice that much"), `plus` an amount ("that much life plus 1"), or `lose: true` ("that player loses that much life instead"). Each applies once to an event; the affected player's best order is used: losing instead first, then adding, then multiplying. Gaining 0 life is no event (nothing applies).
1203
+
1204
+ Rules: CR 614.1a, CR 614.5, CR 616.1, CR 119.10
1205
+
1206
+ | Parameter | Description |
1207
+ | --- | --- |
1208
+ | `player` | you | opponent | any |
1209
+ | `multiply` | integer >= 2 |
1210
+ | `plus` | amount |
1211
+ | `lose` | true |
1212
+
1213
+ ```json
1214
+ {
1215
+ "life_gain_replacement": {
1216
+ "player": "you",
1217
+ "plus": 1
1218
+ }
1219
+ }
1220
+ ```
1221
+
1104
1222
  ## look_at_top
1105
1223
 
1106
1224
  While this permanent is on the battlefield, its controller sees the top card of their library (the `library_top` of their view).
@@ -1234,6 +1352,24 @@ Rules: CR 702.187a, CR 702.187b, CR 702.187c, CR 118.9, CR 601.2b, CR 601.2f, CR
1234
1352
  }
1235
1353
  ```
1236
1354
 
1355
+ ## miracle
1356
+
1357
+ Miracle `cost`: when you draw this card as the first card you drew this turn, it's revealed and a triggered ability lets you cast it as that ability resolves by paying `cost` rather than its mana cost (an `effect_choice`: cast or done), if it's still in your hand. Never offered at priority. `cards_have` with `zone: "hand"` can give it to cards in your hand.
1358
+
1359
+ Rules: CR 702.94a, CR 702.94b, CR 608.2g, CR 118.9, CR 601.2b, CR 601.2f, CR 601.2h, CR 121.2
1360
+
1361
+ | Parameter | Description |
1362
+ | --- | --- |
1363
+ | `cost` | mana cost string, or a list of costs |
1364
+
1365
+ ```json
1366
+ {
1367
+ "miracle": {
1368
+ "cost": "{1}{R}"
1369
+ }
1370
+ }
1371
+ ```
1372
+
1237
1373
  ## mobilize
1238
1374
 
1239
1375
  Mobilize `amount`: whenever this creature attacks, create that many 1/1 red Warrior creature tokens tapped and attacking; sacrifice them at the beginning of the next end step.
@@ -1252,6 +1388,60 @@ Rules: CR 702.181a, CR 508.4
1252
1388
  }
1253
1389
  ```
1254
1390
 
1391
+ ## morph
1392
+
1393
+ Morph: you may cast this card face down as a nameless colorless 2/2 creature spell by paying {3} rather than its mana cost (cast option `via: "alt:<ref>"`). Any time you have priority you may turn the face-down permanent face up by paying `cost` (special action `{type: "turn_face_up", via: "morph"}`); abilities about entering don't trigger then.
1394
+
1395
+ Rules: CR 702.37a, CR 702.37c, CR 702.37d, CR 702.37e, CR 708.2, CR 708.4, CR 708.8, CR 116.2b
1396
+
1397
+ | Parameter | Description |
1398
+ | --- | --- |
1399
+ | `cost` | mana cost string: the cost to turn it face up |
1400
+
1401
+ ```json
1402
+ {
1403
+ "morph": {
1404
+ "cost": "{1}{G}"
1405
+ }
1406
+ }
1407
+ ```
1408
+
1409
+ ## ninjutsu
1410
+
1411
+ Ninjutsu: an activated ability from your hand: pay `cost`, reveal this card and return an unblocked attacking creature you control to its owner's hand (a `choose_cost` decision) to put this card onto the battlefield tapped and attacking what that creature was attacking. It isn't cast. Usable while you have an unblocked attacker (after blockers are declared).
1412
+
1413
+ Rules: CR 702.49a, CR 702.49b, CR 702.49c, CR 509.1h, CR 506.3a, CR 113.6m, CR 602.2a
1414
+
1415
+ | Parameter | Description |
1416
+ | --- | --- |
1417
+ | `cost` | mana cost string, e.g. "{1}{U}{B}" |
1418
+
1419
+ ```json
1420
+ {
1421
+ "ninjutsu": {
1422
+ "cost": "{1}{U}"
1423
+ }
1424
+ }
1425
+ ```
1426
+
1427
+ ## offspring
1428
+
1429
+ Offspring: as you cast this spell you may also pay `cost` (announced with the `choose_kicker` decision; the spell isn't kicked). When the permanent enters, if its offspring cost was paid, create a 1/1 token copy of it (a triggered ability that comes with the keyword). `{"cast_with": "offspring"}` holds if it was paid.
1430
+
1431
+ Rules: CR 702.175a, CR 702.175b, CR 601.2b, CR 601.2f, CR 601.2h, CR 707.9b, CR 603.4
1432
+
1433
+ | Parameter | Description |
1434
+ | --- | --- |
1435
+ | `cost` | mana cost string, or a list of costs |
1436
+
1437
+ ```json
1438
+ {
1439
+ "offspring": {
1440
+ "cost": "{2}"
1441
+ }
1442
+ }
1443
+ ```
1444
+
1255
1445
  ## play_from
1256
1446
 
1257
1447
  With `cards: "self"` (default): its owner may cast this card from `zone` (the ability functions there). With a card spec: while this permanent is on the battlefield, its controller may play their own matching cards from `zone`, or from any of `zones` ("outside": cards they own outside the game, the deck's `outside` list, CR 400.11a). `play`: "cast" (spells only, default) or "play" (lands too, using a land play). `once_each_turn`: once during each of your turns, one use shared by all its zones. `enters_with`: a permanent spell cast this way enters with these counters. Timing and costs are the usual ones.
@@ -1405,6 +1595,35 @@ Rules: CR 702.190a, CR 702.190b, CR 506.3a, CR 118.9, CR 601.2b, CR 601.2f, CR 6
1405
1595
  }
1406
1596
  ```
1407
1597
 
1598
+ ## solved
1599
+
1600
+ A Case's "Solved — [ability]": one static, triggered or activated ability that works only while this permanent is solved (a static applies as long as it's solved, a triggered ability triggers only if it's solved, an activated ability can be activated only if it's solved). Condition `{"solved": true}` reads the designation.
1601
+
1602
+ Rules: CR 702.169a, CR 702.169b, CR 702.169c, CR 702.169d, CR 720.3b, CR 720.3c
1603
+
1604
+ | Parameter | Description |
1605
+ | --- | --- |
1606
+ | `(ability)` | {"static" | "triggered" | "activated": {...}} |
1607
+
1608
+ ```json
1609
+ {
1610
+ "solved": {
1611
+ "activated": {
1612
+ "cost": [
1613
+ "sacrifice"
1614
+ ],
1615
+ "effects": [
1616
+ {
1617
+ "draw": {
1618
+ "amount": 1
1619
+ }
1620
+ }
1621
+ ]
1622
+ }
1623
+ }
1624
+ }
1625
+ ```
1626
+
1408
1627
  ## spell
1409
1628
 
1410
1629
  The spell ability of an instant or sorcery: its targets are chosen while casting and its effects happen in order when it resolves. If every target is illegal on resolution, it doesn't resolve. A mode of a modal spell may have a `cost`: a mana cost paid in addition when that mode is chosen (tiered: "Choose one additional cost").
@@ -1497,9 +1716,9 @@ Rules: CR 702.126a, CR 702.51a, CR 611.3a, CR 604.1
1497
1716
 
1498
1717
  ## static
1499
1718
 
1500
- While its source is on the battlefield (and its `if` condition holds), every permanent it `affects` gets `pump` (fixed or computed amounts, layer 7c), the `keywords` and granted `abilities` (layer 6, triggered, activated or mana abilities), and with `creature_types` has exactly those creature types (layer 4); `loses_abilities: true` removes the abilities it had before (layer 6, in timestamp order: later grants and keyword counters stay, CR 613.7), `colors` sets its colors (layer 5) and `base_power_toughness` its base power and toughness (layer 7b); `types` are card types it has in addition to its other types ("this Vehicle is an artifact creature", layer 4) and `subtypes` subtypes it has in addition to its other types ("is a Wizard in addition to its other types", layer 4). `affects` is {"each": filter, "controller": you|opponent|any, "other": true} (relative to the source's controller), "self", or "attached" ("equipped/enchanted creature").
1719
+ While its source is on the battlefield (and its `if` condition holds), every permanent it `affects` gets `pump` (fixed or computed amounts, layer 7c), the `keywords` and granted `abilities` (layer 6, triggered, activated or mana abilities), and with `creature_types` has exactly those creature types (layer 4); `loses_abilities: true` removes the abilities it had before (layer 6, in timestamp order: later grants and keyword counters stay, CR 613.7), `colors` sets its colors (layer 5) and `base_power_toughness` its base power and toughness (layer 7b); `types` are card types it has in addition to its other types ("this Vehicle is an artifact creature", layer 4) and `subtypes` subtypes it has in addition to its other types ("is a Wizard in addition to its other types", layer 4). `affects` is {"each": filter, "controller": you|opponent|any, "other": true} (relative to the source's controller), "self", or "attached" ("equipped/enchanted creature"). The filter and the `if` condition may read combat and tapped status ("attacking creatures you control have first strike", {"if": {"attacking": "attached"}}), never power or toughness.
1501
1720
 
1502
- Rules: CR 604.1, CR 604.2, CR 611.3a, CR 612.8, CR 613.1c, CR 613.1d, CR 613.1e, CR 613.1f, CR 613.4b, CR 613.4c, CR 613.7a, CR 613.8a, CR 205.1a, CR 205.1b, CR 301.5f, CR 303.4m
1721
+ Rules: CR 604.1, CR 604.2, CR 611.3a, CR 506.4, CR 612.8, CR 613.1c, CR 613.1d, CR 613.1e, CR 613.1f, CR 613.4b, CR 613.4c, CR 613.7a, CR 613.8a, CR 205.1a, CR 205.1b, CR 301.5f, CR 303.4m
1503
1722
 
1504
1723
  | Parameter | Description |
1505
1724
  | --- | --- |
@@ -1621,6 +1840,27 @@ Rules: CR 702.194a, CR 702.194b, CR 702.194c, CR 601.2b, CR 601.2f, CR 601.2h
1621
1840
  }
1622
1841
  ```
1623
1842
 
1843
+ ## to_solve
1844
+
1845
+ A Case's "To solve — [condition]": at the beginning of your end step, if the condition holds and this Case isn't solved, it becomes solved (an intervening-if triggered ability). The parameter is the condition itself.
1846
+
1847
+ Rules: CR 720.3a, CR 720.3b, CR 603.4
1848
+
1849
+ | Parameter | Description |
1850
+ | --- | --- |
1851
+ | `(condition)` | any condition, e.g. {"hand_size": "you", "at_most": 0} |
1852
+
1853
+ ```json
1854
+ {
1855
+ "to_solve": {
1856
+ "amount": {
1857
+ "life_gained_this_turn": "you"
1858
+ },
1859
+ "at_least": 5
1860
+ }
1861
+ }
1862
+ ```
1863
+
1624
1864
  ## token_replacement
1625
1865
 
1626
1866
  If tokens would be created under this permanent's controller's control, that many `token` tokens are created instead (tapped or attacking if the originals would be). `token` is a predefined token name or inline card data.
@@ -1704,13 +1944,14 @@ Rules: CR 702.21a, CR 601.2c, CR 603.2, CR 701.6a, CR 701.67a
1704
1944
 
1705
1945
  ## warp
1706
1946
 
1707
- Warp: you may cast this card from your hand by paying `cost` rather than its mana cost. If you do, the permanent it becomes is exiled at the beginning of the next end step (a delayed triggered ability), and its owner may cast it from exile after this turn has ended for as long as it remains exiled (cast option `via: "warped"`). Conditions `{"cast_with": "warp"}` and `{"cast_with_this_turn": "warp"}` read it.
1947
+ Warp: you may cast this card from your hand by paying `cost` rather than its mana cost. If you do, the permanent it becomes is exiled at the beginning of the next end step (a delayed triggered ability), and its owner may cast it from exile after this turn has ended for as long as it remains exiled (cast option `via: "warped"`). Conditions `{"cast_with": "warp"}` and `{"cast_with_this_turn": "warp"}` read it. `from: ["hand", "graveyard"]`: "you may cast this card from your graveyard using its warp ability" (CR 601.3).
1708
1948
 
1709
- Rules: CR 702.185a, CR 702.185b, CR 702.185c, CR 603.7, CR 118.9, CR 601.2b, CR 601.2f, CR 601.2h
1949
+ Rules: CR 702.185a, CR 702.185b, CR 702.185c, CR 603.7, CR 118.9, CR 601.2b, CR 601.2f, CR 601.2h, CR 601.3
1710
1950
 
1711
1951
  | Parameter | Description |
1712
1952
  | --- | --- |
1713
1953
  | `cost` | mana cost string, or a list of costs |
1954
+ | `from` | zones it works from: "hand" (default), "graveyard", or a list of both |
1714
1955
 
1715
1956
  ```json
1716
1957
  {
@@ -67,6 +67,22 @@ Rules: CR 601.2b, CR 205.3m, CR 607.2d
67
67
  }
68
68
  ```
69
69
 
70
+ ## collect_evidence
71
+
72
+ Collect evidence `N`: exile any number of other cards from your graveyard with total mana value N or greater, chosen one at a time (`choose_cost`; `done` once they total N). Not payable without that much mana value in your graveyard. "If evidence was collected": make it an optional `additional_cost` and read `{"cast_with": "additional_cost"}`.
73
+
74
+ Rules: CR 701.59a, CR 701.59b, CR 701.59c, CR 202.3, CR 601.2h, CR 118.3
75
+
76
+ | Parameter | Description |
77
+ | --- | --- |
78
+ | `(value)` | integer >= 1: N |
79
+
80
+ ```json
81
+ {
82
+ "collect_evidence": 6
83
+ }
84
+ ```
85
+
70
86
  ## discard
71
87
 
72
88
  Discard `count` cards (default 1) from your hand, never this card, matching the card spec `card` if given: chosen while casting or activating and discarded as the spell or ability becomes cast. `random: true` discards them at random instead.
@@ -145,6 +161,26 @@ Rules: CR 406.1, CR 601.2h, CR 602.2b, CR 118.3
145
161
  }
146
162
  ```
147
163
 
164
+ ## exile_permanent
165
+
166
+ Exile `count` permanents you control matching `filter` (`other: true`: not the source). Chosen while casting or activating, exiled as it becomes cast; the exiled cards are `exiled_for_cost`, and their last known power, toughness and mana value are amount `sacrificed`.
167
+
168
+ Rules: CR 406.1, CR 601.2h, CR 602.2b, CR 118.3, CR 608.2h
169
+
170
+ | Parameter | Description |
171
+ | --- | --- |
172
+ | `filter` | filter (default permanent) |
173
+ | `count` | integer (default 1) |
174
+ | `other` | true: not the source itself |
175
+
176
+ ```json
177
+ {
178
+ "exile_permanent": {
179
+ "filter": "creature"
180
+ }
181
+ }
182
+ ```
183
+
148
184
  ## exile_self
149
185
 
150
186
  Exile the permanent the ability belongs to ("Exile this enchantment: ...").
@@ -86,7 +86,7 @@ Put one of your pending triggered abilities on the stack next: `{type: "trigger"
86
86
 
87
87
  ## pay_cost
88
88
 
89
- While casting/activating or paying a cost: `{type: "pay_mana", mana: "R"}` spends one mana from the pool (`restricted: i`: restricted mana, CR 106.6; `from: i`: the pool mana an artifact made that pool_sources[i] names), `{type: "activate_mana", object: id, ability: ref}` (plus `mana: "{G}{G}"` when the mana is chosen) taps a source, `{type: "cancel"}` rewinds (or declines a payment asked for while resolving). Cancel isn't offered once a mana ability with a cost other than {T} (a Treasure) has been activated. `{type: "convoke", object: id}` taps a creature to pay for {1} or one mana of its color (a spell with convoke); `{type: "improvise", object: id}` taps an artifact to pay for {1} (a spell with improvise); `{type: "waterbend", object: id}` taps an artifact or creature to pay {1} of a waterbend cost. `remaining` shows what is left to pay.
89
+ While casting/activating or paying a cost: `{type: "pay_mana", mana: "R"}` spends one mana from the pool (`restricted: i`: restricted mana, CR 106.6; `from: i`: the pool mana an artifact made that pool_sources[i] names), `{type: "activate_mana", object: id, ability: ref}` (plus `mana: "{G}{G}"` when the mana is chosen) taps a source, `{type: "cancel"}` rewinds (or declines a payment asked for while resolving). Cancel isn't offered once a mana ability with a cost other than {T} (a Treasure) has been activated, unless the cost can no longer be paid: then it is the only option, and rewinds keeping the mana abilities' mana in the pool (CR 734.1). `{type: "convoke", object: id}` taps a creature to pay for {1} or one mana of its color (a spell with convoke); `{type: "improvise", object: id}` taps an artifact to pay for {1} (a spell with improvise); `{type: "waterbend", object: id}` taps an artifact or creature to pay {1} of a waterbend cost. `remaining` shows what is left to pay.
90
90
 
91
91
  ## play_or_draw
92
92
 
@@ -108,3 +108,5 @@ Untap step: `{type: "untap", object: id}` or `{type: "keep_tapped", object: id}`
108
108
  - `pass` — `{type: "pass"}` — pass priority. When all players pass in succession with an empty stack, the step ends (CR 117.4).
109
109
  - `play_land` — `{type: "play_land", object: id}` — special action: your main phase, empty stack, one land per turn plus additional land plays (CR 305.1, 305.2). With `via`: a land from another zone that an effect lets you play. With `face: 1`: a modal double-faced card played with its land back face up (CR 712.9).
110
110
  - `special_action` — `{type: "special_action", object: id, ability: ref}` — a special action of a card in your hand: foretell (during your turn, pay {2} and exile it face down, CR 116.2h) or suspend (when you could begin to cast it, pay its suspend cost and exile it with time counters, CR 116.2f) or plot (in your main phase with an empty stack, pay its plot cost and exile it, CR 116.2k).
111
+ - `turn_face_up` — `{type: "turn_face_up", object: id, via: "mana_cost" | "morph" | "disguise"}` — turn a face-down permanent you control face up by paying its mana cost (a manifested or cloaked creature card) or its morph or disguise cost (a special action, any time you have priority, CR 116.2b).
112
+ - `unlock` — `{type: "unlock", object: id, door: "left" | "right"}` — unlock a locked door of a Room you control by paying that door's mana cost (a special action, during a main phase of your turn with an empty stack, CR 116.2m, 709.5e).