enjine 0.6.1 → 0.6.3
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 +36 -1
- data/SUPPORTED.md +8 -8
- data/docs/guides/api.md +12 -0
- data/docs/guides/card-data-format.md +17 -4
- data/docs/reference/abilities.md +5 -4
- data/docs/reference/costs.md +2 -2
- data/docs/reference/effects.md +12 -10
- data/lib/enjine/engine/casting/casting.rb +13 -6
- data/lib/enjine/engine/casting/payment.rb +6 -7
- data/lib/enjine/engine/copies.rb +20 -6
- data/lib/enjine/engine/mana_sources.rb +26 -2
- data/lib/enjine/engine/options_memo.rb +4 -1
- data/lib/enjine/engine/state_based_actions.rb +12 -1
- data/lib/enjine/engine/triggers.rb +2 -2
- data/lib/enjine/game.rb +6 -3
- data/lib/enjine/mana.rb +5 -4
- data/lib/enjine/mechanics/abilities/entering_copy.rb +1 -1
- data/lib/enjine/mechanics/abilities/mana_ability.rb +48 -6
- data/lib/enjine/mechanics/copy_except.rb +23 -3
- data/lib/enjine/mechanics/costs/remove_counters.rb +12 -2
- data/lib/enjine/mechanics/costs/sacrifice.rb +7 -0
- data/lib/enjine/mechanics/effects/copy.rb +1 -1
- data/lib/enjine/mechanics/effects/delayed_triggers.rb +9 -2
- data/lib/enjine/mechanics/effects/pay.rb +1 -1
- data/lib/enjine/mechanics/effects/scry_and_surveil.rb +32 -6
- data/lib/enjine/mechanics/filters/base.rb +27 -4
- data/lib/enjine/setup.rb +12 -3
- data/lib/enjine/snapshot/player_checks.rb +6 -0
- data/lib/enjine/snapshot.rb +2 -0
- data/lib/enjine/state.rb +13 -4
- data/lib/enjine/version.rb +1 -1
- metadata +1 -1
data/lib/enjine/state.rb
CHANGED
|
@@ -88,15 +88,15 @@ module Enjine
|
|
|
88
88
|
# The rules the game was set up with (Enjine::Format), and each player's commander card id or nil (CR 903.3).
|
|
89
89
|
# Like `decklists`, a restart begins from these again.
|
|
90
90
|
attr_accessor :format, :commanders
|
|
91
|
+
# The most permanents the battlefield may hold before the game is drawn, or nil (Setup's `permanent_limit:`).
|
|
92
|
+
attr_accessor :permanent_limit
|
|
91
93
|
# Object ids of commanders put into a graveyard, exile, hand or library since state-based actions were last
|
|
92
94
|
# checked, whose owner may still send them to the command zone (CR 903.9, Engine::Commander).
|
|
93
95
|
attr_accessor :commander_returns
|
|
94
96
|
|
|
95
|
-
def self.initial(names:, decklists:, seed:, outside: nil, format: Format::CONSTRUCTED, commanders: nil)
|
|
97
|
+
def self.initial(names:, decklists:, seed:, outside: nil, format: Format::CONSTRUCTED, commanders: nil, permanent_limit: nil)
|
|
96
98
|
state = new
|
|
97
|
-
state
|
|
98
|
-
state.commanders = (commanders || names.map { nil }).freeze
|
|
99
|
-
state.commander_returns = []
|
|
99
|
+
assign_rules(state, format, commanders || names.map { nil }, permanent_limit)
|
|
100
100
|
state.seed = seed
|
|
101
101
|
state.rng = Rng.from_seed(seed)
|
|
102
102
|
state.decklists = decklists.map { |l| l.dup.freeze }.freeze
|
|
@@ -122,6 +122,14 @@ module Enjine
|
|
|
122
122
|
state
|
|
123
123
|
end
|
|
124
124
|
|
|
125
|
+
def self.assign_rules(state, format, commanders, permanent_limit)
|
|
126
|
+
state.format = format
|
|
127
|
+
state.commanders = commanders.freeze
|
|
128
|
+
state.commander_returns = []
|
|
129
|
+
state.permanent_limit = permanent_limit
|
|
130
|
+
end
|
|
131
|
+
private_class_method :assign_rules
|
|
132
|
+
|
|
125
133
|
# Phases added this turn (CR 500.8): "pending" [{"after": phase, "phases": ["combat", "main"]}] wait for
|
|
126
134
|
# their phase to end, "queue" lists added phases still to come and "resume" the step the turn goes on
|
|
127
135
|
# with after them (Engine::TurnStructure); "combats" counts combat phases begun this turn.
|
|
@@ -158,6 +166,7 @@ module Enjine
|
|
|
158
166
|
**DEEP_FIELDS.to_h { [it, deep_dup(public_send(it))] },
|
|
159
167
|
"repeat_cleanup" => repeat_cleanup, "combat_damage_pass" => combat_damage_pass,
|
|
160
168
|
"attacks_declared" => attacks_declared }.merge("outside_lists" => (outside_lists || []).map(&:dup)).merge(format_h)
|
|
169
|
+
.merge({ "permanent_limit" => permanent_limit }.compact)
|
|
161
170
|
end
|
|
162
171
|
|
|
163
172
|
# What a Commander game adds to a snapshot; a constructed game's is unchanged.
|
data/lib/enjine/version.rb
CHANGED