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.
Files changed (158) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +196 -1
  3. data/README.md +12 -3
  4. data/SUPPORTED.md +73 -38
  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 +146 -9
  9. data/docs/plans/dsl-gaps.md +23 -0
  10. data/docs/reference/abilities.md +299 -25
  11. data/docs/reference/costs.md +59 -6
  12. data/docs/reference/decisions.md +7 -1
  13. data/docs/reference/effects.md +200 -27
  14. data/docs/reference/filters.md +30 -3
  15. data/docs/reference/keywords.md +58 -2
  16. data/docs/reference/subtypes.md +18 -0
  17. data/docs/reference/triggers.md +94 -14
  18. data/docs/reference/types.md +20 -0
  19. data/lib/enjine/actions/play_land.rb +3 -1
  20. data/lib/enjine/actions/special_action.rb +4 -0
  21. data/lib/enjine/actions/turn_face_up.rb +25 -0
  22. data/lib/enjine/actions/unlock.rb +23 -0
  23. data/lib/enjine/card_definition.rb +54 -15
  24. data/lib/enjine/card_face_down.rb +31 -0
  25. data/lib/enjine/card_faces.rb +4 -2
  26. data/lib/enjine/card_rooms.rb +86 -0
  27. data/lib/enjine/catalog.rb +9 -3
  28. data/lib/enjine/cli/text.rb +11 -3
  29. data/lib/enjine/color_identity.rb +34 -1
  30. data/lib/enjine/decisions/casting.rb +6 -3
  31. data/lib/enjine/decisions/combat.rb +4 -2
  32. data/lib/enjine/decisions/damage_order.rb +18 -0
  33. data/lib/enjine/engine/ability_layers.rb +14 -1
  34. data/lib/enjine/engine/casting/alt_casting.rb +45 -5
  35. data/lib/enjine/engine/casting/cast_choices.rb +21 -2
  36. data/lib/enjine/engine/casting/casting.rb +42 -29
  37. data/lib/enjine/engine/casting/cost_options.rb +3 -1
  38. data/lib/enjine/engine/casting/costs.rb +8 -1
  39. data/lib/enjine/engine/casting/payment.rb +47 -9
  40. data/lib/enjine/engine/casting/permissions.rb +19 -17
  41. data/lib/enjine/engine/casting/target_counts.rb +14 -3
  42. data/lib/enjine/engine/casting/waterbend.rb +22 -2
  43. data/lib/enjine/engine/characteristics.rb +11 -11
  44. data/lib/enjine/engine/combat.rb +45 -14
  45. data/lib/enjine/engine/copies.rb +12 -4
  46. data/lib/enjine/engine/crimes.rb +46 -0
  47. data/lib/enjine/engine/damage.rb +85 -1
  48. data/lib/enjine/engine/entering.rb +36 -2
  49. data/lib/enjine/engine/face_down.rb +12 -3
  50. data/lib/enjine/engine/face_down_permanents.rb +108 -0
  51. data/lib/enjine/engine/faces.rb +20 -5
  52. data/lib/enjine/engine/follow_ups.rb +4 -1
  53. data/lib/enjine/engine/mana_sources.rb +18 -3
  54. data/lib/enjine/engine/options_memo.rb +140 -0
  55. data/lib/enjine/engine/permanent_designations.rb +29 -0
  56. data/lib/enjine/engine/resolution.rb +71 -6
  57. data/lib/enjine/engine/rooms.rb +86 -0
  58. data/lib/enjine/engine/rules.rb +6 -4
  59. data/lib/enjine/engine/state_based_actions.rb +25 -4
  60. data/lib/enjine/engine/triggers.rb +25 -20
  61. data/lib/enjine/engine/turn_history.rb +43 -5
  62. data/lib/enjine/engine/turn_structure.rb +1 -0
  63. data/lib/enjine/engine/zones.rb +37 -8
  64. data/lib/enjine/engine.rb +5 -1
  65. data/lib/enjine/events.rb +11 -0
  66. data/lib/enjine/frames.rb +5 -2
  67. data/lib/enjine/fuzz.rb +3 -0
  68. data/lib/enjine/game.rb +3 -1
  69. data/lib/enjine/mana.rb +3 -0
  70. data/lib/enjine/mechanics/abilities/chosen_values.rb +49 -6
  71. data/lib/enjine/mechanics/abilities/cost_changes.rb +32 -10
  72. data/lib/enjine/mechanics/abilities/damage_replacements.rb +137 -65
  73. data/lib/enjine/mechanics/abilities/designated.rb +57 -0
  74. data/lib/enjine/mechanics/abilities/entering_choices.rb +40 -21
  75. data/lib/enjine/mechanics/abilities/life_replacements.rb +74 -0
  76. data/lib/enjine/mechanics/abilities/mana_ability.rb +10 -4
  77. data/lib/enjine/mechanics/abilities/play_permissions.rb +52 -20
  78. data/lib/enjine/mechanics/abilities/player_rules.rb +30 -13
  79. data/lib/enjine/mechanics/abilities/stack_abilities.rb +12 -7
  80. data/lib/enjine/mechanics/abilities/static.rb +19 -6
  81. data/lib/enjine/mechanics/card_spec.rb +63 -11
  82. data/lib/enjine/mechanics/costs/base.rb +68 -9
  83. data/lib/enjine/mechanics/costs/behold.rb +28 -5
  84. data/lib/enjine/mechanics/costs/choose_creature_type.rb +43 -0
  85. data/lib/enjine/mechanics/costs/collect_evidence.rb +60 -0
  86. data/lib/enjine/mechanics/costs/exile_permanent.rb +41 -0
  87. data/lib/enjine/mechanics/costs/one_of.rb +3 -0
  88. data/lib/enjine/mechanics/costs/pay_life.rb +27 -8
  89. data/lib/enjine/mechanics/costs/remove_counters.rb +8 -5
  90. data/lib/enjine/mechanics/costs/tap.rb +44 -3
  91. data/lib/enjine/mechanics/effects/base.rb +36 -7
  92. data/lib/enjine/mechanics/effects/become.rb +29 -12
  93. data/lib/enjine/mechanics/effects/choose_cards.rb +44 -14
  94. data/lib/enjine/mechanics/effects/copy.rb +58 -21
  95. data/lib/enjine/mechanics/effects/counters.rb +18 -6
  96. data/lib/enjine/mechanics/effects/damage.rb +11 -0
  97. data/lib/enjine/mechanics/effects/delayed_triggers.rb +13 -6
  98. data/lib/enjine/mechanics/effects/earthbend.rb +2 -1
  99. data/lib/enjine/mechanics/effects/fight.rb +11 -0
  100. data/lib/enjine/mechanics/effects/library.rb +76 -18
  101. data/lib/enjine/mechanics/effects/may.rb +4 -2
  102. data/lib/enjine/mechanics/effects/pay.rb +27 -10
  103. data/lib/enjine/mechanics/effects/repeat.rb +92 -0
  104. data/lib/enjine/mechanics/effects/search.rb +34 -6
  105. data/lib/enjine/mechanics/effects/tokens.rb +42 -10
  106. data/lib/enjine/mechanics/filters/any_target.rb +6 -3
  107. data/lib/enjine/mechanics/filters/base.rb +36 -17
  108. data/lib/enjine/mechanics/filters/exile.rb +27 -0
  109. data/lib/enjine/mechanics/filters/permanents.rb +7 -0
  110. data/lib/enjine/mechanics/filters/stack.rb +14 -8
  111. data/lib/enjine/mechanics/keywords/alternative_costs.rb +80 -22
  112. data/lib/enjine/mechanics/keywords/cards_have.rb +67 -0
  113. data/lib/enjine/mechanics/keywords/craft.rb +132 -0
  114. data/lib/enjine/mechanics/keywords/cycling.rb +46 -7
  115. data/lib/enjine/mechanics/keywords/extort.rb +2 -0
  116. data/lib/enjine/mechanics/keywords/face_down.rb +165 -0
  117. data/lib/enjine/mechanics/keywords/flags.rb +3 -1
  118. data/lib/enjine/mechanics/keywords/hideaway.rb +6 -5
  119. data/lib/enjine/mechanics/keywords/impending.rb +75 -0
  120. data/lib/enjine/mechanics/keywords/increment.rb +2 -0
  121. data/lib/enjine/mechanics/keywords/infinity.rb +46 -0
  122. data/lib/enjine/mechanics/keywords/kicker.rb +24 -6
  123. data/lib/enjine/mechanics/keywords/miracle.rb +142 -0
  124. data/lib/enjine/mechanics/keywords/ninjutsu.rb +101 -0
  125. data/lib/enjine/mechanics/keywords/offspring.rb +48 -0
  126. data/lib/enjine/mechanics/keywords/persist_and_undying.rb +42 -0
  127. data/lib/enjine/mechanics/keywords/protection.rb +24 -8
  128. data/lib/enjine/mechanics/keywords/riot.rb +13 -10
  129. data/lib/enjine/mechanics/keywords/split_second.rb +29 -0
  130. data/lib/enjine/mechanics/keywords/storm_and_cascade.rb +5 -0
  131. data/lib/enjine/mechanics/keywords/void.rb +34 -0
  132. data/lib/enjine/mechanics/linked.rb +33 -3
  133. data/lib/enjine/mechanics/mana_spent.rb +1 -1
  134. data/lib/enjine/mechanics/selector.rb +62 -18
  135. data/lib/enjine/mechanics/subtypes/case.rb +68 -0
  136. data/lib/enjine/mechanics/triggers/base.rb +13 -4
  137. data/lib/enjine/mechanics/triggers/casting.rb +15 -9
  138. data/lib/enjine/mechanics/triggers/combat.rb +32 -12
  139. data/lib/enjine/mechanics/triggers/crime.rb +28 -0
  140. data/lib/enjine/mechanics/triggers/damage.rb +33 -18
  141. data/lib/enjine/mechanics/triggers/draw_and_discard.rb +19 -6
  142. data/lib/enjine/mechanics/triggers/keyword_actions.rb +17 -0
  143. data/lib/enjine/mechanics/triggers/rooms.rb +49 -0
  144. data/lib/enjine/mechanics/triggers/tap_and_counters.rb +20 -9
  145. data/lib/enjine/mechanics/triggers/zone_changes.rb +24 -9
  146. data/lib/enjine/mechanics/types/battle.rb +130 -0
  147. data/lib/enjine/mechanics/values.rb +84 -30
  148. data/lib/enjine/replacements.rb +21 -2
  149. data/lib/enjine/rules_monitor.rb +56 -71
  150. data/lib/enjine/snapshot/deep_copy.rb +23 -0
  151. data/lib/enjine/snapshot/player_checks.rb +10 -2
  152. data/lib/enjine/snapshot.rb +2 -1
  153. data/lib/enjine/state.rb +2 -2
  154. data/lib/enjine/verify.rb +10 -3
  155. data/lib/enjine/version.rb +1 -1
  156. data/lib/enjine/view.rb +50 -14
  157. data/lib/enjine.rb +1 -1
  158. metadata +34 -1
@@ -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
@@ -1372,7 +1401,7 @@ grants its abilities.
1372
1401
  | "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 |
1373
1402
  | "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"]` |
1374
1403
  | 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 |
1375
- | "Hideaway 4" (CR 702.75a) | ability `{ "hideaway": { "amount": 4 } }`: the exiled card is `"exiled_with"` the permanent, face down, and only its controller may look at it |
1404
+ | "Hideaway 4" (CR 702.75a) | ability `{ "hideaway": { "amount": 4 } }`: the exiled card is `"exiled_with"` the permanent, face down, and only the player who controls the permanent may look at it |
1376
1405
  | "You may play the exiled card without paying its mana cost" | `{ "cast_free": { "to": "exiled_with", "play": true } }` (`play: true` also plays a land, on your turn with a land play left, CR 305.2a, 305.3) |
1377
1406
  | "look at the top N cards, exile one face down" | `{ "dig": { "amount": N, "put": "exile", "face_down": true, "link": true } }` (`link`: exiled with the source) |
1378
1407
  | "Devour land 3" (CR 702.82c) / "Devour 2" | ability `{ "devour": { "amount": 3, "each": "land" } }` / `{ "devour": { "amount": 2 } }`: as it enters, `enter_choice` `{type: "devour", object: id}` picks permanents one at a time, then `{type: "done"}`; it enters with N +1/+1 counters for each and remembers how many it devoured |
@@ -1389,6 +1418,111 @@ grants its abilities.
1389
1418
  { "foretell": { "cost": "{1}{R}" } }] }
1390
1419
  ```
1391
1420
 
1421
+ ### 4.30 Casting permissions: "for as long as you control", flash by a cost, granted sneak, costs that read the board
1422
+
1423
+ | Oracle text | Data |
1424
+ | --- | --- |
1425
+ | "You may play that card for as long as you control this creature" (CR 611.2b) | `{ "play_permission": { "to": { "result": 0 }, "duration": "while_you_control_source" } }` (ends when the source leaves or changes control; never starts if that already happened) |
1426
+ | "For as long as you control Hama, you may cast the exiled card during your turn by waterbending {X} rather than paying its mana cost, where X is its mana value" (CR 701.67a, 118.9) | the same with `"play": "cast", "during": "your_turn", "waterbend": "mana_value"` (pay_cost `{type: "waterbend", object: id}` taps an artifact or creature for {1}) |
1427
+ | "You may cast this spell as though it had flash if you behold a Dragon as an additional cost" (CR 601.3c) | `{ "additional_cost": { "cost": [{ "behold": { "card": { "subtypes": ["dragon"] } } }], "optional": true, "flash": true } }`: at instant speed only `kick` is offered |
1428
+ | "As an additional cost to cast this spell, you may choose a creature type and behold two creatures of that type" (CR 601.2b, 607.2d) | `"cost": [{ "choose_creature_type": {} }, { "behold": { "card": { "types": ["creature"], "subtypes": "chosen" }, "count": 2 } }]` with `"optional": true` (`choose_cost` option `{type: "cost", creature_type: "elf"}`; the spell remembers the type) |
1429
+ | "If this spell's additional cost was paid and the revealed card is the chosen type, put that card onto the battlefield instead" | `search_library` with `"battlefield_instead": { "if": { "cast_with": "additional_cost" }, "for": { "subtypes": "chosen" } }` |
1430
+ | "Discard a legendary card with the same name as a legendary permanent you control" (CR 201.2a) | `{ "discard": { "card": { "supertypes": ["legendary"], "same_name_as": { "permanent": { "supertypes": ["legendary"], "controller": "you" } } } } }` (a card spec relation, read for whoever pays) |
1431
+ | "Exile any number of black cards from your graveyard with fifteen or more black mana symbols among their mana costs: Copy those exiled cards. You may cast up to three of the copies without paying their mana costs." (CR 107.4e, 707.12) | cost `{ "exile_from_graveyard": { "count": "any", "card": { "colors": ["B"] }, "symbols": { "color": "B", "at_least": 15 } } }` (choose cards, `done` once enough symbols are chosen); effects `{ "copy_card": { "of": "exiled_for_cost" } }`, `{ "cast_free": { "to": { "result": 0 }, "count": 3 } }` |
1432
+ | "Whenever Bilbo attacks, you may cast an artifact, instant, or sorcery spell from your graveyard. If an instant or sorcery spell cast this way would be put into your graveyard, exile it instead." (CR 608.2g) | `{ "cast": { "from": "graveyard", "for": { "any_of": [...] }, "exile_instead": { "any_of": [{ "types": ["instant"] }, { "types": ["sorcery"] }] } } }` (`from` also on `cast_free`; `count` takes an integer: "up to N") |
1433
+ | "Creature cards in your graveyard have sneak {3}{B}. You may cast creature spells from your graveyard using their sneak abilities." (CR 611.3a) | `{ "cards_have": { "zone": "graveyard", "cards": { "types": ["creature"] }, "ability": { "sneak": { "cost": "{3}{B}" } } } }` (flashback, harmonize, mayhem, web-slinging or sneak; cast option `via: "alt:cards_have:<permanent>:<ref>"`) |
1434
+ | "Whenever you cast a spell you don't own" (CR 108.3) | trigger `{ "cast": { "owner": "not_you" } }` (`"you"`: one you own) |
1435
+ | "Ward—Pay life equal to Raubahn's power" (CR 702.21a) | `{ "ward": { "cost": [{ "pay_life": { "power": "self" } }] } }` (`pay_life` takes an amount, computed as it's paid) |
1436
+ | "Whenever you give a gift" (CR 702.174c) | trigger `{ "gives_gift": {} }`: a gift-promised instant or sorcery you control resolves, or a permanent's gift trigger (`"if": { "cast_with": "gift" }`) resolves |
1437
+ | "Remove two counters from Ghost-Spider" | `{ "remove_counters": { "count": 2, "self": true } }` |
1438
+
1439
+ A card's colors include those of its hybrid symbols (CR 202.2d), so a `{U/B}` card is a black card for `"colors": ["B"]`.
1440
+
1441
+ ```json
1442
+ { "name": "Example Bloodwater Adept", "mana_cost": "{2}{U}{B}", "types": ["creature"], "subtypes": ["human", "warlock"],
1443
+ "power": 3, "toughness": 3,
1444
+ "abilities": [{ "triggered": { "when": { "enters": {} },
1445
+ "effects": [{ "exile_top": { "amount": 1 } },
1446
+ { "play_permission": { "to": { "result": 0 }, "play": "cast",
1447
+ "duration": "while_you_control_source",
1448
+ "during": "your_turn", "waterbend": "mana_value" } }] } }] }
1449
+ ```
1450
+
1451
+ ### 4.31 Rules correctness: ordering damage effects, new targets, chosen sources, entering attacking
1452
+
1453
+ These need no new data: the shapes above play by these rules.
1454
+
1455
+ | Rule | How the engine applies it |
1456
+ | --- | --- |
1457
+ | Several replacement and prevention effects apply to one damage event (CR 616.1, 616.1e-f) | Redirections (`redirect`) apply first. When the order of the others changes the result (the damage dealt, a shield left, a `then` amount), the affected player (the player dealt damage, or the permanent's controller) gets a `damage_order` decision before the damage is dealt: options `{type: "order", order: [keys], steps: [labels], amount: n}`, one per distinct result, asked in APNAP order for combat damage. Otherwise nothing is asked and the order is prevention, multiplying, adding (statics before resolved effects). Each effect applies once; after each, the others are rechecked |
1458
+ | "Damage can't be prevented" against a prevention effect with `then` (CR 615.12) | The prevention effect still applies once: nothing is prevented, a shield (`next`, `next_time`) isn't used up, and its `then` happens with `{"triggering": "amount"}` 0, except a `reflexive_trigger` ("when damage is prevented this way") |
1459
+ | `choose_new_targets`, `copy_spell` (CR 115.7, 707.10, 702.21a) | Each new target, and each target of a copy, becomes a target of that spell or ability: ward and `becomes_target` trigger (for the spell's controller) |
1460
+ | New targets for a divided spell (CR 115.7f, 601.2d) | Each target's share of the division goes to the target that replaced it; a new target can't be another target of the same spell |
1461
+ | `prevent_damage` with `"by": "chosen_source"` (CR 609.7a-b) | The choice includes permanents, spells and abilities on the stack, objects they refer to (targets, an ability's source) and objects in the command zone. A chosen permanent spell's damage is prevented also once it is a permanent |
1462
+ | `create_token` with `attacking: true` (CR 508.4) | When the defending player controls a planeswalker, the controller chooses for each token what it attacks: an `effect_choice` of `{type: "attack", target: ref}` |
1463
+ | `copy_spell` of `{"triggering": "ability"}` after that ability left the stack (CR 707.10, 608.2h) | The engine's reading for "copy that ability" (Firebender Ascension): it is copied as it last existed on the stack, with its targets, modes and X |
1464
+
1465
+ ### 4.32 Statics, grants and combat: granted costs, bound choices, chosen names, riot grants, attacking alone
1466
+
1467
+ | Oracle text | Data |
1468
+ | --- | --- |
1469
+ | "Equipped creature has '{1}, {T}, Tap Fishing Pole: Put a bait counter on Fishing Pole.'" (CR 602.2b, 607.1a) | granted `activated` with `"cost": [{ "mana": "{1}" }, "tap", { "tap": "granter" }]` and `"to": "granter"` (the cost taps the permanent that granted this ability; not {T}, so summoning sickness doesn't matter) |
1470
+ | "remove a bait counter from this Equipment. If you do, create …" | `remove_counters`, then the effect with `"if": { "amount": { "this_way": 0 }, "at_least": 1 }` (how many were removed) |
1471
+ | "Until end of turn, ~ becomes the color of your choice and gains hexproof from that color" (CR 607.2d) | `{ "choose_color": {} }`, then `{ "become": { "colors": "chosen", "abilities": [{ "hexproof_from": "chosen_color" }], "to": "self" } }`: the color is bound into the granted ability as it resolves, so a second activation with another color adds a second hexproof (`"chosen_color"` on a permanent that chose as it entered reads its own choice) |
1472
+ | "That creature can't become untapped for as long as you control ~" (CR 701.26b) | `{ "become": { "keywords": ["cant_become_untapped"], "duration": "while_you_control_source", "to": { "target": 0 } } }` (neither the untap step nor "untap it" untaps it; `doesnt_untap` only stops the untap step); "Enchanted creature can't become untapped" is a `static` handing out the same keyword |
1473
+ | "As this artifact enters, look at an opponent's hand, then choose any card name" | `{ "choose_card_name": { "look_at_hand": "opponent" } }` (`types`: `["land"]` for "a land card name") |
1474
+ | "When this land enters, choose a land card name." (a triggered ability, linked to the land's other abilities) | effect `{ "choose_card_name": { "types": ["land"], "remember": "source" } }` (`remember: "source"` works for every resolving `choose_*`) |
1475
+ | "Activated abilities of sources with the chosen name can't be activated unless they're mana abilities" (CR 201.4, 602.5) | `{ "player_rule": { "rule": "cant_activate", "affects": "each", "name": "chosen" } }` (sources in any zone: cycling from a hand is stopped too) |
1476
+ | "Lands with the chosen name have '{T}: Add {C}.'" | `static` with `"affects": { "each": { "land": { "name": "chosen" } } }` (filter key `"name": "chosen"`) |
1477
+ | "Other Spiders you control have riot" (CR 614.12, 702.136b) | `static` with `"keywords": ["riot"]`: a Spider entering while it applies makes riot's choice as it enters (a Spider with its own riot chooses twice); haste chosen this way stays after the riot is gone |
1478
+ | "Whenever a creature you control attacks alone, it gains double strike until end of turn" (CR 506.5) | trigger `{ "attacks": { "subject": { "each": "creature", "controller": "you" }, "alone": true } }` (once attackers are declared), effect `grant` to `{ "triggering": "object" }` |
1479
+ | "Creatures with flying can't attack you" (CR 508.1c) | `{ "player_rule": { "rule": "cant_be_attacked", "filter": { "creature": { "keywords": ["flying"] } } } }` (your planeswalkers can still be attacked) |
1480
+ | "… or block creatures you control" | `static` granting creatures you control `{ "cant_be_blocked_by": { "filter": { "creature": { "keywords": ["flying"] } } } }` |
1481
+ | "Create an X/X white Spirit creature token, where X is the greatest toughness among creatures you control" | `create_token` with `"size": { "greatest_toughness": { "each": "creature", "controller": "you" } }` (the token data says 0/0) |
1482
+ | "Each creature you control with toughness greater than its power assigns combat damage equal to its toughness" (CR 510.1a) | `static` handing out `assigns_damage_by_toughness` (attacking and blocking) |
1483
+ | "This creature saddles Mounts and crews Vehicles using its toughness" gained by an effect | `become` with `"abilities": [{ "tapping_power": … }]` |
1484
+
1485
+ ```json
1486
+ { "name": "Example Lure Angler", "mana_cost": "{1}", "types": ["artifact"], "subtypes": ["equipment"],
1487
+ "abilities": [{ "static": { "affects": "attached", "abilities": [
1488
+ { "activated": { "cost": ["tap", { "tap": "granter" }],
1489
+ "effects": [{ "add_counters": { "counter": "bait", "amount": 1, "to": "granter" } }] } }] } },
1490
+ { "equip": { "cost": [{ "mana": "{1}" }] } }] }
1491
+
1492
+ ### 4.33 Loops, exiling until, cards exiled with a permanent, changing targets and the Nth counter
1493
+
1494
+ | Oracle text | Data |
1495
+ | --- | --- |
1496
+ | "[effects]. If the exiled card is a land card, repeat this process." (CR 608.2c) | `{ "repeat": { "effects": [...], "while": condition } }`: the effects run, then run again while `while` holds. Each pass has results of its own: `{ "result": n }` in the list and in `while` is what effect n did during this pass (at most 100 passes) |
1497
+ | "the exiled card is a land card" | selector `{ "result": 0, "for": { "types": ["land"] } }` (only the results matching a card spec), e.g. `"while": { "amount": { "count": { "result": 0, "for": { "types": ["land"] } } }, "at_least": 1 }` |
1498
+ | "exile a permanent card from your graveyard at random" | `{ "choose_cards": { "from": { "graveyard": "you" }, "for": { "permanent": true }, "random": true, "put": "exile" } }` |
1499
+ | "Exile cards from the top of your library until you exile cards with total mana value 4 or greater" (CR 406.1) | `{ "exile_top": { "until": { "total_mana_value": 4 } } }` (`until` replaces `amount`; the cards are the effect's result) |
1500
+ | "… until they exile a nonland card" | `{ "exile_top": { "to": "each_opponent", "until": { "card": { "not_types": ["land"] } } } }` |
1501
+ | "You may cast any number of spells from among them without paying their mana costs" | `{ "cast_free": { "to": { "result": 0 }, "count": "any" } }` |
1502
+ | "target creature card exiled with [this]" (CR 607.2a) | target filter `{ "exiled_with": { "any_of": ["creature"] } }`: a card in exile that one of this object's abilities exiled (`link: true` on `exile`, `choose_cards`, `dig`, `exile_top`; `exile_if_dies`) |
1503
+ | "Black spells you cast cost {1} less" | `{ "cost_modifier": { "spells": { "colors": ["B"] }, "reduce": 1 } }` |
1504
+ | "If it was attacking, …" (CR 608.2h) | condition `{ "attacking": { "target": 0 } }`: it's attacking, or, if it left the battlefield during this resolution, it was as it last existed |
1505
+ | "When the fourth plan counter is put on this enchantment" (CR 122.6) | trigger `{ "counters_placed": { "counter": "plan", "nth": 4 } }`: the event that takes it from fewer than four plan counters to four or more |
1506
+ | "sacrifice it. When you do, it deals 7 damage divided as you choose among one or two targets" | `[{ "sacrifice": { "to": "self" } }, { "reflexive_trigger": { "if": { "amount": { "count": { "result": 0 } }, "at_least": 1 }, "targets": [{ "filter": "any_target", "count": 2, "optional": true }], "divide": 7, "effects": [{ "distribute_damage": {} }] } }]` |
1507
+ | "target spell or ability with a single target" | `{ "one_of": [{ "spell": { "single_target": true } }, { "stack_ability": { "single_target": true } }] }` |
1508
+ | "Change the target of target spell or ability" (CR 115.7a) | `{ "change_target": { "of": { "target": 0 } } }`: you choose another legal target for each of its targets (`effect_choice` `{type: "target"}`); a target with no other legal target stays, and then none change. "You may choose new targets" is `choose_new_targets` (CR 115.7d) |
1509
+ | "Assimilate a creature card exiled with it. If you can't, exile up to one target creature." (CR 701.72b, 607.2a) | `[{ "assimilate": { "to": "exiled_with", "for": { "types": ["creature"] }, "choose": true } }, { "exile": { "to": { "target": 0 }, "link": true, "if": { "amount": { "count": { "result": 0 } }, "at_most": 0 } } }]`, with the target `{ "filter": "creature", "optional": true }` |
1510
+
1511
+ Also automatic:
1512
+ - A melded permanent's mana value is the total of its two front faces' (CR 713.5c). As the pair is melded, the second
1513
+ card's move from exile is an event of its own (`zone_changed` with `new_id: null`).
1514
+ - A hidden-away card (hideaway, CR 702.75a) may be looked at, and played, by whoever controls the permanent now
1515
+ (`dig` with `looker: "source_controller"`).
1516
+ - Earthbend's "when that land dies or is put into exile" ends when the land leaves the battlefield for any other zone.
1517
+
1518
+ ```json
1519
+ { "name": "Example Echo of the Depths", "mana_cost": "{3}{B}", "types": ["sorcery"],
1520
+ "abilities": [{ "spell": { "effects": [{ "repeat": {
1521
+ "effects": [{ "mill": { "amount": 1 } },
1522
+ { "return_to_battlefield": { "to": { "result": 0, "for": { "types": ["land"] } }, "tapped": true } }],
1523
+ "while": { "amount": { "count": { "result": 0, "for": { "types": ["land"] } } }, "at_least": 1 } } }] } }] }
1524
+ ```
1525
+
1392
1526
  ---
1393
1527
 
1394
1528
  ## 5. Worked examples
@@ -1477,7 +1611,10 @@ It must be a legendary creature, Vehicle, or Spacecraft with power and toughness
1477
1611
  (CR 903.3). There is one copy of each card, except basic lands (CR 903.5b), and
1478
1612
  every card's **color identity** must be inside the commander's (CR 903.5c). A card's
1479
1613
  identity is the colors of every mana symbol in its data (mana cost, ability costs,
1480
- 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
1481
1618
  (CR 903.5d) and those of all its faces (CR 903.4d–e). `rules_text` is never read
1482
1619
  (reminder text doesn't count, CR 903.4c). For the odd card whose identity the data
1483
1620
  can't show, a card or face may state it with `"color_identity"`.
@@ -1495,7 +1632,7 @@ bundle exec exe/enjine --validate cards.json
1495
1632
  `cards.json` is a JSON array of card blocks (or a single block). The report:
1496
1633
 
1497
1634
  ```json
1498
- { "rules_version": "2026-11-06", "engine_version": "0.3.0",
1635
+ { "rules_version": "2026-11-06", "engine_version": "0.6.0",
1499
1636
  "valid": [ { "index": 0, "id": "lightning_bolt", "name": "Lightning Bolt", "card": { ...canonical... } } ],
1500
1637
  "invalid": [ { "index": 1, "name": "Gale Drifter", "errors": ["keywords[0]: unknown keyword \"flyng\" ..."] } ] }
1501
1638
  ```
@@ -27,6 +27,29 @@ that makes the most cards exact per unit of effort (S = 1, M = 2, L = 3+, from a
27
27
  Equipment with equip), Brilliance Unleashed (its own return effect, not yet re-scripted with `as`).
28
28
  Known gap: layer 4 applies resolved type effects (in timestamp order) before statics that change types,
29
29
  whatever their timestamps (CR 613.7a wants one order for both).
30
+ - **Batch 3 done (0.5.0), engine side:** each gap is covered by real-card specs
31
+ (`spec/integration/real_cards/known_gaps_*_spec.rb`) and invented fuzz cards; the cards still need re-scripting in
32
+ deckfinder and an `enjine --verify` run before they count as exact.
33
+ - Casting and permissions (change 24 in part, cluster 2): `play_permission` `while_you_control_source`, `during`,
34
+ `waterbend` (Hama); flash by an optional additional cost (Molten Exhale); `choose_creature_type` cost and
35
+ `battlefield_instead` (Celestial Reunion); card spec `same_name_as` (Key to the Side-Door); `exile_from_graveyard`
36
+ by mana symbols and `copy_card` (Baron Helmut Zemo); `cast` from the graveyard with `exile_instead` (Bilbo);
37
+ `cards_have` (Ninja Teen level 3); `cast` trigger `owner` (Nita); computed `pay_life` in ward (Raubahn);
38
+ `remove_counters` `self`/`count` (Gwen Stacy // Ghost-Spider); `gives_gift`.
39
+ - Effects, zones and loops (changes 9 and 10): `repeat` (Sin, Spira's Punishment); `exile_top` `until`
40
+ (Improvisation Capstone); `exiled_with` targets (The Darkness Crystal, Borg Cube); `attacking` condition
41
+ (Desculpting Blast); `counters_placed` `nth` (Death to Our Enemies); `change_target` and `single_target`
42
+ (Redirect Lightning); meld mana value, hideaway under another controller, earthbend's return ending.
43
+ - Statics, grants and combat (change 30, change 27 in part, change 24): `{"tap": "granter"}` (Fishing Pole);
44
+ `colors: "chosen"` with bound `hexproof_from` (Mondo Gecko); `cant_become_untapped` (Spider-Woman);
45
+ `choose_card_name` and `"name": "chosen"` (Sorcerous Spyglass, Petrified Hamlet); granted riot (Spider-Punk);
46
+ `attacks` `alone` (Seifer Almasy); `cant_be_attacked` by filter and grantable `cant_be_blocked_by` (Storm,
47
+ Windrider); `create_token` `size` (Abzan Monument); `assigns_damage_by_toughness` (Ghalta); `tapping_power`
48
+ granted by `become`.
49
+ - Rules correctness (no new data): the `damage_order` decision (CR 616.1), unpreventable damage against prevention
50
+ with `then` (CR 615.12), new targets and copy targets becoming targets (ward, `becomes_target`), divided new
51
+ targets, chosen sources on the stack, tokens entering attacking a planeswalker, "copy that ability" by last
52
+ known information.
30
53
  - 81 cards have only a one-off gap (no change below helps them); 284 share at least one listed gap.
31
54
  - The first 4 changes (all S) make **30** cards exact; the first 20 make about **95**; the first 30
32
55
  about **150**.