enjine 0.4.1 → 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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +196 -1
- data/README.md +12 -3
- data/SUPPORTED.md +73 -38
- data/docs/ARCHITECTURE.md +7 -2
- data/docs/MECHANICS_COVERAGE.md +10 -8
- data/docs/guides/api.md +2 -1
- data/docs/guides/card-data-format.md +146 -9
- data/docs/plans/dsl-gaps.md +23 -0
- data/docs/reference/abilities.md +299 -25
- data/docs/reference/costs.md +59 -6
- data/docs/reference/decisions.md +7 -1
- data/docs/reference/effects.md +200 -27
- data/docs/reference/filters.md +30 -3
- data/docs/reference/keywords.md +58 -2
- data/docs/reference/subtypes.md +18 -0
- data/docs/reference/triggers.md +94 -14
- data/docs/reference/types.md +20 -0
- data/lib/enjine/actions/play_land.rb +3 -1
- data/lib/enjine/actions/special_action.rb +4 -0
- data/lib/enjine/actions/turn_face_up.rb +25 -0
- data/lib/enjine/actions/unlock.rb +23 -0
- data/lib/enjine/card_definition.rb +54 -15
- data/lib/enjine/card_face_down.rb +31 -0
- data/lib/enjine/card_faces.rb +4 -2
- data/lib/enjine/card_rooms.rb +86 -0
- data/lib/enjine/catalog.rb +9 -3
- data/lib/enjine/cli/text.rb +11 -3
- data/lib/enjine/color_identity.rb +34 -1
- data/lib/enjine/decisions/casting.rb +6 -3
- data/lib/enjine/decisions/combat.rb +4 -2
- data/lib/enjine/decisions/damage_order.rb +18 -0
- data/lib/enjine/engine/ability_layers.rb +14 -1
- data/lib/enjine/engine/casting/alt_casting.rb +45 -5
- data/lib/enjine/engine/casting/cast_choices.rb +21 -2
- data/lib/enjine/engine/casting/casting.rb +42 -29
- data/lib/enjine/engine/casting/cost_options.rb +3 -1
- data/lib/enjine/engine/casting/costs.rb +8 -1
- data/lib/enjine/engine/casting/payment.rb +47 -9
- data/lib/enjine/engine/casting/permissions.rb +19 -17
- data/lib/enjine/engine/casting/target_counts.rb +14 -3
- data/lib/enjine/engine/casting/waterbend.rb +22 -2
- data/lib/enjine/engine/characteristics.rb +11 -11
- data/lib/enjine/engine/combat.rb +45 -14
- data/lib/enjine/engine/copies.rb +12 -4
- data/lib/enjine/engine/crimes.rb +46 -0
- data/lib/enjine/engine/damage.rb +85 -1
- data/lib/enjine/engine/entering.rb +36 -2
- data/lib/enjine/engine/face_down.rb +12 -3
- data/lib/enjine/engine/face_down_permanents.rb +108 -0
- data/lib/enjine/engine/faces.rb +20 -5
- data/lib/enjine/engine/follow_ups.rb +4 -1
- data/lib/enjine/engine/mana_sources.rb +18 -3
- data/lib/enjine/engine/options_memo.rb +140 -0
- data/lib/enjine/engine/permanent_designations.rb +29 -0
- data/lib/enjine/engine/resolution.rb +71 -6
- data/lib/enjine/engine/rooms.rb +86 -0
- data/lib/enjine/engine/rules.rb +6 -4
- data/lib/enjine/engine/state_based_actions.rb +25 -4
- data/lib/enjine/engine/triggers.rb +25 -20
- data/lib/enjine/engine/turn_history.rb +43 -5
- data/lib/enjine/engine/turn_structure.rb +1 -0
- data/lib/enjine/engine/zones.rb +37 -8
- data/lib/enjine/engine.rb +5 -1
- data/lib/enjine/events.rb +11 -0
- data/lib/enjine/frames.rb +5 -2
- data/lib/enjine/fuzz.rb +3 -0
- data/lib/enjine/game.rb +3 -1
- data/lib/enjine/mana.rb +3 -0
- data/lib/enjine/mechanics/abilities/chosen_values.rb +49 -6
- data/lib/enjine/mechanics/abilities/cost_changes.rb +32 -10
- data/lib/enjine/mechanics/abilities/damage_replacements.rb +137 -65
- data/lib/enjine/mechanics/abilities/designated.rb +57 -0
- data/lib/enjine/mechanics/abilities/entering_choices.rb +40 -21
- data/lib/enjine/mechanics/abilities/life_replacements.rb +74 -0
- data/lib/enjine/mechanics/abilities/mana_ability.rb +10 -4
- data/lib/enjine/mechanics/abilities/play_permissions.rb +52 -20
- data/lib/enjine/mechanics/abilities/player_rules.rb +30 -13
- data/lib/enjine/mechanics/abilities/stack_abilities.rb +12 -7
- data/lib/enjine/mechanics/abilities/static.rb +19 -6
- data/lib/enjine/mechanics/card_spec.rb +63 -11
- data/lib/enjine/mechanics/costs/base.rb +68 -9
- data/lib/enjine/mechanics/costs/behold.rb +28 -5
- data/lib/enjine/mechanics/costs/choose_creature_type.rb +43 -0
- data/lib/enjine/mechanics/costs/collect_evidence.rb +60 -0
- data/lib/enjine/mechanics/costs/exile_permanent.rb +41 -0
- data/lib/enjine/mechanics/costs/one_of.rb +3 -0
- data/lib/enjine/mechanics/costs/pay_life.rb +27 -8
- data/lib/enjine/mechanics/costs/remove_counters.rb +8 -5
- data/lib/enjine/mechanics/costs/tap.rb +44 -3
- data/lib/enjine/mechanics/effects/base.rb +36 -7
- data/lib/enjine/mechanics/effects/become.rb +29 -12
- data/lib/enjine/mechanics/effects/choose_cards.rb +44 -14
- data/lib/enjine/mechanics/effects/copy.rb +58 -21
- data/lib/enjine/mechanics/effects/counters.rb +18 -6
- data/lib/enjine/mechanics/effects/damage.rb +11 -0
- data/lib/enjine/mechanics/effects/delayed_triggers.rb +13 -6
- data/lib/enjine/mechanics/effects/earthbend.rb +2 -1
- data/lib/enjine/mechanics/effects/fight.rb +11 -0
- data/lib/enjine/mechanics/effects/library.rb +76 -18
- data/lib/enjine/mechanics/effects/may.rb +4 -2
- data/lib/enjine/mechanics/effects/pay.rb +27 -10
- data/lib/enjine/mechanics/effects/repeat.rb +92 -0
- data/lib/enjine/mechanics/effects/search.rb +34 -6
- data/lib/enjine/mechanics/effects/tokens.rb +42 -10
- data/lib/enjine/mechanics/filters/any_target.rb +6 -3
- data/lib/enjine/mechanics/filters/base.rb +36 -17
- data/lib/enjine/mechanics/filters/exile.rb +27 -0
- data/lib/enjine/mechanics/filters/permanents.rb +7 -0
- data/lib/enjine/mechanics/filters/stack.rb +14 -8
- data/lib/enjine/mechanics/keywords/alternative_costs.rb +80 -22
- data/lib/enjine/mechanics/keywords/cards_have.rb +67 -0
- data/lib/enjine/mechanics/keywords/craft.rb +132 -0
- data/lib/enjine/mechanics/keywords/cycling.rb +46 -7
- data/lib/enjine/mechanics/keywords/extort.rb +2 -0
- data/lib/enjine/mechanics/keywords/face_down.rb +165 -0
- data/lib/enjine/mechanics/keywords/flags.rb +3 -1
- data/lib/enjine/mechanics/keywords/hideaway.rb +6 -5
- data/lib/enjine/mechanics/keywords/impending.rb +75 -0
- data/lib/enjine/mechanics/keywords/increment.rb +2 -0
- data/lib/enjine/mechanics/keywords/infinity.rb +46 -0
- data/lib/enjine/mechanics/keywords/kicker.rb +24 -6
- data/lib/enjine/mechanics/keywords/miracle.rb +142 -0
- data/lib/enjine/mechanics/keywords/ninjutsu.rb +101 -0
- data/lib/enjine/mechanics/keywords/offspring.rb +48 -0
- data/lib/enjine/mechanics/keywords/persist_and_undying.rb +42 -0
- data/lib/enjine/mechanics/keywords/protection.rb +24 -8
- data/lib/enjine/mechanics/keywords/riot.rb +13 -10
- data/lib/enjine/mechanics/keywords/split_second.rb +29 -0
- data/lib/enjine/mechanics/keywords/storm_and_cascade.rb +5 -0
- data/lib/enjine/mechanics/keywords/void.rb +34 -0
- data/lib/enjine/mechanics/linked.rb +33 -3
- data/lib/enjine/mechanics/mana_spent.rb +1 -1
- data/lib/enjine/mechanics/selector.rb +62 -18
- data/lib/enjine/mechanics/subtypes/case.rb +68 -0
- data/lib/enjine/mechanics/triggers/base.rb +13 -4
- data/lib/enjine/mechanics/triggers/casting.rb +15 -9
- data/lib/enjine/mechanics/triggers/combat.rb +32 -12
- data/lib/enjine/mechanics/triggers/crime.rb +28 -0
- data/lib/enjine/mechanics/triggers/damage.rb +33 -18
- data/lib/enjine/mechanics/triggers/draw_and_discard.rb +19 -6
- data/lib/enjine/mechanics/triggers/keyword_actions.rb +17 -0
- data/lib/enjine/mechanics/triggers/rooms.rb +49 -0
- data/lib/enjine/mechanics/triggers/tap_and_counters.rb +20 -9
- data/lib/enjine/mechanics/triggers/zone_changes.rb +24 -9
- data/lib/enjine/mechanics/types/battle.rb +130 -0
- data/lib/enjine/mechanics/values.rb +84 -30
- data/lib/enjine/replacements.rb +21 -2
- data/lib/enjine/rules_monitor.rb +56 -71
- data/lib/enjine/snapshot/deep_copy.rb +23 -0
- data/lib/enjine/snapshot/player_checks.rb +10 -2
- data/lib/enjine/snapshot.rb +2 -1
- data/lib/enjine/state.rb +2 -2
- data/lib/enjine/verify.rb +10 -3
- data/lib/enjine/version.rb +1 -1
- data/lib/enjine/view.rb +50 -14
- data/lib/enjine.rb +1 -1
- metadata +34 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 4a8de114a3243b7158daba48d6980757e397052fc2516b6ae10a727f067bd4c3
|
|
4
|
+
data.tar.gz: fd1c70a0e80a23f6517d7262e3887529e34fd1c05ef3dd9b7ccb209da1b5d01d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 320c46f47283d285a31699d07d1c591d1e302001ed69ab97b7627f38f4a266723cbad4a9aea2b5fedb55f1c5b86bf14cf7162223f2d701f597cc94f064bf5ebe
|
|
7
|
+
data.tar.gz: 88e51fe93aceb02b02d63121995eefe10f1ebc3a18ea61f14d690c7d060f4917ee57921918adf28677a02cf2b7046403d0baa5451ee1a43023bf1a6fde649453
|
data/CHANGELOG.md
CHANGED
|
@@ -8,6 +8,199 @@ change the public API; the stable surface is described in
|
|
|
8
8
|
|
|
9
9
|
## [Unreleased]
|
|
10
10
|
|
|
11
|
+
## [0.6.0] - 2026-11-28
|
|
12
|
+
|
|
13
|
+
### Added
|
|
14
|
+
- An activated ability's `cost_reduction` amount may name its targets (`{"counters": {"of": {"target": 0}, "kind":
|
|
15
|
+
"+1/+1"}}`: "costs {1} less for each +1/+1 counter on the target", CR 601.2f); before targets are chosen, it counts as
|
|
16
|
+
any amount for affordability.
|
|
17
|
+
- Fuzz invariant: a pending decision always has at least one option.
|
|
18
|
+
- Keywords `split_second` (no spells or non-mana activated abilities while it's on the stack, also while another
|
|
19
|
+
object resolves; `spell_keywords` can grant it, CR 702.61), `persist` and `undying` (their dies triggers come with
|
|
20
|
+
the keyword, so statics granting them work and filters see them, CR 702.79a, 702.93a).
|
|
21
|
+
- Abilities `offspring` (optional additional cost plus a 1/1 token copy as it enters; `{"cast_with": "offspring"}`,
|
|
22
|
+
CR 702.175), `impending` (`amount`, `cost`: enters with time counters, not a creature while it has one, a counter
|
|
23
|
+
comes off at your end step; `{"cast_with": "impending"}`, CR 702.176a), `miracle` (the first card drawn this turn
|
|
24
|
+
triggers and may be cast for its miracle cost as the trigger resolves; `cards_have` with `zone: "hand"` grants it,
|
|
25
|
+
CR 702.94a) and `craft` (`cost`, `materials`: exile this and permanents you control and/or graveyard cards, return
|
|
26
|
+
it transformed; materials are `exiled_for_cost`, CR 702.167).
|
|
27
|
+
- Cost `collect_evidence` (exile graveyard cards with total mana value N or more, CR 701.59); "if evidence was
|
|
28
|
+
collected" is an optional `additional_cost` read by `{"cast_with": "additional_cost"}`.
|
|
29
|
+
- Condition `{"void": true}` (a nonland permanent left the battlefield or a spell was warped this turn).
|
|
30
|
+
- `flashback` takes `cost: "mana_cost"` (its flashback cost equals its mana cost; e.g. granted by `grant_ability`,
|
|
31
|
+
CR 702.34a). `warp` takes `from: ["hand", "graveyard"]` (CR 601.3).
|
|
32
|
+
- `cycling` takes a cost with {X} or a list of costs ("Cycling—Pay 2 life"); trigger `cycles` takes `self: true`
|
|
33
|
+
("when you cycle this card", a `zone: "graveyard"` ability whose X is the cycling ability's, CR 702.29c).
|
|
34
|
+
- Battles (CR 310): card type `battle` with a printed `defense` (it enters with defense counters, CR 310.4b) and the
|
|
35
|
+
battle type `siege`: an opponent becomes its protector as it enters (CR 310.12); the protector's opponents can
|
|
36
|
+
attack it and the protector blocks for it (CR 310.5, 310.9); damage removes defense counters (CR 120.3h); at 0
|
|
37
|
+
defense it's put into its owner's graveyard unless its triggered ability is still waiting (CR 704.5v); a Siege its
|
|
38
|
+
protector controls gets a new protector (CR 704.5x); defeated, a Siege exiles itself and its controller may cast its
|
|
39
|
+
back face without paying its mana cost (CR 310.12, 712.10). Filter `battle`; `any_target` now includes battles
|
|
40
|
+
(CR 115.4); views show `defense` and `protector`.
|
|
41
|
+
- Ability `life_gain_replacement` (CR 614.1a, 616.1): "if you would gain life, you gain twice that much / that much
|
|
42
|
+
plus 1 instead" (`multiply` / `plus`) and "if an opponent would gain life, that player loses that much life
|
|
43
|
+
instead" (`player: "opponent"`, `lose: true`).
|
|
44
|
+
- `choose_cards` takes `chooser` (a player selector: "target opponent chooses a card from among them", CR 608.2d; that
|
|
45
|
+
player looks at hidden cards first) and `count: "all"` (every matching card, no choice: "discards all cards with
|
|
46
|
+
that name").
|
|
47
|
+
- Card specs take `"name": "chosen"` (the card name chosen for the source or the resolving spell, CR 201.4): in
|
|
48
|
+
the card specs of resolving effects (`reveal_until`, `exile_top` `until`, `choose_cards`, `search_library`, ...) and
|
|
49
|
+
in `cost_modifier` `spells` (which takes `name` now), `player_rule` `spells` ("spells with the chosen name can't be
|
|
50
|
+
cast") and `grant_ability` `for`. Like `"subtypes": "chosen"`, it matches nothing in specs read without a source
|
|
51
|
+
(`play_permission`, `cards_have`, `convoke`, mana-ability spends, `cant_be_targeted_by` `abilities_from`).
|
|
52
|
+
- Triggers: `enters` and `dies` take `batched` ("whenever one or more ...", CR 603.2c); `deals_damage` takes `batched`
|
|
53
|
+
and `to` as `you`, `planeswalker`, `battle`, `permanent` or a list of them. A batched trigger's
|
|
54
|
+
`{"triggering": "objects"}` names the objects of every occurrence in its batch ("those creatures").
|
|
55
|
+
- `remove_counters` and `remove_all_counters` reach players' counters (poison, energy, experience, CR 122.1).
|
|
56
|
+
- Spell filters accept the card types `kindred` and `battle` (CR 308, 310).
|
|
57
|
+
- Static abilities may read combat and tapped status: `affects` with `{"creature": {"attacking": true}}`, `blocking`,
|
|
58
|
+
`tapped`, and an `if` such as `{"attacking": "attached"}` ("as long as equipped creature is attacking", CR 506.4).
|
|
59
|
+
- Committing a crime (CR 700.13): a spell cast, ability activated or triggered ability put on the stack that targets
|
|
60
|
+
an opponent, something an opponent controls or a card in an opponent's graveyard is one crime (activated and
|
|
61
|
+
triggered abilities count, not only spells). Trigger `commits_crime` (`controller`), amount `crimes_this_turn`,
|
|
62
|
+
event `crime_committed`.
|
|
63
|
+
- Cases (CR 720.3, 702.169): ability `to_solve` (a condition; at the beginning of your end step the Case becomes
|
|
64
|
+
solved), ability `solved` wrapping one static, triggered or activated ability, effect `solve`, condition
|
|
65
|
+
`{"solved": true}`. Solved is a permanent designation shown in views (`designations`).
|
|
66
|
+
- Harness and ∞ (CR 701.64, 702.186): effect `harness`, ability `infinity` wrapping one static, triggered or
|
|
67
|
+
activated ability, condition `{"harnessed": true}`; cost `exile_permanent` ("Exile a creature you control", not a
|
|
68
|
+
sacrifice; the cards are `exiled_for_cost`, their last known stats amount `sacrificed`).
|
|
69
|
+
- Ninjutsu (CR 702.49): an activated ability from the hand (not a cast): pay, reveal the card, return an unblocked
|
|
70
|
+
attacker; the card enters tapped and attacking what that creature attacked. Usable from the declare blockers step
|
|
71
|
+
to the end of combat.
|
|
72
|
+
- Rooms (CR 709.5, 116.2m): layout `room` (two doors sharing a type line). The card has both halves combined off the
|
|
73
|
+
battlefield, is cast as one door, and the permanent has only its unlocked doors' name, mana cost and abilities
|
|
74
|
+
(both locked: no name, mana value 0). Special action `{type: "unlock", object, door: "left" | "right"}`; trigger
|
|
75
|
+
`unlocks_door` (on a door: "when you unlock this door"; `door: "any"`, `fully: true`); views show `unlocked`.
|
|
76
|
+
- Face-down spells and permanents (CR 708): effects `manifest`, `cloak` and `manifest_dread` (CR 701.40, 701.58,
|
|
77
|
+
701.62); keyword abilities `morph` and `disguise` (cast face down for {3}, CR 702.37, 702.168); special action
|
|
78
|
+
`{type: "turn_face_up", object, via: "mana_cost" | "morph" | "disguise"}` (CR 116.2b); trigger `turned_face_up`;
|
|
79
|
+
amounts `entered_face_down_this_turn` and `turned_face_up_this_turn`. A face-down object is a nameless 2/2 (ward {2}
|
|
80
|
+
for cloak and disguise) with an id that doesn't name it; only its controller sees the card in views and events,
|
|
81
|
+
and it is revealed when it leaves the battlefield or stack and at the end of the game (CR 708.5, 708.9).
|
|
82
|
+
- Repeated keyword instances: `"keywords": ["cascade", "cascade"]` gives two cascade abilities that each trigger
|
|
83
|
+
(CR 702.85c); the same for `storm`, `extort` and `increment` (CR 702.40b, 702.101b, 702.191b). Other keywords
|
|
84
|
+
listed twice stay one instance (CR 702.2f).
|
|
85
|
+
- Effect lists nested in `may`, `pay`, `choose_cards`, `reflexive_trigger` and `delayed_trigger` number their own
|
|
86
|
+
results after the enclosing list's earlier effects: in a list nested in effect `i`, `{"result": n}` and
|
|
87
|
+
`{"this_way": n}` with `n < i` name the parent's effects as before, `i + j` the nested list's own effect `j` (a
|
|
88
|
+
`may`'s `then` continues after its `effects`; CR 608.2c, 603.12).
|
|
89
|
+
- `{"counters": {"of": {"triggering": "object"}}}`, and `power`, `toughness` and `mana_value` of `{"triggering":
|
|
90
|
+
"object"}`, read a permanent that left the battlefield as it last existed (CR 603.10a, 608.2h).
|
|
91
|
+
|
|
92
|
+
### Changed
|
|
93
|
+
- Faster legal options, with identical results (the same options in the same order, the same random numbers drawn):
|
|
94
|
+
while one decision's options are computed, a conservative mana pre-check rules out spells whose colored symbols the
|
|
95
|
+
player's mana can't reach (CR 601.2f-h) and costs above what the player could ever make; permission sources, play
|
|
96
|
+
methods, cost modifiers, battlefield characteristics and abilities by kind are found once per decision; exiled cards
|
|
97
|
+
of another owner no permission names are skipped (CR 108.3); cards with no face that has an alternative cost or a
|
|
98
|
+
special action skip the full look (`Engine::OptionsMemo`).
|
|
99
|
+
- `Game#view_for` reuses the pending decision's memoized options instead of generating them again
|
|
100
|
+
(`View.build` takes `options:`); views reuse each card's type line, mana cost text and keyword names (now frozen
|
|
101
|
+
strings), and `Snapshot.deep_copy` / `State#to_h` copy plain data without a Marshal round trip.
|
|
102
|
+
- `script/determinism_digest.rb`: plays seeded games (constructed example and random decks, the real cards, Duel
|
|
103
|
+
Commander) and prints a digest per game of every decision's options, views, export/import, rolled-back applies and
|
|
104
|
+
forks, to check that a performance change keeps games bit-identical.
|
|
105
|
+
|
|
106
|
+
### Fixed
|
|
107
|
+
- `pay` (and `counter_unless_pays` with `cost`): a cost's choices keep every key of the option, so `remove_counters`
|
|
108
|
+
removes the chosen counter kind (it removed nothing and still counted as paid), and `choose_creature_type` then
|
|
109
|
+
`behold` `"subtypes": "chosen"` work while resolving (the resolving spell or ability remembers the type, CR 118.12).
|
|
110
|
+
- `pay` in a triggered or activated ability: "this permanent" costs (`remove_counters` `self: true`, `sacrifice`,
|
|
111
|
+
`other: true`) refer to the source permanent while it is still on the battlefield under the ability's controller,
|
|
112
|
+
not to the ability on the stack (CR 113.7a); once it has left, they can't be paid (CR 400.7).
|
|
113
|
+
- `exile_this_spell` may come before effects that ask for a decision or pay, and before a `reflexive_trigger`: the
|
|
114
|
+
resolving frame keeps the spell as it last existed on the stack and it stands in for itself until it has resolved
|
|
115
|
+
(CR 608.2n; it raised `KeyError`). Snapshots and their validation keep it (`left_stack` in the resolve frame).
|
|
116
|
+
- `cost_modifier` `spells: {"subtypes": "chosen"}` reduces the cost of spells of the type chosen for the permanent
|
|
117
|
+
(CR 607.2d; it never applied).
|
|
118
|
+
- A granted mana ability's `{"tap": "granter"}` cost taps the granting permanent; affordability counts such abilities
|
|
119
|
+
as one source among all of them, and cancelling a payment untaps the granter (CR 602.2b, 607.1a, 734.1).
|
|
120
|
+
- A payment made irreversible by a mana ability (paying life, sacrificing) that can no longer be finished offers
|
|
121
|
+
`cancel` instead of no option at all: the cast is rewound (or the resolving payment counts as unpaid), the mana
|
|
122
|
+
abilities aren't (their sources stay tapped, their mana stays in the pool) and the mana spent goes back to the pool
|
|
123
|
+
(CR 734.1).
|
|
124
|
+
- A `one_of` in a mana ability's cost is refused when the card is loaded (it crashed when activated, CR 605.3a).
|
|
125
|
+
- "Target ... with mana value X" reads the X of the spell or ability being cast (CR 601.2b-c, 608.2b), not its
|
|
126
|
+
source's.
|
|
127
|
+
- Permanents put into graveyards by the same state-based-action check are one event batch for "one or more"
|
|
128
|
+
triggers (CR 603.2c, 704.3); before, each was its own batch. Combat damage of one step is named as one batch
|
|
129
|
+
explicitly (CR 510.2).
|
|
130
|
+
- `cost_modifier` `spells` with `"subtypes": "chosen"` now reads the source's choice (it never matched before).
|
|
131
|
+
- An additional trigger of a batched ability no longer shares its "that many" count with the original.
|
|
132
|
+
- `"self"` in a permanent's own leaves-the-battlefield trigger finds the card in the public zone it went to while
|
|
133
|
+
it's still there, so "when this dies, exile it / return it" works (CR 400.7e); amounts of `"self"` still read it
|
|
134
|
+
as it last existed.
|
|
135
|
+
- A token copy of a card counts as a token in `{"triggering": filter}` conditions (CR 111.1).
|
|
136
|
+
- A dies trigger of a permanent that was cast remembers how (`was_cast`, `cast_from` / `cast_with`, kicker, the
|
|
137
|
+
mana spent); `was_cast` and `cast_from` / `cast_with` also work as its intervening "if" (CR 400.7d, 603.4).
|
|
138
|
+
- `{"triggering": "object"}` names the permanent of a `becomes_untapped` trigger (CR 603.2).
|
|
139
|
+
- A reflexive trigger's `{"this_way": n}` reads its own effects' amounts, not the creating list's.
|
|
140
|
+
- Color identity counts the colors of a mana choice among some (`"color": "any_one", "colors": ["B", "G"]`), and
|
|
141
|
+
no longer counts mana of the chosen color (a fixed color gated by `"only_if": {"chosen": ...}`, CR 903.4).
|
|
142
|
+
- `RulesMonitor` reads a permanent's types, keywords and abilities from the engine's layers 1-6 (CR 613.1a-f)
|
|
143
|
+
instead of re-deriving them from the printed card, and recomputes only layer 7 and the rules that follow. No more
|
|
144
|
+
false findings for: statics matching a creature that "becomes a Bear in addition to its other types" (CR 205.1b,
|
|
145
|
+
613.4c); a creature an effect made only a land (CR 208.3); keyword counters (an indestructible counter, CR 122.1b,
|
|
146
|
+
704.5g); a copy's `except` keywords (haste on a token copy, CR 707.9b, 302.6); keywords an Aura granted before a
|
|
147
|
+
"loses all abilities" effect (timestamps, CR 613.7, 702.9b); extra land plays from a class level or a station symbol
|
|
148
|
+
(CR 305.2, 717.2a, 722.2a); "no maximum hand size" from an emblem (CR 114.4, 514.1). It also counts every
|
|
149
|
+
power/toughness counter (`-0/-1`, `+1/+0`, ..., CR 122.1a) and checks a `"-X"` loyalty ability against the X
|
|
150
|
+
announced (CR 606.4, 107.3).
|
|
151
|
+
- `Enjine::Verify` places a colorless land with a colored activated ability or cycling cost in a coverage deck whose
|
|
152
|
+
colors cover it, instead of failing to build one ("does not fit a … deck") and never exercising the land.
|
|
153
|
+
|
|
154
|
+
## [0.5.0] - 2026-11-24
|
|
155
|
+
|
|
156
|
+
### Added
|
|
157
|
+
- Casting permissions: `play_permission` `duration: "while_you_control_source"` ("for as long as you control this
|
|
158
|
+
creature", CR 611.2b), `during: "your_turn"` and `waterbend: "mana_value"` (cast by waterbending {X}, CR 701.67a);
|
|
159
|
+
`cast` and `cast_free` take `from` (e.g. `"graveyard"`), `cast` takes `exile_instead` (CR 608.2g), `cast_free` takes
|
|
160
|
+
`count` as an integer ("up to three").
|
|
161
|
+
- Ability `cards_have`: cards you own in a zone have a keyword alternative cost (flashback, harmonize, mayhem,
|
|
162
|
+
web_slinging or sneak) and may be cast with it ("Creature cards in your graveyard have sneak {3}{B}", CR 611.3a);
|
|
163
|
+
cast option `via: "alt:cards_have:<permanent>:<ref>"`.
|
|
164
|
+
- Costs: an optional `additional_cost` with `flash: true` ("as though it had flash if you behold a Dragon", CR 601.3c);
|
|
165
|
+
`choose_creature_type` before `behold` with `"subtypes": "chosen"` (CR 607.2d); `exile_from_graveyard` with
|
|
166
|
+
`count: "any"` and `symbols` (a mana-symbol total, CR 107.4e), and `copy_card` `of: "exiled_for_cost"`; `pay_life`
|
|
167
|
+
with a computed amount (`{"power": "self"}`, e.g. in ward); `remove_counters` with `self: true` and `count`.
|
|
168
|
+
- Card specs take `same_name_as` (a filter: "with the same name as a legendary permanent you control", CR 201.2a)
|
|
169
|
+
and `"subtypes": "chosen"`. `search_library` takes `battlefield_instead` (`if`, `for`).
|
|
170
|
+
- Triggers: `gives_gift` ("whenever you give a gift", CR 702.174c); `cast` with `owner: you | not_you` ("a spell you
|
|
171
|
+
don't own", CR 108.3); `attacks` with `alone: true` (CR 506.5); `counters_placed` with `nth` ("when the fourth plan
|
|
172
|
+
counter is put on it", CR 122.6).
|
|
173
|
+
- Effects, zones and loops: `repeat` (`effects`, `while`: "repeat this process", CR 608.2c), with `{"result": n,
|
|
174
|
+
"for": card spec}` selectors; `exile_top` `until` (`{"total_mana_value": n}` or `{"card": spec}`, CR 406.1);
|
|
175
|
+
`cast_free` `count: "any"`; `choose_cards` `random: true`; target filter `exiled_with` (a card this object's
|
|
176
|
+
abilities exiled, with `link: true` on `exile`, `choose_cards`, `dig`, `exile_top` and `exile_if_dies`, CR 607.2a);
|
|
177
|
+
condition `attacking` ("if it was attacking", CR 608.2h); stack filters `single_target`; effect `change_target`
|
|
178
|
+
(CR 115.7a); `dig` `looker: "source_controller"`.
|
|
179
|
+
- Statics, grants and combat: cost `{"tap": "granter"}` in a granted ability (CR 602.2b, 607.1a); `become`
|
|
180
|
+
`colors: "chosen"` with `hexproof_from: "chosen_color"` bound into the granted ability (CR 607.2d); keyword
|
|
181
|
+
`cant_become_untapped` (CR 701.26b); the `choose_card_name` ability takes `types` and `look_at_hand`, and is now
|
|
182
|
+
an effect too (`remember: "source"` for every resolving `choose_*`); `"name": "chosen"` in filters and in
|
|
183
|
+
`player_rule` `cant_activate` (CR 201.4, 602.5); `player_rule` `cant_be_attacked` with a `filter` (CR 508.1c);
|
|
184
|
+
statics can grant `cant_be_blocked_by`, and `become` can grant `tapping_power`; `create_token` `size` (an N/N
|
|
185
|
+
token, CR 707.2); riot granted by a static ability is chosen as the permanent enters (CR 614.12, 702.136b).
|
|
186
|
+
- Decision `damage_order` (CR 616.1): when the order of replacement and prevention effects on one damage event
|
|
187
|
+
changes the result, the affected player chooses it. Agents must answer this new decision kind.
|
|
188
|
+
|
|
189
|
+
### Changed
|
|
190
|
+
- `choose_new_targets` and `copy_spell` targets become targets (ward and `becomes_target` trigger, CR 115.7, 707.10);
|
|
191
|
+
new targets of a divided spell keep each target's share (CR 115.7f); `prevent_damage` `by: "chosen_source"` may
|
|
192
|
+
choose spells, abilities and command-zone objects (CR 609.7a-b); tokens created attacking choose a planeswalker to
|
|
193
|
+
attack when there is one (CR 508.4); "copy that ability" after it left the stack copies it as it last existed.
|
|
194
|
+
- A hidden-away card may be looked at and played by whoever controls the permanent now (CR 702.75a); earthbend's
|
|
195
|
+
return ends when the land leaves for another zone; a melded permanent's mana value is its front faces' total
|
|
196
|
+
(CR 713.5c).
|
|
197
|
+
|
|
198
|
+
### Fixed
|
|
199
|
+
- A card's colors include those of its hybrid symbols (CR 202.2d): a `{U/B}` card is black for `"colors": ["B"]`.
|
|
200
|
+
- "Damage can't be prevented" against a prevention effect with `then`: it still applies once without preventing
|
|
201
|
+
anything (CR 615.12).
|
|
202
|
+
- The rules monitor accepts a spell cast at instant speed through its paid flash-granting additional cost (CR 601.3c).
|
|
203
|
+
|
|
11
204
|
## [0.4.1] - 2026-11-22
|
|
12
205
|
|
|
13
206
|
Includes 0.4.0, which was tagged but never published to RubyGems.
|
|
@@ -114,7 +307,9 @@ Includes 0.4.0, which was tagged but never published to RubyGems.
|
|
|
114
307
|
- `enjine` CLI: hot-seat and random play, `--validate`, `--verify`,
|
|
115
308
|
`--random-deck`, save and load.
|
|
116
309
|
|
|
117
|
-
[Unreleased]: https://github.com/thisiscetin/enjine/compare/v0.
|
|
310
|
+
[Unreleased]: https://github.com/thisiscetin/enjine/compare/v0.6.0...HEAD
|
|
311
|
+
[0.6.0]: https://github.com/thisiscetin/enjine/compare/v0.5.0...v0.6.0
|
|
312
|
+
[0.5.0]: https://github.com/thisiscetin/enjine/compare/v0.4.1...v0.5.0
|
|
118
313
|
[0.4.1]: https://github.com/thisiscetin/enjine/compare/v0.4.0...v0.4.1
|
|
119
314
|
[0.4.0]: https://github.com/thisiscetin/enjine/compare/v0.3.0...v0.4.0
|
|
120
315
|
[0.3.0]: https://github.com/thisiscetin/enjine/compare/v0.2.0...v0.3.0
|
data/README.md
CHANGED
|
@@ -9,8 +9,10 @@ atomic decision with a list of legal options. That makes it a solid base for
|
|
|
9
9
|
simulations, bots and reinforcement learning, or for a game client.
|
|
10
10
|
|
|
11
11
|
**Scope: Standard.** Enjine implements the core rules and the mechanics of the
|
|
12
|
-
current Standard-legal sets
|
|
13
|
-
|
|
12
|
+
current Standard-legal sets, plus a growing set of older mechanics that real
|
|
13
|
+
decks ask for (face-down cards, persist and undying, ninjutsu, miracle, battles,
|
|
14
|
+
Rooms, Cases, ...). Mechanics nothing supports yet (madness, infect, mutate, ...)
|
|
15
|
+
are rejected at validation. The
|
|
14
16
|
[mechanics coverage](docs/MECHANICS_COVERAGE.md) page has the details and the
|
|
15
17
|
numbers. Games are constructed by default; two-player **Duel Commander** (CR 903)
|
|
16
18
|
is a `format:` away (`--format duel_commander` in the CLI).
|
|
@@ -29,7 +31,9 @@ is a `format:` away (`--format duel_commander` in the CLI).
|
|
|
29
31
|
omniscient observer view.
|
|
30
32
|
- **No runtime dependencies.** Plain Ruby 4.0.
|
|
31
33
|
|
|
32
|
-
> **Status: 0.1.**
|
|
34
|
+
> **Status: 0.6, pre-1.0.** The public API is described in the
|
|
35
|
+
> [API guide](docs/guides/api.md); minor versions may still change it (see
|
|
36
|
+
> [CHANGELOG.md](CHANGELOG.md)). Start there and with the
|
|
33
37
|
> [card DSL guide](docs/guides/card-data-format.md). Progress and what's pending
|
|
34
38
|
> are in [docs/plans/standard.md](docs/plans/standard.md).
|
|
35
39
|
|
|
@@ -175,6 +179,8 @@ bundle exec exe/enjine --verify my_cards/ # validate, then play-test them i
|
|
|
175
179
|
bundle exec rake # specs (with coverage gate + docs drift check) and RuboCop
|
|
176
180
|
bundle exec rake docs # regenerate SUPPORTED.md and docs/reference after changing a primitive
|
|
177
181
|
bundle exec rake fuzz[50,1] # 50 random games, invariants checked after every decision
|
|
182
|
+
bundle exec rake "fuzz[40,3,duel_commander]" # the same in Duel Commander
|
|
183
|
+
bundle exec ruby -Ilib script/determinism_digest.rb 80 tmp/a.txt # per-game digests; diff two runs around a speedup
|
|
178
184
|
bundle exec rake bench # games per second (benchmark-ips)
|
|
179
185
|
bundle exec rake profile # stackprof CPU profile
|
|
180
186
|
```
|
|
@@ -184,6 +190,9 @@ Every mechanic is tested at three levels:
|
|
|
184
190
|
- **Integration:** scenario boards built with a small DSL, then legal options, then a decision, then the resulting state and events.
|
|
185
191
|
- **End-to-end:** full 60-card games, scripted and fuzzed, with export/import round-trips.
|
|
186
192
|
|
|
193
|
+
Rules-monitored play (`Enjine::Verify`, `--verify`) reruns an independent check of
|
|
194
|
+
the layer system and state-based actions against every game it plays.
|
|
195
|
+
|
|
187
196
|
## Contributing
|
|
188
197
|
|
|
189
198
|
Contributions are welcome: see [CONTRIBUTING.md](CONTRIBUTING.md) and the
|