enjine 0.1.0 → 0.3.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +55 -1
- data/README.md +2 -1
- data/SUPPORTED.md +12 -9
- data/docs/ARCHITECTURE.md +2 -0
- data/docs/DESIGN.md +12 -5
- data/docs/MECHANICS_COVERAGE.md +33 -5
- data/docs/guides/api.md +51 -0
- data/docs/guides/card-data-format.md +43 -4
- data/docs/guides/deck-builder.md +18 -0
- data/docs/plans/commander.md +63 -0
- data/docs/plans/dsl-gaps.md +606 -0
- data/docs/plans/standard.md +3 -0
- data/docs/reference/abilities.md +33 -7
- data/docs/reference/costs.md +11 -1
- data/docs/reference/decisions.md +6 -2
- data/docs/reference/effects.md +30 -9
- data/docs/reference/triggers.md +3 -2
- data/lib/enjine/actions/cast.rb +2 -1
- data/lib/enjine/actions/special_action.rb +4 -2
- data/lib/enjine/card_definition.rb +24 -3
- data/lib/enjine/cli/text.rb +23 -1
- data/lib/enjine/cli.rb +2 -1
- data/lib/enjine/color_identity.rb +38 -0
- data/lib/enjine/decisions/commander_zone.rb +36 -0
- data/lib/enjine/deck.rb +73 -14
- data/lib/enjine/deck_builder.rb +62 -18
- data/lib/enjine/engine/casting/alt_casting.rb +19 -2
- data/lib/enjine/engine/casting/casting.rb +3 -3
- data/lib/enjine/engine/casting/costs.rb +5 -1
- data/lib/enjine/engine/casting/permissions.rb +3 -3
- data/lib/enjine/engine/characteristics.rb +0 -13
- data/lib/enjine/engine/commander.rb +125 -0
- data/lib/enjine/engine/damage.rb +1 -0
- data/lib/enjine/engine/defined_power_toughness.rb +30 -0
- data/lib/enjine/engine/emblems.rb +1 -1
- data/lib/enjine/engine/mana_sources.rb +8 -1
- data/lib/enjine/engine/pregame.rb +1 -0
- data/lib/enjine/engine/priority.rb +1 -0
- data/lib/enjine/engine/resolution.rb +1 -0
- data/lib/enjine/engine/rules.rb +1 -1
- data/lib/enjine/engine/state_based_actions.rb +1 -0
- data/lib/enjine/engine/triggers.rb +2 -1
- data/lib/enjine/engine/turn_history.rb +25 -1
- data/lib/enjine/engine/zones.rb +17 -6
- data/lib/enjine/format.rb +53 -0
- data/lib/enjine/fuzz.rb +17 -0
- data/lib/enjine/game.rb +4 -3
- data/lib/enjine/mechanics/abilities/additional_triggers.rb +23 -11
- data/lib/enjine/mechanics/abilities/cost_changes.rb +20 -7
- data/lib/enjine/mechanics/abilities/mana_ability.rb +21 -6
- data/lib/enjine/mechanics/abilities/stack_abilities.rb +13 -9
- data/lib/enjine/mechanics/abilities/static.rb +13 -7
- data/lib/enjine/mechanics/costs/sacrifice.rb +28 -2
- data/lib/enjine/mechanics/effects/become.rb +8 -4
- data/lib/enjine/mechanics/effects/choose_cards.rb +9 -7
- data/lib/enjine/mechanics/effects/delayed_triggers.rb +2 -1
- data/lib/enjine/mechanics/effects/search.rb +15 -8
- data/lib/enjine/mechanics/keywords/plot.rb +79 -0
- data/lib/enjine/mechanics/triggers/casting.rb +8 -6
- data/lib/enjine/mechanics/values.rb +82 -14
- data/lib/enjine/player.rb +2 -1
- data/lib/enjine/rules_monitor.rb +25 -1
- data/lib/enjine/setup.rb +10 -4
- data/lib/enjine/snapshot/player_checks.rb +47 -0
- data/lib/enjine/snapshot.rb +4 -1
- data/lib/enjine/state.rb +33 -14
- data/lib/enjine/version.rb +1 -1
- data/lib/enjine/view.rb +18 -1
- data/lib/enjine.rb +2 -0
- metadata +9 -1
|
@@ -59,6 +59,7 @@ Tips:
|
|
|
59
59
|
| `abilities` | no | list | Section 4. |
|
|
60
60
|
| `rules_text` | no | string | Informational only (shown in the CLI). Never interpreted. |
|
|
61
61
|
| `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). |
|
|
62
|
+
| `color_identity` | no | list of `W U B R G` | Commander only (CR 903.4): states the color identity of this card (or face) instead of deriving it. Rarely needed: the identity is derived from the card's data, see "Commander decks" in §6. |
|
|
62
63
|
| `rarity` | no | string | Catalogue data, e.g. `"rare"`. The rules never read it. |
|
|
63
64
|
| `printing` | no | object | `{ "set": "trk", "number": "12" }`: the set code and collector number printed on the card (a number may be given as an integer; it is stored as a string, since numbers like `"12a"` exist). The rules never read it, and two cards differing only in `rarity`/`printing` are the same card (a reprint). On a card with faces it sits beside `faces`. |
|
|
64
65
|
|
|
@@ -154,7 +155,7 @@ takes `spend_only` too ("Add {C}{C}. Spend this mana only to cast spells.").
|
|
|
154
155
|
```
|
|
155
156
|
|
|
156
157
|
- `cost`: costs before the colon. `"tap"` is `{T}`; `{ "mana": "{1}{R}" }` is a mana
|
|
157
|
-
cost; `"sacrifice"` sacrifices this permanent; `{ "sacrifice_permanent": { "filter": "creature", "other": true } }`,
|
|
158
|
+
cost; `"sacrifice"` sacrifices this permanent and `"exile_self"` exiles it; `{ "sacrifice_permanent": { "filter": "creature", "other": true } }`,
|
|
158
159
|
`{ "tap_permanents": { "count": 3, "filter": ... } }` and `{ "remove_counters": { "count": 3 } }` are chosen while
|
|
159
160
|
activating; `"exile_self_from_graveyard"` / `"bottom_self_from_graveyard"` make it a graveyard ability. `{Q}` is
|
|
160
161
|
not supported yet. More costs (each also usable in a spell's `additional_cost`):
|
|
@@ -219,8 +220,11 @@ is fixed) and then chooses that many different objects; `{ "target": n }` then m
|
|
|
219
220
|
"effects": [{ "deal_damage": { "amount": 3, "to": { "target": 0 } } }] } }
|
|
220
221
|
```
|
|
221
222
|
|
|
222
|
-
`cost` is the signed number: `+1` → `1`, `−2` → `-2`, `0` → `0
|
|
223
|
-
|
|
223
|
+
`cost` is the signed number: `+1` → `1`, `−2` → `-2`, `0` → `0`, or `"-X"` (X is announced as
|
|
224
|
+
it's activated, at most the planeswalker's loyalty; effects read it as `"x"`). Sorcery timing and
|
|
225
|
+
once-per-turn are automatic. A static grants one like any other ability: "Planeswalkers you control
|
|
226
|
+
have '[−2]: …'" is `{ "static": { "affects": { "each": "planeswalker", "controller": "you" },
|
|
227
|
+
"abilities": [{ "loyalty": { "cost": -2, "effects": [ … ] } }] } }`.
|
|
224
228
|
|
|
225
229
|
### 4.4 Target filters
|
|
226
230
|
|
|
@@ -297,6 +301,7 @@ is a flicker ("exile …, then return it to the battlefield under its owner's co
|
|
|
297
301
|
| one of your creatures is targeted by an opponent's spell or ability | `{ "becomes_target": { "subject": { "each": "creature", "controller": "you" }, "by": "opponent" } }` |
|
|
298
302
|
| "Whenever a card leaves your graveyard" / "one or more cards leave" | `{ "leaves_graveyard": {} }` / `{ "leaves_graveyard": { "batched": true } }` |
|
|
299
303
|
| "Whenever an opponent activates an ability" (not mana abilities) | `{ "activates_ability": { "controller": "opponent" } }` |
|
|
304
|
+
| "Whenever an opponent activates a loyalty ability" | `{ "activates_ability": { "controller": "opponent", "loyalty": true } }` |
|
|
300
305
|
| "When you cast this spell" | `{ "cast": { "self": true } }` |
|
|
301
306
|
| you cast a spell that is a creature or a Spacecraft | `{ "cast": { "spell": { "one_of": [{ "spell": { "any_of": ["creature"] } }, { "spell": { "subtypes": ["spacecraft"] } }] } } }` |
|
|
302
307
|
| a number chosen as it enters (0 to 10) / spells whose mana value is that number | ability `{ "choose_number": { "min": 0, "max": 10 } }` / `"cast": { "mana_value": "chosen" }` |
|
|
@@ -311,6 +316,7 @@ is a flicker ("exile …, then return it to the battlefield under its owner's co
|
|
|
311
316
|
| optional A; if it was done, a reflexive trigger B with its own target | `{ "may": { "effects": [A], "then": [{ "reflexive_trigger": { "targets": [...], "effects": [B] } }] } }` |
|
|
312
317
|
| a targeted opponent decides whether A happens; B if not | `{ "may": { "chooser": { "target": 0 }, "effects": [A], "otherwise": [B] } }` |
|
|
313
318
|
| your life gain makes your permanents' triggered abilities trigger one extra time | `{ "additional_triggers": { "cause": "you_gain_life" } }` |
|
|
319
|
+
| "If a triggered ability of an Ally you control triggers, it triggers an additional time" | `{ "additional_triggers": { "of": { "creature": { "subtypes": ["ally"] } } } }` (`"other": true`, `"subtypes": "chosen"` work in the filter; combine with `cause`) |
|
|
314
320
|
| tapped unless its controller has two other lands / a trigger only if it came in untapped | `{ "enters_tapped_unless": { "condition": { "controls": { "each": "land", "controller": "you" }, "at_least": 2 } } }` / `{ "enters": { "untapped": true } }` |
|
|
315
321
|
| returned to the battlefield carrying a +1/+1 counter | `"counters": { "+1/+1": 1 }` on `return_to_battlefield` |
|
|
316
322
|
|
|
@@ -350,6 +356,7 @@ See `docs/reference/effects.md` for the generated list. Currently:
|
|
|
350
356
|
| `deal_damage` | "deals N damage to …" | `{ "deal_damage": { "amount": N, "to": … } }` |
|
|
351
357
|
| `pump` | "gets +X/+Y until end of turn" | `{ "pump": { "power": X, "toughness": Y, "to": … } }` |
|
|
352
358
|
| `pump` | "get -1/-0 until your next turn" | `{ "pump": { "power": -1, "toughness": 0, "duration": "until_your_next_turn", "to": … } }` (ends as your next turn begins, CR 611.2a) |
|
|
359
|
+
| `grant`, `become` | "gain flying until your next turn", "until your next turn, it becomes a land" | `"duration": "until_your_next_turn"` on `grant` or `become` |
|
|
353
360
|
| `add_counters` | "put N +1/+1 counters on …" | `{ "add_counters": { "counter": "+1/+1", "amount": N, "to": … } }` (any counter name: `+1/+1`, `stun`, `shield`, `oil`, a keyword; see `docs/reference/counters.md`) |
|
|
354
361
|
| `gain_life` | "you gain N life" | `{ "gain_life": { "amount": N } }` (`to` defaults to `"you"`) |
|
|
355
362
|
| `lose_life` | "each opponent loses N life" | `{ "lose_life": { "amount": N, "to": "each_opponent" } }` |
|
|
@@ -371,6 +378,7 @@ See `docs/reference/effects.md` for the generated list. Currently:
|
|
|
371
378
|
| "Affinity for artifacts" | `{ "cost_reduction": { "amount": { "count": { "each": "artifact", "controller": "you" } } } }` |
|
|
372
379
|
| "Noncreature spells you cast cost {1} less to cast." | `{ "cost_modifier": { "spells": { "not": ["creature"] }, "reduce": 1 } }` |
|
|
373
380
|
| "Spells your opponents cast cost {1} more to cast." | `{ "cost_modifier": { "caster": "opponent", "increase": 1 } }` |
|
|
381
|
+
| "Dragon spells you cast cost {1} less" / "Red spells you cast cost {1} less" | `{ "cost_modifier": { "spells": { "subtypes": ["dragon"] }, "reduce": 1 } }` / `"spells": { "colors": ["R"] }` (combine with `any_of` / `not`) |
|
|
374
382
|
| "This ability costs {1} less to activate for each land you control." | `"cost_reduction": { "amount": {...} }` inside the `activated` ability |
|
|
375
383
|
|
|
376
384
|
An activated ability without targets that adds mana is a *mana ability* (CR 605.1a):
|
|
@@ -579,6 +587,11 @@ The full lists are in `lib/enjine/mechanics/values.rb` (`Amount`, `Condition`).
|
|
|
579
587
|
| "the number of creature types among …" | `{ "distinct_types": <selector> }` |
|
|
580
588
|
| "the number of counters on it" | `{ "counters": { "of": "self", "kind": "quest" } }` (no `kind`: every counter) |
|
|
581
589
|
| "cards in your graveyard", "greatest power among …" | `{ "graveyard_size": "you" }`, `{ "greatest_power": <selector> }` |
|
|
590
|
+
| "cards in your library", "half their library, rounded up" | `{ "library_size": "you" }`, `{ "divide": [{ "plus": [{ "library_size": <player> }, 1] }, 2] }` |
|
|
591
|
+
| "the greatest mana value among …" | `{ "greatest_mana_value": <selector> }` (0 for none) |
|
|
592
|
+
| "its mana value" / "its power" of a target destroyed earlier in the same effects; "the sacrificed creature's power" after a `sacrifice_choice` | `{ "mana_value": { "target": 0 } }`, `{ "power": { "result": n } }`: read as it last existed on the battlefield (CR 608.2h) |
|
|
593
|
+
| "the sacrificed artifact's mana value" when the sacrifice is a cost | `{ "sacrificed": "mana_value" }` (also `"power"`, `"toughness"`; CR 601.2h) |
|
|
594
|
+
| delirium: "four or more card types among cards in your graveyard" | `{ "amount": { "card_types": { "each": { "graveyard_card": {} }, "controller": "you" } }, "at_least": 4 }` |
|
|
582
595
|
| "life you gained / that player lost this turn" | `{ "life_gained_this_turn": "you" }`, `{ "life_lost_this_turn": "each_opponent" }` |
|
|
583
596
|
| an amount an earlier effect changed (life it made a player lose) | `{ "this_way": n }` (effect n of the same list) |
|
|
584
597
|
| N or more cards drawn by an earlier effect; "if you do" after a mandatory effect | `{ "amount": { "count": { "result": n } }, "at_least": 3 }` |
|
|
@@ -619,6 +632,7 @@ Generic shapes (N, [quality] and [zone] stand for whatever the card says):
|
|
|
619
632
|
| exile the top N; the permanent cards exiled this way enter the battlefield | `exile_top`, then `{ "return_to_battlefield": { "to": { "result": 0 }, "under": "you" } }` |
|
|
620
633
|
| mill N; you may put a [quality] card from among them into your hand | `mill`, then `{ "choose_cards": { "from": { "result": 0 }, "for": spec, "optional": true, "put": "hand" } }` |
|
|
621
634
|
| return a [quality] card from your graveyard to your hand; if you can't, [effect] | `{ "choose_cards": { "from": { "graveyard": "you" }, "for": spec, "put": "hand", "otherwise": [ … ] } }` |
|
|
635
|
+
| target opponent reveals their hand; you choose a [quality] card from it; that player discards that card | `{ "choose_cards": { "from": { "hand": { "target": 0 } }, "for": spec, "reveal": "all", "put": "discard" } }` (a discard: discard triggers see it) |
|
|
622
636
|
| look at a player's hand; you may choose a [quality] card; if you do, [effect] | `{ "choose_cards": { "from": { "hand": { "target": 0 } }, "look": true, "for": spec, "optional": true, "put": "exile", "then": [ … ] } }` |
|
|
623
637
|
| each player sacrifices a [quality] permanent of their choice | `{ "sacrifice_choice": { "filter": filter, "to": { "each": "player" } } }` (`"count": "any"`: any number) |
|
|
624
638
|
| exile a target card in a graveyard; return a target card from your graveyard to your hand | `exile` / `return_to_hand` with a `graveyard_card` target |
|
|
@@ -1186,6 +1200,7 @@ but cards already revealed for a behold or permanents tapped for a cost stay so.
|
|
|
1186
1200
|
| "costs {X} less to cast, where X is the greatest toughness among creatures you control" | `{ "cost_reduction": { "amount": { "greatest_toughness": { "each": "creature", "controller": "you" } } } }` |
|
|
1187
1201
|
| "Spend this mana only to cast a spell from anywhere other than your hand" / "only to cast spells from exile" | `"spend_only": { "not_from": "hand" }` / `{ "from": "exile" }` (also with `spells`) |
|
|
1188
1202
|
| "{T}: Add {G}{G}. Activate only if there is an Elf card in your graveyard." (CR 602.5b) | `{ "mana": { "cost": ["tap"], "produce": "{G}{G}", "only_if": condition } }` |
|
|
1203
|
+
| "{1}: Add {B}, {G}, or {W}. Activate only once each turn." (CR 602.5b) | `{ "mana": { "cost": [{ "mana": "{1}" }], "color": "any_one", "colors": ["W", "B", "G"], "limit": "once_each_turn" } }` |
|
|
1189
1204
|
| "If that spell would be put into a graveyard, exile it instead" (CR 614.1a) | `"exile_instead": true` on `cast_free`, `cast` or `play_permission`; a card spec instead of `true` limits it ("if an instant or sorcery spell cast this way …": `{ "any_of": [{ "types": ["instant"] }, { "types": ["sorcery"] }] }`) |
|
|
1190
1205
|
| "you may cast it, and mana of any type can be spent to cast that spell" (while resolving) | `{ "cast": { "to": { "target": 0 }, "any_mana_type": true } }` |
|
|
1191
1206
|
|
|
@@ -1294,6 +1309,9 @@ grants its abilities.
|
|
|
1294
1309
|
| "you may copy it. If you do, those spells gain wither" | `copy_spell` with `"except": { "keywords": ["wither"] }`, then `{ "grant": { "keywords": ["wither"], "to": { "triggering": "object" } } }` (a spell on the stack can gain keywords) |
|
|
1295
1310
|
| "Instant and sorcery spells you cast from your hand have cascade" | ability `{ "spell_keywords": { "spells": { "spell": { "any_of": ["instant", "sorcery"] } }, "from": "hand", "keywords": ["cascade"] } }` |
|
|
1296
1311
|
| "search your library for up to X basic land cards with different names" | `{ "search_library": { "for": { "supertypes": ["basic"], "types": ["land"] }, "count": "x", "different_names": true } }` |
|
|
1312
|
+
| "search your library for a creature card, put it into your graveyard, then shuffle" | `{ "search_library": { "for": { "types": ["creature"] }, "put": "graveyard" } }` |
|
|
1313
|
+
| "search your library for a card, then shuffle and put that card on top" | `{ "search_library": { "put": "library_top" } }` (one card; add `"reveal": true` if it's revealed) |
|
|
1314
|
+
| "an artifact card with mana value equal to 1 plus the sacrificed artifact's mana value" | `"for": { "types": ["artifact"], "mana_value": { "equal": { "plus": [{ "sacrificed": "mana_value" }, 1] } } }` |
|
|
1297
1315
|
| "The first time you flip one or more coins each turn, those coins come up heads and you win those flips" (CR 705.3) | ability `"first_flips_win"` |
|
|
1298
1316
|
| "Roll a d20" / "roll two six-sided dice" (CR 706) | `{ "roll_dice": { "sides": 20 } }` / `{ "roll_dice": { "amount": 2 } }`; the total is `{ "this_way": n }` (a results table is effects with an `if` on it) |
|
|
1299
1317
|
|
|
@@ -1312,6 +1330,8 @@ grants its abilities.
|
|
|
1312
1330
|
| --- | --- |
|
|
1313
1331
|
| "Paradigm" (CR 702.192a) | `"keywords": ["paradigm"]` on an instant or sorcery: as it finishes resolving it's exiled; the first time a spell you control with its name resolves this game, at the beginning of each of your precombat main phases you create a copy of the card in exile and may cast it without paying its mana cost (an `effect_choice` of `{type: "cast"}` or `"done"`) |
|
|
1314
1332
|
| "Foretell {2}{R}" (CR 702.143a) | ability `{ "foretell": { "cost": "{2}{R}" } }`: during your turn the priority option `{type: "special_action", object: id, ability: ref}` pays {2} and exiles it face down; on a later turn it's cast from exile with `via: "alt:<ref>"`; condition `{ "cast_with": "foretell" }` |
|
|
1333
|
+
| "Plot {1}{R}" (CR 702.170a) | ability `{ "plot": { "cost": "{1}{R}" } }`: in your main phase with an empty stack the priority option `{type: "special_action", object: id, ability: ref}` pays the cost and exiles it face up; on a later turn it's cast from exile without paying its mana cost with `via: "plotted"`, at sorcery timing even for an instant |
|
|
1334
|
+
| "Exile target spell. It becomes plotted." / "it becomes plotted" for an exiled card (CR 702.170c) | effect `{ "plot": { "to": { "target": 0 } } }` (or `{ "result": n }` for a card an earlier effect exiled) |
|
|
1315
1335
|
| "Suspend 3—{2}{W}" (CR 702.62a) | ability `{ "suspend": { "amount": 3, "cost": "{2}{W}" } }`: the special action exiles it with three time counters whenever you could begin to cast it |
|
|
1316
1336
|
| "exile it with four time counters on it. If it doesn't have suspend, it gains suspend" | effect `{ "suspend": { "to": …, "amount": 4 } }` (a spell, a card or a permanent); a card that has suspend from the start is `"keywords": ["suspend"]` |
|
|
1317
1337
|
| suspended cards (CR 702.62b) | automatic: at the beginning of its owner's upkeep a time counter is removed; when the last is removed they may play it without paying its mana cost (`effect_choice` `{type: "cast"}` / `{type: "play_land"}`), and a creature spell cast this way has haste while they control it |
|
|
@@ -1406,6 +1426,25 @@ view. A `play_from` ability with `"outside"` among its zones offers them as
|
|
|
1406
1426
|
`{ "type": "cast", "object": "outside:hill_giant", "via": ... }` (or `play_land`). The
|
|
1407
1427
|
object is created as the card enters the game, and that player owns it (CR 108.3).
|
|
1408
1428
|
|
|
1429
|
+
**Commander decks** (CR 903). A deck that names a `commander` is played with
|
|
1430
|
+
`format: :duel_commander`. The commander is one of `cards` but isn't listed in
|
|
1431
|
+
`main`, which holds the other 99 cards:
|
|
1432
|
+
|
|
1433
|
+
```json
|
|
1434
|
+
{ "cards": [ ... ],
|
|
1435
|
+
"main": [ { "card": "Forest", "count": 38 }, { "card": "Grizzly Bears", "count": 1 }, "..." ],
|
|
1436
|
+
"commander": "Wort, the Raidmother" }
|
|
1437
|
+
```
|
|
1438
|
+
|
|
1439
|
+
It must be a legendary creature, Vehicle, or Spacecraft with power and toughness
|
|
1440
|
+
(CR 903.3). There is one copy of each card, except basic lands (CR 903.5b), and
|
|
1441
|
+
every card's **color identity** must be inside the commander's (CR 903.5c). A card's
|
|
1442
|
+
identity is the colors of every mana symbol in its data (mana cost, ability costs,
|
|
1443
|
+
produced mana, kicker, and so on), plus `colors`, the colors of its basic land types
|
|
1444
|
+
(CR 903.5d) and those of all its faces (CR 903.4d–e). `rules_text` is never read
|
|
1445
|
+
(reminder text doesn't count, CR 903.4c). For the odd card whose identity the data
|
|
1446
|
+
can't show, a card or face may state it with `"color_identity"`.
|
|
1447
|
+
|
|
1409
1448
|
---
|
|
1410
1449
|
|
|
1411
1450
|
## 7. Validating
|
|
@@ -1419,7 +1458,7 @@ bundle exec exe/enjine --validate cards.json
|
|
|
1419
1458
|
`cards.json` is a JSON array of card blocks (or a single block). The report:
|
|
1420
1459
|
|
|
1421
1460
|
```json
|
|
1422
|
-
{ "rules_version": "2026-11-06", "engine_version": "0.
|
|
1461
|
+
{ "rules_version": "2026-11-06", "engine_version": "0.3.0",
|
|
1423
1462
|
"valid": [ { "index": 0, "id": "lightning_bolt", "name": "Lightning Bolt", "card": { ...canonical... } } ],
|
|
1424
1463
|
"invalid": [ { "index": 1, "name": "Gale Drifter", "errors": ["keywords[0]: unknown keyword \"flyng\" ..."] } ] }
|
|
1425
1464
|
```
|
data/docs/guides/deck-builder.md
CHANGED
|
@@ -36,6 +36,24 @@ The same pool, arguments and seed always give the same deck, whatever the order
|
|
|
36
36
|
of the pool. The `description` records the colors (including ones picked at
|
|
37
37
|
random) and the seed, so you can rebuild any deck.
|
|
38
38
|
|
|
39
|
+
## Commander decks
|
|
40
|
+
|
|
41
|
+
`commander:` builds a Duel Commander deck (CR 903) around a pool card that may lead
|
|
42
|
+
one: 99 distinct cards whose color identity fits the commander's, plus basic lands
|
|
43
|
+
of its colors. The colors and the size come from the commander, so don't pass
|
|
44
|
+
`colors:` or `size:`. Play it with `format: :duel_commander`.
|
|
45
|
+
|
|
46
|
+
```ruby
|
|
47
|
+
doc = builder.build(commander: "Wort, the Raidmother", seed: 3)
|
|
48
|
+
doc["commander"] # => "Wort, the Raidmother"
|
|
49
|
+
Enjine::Setup.new(Enjine::Player.new(name: "a", deck: doc), Enjine::Player.new(name: "b", deck: other),
|
|
50
|
+
format: :duel_commander)
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
The proportions are the same ranges as for 60 cards, scaled to 99 (about 40 lands).
|
|
54
|
+
A colorless commander isn't supported: it would need Wastes, which the builder
|
|
55
|
+
doesn't add.
|
|
56
|
+
|
|
39
57
|
## The pool
|
|
40
58
|
|
|
41
59
|
Each entry is a card data block (the [card DSL](card-data-format.md), optionally
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
# Plan: Duel Commander (0.3.0)
|
|
2
|
+
|
|
3
|
+
**Goal.** Enjine plays Duel Commander: two players, 100-card singleton decks led by a
|
|
4
|
+
commander, 40 life (CR 903). Commander is a *game-setup variant*: `DESIGN.md` §1 now
|
|
5
|
+
lists it as in scope. Which card mechanics we implement is still governed by the
|
|
6
|
+
Standard program.
|
|
7
|
+
|
|
8
|
+
## Decisions (settled with the user)
|
|
9
|
+
|
|
10
|
+
- **Format.** Duel Commander only: 1v1, 100 cards including the commander, 40 life.
|
|
11
|
+
Multiplayer Commander and Brawl are separate, later work.
|
|
12
|
+
- **Rules in the cut.** Command zone for commanders (903.6), life 40 (903.7), tax (903.8),
|
|
13
|
+
returning to the command zone (903.9a, 903.9b), 21 combat damage from one commander
|
|
14
|
+
(903.10a), deck construction (903.3–903.5).
|
|
15
|
+
- **Deferred (OOS in `MECHANICS_COVERAGE.md`).** Partner, background, companion, commander
|
|
16
|
+
ninjutsu, "can be your commander" on non-creatures, cards that refer to "your commander".
|
|
17
|
+
- **Commander picked up front.** The deck carries `"commander": "Card Name"` beside `main`
|
|
18
|
+
(99 cards + the commander). The format is a `Setup`/`Game.start` option; the default stays
|
|
19
|
+
constructed and unchanged.
|
|
20
|
+
- **Engine knows no banlist.** It validates structure only: 100 cards, singleton, color
|
|
21
|
+
identity, a legal commander card.
|
|
22
|
+
- **Color identity** is derived from structured card data (never rules text), with an
|
|
23
|
+
optional explicit `color_identity` override.
|
|
24
|
+
- **Identity of the commander** is a predicate (owner + the card's own id, not a token, not a
|
|
25
|
+
copy), never a flag on the object, so zone changes and cancelled casts can't lose it.
|
|
26
|
+
|
|
27
|
+
## Design
|
|
28
|
+
|
|
29
|
+
| Piece | Where |
|
|
30
|
+
| --- | --- |
|
|
31
|
+
| Format presets | `Enjine::Format` (`CONSTRUCTED`, `DUEL_COMMANDER`) |
|
|
32
|
+
| Color identity | `Enjine::ColorIdentity`, `CardDefinition#color_identity` |
|
|
33
|
+
| Deck validity per format | `Deck#errors(format)`, `Deck#commander` |
|
|
34
|
+
| Per-game config | `State#format`, `State#commanders`; `PlayerState#commander_casts`, `#commander_damage` |
|
|
35
|
+
| Rules | `Engine::Commander` (setup, predicate, casting method + tax, damage, 903.9) |
|
|
36
|
+
| Cast from the command zone | a play *method* (`via: "command"`) with a `cost_increase` rider: tax is part of the cost |
|
|
37
|
+
| 903.9 choice | `Decisions::CommanderZone` + a `commander_zone` frame, like the legend rule |
|
|
38
|
+
| 21 damage | counted in `deal_proposed_damage!`, checked as a state-based action |
|
|
39
|
+
|
|
40
|
+
Command-zone cards that are not emblems have no abilities that function there
|
|
41
|
+
(CR 113.6): `Engine#emblems` is the one accessor for "objects in the command zone that act".
|
|
42
|
+
|
|
43
|
+
## Open point: 903.9b
|
|
44
|
+
|
|
45
|
+
903.9b is an optional *replacement* ("would be put into hand or library"), but replacements
|
|
46
|
+
are synchronous and cannot ask a player. The engine instead lets the move happen and, before
|
|
47
|
+
anyone gets priority, offers the move to the command zone (the same decision as 903.9a). The
|
|
48
|
+
visible difference: during the resolution that bounced it, the commander is briefly in the
|
|
49
|
+
hand/library. See "Decisions to confirm" in the release notes.
|
|
50
|
+
|
|
51
|
+
## Slices
|
|
52
|
+
|
|
53
|
+
1. Format, color identity, deck commander and validation, `Setup` option.
|
|
54
|
+
2. Command zone, casting from it, tax.
|
|
55
|
+
3. 903.9 decision, 21-damage state-based action.
|
|
56
|
+
4. Snapshot, view, `DeckBuilder`, CLI.
|
|
57
|
+
5. Fuzz, rules monitor, docs, 0.3.0 release.
|
|
58
|
+
|
|
59
|
+
## Snapshot compatibility
|
|
60
|
+
|
|
61
|
+
New keys (`format`, `commanders`, per-player `commander_casts` and `commander_damage`) are
|
|
62
|
+
optional with defaults, as every earlier addition was; constructed snapshots are unchanged
|
|
63
|
+
and old ones still load. `VERSION` stays 2.
|