summaryrefslogtreecommitdiffstats
path: root/spec
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2023-12-05 11:23:13 +0100
committerJérémy Zurcher <jeremy@asynk.ch>2023-12-05 11:23:13 +0100
commit87c981c0dd14b15f94936ab63368fff59f436276 (patch)
tree9da1196f8d61cde60bf195f181dcc37312cc395e /spec
parent6992c815f9a47c74f7977566201c910cb7af2e97 (diff)
downloadcolonial-twilight-87c981c0dd14b15f94936ab63368fff59f436276.zip
colonial-twilight-87c981c0dd14b15f94936ab63368fff59f436276.tar.gz
spec : complete Mock
Diffstat (limited to 'spec')
-rw-r--r--spec/mock_board.rb49
1 files changed, 48 insertions, 1 deletions
diff --git a/spec/mock_board.rb b/spec/mock_board.rb
index aed32c1..128c074 100644
--- a/spec/mock_board.rb
+++ b/spec/mock_board.rb
@@ -128,21 +128,68 @@ end
class Board
attr_reader :sector, :spaces
- attr_accessor :fln_resources, :available_fln_underground, :available_fln_bases
+ attr_accessor :fln_resources, :available_fln_underground, :available_fln_bases, :france_track
def initialize
@fln_resources = 0
+ @france_track = 0
@available_fln_bases = 1
@available_fln_underground = 0
@sector = Sector.new
@spaces = []
end
+ def apply(action, keep)
+ @fln_resources -= action.cost
+ spaces.delete(action.space) unless keep
+ end
+
def has(&block)
block.call(@sector)
end
+ def search(&block)
+ @spaces.select(&block)
+ end
+
def count(&block)
block.call(@sector)
end
end
+
+class Options
+ def debug
+ @debug || 0
+ end
+end
+
+class Game
+ attr_reader :action, :actions, :current_card
+ attr_accessor :board, :options, :keep
+
+ def initialize
+ @actions = []
+ @board = Board.new
+ @options = Options.new
+ @keep = false
+ end
+
+ def set(hash)
+ @board.spaces << Sector.new(hash)
+ end
+
+ def d6
+ 3
+ end
+
+ def apply(_faction, action)
+ if @options.debug.positive?
+ puts '** _apply'
+ puts action.inspect
+ end
+ @action = action
+ @actions << action
+ @board.apply(action, @keep)
+ true
+ end
+end