spy_alley_application 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +13 -0
- data/.rspec +3 -0
- data/.travis.yml +7 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +92 -0
- data/LICENSE.txt +21 -0
- data/README.md +39 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/lib/spy_alley_application.rb +6 -0
- data/lib/spy_alley_application/actions/buy_equipment.rb +31 -0
- data/lib/spy_alley_application/actions/choose_new_spy_identity.rb +26 -0
- data/lib/spy_alley_application/actions/choose_space_to_move.rb +21 -0
- data/lib/spy_alley_application/actions/confiscate_materials.rb +58 -0
- data/lib/spy_alley_application/actions/generate_new_game.rb +70 -0
- data/lib/spy_alley_application/actions/make_accusation.rb +40 -0
- data/lib/spy_alley_application/actions/pass.rb +21 -0
- data/lib/spy_alley_application/actions/roll_die.rb +25 -0
- data/lib/spy_alley_application/actions/use_move_card.rb +28 -0
- data/lib/spy_alley_application/execute_action.rb +20 -0
- data/lib/spy_alley_application/injection_container.rb +596 -0
- data/lib/spy_alley_application/models/acquisition_method/by_confiscation.rb +22 -0
- data/lib/spy_alley_application/models/acquisition_method/by_free_gift.rb +20 -0
- data/lib/spy_alley_application/models/acquisition_method/by_passing_start.rb +20 -0
- data/lib/spy_alley_application/models/acquisition_method/by_purchase.rb +21 -0
- data/lib/spy_alley_application/models/acquisition_method/by_selling_top_secret_information.rb +21 -0
- data/lib/spy_alley_application/models/board_spaces/black_market.rb +24 -0
- data/lib/spy_alley_application/models/board_spaces/border_crossing.rb +24 -0
- data/lib/spy_alley_application/models/board_spaces/buy_equipment.rb +26 -0
- data/lib/spy_alley_application/models/board_spaces/buy_password.rb +26 -0
- data/lib/spy_alley_application/models/board_spaces/confiscate_materials.rb +24 -0
- data/lib/spy_alley_application/models/board_spaces/draw_free_gift.rb +24 -0
- data/lib/spy_alley_application/models/board_spaces/draw_move_card.rb +24 -0
- data/lib/spy_alley_application/models/board_spaces/embassy.rb +26 -0
- data/lib/spy_alley_application/models/board_spaces/move_back.rb +25 -0
- data/lib/spy_alley_application/models/board_spaces/sold_top_secret_information.rb +27 -0
- data/lib/spy_alley_application/models/board_spaces/spy_alley_entrance.rb +38 -0
- data/lib/spy_alley_application/models/board_spaces/spy_eliminator.rb +24 -0
- data/lib/spy_alley_application/models/board_spaces/start.rb +36 -0
- data/lib/spy_alley_application/models/board_spaces/take_another_turn.rb +24 -0
- data/lib/spy_alley_application/models/equipment.rb +42 -0
- data/lib/spy_alley_application/models/game_board.rb +23 -0
- data/lib/spy_alley_application/models/game_board/black_market_option_state.rb +59 -0
- data/lib/spy_alley_application/models/game_board/buy_equipment_option_state.rb +52 -0
- data/lib/spy_alley_application/models/game_board/buy_password_option_state.rb +39 -0
- data/lib/spy_alley_application/models/game_board/confiscate_materials_option_state.rb +68 -0
- data/lib/spy_alley_application/models/game_board/eliminate_player.rb +91 -0
- data/lib/spy_alley_application/models/game_board/embassy_victory.rb +23 -0
- data/lib/spy_alley_application/models/game_board/equipment_bought.rb +42 -0
- data/lib/spy_alley_application/models/game_board/equipment_confiscated.rb +67 -0
- data/lib/spy_alley_application/models/game_board/free_gift_drawn.rb +39 -0
- data/lib/spy_alley_application/models/game_board/money_gained_or_lost.rb +22 -0
- data/lib/spy_alley_application/models/game_board/move_card_drawn.rb +31 -0
- data/lib/spy_alley_application/models/game_board/move_card_used.rb +30 -0
- data/lib/spy_alley_application/models/game_board/move_options.rb +23 -0
- data/lib/spy_alley_application/models/game_board/new_spy_identity_chosen.rb +37 -0
- data/lib/spy_alley_application/models/game_board/next_game_state.rb +70 -0
- data/lib/spy_alley_application/models/game_board/player_moved.rb +24 -0
- data/lib/spy_alley_application/models/game_board/spy_eliminator_options.rb +41 -0
- data/lib/spy_alley_application/models/game_state/buy_equipment.rb +26 -0
- data/lib/spy_alley_application/models/game_state/choose_new_spy_identity.rb +29 -0
- data/lib/spy_alley_application/models/game_state/confiscate_materials.rb +29 -0
- data/lib/spy_alley_application/models/game_state/game_over.rb +27 -0
- data/lib/spy_alley_application/models/game_state/move_option.rb +25 -0
- data/lib/spy_alley_application/models/game_state/spy_eliminator.rb +25 -0
- data/lib/spy_alley_application/models/game_state/start_of_turn.rb +23 -0
- data/lib/spy_alley_application/models/game_state/victory_reason/by_elimination.rb +22 -0
- data/lib/spy_alley_application/models/game_state/victory_reason/by_embassy.rb +22 -0
- data/lib/spy_alley_application/models/move_card.rb +26 -0
- data/lib/spy_alley_application/models/player.rb +37 -0
- data/lib/spy_alley_application/models/sell_top_secret_information.rb +24 -0
- data/lib/spy_alley_application/models/validator/buying_equipment.rb +35 -0
- data/lib/spy_alley_application/models/validator/choosing_new_spy_identity.rb +33 -0
- data/lib/spy_alley_application/models/validator/confiscating_materials.rb +50 -0
- data/lib/spy_alley_application/models/validator/making_accusation.rb +31 -0
- data/lib/spy_alley_application/models/validator/moving.rb +30 -0
- data/lib/spy_alley_application/models/validator/passing.rb +24 -0
- data/lib/spy_alley_application/models/validator/rolling_die.rb +29 -0
- data/lib/spy_alley_application/models/validator/using_move_card.rb +31 -0
- data/lib/spy_alley_application/models/wild_card.rb +25 -0
- data/lib/spy_alley_application/new_game.rb +18 -0
- data/lib/spy_alley_application/new_game/assign_seats.rb +21 -0
- data/lib/spy_alley_application/new_game/assign_spy_identities.rb +24 -0
- data/lib/spy_alley_application/results/nodes/buy_equipment_option_node.rb +23 -0
- data/lib/spy_alley_application/results/nodes/choose_new_spy_identity_option_node.rb +23 -0
- data/lib/spy_alley_application/results/nodes/confiscate_materials_option_node.rb +22 -0
- data/lib/spy_alley_application/results/nodes/die_rolled_node.rb +21 -0
- data/lib/spy_alley_application/results/nodes/eliminated_player_node.rb +22 -0
- data/lib/spy_alley_application/results/nodes/equipment_gained_node.rb +28 -0
- data/lib/spy_alley_application/results/nodes/game_over_node.rb +24 -0
- data/lib/spy_alley_application/results/nodes/make_accusation_option_node.rb +20 -0
- data/lib/spy_alley_application/results/nodes/money_gained_node.rb +25 -0
- data/lib/spy_alley_application/results/nodes/money_lost_node.rb +21 -0
- data/lib/spy_alley_application/results/nodes/move_back_node.rb +21 -0
- data/lib/spy_alley_application/results/nodes/move_card_drawn_node.rb +22 -0
- data/lib/spy_alley_application/results/nodes/move_card_used_node.rb +22 -0
- data/lib/spy_alley_application/results/nodes/move_option_node.rb +20 -0
- data/lib/spy_alley_application/results/nodes/new_spy_identity_chosen_node.rb +21 -0
- data/lib/spy_alley_application/results/nodes/next_player_node.rb +20 -0
- data/lib/spy_alley_application/results/nodes/pass_option_node.rb +16 -0
- data/lib/spy_alley_application/results/nodes/player_movement_node.rb +21 -0
- data/lib/spy_alley_application/results/nodes/player_passed_node.rb +19 -0
- data/lib/spy_alley_application/results/nodes/reached_embassy_with_all_equipment_node.rb +20 -0
- data/lib/spy_alley_application/results/nodes/result_game_board_node.rb +21 -0
- data/lib/spy_alley_application/results/nodes/roll_die_option_node.rb +16 -0
- data/lib/spy_alley_application/results/nodes/use_move_card_option_node.rb +20 -0
- data/lib/spy_alley_application/results/nodes/wild_card_gained_node.rb +27 -0
- data/lib/spy_alley_application/results/process_buy_equipment_options.rb +25 -0
- data/lib/spy_alley_application/results/process_eliminating_player.rb +36 -0
- data/lib/spy_alley_application/results/process_landing_on_space.rb +232 -0
- data/lib/spy_alley_application/results/process_move_options.rb +65 -0
- data/lib/spy_alley_application/results/process_next_turn_options.rb +87 -0
- data/lib/spy_alley_application/results/process_passing_spaces.rb +68 -0
- data/lib/spy_alley_application/results/process_proceeding_to_next_state.rb +23 -0
- data/lib/spy_alley_application/types/array_of_equipment.rb +7 -0
- data/lib/spy_alley_application/types/array_of_free_gifts.rb +7 -0
- data/lib/spy_alley_application/types/array_of_move_cards.rb +6 -0
- data/lib/spy_alley_application/types/array_of_players.rb +6 -0
- data/lib/spy_alley_application/types/board_space.rb +4 -0
- data/lib/spy_alley_application/types/coercible_integer_one_to_six.rb +9 -0
- data/lib/spy_alley_application/types/equipment.rb +32 -0
- data/lib/spy_alley_application/types/equipment_type.rb +9 -0
- data/lib/spy_alley_application/types/free_gift.rb +22 -0
- data/lib/spy_alley_application/types/game_board.rb +52 -0
- data/lib/spy_alley_application/types/game_state.rb +19 -0
- data/lib/spy_alley_application/types/move_card.rb +21 -0
- data/lib/spy_alley_application/types/nationality.rb +5 -0
- data/lib/spy_alley_application/types/player.rb +123 -0
- data/lib/spy_alley_application/types/validation_builder.rb +21 -0
- data/lib/spy_alley_application/types/validator/non_admin.rb +21 -0
- data/lib/spy_alley_application/types/wild_card.rb +14 -0
- data/lib/spy_alley_application/validator/builder.rb +119 -0
- data/lib/spy_alley_application/validator/buy_equipment.rb +39 -0
- data/lib/spy_alley_application/validator/choose_new_spy_identity.rb +24 -0
- data/lib/spy_alley_application/validator/confiscate_materials.rb +22 -0
- data/lib/spy_alley_application/validator/confiscate_materials/full_validator.rb +39 -0
- data/lib/spy_alley_application/validator/confiscate_materials/validate_target_player_id.rb +24 -0
- data/lib/spy_alley_application/validator/make_accusation.rb +24 -0
- data/lib/spy_alley_application/validator/move.rb +24 -0
- data/lib/spy_alley_application/validator/new_game.rb +35 -0
- data/lib/spy_alley_application/validator/new_game_builder.rb +32 -0
- data/lib/spy_alley_application/validator/no_options.rb +7 -0
- data/lib/spy_alley_application/validator/use_move_card.rb +23 -0
- data/lib/spy_alley_application/version.rb +3 -0
- data/spy_alley_application.gemspec +40 -0
- metadata +343 -0
@@ -0,0 +1,40 @@
|
|
1
|
+
# frozen string literal: true
|
2
|
+
|
3
|
+
require 'dry-initializer'
|
4
|
+
|
5
|
+
module SpyAlleyApplication
|
6
|
+
module Actions
|
7
|
+
class MakeAccusation
|
8
|
+
include Dry::Initializer.define -> do
|
9
|
+
option :process_eliminating_player, type: ::Types::Callable, reader: :private
|
10
|
+
option :process_proceeding_to_next_state, type: ::Types::Callable, reader: :private
|
11
|
+
end
|
12
|
+
|
13
|
+
def call(game_board:, change_orders:, target_player_id:, nationality:)
|
14
|
+
player = game_board.current_player
|
15
|
+
target_player = game_board.players.find{|p| p.id.eql?(target_player_id)}
|
16
|
+
at_risk_accusation = game_board.game_state.accept(self)
|
17
|
+
execute_if_guess_incorrect =
|
18
|
+
at_risk_accusation ? process_eliminating_player : process_proceeding_to_next_state
|
19
|
+
if target_player.spy_identity.eql?(nationality)
|
20
|
+
process_eliminating_player.(
|
21
|
+
game_board: game_board,
|
22
|
+
change_orders: change_orders,
|
23
|
+
eliminating_player: player,
|
24
|
+
eliminated_player: target_player)
|
25
|
+
else
|
26
|
+
execute_if_incorrect.(
|
27
|
+
game_board: game_board,
|
28
|
+
change_orders: change_orders,
|
29
|
+
target_player_id: target_player_id,
|
30
|
+
eliminating_player: target_player,
|
31
|
+
eliminated_player: player)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
def handle_spy_eliminator(*args);false;end
|
36
|
+
def handle_start_of_turn(*args);true;end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# frozen string literal: true
|
2
|
+
|
3
|
+
require 'dry-initializer'
|
4
|
+
|
5
|
+
module SpyAlleyApplication
|
6
|
+
module Actions
|
7
|
+
class Pass
|
8
|
+
include Dry::Initializer.define -> do
|
9
|
+
option :get_player_passed_node, type: ::Types::Callable, reader: :private
|
10
|
+
option :process_proceeding_to_next_state, type: ::Types::Callable, reader: :private
|
11
|
+
end
|
12
|
+
|
13
|
+
def call(game_board:, change_orders:)
|
14
|
+
process_proceeding_to_next_state.(
|
15
|
+
game_board: game_board,
|
16
|
+
change_orders: change_orders.push(get_player_passed_node.()))
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# frozen string literal: true
|
2
|
+
|
3
|
+
require 'dry-initializer'
|
4
|
+
|
5
|
+
module SpyAlleyApplication
|
6
|
+
module Actions
|
7
|
+
class RollDie
|
8
|
+
include Dry::Initializer.define -> do
|
9
|
+
option :execute_die_roll, type: ::Types::Callable, reader: :private
|
10
|
+
option :get_die_rolled_node, type: ::Types::Callable, reader: :private
|
11
|
+
option :process_passing_spaces, type: ::Types::Callable, reader: :private
|
12
|
+
end
|
13
|
+
|
14
|
+
def call(game_board:, change_orders:, number_rolled: nil)
|
15
|
+
number_rolled ||= execute_die_roll.()
|
16
|
+
process_passing_spaces.(
|
17
|
+
game_board: game_board,
|
18
|
+
change_orders: change_orders.push(get_die_rolled_node.(number_rolled: number_rolled)),
|
19
|
+
board_space: game_board.current_player.location,
|
20
|
+
spaces_remaining: number_rolled)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# frozen string literal: true
|
2
|
+
|
3
|
+
require 'dry-initializer'
|
4
|
+
|
5
|
+
module SpyAlleyApplication
|
6
|
+
module Actions
|
7
|
+
class UseMoveCard
|
8
|
+
include Dry::Initializer.define -> do
|
9
|
+
option :get_move_card_used_node, type: ::Types::Callable, reader: :private
|
10
|
+
option :move_card_used, type: ::Types::Callable, reader: :private
|
11
|
+
option :process_passing_spaces, type: ::Types::Callable, reader: :private
|
12
|
+
end
|
13
|
+
|
14
|
+
def call(game_board:, change_orders:, card_to_use:)
|
15
|
+
change_orders = change_orders.push(get_move_card_used_node.(
|
16
|
+
player_id: game_board.current_player.id,
|
17
|
+
card: card_to_use))
|
18
|
+
game_board = move_card_used.(game_board: game_board, move_card_used: card_to_use)
|
19
|
+
process_passing_spaces.(
|
20
|
+
game_board: game_board,
|
21
|
+
change_orders: change_orders,
|
22
|
+
board_space: game_board.current_player.location,
|
23
|
+
spaces_remaining: card_to_use)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'dry-auto_inject'
|
4
|
+
require 'spy_alley_application/injection_container'
|
5
|
+
require 'spy_alley_application/types/game_board'
|
6
|
+
|
7
|
+
module SpyAlleyApplication
|
8
|
+
class ExecuteAction
|
9
|
+
include Dry::AutoInject(SpyAlleyApplication::InjectionContainer)[
|
10
|
+
:change_orders_initializer, :build_validator]
|
11
|
+
|
12
|
+
def call(action_hash:, game_board:, user:, last_action_id:)
|
13
|
+
game_board = SpyAlleyApplication::Types::GameBoard.call(game_board.to_h)
|
14
|
+
validate = build_validator.(game_board: game_board, last_action_id: last_action_id)
|
15
|
+
execute_action = validate.(action_hash: action_hash, user: user)
|
16
|
+
execute_action.(game_board: game_board, change_orders: change_orders_initializer.())
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
@@ -0,0 +1,596 @@
|
|
1
|
+
# frozen string literal: true
|
2
|
+
|
3
|
+
require 'change_orders'
|
4
|
+
require 'dry-auto_inject'
|
5
|
+
require 'dry-container'
|
6
|
+
require 'game_validator'
|
7
|
+
require 'spy_alley_application/actions/buy_equipment'
|
8
|
+
require 'spy_alley_application/actions/choose_new_spy_identity'
|
9
|
+
require 'spy_alley_application/actions/choose_space_to_move'
|
10
|
+
require 'spy_alley_application/actions/confiscate_materials'
|
11
|
+
require 'spy_alley_application/actions/generate_new_game'
|
12
|
+
require 'spy_alley_application/actions/make_accusation'
|
13
|
+
require 'spy_alley_application/actions/pass'
|
14
|
+
require 'spy_alley_application/actions/roll_die'
|
15
|
+
require 'spy_alley_application/actions/use_move_card'
|
16
|
+
require 'spy_alley_application/models/game_board/black_market_option_state'
|
17
|
+
require 'spy_alley_application/models/game_board/buy_equipment_option_state'
|
18
|
+
require 'spy_alley_application/models/game_board/buy_password_option_state'
|
19
|
+
require 'spy_alley_application/models/game_board/confiscate_materials_option_state'
|
20
|
+
require 'spy_alley_application/models/game_board/eliminate_player'
|
21
|
+
require 'spy_alley_application/models/game_board/embassy_victory'
|
22
|
+
require 'spy_alley_application/models/game_board/equipment_bought'
|
23
|
+
require 'spy_alley_application/models/game_board/equipment_confiscated'
|
24
|
+
require 'spy_alley_application/models/game_board/free_gift_drawn'
|
25
|
+
require 'spy_alley_application/models/game_board/money_gained_or_lost'
|
26
|
+
require 'spy_alley_application/models/game_board/move_card_drawn'
|
27
|
+
require 'spy_alley_application/models/game_board/move_card_used'
|
28
|
+
require 'spy_alley_application/models/game_board/move_options'
|
29
|
+
require 'spy_alley_application/models/game_board/new_spy_identity_chosen'
|
30
|
+
require 'spy_alley_application/models/game_board/next_game_state'
|
31
|
+
require 'spy_alley_application/models/game_board/player_moved'
|
32
|
+
require 'spy_alley_application/models/game_board/spy_eliminator_options'
|
33
|
+
require 'spy_alley_application/new_game/assign_seats'
|
34
|
+
require 'spy_alley_application/new_game/assign_spy_identities'
|
35
|
+
require 'spy_alley_application/results/nodes/buy_equipment_option_node'
|
36
|
+
require 'spy_alley_application/results/nodes/choose_new_spy_identity_option_node'
|
37
|
+
require 'spy_alley_application/results/nodes/confiscate_materials_option_node'
|
38
|
+
require 'spy_alley_application/results/nodes/die_rolled_node'
|
39
|
+
require 'spy_alley_application/results/nodes/eliminated_player_node'
|
40
|
+
require 'spy_alley_application/results/nodes/equipment_gained_node'
|
41
|
+
require 'spy_alley_application/results/nodes/game_over_node'
|
42
|
+
require 'spy_alley_application/results/nodes/make_accusation_option_node'
|
43
|
+
require 'spy_alley_application/results/nodes/money_gained_node'
|
44
|
+
require 'spy_alley_application/results/nodes/money_lost_node'
|
45
|
+
require 'spy_alley_application/results/nodes/move_back_node'
|
46
|
+
require 'spy_alley_application/results/nodes/move_card_drawn_node'
|
47
|
+
require 'spy_alley_application/results/nodes/move_card_used_node'
|
48
|
+
require 'spy_alley_application/results/nodes/move_option_node'
|
49
|
+
require 'spy_alley_application/results/nodes/new_spy_identity_chosen_node'
|
50
|
+
require 'spy_alley_application/results/nodes/next_player_node'
|
51
|
+
require 'spy_alley_application/results/nodes/pass_option_node'
|
52
|
+
require 'spy_alley_application/results/nodes/player_movement_node'
|
53
|
+
require 'spy_alley_application/results/nodes/player_passed_node'
|
54
|
+
require 'spy_alley_application/results/nodes/result_game_board_node'
|
55
|
+
require 'spy_alley_application/results/nodes/roll_die_option_node'
|
56
|
+
require 'spy_alley_application/results/nodes/use_move_card_option_node'
|
57
|
+
require 'spy_alley_application/results/nodes/wild_card_gained_node'
|
58
|
+
require 'spy_alley_application/results/process_buy_equipment_options'
|
59
|
+
require 'spy_alley_application/results/process_eliminating_player'
|
60
|
+
require 'spy_alley_application/results/process_move_options'
|
61
|
+
require 'spy_alley_application/results/process_landing_on_space'
|
62
|
+
require 'spy_alley_application/results/process_next_turn_options'
|
63
|
+
require 'spy_alley_application/results/process_passing_spaces'
|
64
|
+
require 'spy_alley_application/results/process_proceeding_to_next_state'
|
65
|
+
require 'spy_alley_application/validator/builder'
|
66
|
+
require 'spy_alley_application/validator/new_game'
|
67
|
+
require 'spy_alley_application/validator/new_game_builder'
|
68
|
+
|
69
|
+
module SpyAlleyApplication
|
70
|
+
class InjectionContainer
|
71
|
+
extend Dry::Container::Mixin
|
72
|
+
register :change_orders_initializer do
|
73
|
+
new_change_orders = ChangeOrders::Container::new
|
74
|
+
->{new_change_orders}
|
75
|
+
end
|
76
|
+
|
77
|
+
namespace :actions do
|
78
|
+
register :buy_equipment do
|
79
|
+
equipment_bought = SpyAlleyApplication::InjectionContainer
|
80
|
+
.resolve('game_board_effects.equipment_bought')
|
81
|
+
get_equipment_gained_node = SpyAlleyApplication::InjectionContainer
|
82
|
+
.resolve('results.get.equipment_gained_node')
|
83
|
+
process_proceeding_to_next_state = SpyAlleyApplication::InjectionContainer
|
84
|
+
.resolve('results.process_proceeding_to_next_state')
|
85
|
+
SpyAlleyApplication::Actions::BuyEquipment::new(
|
86
|
+
equipment_bought: equipment_bought,
|
87
|
+
get_equipment_gained_node: get_equipment_gained_node,
|
88
|
+
process_proceeding_to_next_state: process_proceeding_to_next_state).method(:call)
|
89
|
+
end
|
90
|
+
|
91
|
+
register :choose_new_spy_identity do
|
92
|
+
get_new_spy_identity_chosen_node = SpyAlleyApplication::InjectionContainer
|
93
|
+
.resolve('results.get.new_spy_identity_chosen_node')
|
94
|
+
get_result_game_board_node = SpyAlleyApplication::InjectionContainer
|
95
|
+
.resolve('results.get.result_game_board_node')
|
96
|
+
new_spy_identity_chosen = SpyAlleyApplication::InjectionContainer
|
97
|
+
.resolve('game_board_effects.new_spy_identity_chosen')
|
98
|
+
process_proceeding_to_next_state = SpyAlleyApplication::InjectionContainer
|
99
|
+
.resolve('results.process_proceeding_to_next_state')
|
100
|
+
SpyAlleyApplication::Actions::ChooseNewSpyIdentity::new(
|
101
|
+
get_new_spy_identity_chosen_node: get_new_spy_identity_chosen_node,
|
102
|
+
get_result_game_board_node: get_result_game_board_node,
|
103
|
+
new_spy_identity_chosen: new_spy_identity_chosen,
|
104
|
+
process_proceeding_to_next_state: process_proceeding_to_next_state).method(:call)
|
105
|
+
end
|
106
|
+
|
107
|
+
register :choose_space_to_move do
|
108
|
+
process_landing_on_space = SpyAlleyApplication::InjectionContainer
|
109
|
+
.resolve('results.process_landing_on_space')
|
110
|
+
SpyAlleyApplication::Actions::ChooseSpaceToMove::new(
|
111
|
+
process_landing_on_space: process_landing_on_space).method(:call)
|
112
|
+
end
|
113
|
+
|
114
|
+
register :confiscate_materials do
|
115
|
+
equipment_confiscated = SpyAlleyApplication::InjectionContainer
|
116
|
+
.resolve('game_board_effects.equipment_confiscated')
|
117
|
+
get_equipment_gained_node = SpyAlleyApplication::InjectionContainer
|
118
|
+
.resolve('results.get.equipment_gained_node')
|
119
|
+
get_wild_card_gained_node = SpyAlleyApplication::InjectionContainer
|
120
|
+
.resolve('results.get.wild_card_gained_node')
|
121
|
+
process_proceeding_to_next_state = SpyAlleyApplication::InjectionContainer
|
122
|
+
.resolve('results.process_proceeding_to_next_state')
|
123
|
+
SpyAlleyApplication::Actions::ConfiscateMaterials::new(
|
124
|
+
equipment_confiscated: equipment_confiscated,
|
125
|
+
get_equipment_gained_node: get_equipment_gained_node,
|
126
|
+
get_wild_card_gained_node: get_wild_card_gained_node,
|
127
|
+
process_proceeding_to_next_state: process_proceeding_to_next_state)
|
128
|
+
end
|
129
|
+
|
130
|
+
register :generate_new_game do
|
131
|
+
get_result_game_board_node = SpyAlleyApplication::InjectionContainer
|
132
|
+
.resolve('results.get.result_game_board_node')
|
133
|
+
process_next_turn_options = SpyAlleyApplication::InjectionContainer
|
134
|
+
.resolve('results.process_next_turn_options')
|
135
|
+
SpyAlleyApplication::Actions::GenerateNewGame::new(
|
136
|
+
get_result_game_board_node: get_result_game_board_node,
|
137
|
+
process_next_turn_options: process_next_turn_options).method(:call)
|
138
|
+
end
|
139
|
+
|
140
|
+
register :make_accusation do
|
141
|
+
process_eliminating_player = SpyAlleyApplication::InjectionContainer
|
142
|
+
.resolve('results.process_eliminating_player')
|
143
|
+
process_proceeding_to_next_state = SpyAlleyApplication::InjectionContainer
|
144
|
+
.resolve('results.process_proceeding_to_next_state')
|
145
|
+
SpyAlleyApplication::Actions::MakeAccusation::new(
|
146
|
+
process_eliminating_player: process_eliminating_player,
|
147
|
+
process_proceeding_to_next_state: process_proceeding_to_next_state).method(:call)
|
148
|
+
end
|
149
|
+
|
150
|
+
register :pass do
|
151
|
+
get_player_passed_node = SpyAlleyApplication::InjectionContainer
|
152
|
+
.resolve('results.get.player_passed_node')
|
153
|
+
process_proceeding_to_next_state = SpyAlleyApplication::InjectionContainer
|
154
|
+
.resolve('results.process_proceeding_to_next_state')
|
155
|
+
SpyAlleyApplication::Actions::Pass::new(
|
156
|
+
get_player_passed_node: get_player_passed_node,
|
157
|
+
process_proceeding_to_next_state: process_proceeding_to_next_state).method(:call)
|
158
|
+
end
|
159
|
+
|
160
|
+
register :roll_die do
|
161
|
+
execute_die_roll = SpyAlleyApplication::InjectionContainer
|
162
|
+
.resolve('results.execute_die_roll')
|
163
|
+
get_die_rolled_node = SpyAlleyApplication::InjectionContainer
|
164
|
+
.resolve('results.get.die_rolled_node')
|
165
|
+
process_passing_spaces = SpyAlleyApplication::InjectionContainer
|
166
|
+
.resolve('results.process_passing_spaces')
|
167
|
+
SpyAlleyApplication::Actions::RollDie::new(
|
168
|
+
execute_die_roll: execute_die_roll,
|
169
|
+
get_die_rolled_node: get_die_rolled_node,
|
170
|
+
process_passing_spaces: process_passing_spaces).method(:call)
|
171
|
+
end
|
172
|
+
|
173
|
+
register :use_move_card do
|
174
|
+
get_move_card_used_node = SpyAlleyApplication::InjectionContainer
|
175
|
+
.resolve('results.get.move_card_used_node')
|
176
|
+
move_card_used = SpyAlleyApplication::InjectionContainer
|
177
|
+
.resolve('game_board_effects.move_card_used')
|
178
|
+
process_passing_spaces =
|
179
|
+
SpyAlleyApplication::InjectionContainer.resolve('results.process_passing_spaces')
|
180
|
+
SpyAlleyApplication::Actions::UseMoveCard::new(
|
181
|
+
get_move_card_used_node: get_move_card_used_node,
|
182
|
+
move_card_used: move_card_used,
|
183
|
+
process_passing_spaces: process_passing_spaces).method(:call)
|
184
|
+
end
|
185
|
+
end
|
186
|
+
|
187
|
+
namespace :game_board_effects do
|
188
|
+
register :black_market_option_state do
|
189
|
+
SpyAlleyApplication::Models::GameBoard::BlackMarketOptionState::new(
|
190
|
+
next_game_state: resolve(:next_game_state)).method(:call)
|
191
|
+
end
|
192
|
+
|
193
|
+
register :buy_equipment_option_state do
|
194
|
+
SpyAlleyApplication::Models::GameBoard::BuyEquipmentOptionState::new(
|
195
|
+
next_game_state: resolve(:next_game_state)).method(:call)
|
196
|
+
end
|
197
|
+
|
198
|
+
register :buy_password_option_state do
|
199
|
+
SpyAlleyApplication::Models::GameBoard::BuyPasswordOptionState::new(
|
200
|
+
next_game_state: resolve(:next_game_state)).method(:call)
|
201
|
+
end
|
202
|
+
|
203
|
+
register :confiscate_materials_option_state do
|
204
|
+
SpyAlleyApplication::Models::GameBoard::ConfiscateMaterialsOptionState::new(
|
205
|
+
next_game_state: resolve(:next_game_state)).method(:call)
|
206
|
+
end
|
207
|
+
|
208
|
+
register :eliminate_player do
|
209
|
+
SpyAlleyApplication::Models::GameBoard::EliminatePlayer::new.method(:call)
|
210
|
+
end
|
211
|
+
|
212
|
+
register :equipment_bought do
|
213
|
+
SpyAlleyApplication::Models::GameBoard::EquipmentBought::new.method(:call)
|
214
|
+
end
|
215
|
+
|
216
|
+
register :equipment_confiscated do
|
217
|
+
SpyAlleyApplication::Models::GameBoard::EquipmentConfiscated::new.method(:call)
|
218
|
+
end
|
219
|
+
|
220
|
+
register :embassy_victory do
|
221
|
+
SpyAlleyApplication::Models::GameBoard::EmbassyVictory::new.method(:call)
|
222
|
+
end
|
223
|
+
|
224
|
+
register :free_gift_drawn do
|
225
|
+
SpyAlleyApplication::Models::GameBoard::FreeGiftDrawn::new.method(:call)
|
226
|
+
end
|
227
|
+
|
228
|
+
register :money_gained_or_lost do
|
229
|
+
SpyAlleyApplication::Models::GameBoard::MoneyGainedOrLost::new.method(:call)
|
230
|
+
end
|
231
|
+
|
232
|
+
register :move_card_drawn do
|
233
|
+
SpyAlleyApplication::Models::GameBoard::MoveCardDrawn::new.method(:call)
|
234
|
+
end
|
235
|
+
|
236
|
+
register :move_card_used do
|
237
|
+
SpyAlleyApplication::Models::GameBoard::MoveCardUsed::new.method(:call)
|
238
|
+
end
|
239
|
+
|
240
|
+
register :move_options do
|
241
|
+
SpyAlleyApplication::Models::GameBoard::MoveOptions::new.method(:call)
|
242
|
+
end
|
243
|
+
|
244
|
+
register :new_spy_identity_chosen do
|
245
|
+
SpyAlleyApplication::Models::GameBoard::NewSpyIdentityChosen::new.method(:call)
|
246
|
+
end
|
247
|
+
|
248
|
+
register :next_game_state do
|
249
|
+
SpyAlleyApplication::Models::GameBoard::NextGameState::new.method(:call)
|
250
|
+
end
|
251
|
+
|
252
|
+
register :player_moved do
|
253
|
+
SpyAlleyApplication::Models::GameBoard::PlayerMoved::new.method(:call)
|
254
|
+
end
|
255
|
+
|
256
|
+
register :spy_eliminator_options do
|
257
|
+
SpyAlleyApplication::Models::GameBoard::SpyEliminatorOptions::new(
|
258
|
+
next_game_state: resolve(:next_game_state)).method(:call)
|
259
|
+
end
|
260
|
+
end
|
261
|
+
|
262
|
+
namespace :new_game do
|
263
|
+
register :assign_seats do
|
264
|
+
SpyAlleyApplication::NewGame::AssignSeats::new
|
265
|
+
end
|
266
|
+
|
267
|
+
register :assign_spy_identities do
|
268
|
+
SpyAlleyApplication::NewGame::AssignSpyIdentities::new
|
269
|
+
end
|
270
|
+
|
271
|
+
register :validate_new_game do
|
272
|
+
SpyAlleyApplication::Validator::NewGame::new
|
273
|
+
end
|
274
|
+
end
|
275
|
+
|
276
|
+
namespace :results do
|
277
|
+
register :execute_die_roll do
|
278
|
+
->{rand(6) + 1}
|
279
|
+
end
|
280
|
+
|
281
|
+
namespace :get do
|
282
|
+
register :buy_equipment_option_node do
|
283
|
+
->(options:, limit:) do
|
284
|
+
SpyAlleyApplication::Results::Nodes::BuyEquipmentOptionNode::new(
|
285
|
+
options: options,
|
286
|
+
limit: limit)
|
287
|
+
end
|
288
|
+
end
|
289
|
+
|
290
|
+
register :choose_new_spy_identity_option_node do
|
291
|
+
->(options:) do
|
292
|
+
SpyAlleyApplication::Results::Nodes::ChooseNewSpyIdentityOptionNode::new(
|
293
|
+
options: options)
|
294
|
+
end
|
295
|
+
end
|
296
|
+
|
297
|
+
register :confiscate_materials_option_node do
|
298
|
+
->(target_player_id:, targetable_equipment:) do
|
299
|
+
SpyAlleyApplication::Results::Nodes::ConfiscateMaterialsOptionNode::new(
|
300
|
+
target_player_id: target_player_id,
|
301
|
+
targetable_equipment: targetable_equipment)
|
302
|
+
end
|
303
|
+
end
|
304
|
+
|
305
|
+
register :die_rolled_node do
|
306
|
+
->(number_rolled:) do
|
307
|
+
SpyAlleyApplication::Results::Nodes::DieRolledNode::new(
|
308
|
+
number_rolled: number_rolled)
|
309
|
+
end
|
310
|
+
end
|
311
|
+
|
312
|
+
register :eliminated_player_node do
|
313
|
+
->(eliminating_player:, eliminated_player:) do
|
314
|
+
SpyAlleyApplication::Results::Nodes::EliminatedPlayerNode::new(
|
315
|
+
eliminating_player: eliminating_player,
|
316
|
+
eliminated_player: eliminated_player)
|
317
|
+
end
|
318
|
+
end
|
319
|
+
|
320
|
+
register :equipment_gained_node do
|
321
|
+
->(player_id:, equipment:, reason:) do
|
322
|
+
SpyAlleyApplication::Results::Nodes::EquipmentGainedNode::new(
|
323
|
+
player_id: player_id,
|
324
|
+
equipment: equipment,
|
325
|
+
reason: reason)
|
326
|
+
end
|
327
|
+
end
|
328
|
+
|
329
|
+
register :game_over_node do
|
330
|
+
->(winning_player_id:, reason:) do
|
331
|
+
SpyAlleyApplication::Results::Nodes::GameOverNode::new(
|
332
|
+
winning_player_id: winning_player_id, reason: reason)
|
333
|
+
end
|
334
|
+
end
|
335
|
+
|
336
|
+
register :make_accusation_option_node do
|
337
|
+
->(player_id_list:) do
|
338
|
+
SpyAlleyApplication::Results::Nodes::MakeAccusationOptionNode::new(
|
339
|
+
player_id_list: player_id_list)
|
340
|
+
end
|
341
|
+
end
|
342
|
+
|
343
|
+
register :money_gained_node do
|
344
|
+
->(player_id:, money_gained:, reason:) do
|
345
|
+
SpyAlleyApplication::Results::Nodes::MoneyGainedNode::new(
|
346
|
+
player_id: player_id,
|
347
|
+
money_gained: money_gained,
|
348
|
+
reason: reason)
|
349
|
+
end
|
350
|
+
end
|
351
|
+
|
352
|
+
register :money_lost_node do
|
353
|
+
->(player_id:, money_lost:, reason:) do
|
354
|
+
SpyAlleyApplication::Results::Nodes::MoneyLostNode::new(
|
355
|
+
player_id: player_id,
|
356
|
+
money_gained: money_gained,
|
357
|
+
reason: reason)
|
358
|
+
end
|
359
|
+
end
|
360
|
+
|
361
|
+
register :move_back_node do
|
362
|
+
->(player_id:, player_moved:) do
|
363
|
+
SpyAlleyApplication::Results::Nodes::MoveBackNode::new(
|
364
|
+
player_id: player_id,
|
365
|
+
player_moved: player_moved)
|
366
|
+
end
|
367
|
+
end
|
368
|
+
|
369
|
+
register :move_card_drawn_node do
|
370
|
+
->(player_id:, card:) do
|
371
|
+
SpyAlleyApplication::Results::Nodes::MoveCardDrawnNode::new(
|
372
|
+
player_id: player_id,
|
373
|
+
card: card)
|
374
|
+
end
|
375
|
+
end
|
376
|
+
|
377
|
+
register :move_card_used_node do
|
378
|
+
->(player_id:, card:) do
|
379
|
+
SpyAlleyApplication::Results::Nodes::MoveCardUsedNode::new(
|
380
|
+
player_id: player_id,
|
381
|
+
card: card)
|
382
|
+
end
|
383
|
+
end
|
384
|
+
|
385
|
+
register :move_option_node do
|
386
|
+
->(options:) do
|
387
|
+
SpyAlleyApplication::Results::Nodes::MoveOptionNode::new(
|
388
|
+
options: options)
|
389
|
+
end
|
390
|
+
end
|
391
|
+
|
392
|
+
register :new_spy_identity_chosen_node do
|
393
|
+
->(nationality:) do
|
394
|
+
SpyAlleyApplication::Results::Nodes::NewSpyIdentityChosenNode::new(
|
395
|
+
nationality: nationality)
|
396
|
+
end
|
397
|
+
end
|
398
|
+
|
399
|
+
register :next_player_node do
|
400
|
+
->(player_id:) do
|
401
|
+
SpyAlleyApplication::Results::Nodes::NextPlayerNode::new(player_id: player_id)
|
402
|
+
end
|
403
|
+
end
|
404
|
+
|
405
|
+
register :pass_option_node do
|
406
|
+
pass_option_node = SpyAlleyApplication::Results::Nodes::PassOptionNode::new
|
407
|
+
->{pass_option_node}
|
408
|
+
end
|
409
|
+
|
410
|
+
register :player_movement_node do
|
411
|
+
->(player_id:, space_id:) do
|
412
|
+
SpyAlleyApplication::Results::Nodes::PlayerMovementNode::new(
|
413
|
+
player_id: player_id,
|
414
|
+
space_id: space_id)
|
415
|
+
end
|
416
|
+
end
|
417
|
+
|
418
|
+
register :player_passed_node do
|
419
|
+
player_passed_node = SpyAlleyApplication::Results::Nodes::PlayerPassedNode::new
|
420
|
+
->{player_passed_node}
|
421
|
+
end
|
422
|
+
|
423
|
+
register :result_game_board_node do
|
424
|
+
->(game_board:) do
|
425
|
+
SpyAlleyApplication::Results::Nodes::ResultGameBoardNode::new(game_board: game_board)
|
426
|
+
end
|
427
|
+
end
|
428
|
+
|
429
|
+
register :roll_die_option_node do
|
430
|
+
roll_die = SpyAlleyApplication::Results::Nodes::RollDieOptionNode::new
|
431
|
+
->{roll_die}
|
432
|
+
end
|
433
|
+
|
434
|
+
register :use_move_card_option_node do
|
435
|
+
->(card_list:) do
|
436
|
+
SpyAlleyApplication::Results::Nodes::UseMoveCardOptionNode::new(card_list: card_list)
|
437
|
+
end
|
438
|
+
end
|
439
|
+
|
440
|
+
register :wild_card_gained_node do
|
441
|
+
->(player_id:, number_gained:, reason:) do
|
442
|
+
SpyAlleyApplication::Results::Nodes::WildCardGainedNode::new(
|
443
|
+
player_id: player_id,
|
444
|
+
number_gained: number_gained,
|
445
|
+
reason: reason)
|
446
|
+
end
|
447
|
+
end
|
448
|
+
end
|
449
|
+
|
450
|
+
register :process_buy_equipment_options do
|
451
|
+
SpyAlleyApplication::Results::ProcessBuyEquipmentOptions::new(
|
452
|
+
get_buy_equipment_option_node: resolve('get.buy_equipment_option_node'),
|
453
|
+
get_next_player_node: resolve('get.next_player_node'),
|
454
|
+
get_pass_option_node: resolve('get.pass_option_node')).method(:call)
|
455
|
+
end
|
456
|
+
|
457
|
+
register :process_eliminating_player do
|
458
|
+
eliminate_player = SpyAlleyApplication::InjectionContainer
|
459
|
+
.resolve('game_board_effects.eliminate_player')
|
460
|
+
SpyAlleyApplication::Results::ProcessEliminatingPlayer::new(
|
461
|
+
get_eliminated_player_node: resolve('get.eliminated_player_node'),
|
462
|
+
get_game_over_node: resolve('get.game_over_node'),
|
463
|
+
get_result_game_board_node: resolve('get.result_game_board_node'),
|
464
|
+
eliminate_player: eliminate_player,
|
465
|
+
process_next_turn_options: resolve(:process_next_turn_options)).method(:call)
|
466
|
+
end
|
467
|
+
|
468
|
+
register :process_landing_on_space do
|
469
|
+
black_market_option_state = SpyAlleyApplication::InjectionContainer
|
470
|
+
.resolve('game_board_effects.black_market_option_state')
|
471
|
+
buy_equipment_option_state = SpyAlleyApplication::InjectionContainer
|
472
|
+
.resolve('game_board_effects.buy_equipment_option_state')
|
473
|
+
buy_password_option_state = SpyAlleyApplication::InjectionContainer
|
474
|
+
.resolve('game_board_effects.buy_password_option_state')
|
475
|
+
confiscate_materials_option_state = SpyAlleyApplication::InjectionContainer
|
476
|
+
.resolve('game_board_effects.confiscate_materials_option_state')
|
477
|
+
embassy_victory = SpyAlleyApplication::InjectionContainer
|
478
|
+
.resolve('game_board_effects.embassy_victory')
|
479
|
+
free_gift_drawn = SpyAlleyApplication::InjectionContainer
|
480
|
+
.resolve('game_board_effects.free_gift_drawn')
|
481
|
+
money_gained_or_lost = SpyAlleyApplication::InjectionContainer
|
482
|
+
.resolve('game_board_effects.money_gained_or_lost')
|
483
|
+
move_card_drawn = SpyAlleyApplication::InjectionContainer
|
484
|
+
.resolve('game_board_effects.move_card_drawn')
|
485
|
+
next_game_state = SpyAlleyApplication::InjectionContainer
|
486
|
+
.resolve('game_board_effects.next_game_state')
|
487
|
+
player_moved = SpyAlleyApplication::InjectionContainer
|
488
|
+
.resolve('game_board_effects.player_moved')
|
489
|
+
spy_eliminator_options = SpyAlleyApplication::InjectionContainer
|
490
|
+
.resolve('game_board_effects.spy_eliminator_options')
|
491
|
+
SpyAlleyApplication::Results::ProcessLandingOnSpace::new(
|
492
|
+
black_market_option_state: black_market_option_state,
|
493
|
+
buy_equipment_option_state: buy_equipment_option_state,
|
494
|
+
buy_password_option_state: buy_password_option_state,
|
495
|
+
confiscate_materials_option_state: confiscate_materials_option_state,
|
496
|
+
embassy_victory: embassy_victory,
|
497
|
+
free_gift_drawn: free_gift_drawn,
|
498
|
+
get_equipment_gained_node: resolve('get.equipment_gained_node'),
|
499
|
+
get_game_over_node: resolve('get.game_over_node'),
|
500
|
+
get_money_gained_node: resolve('get.money_gained_node'),
|
501
|
+
get_money_lost_node: resolve('get.money_lost_node'),
|
502
|
+
get_move_card_drawn_node: resolve('get.move_card_drawn_node'),
|
503
|
+
get_player_movement_node: resolve('get.player_movement_node'),
|
504
|
+
get_result_game_board_node: resolve('get.result_game_board_node'),
|
505
|
+
get_wild_card_gained_node: resolve('get.wild_card_gained_node'),
|
506
|
+
money_gained_or_lost: money_gained_or_lost,
|
507
|
+
move_card_drawn: move_card_drawn,
|
508
|
+
next_game_state: next_game_state,
|
509
|
+
player_moved: player_moved,
|
510
|
+
process_next_turn_options: resolve(:process_next_turn_options),
|
511
|
+
process_proceeding_to_next_state: resolve(:process_proceeding_to_next_state),
|
512
|
+
spy_eliminator_options: spy_eliminator_options).method(:call)
|
513
|
+
end
|
514
|
+
|
515
|
+
register :process_move_options do
|
516
|
+
move_options = SpyAlleyApplication::InjectionContainer
|
517
|
+
.resolve('game_board_effects.move_options')
|
518
|
+
SpyAlleyApplication::Results::ProcessMoveOptions::new(
|
519
|
+
move_options: move_options,
|
520
|
+
process_landing_on_space: resolve(:process_landing_on_space),
|
521
|
+
process_next_turn_options: resolve(:process_next_turn_options)).method(:call)
|
522
|
+
end
|
523
|
+
|
524
|
+
register :process_next_turn_options do
|
525
|
+
choose_new_spy_identity_option_node = resolve('get.choose_new_spy_identity_option_node')
|
526
|
+
SpyAlleyApplication::Results::ProcessNextTurnOptions::new(
|
527
|
+
get_buy_equipment_option_node: resolve('get.buy_equipment_option_node'),
|
528
|
+
get_choose_new_spy_identity_option_node: choose_new_spy_identity_option_node,
|
529
|
+
get_confiscate_materials_option_node: resolve('get.confiscate_materials_option_node'),
|
530
|
+
get_make_accusation_option_node: resolve('get.make_accusation_option_node'),
|
531
|
+
get_next_player_node: resolve('get.next_player_node'),
|
532
|
+
get_move_option_node: resolve('get.move_option_node'),
|
533
|
+
get_pass_option_node: resolve('get.pass_option_node'),
|
534
|
+
get_roll_die_option_node: resolve('get.roll_die_option_node'),
|
535
|
+
get_use_move_card_option_node: resolve('get.use_move_card_option_node')).method(:call)
|
536
|
+
end
|
537
|
+
|
538
|
+
register :process_passing_spaces do
|
539
|
+
money_gained_or_lost = SpyAlleyApplication::InjectionContainer
|
540
|
+
.resolve('game_board_effects.money_gained_or_lost')
|
541
|
+
SpyAlleyApplication::Results::ProcessPassingSpaces::new(
|
542
|
+
get_money_gained_node: resolve('get.money_gained_node'),
|
543
|
+
money_gained_or_lost: money_gained_or_lost,
|
544
|
+
process_landing_on_space: resolve(:process_landing_on_space),
|
545
|
+
process_move_options: resolve(:process_move_options)).method(:call)
|
546
|
+
end
|
547
|
+
|
548
|
+
register :process_proceeding_to_next_state do
|
549
|
+
next_game_state = SpyAlleyApplication::InjectionContainer
|
550
|
+
.resolve('game_board_effects.next_game_state')
|
551
|
+
SpyAlleyApplication::Results::ProcessProceedingToNextState::new(
|
552
|
+
get_result_game_board_node: resolve('get.result_game_board_node'),
|
553
|
+
next_game_state: next_game_state,
|
554
|
+
process_next_turn_options: resolve(:process_next_turn_options)).method(:call)
|
555
|
+
end
|
556
|
+
end
|
557
|
+
|
558
|
+
register :build_new_game_validator do
|
559
|
+
SpyAlleyApplication::Validator::NewGameBuilder::new(
|
560
|
+
assign_seats: resolve('new_game.assign_seats'),
|
561
|
+
assign_spy_identities: resolve('new_game.assign_spy_identities'),
|
562
|
+
generate_new_game: resolve('actions.generate_new_game'),
|
563
|
+
validate_new_game: resolve('new_game.validate_new_game'))
|
564
|
+
end
|
565
|
+
|
566
|
+
register :build_validator do
|
567
|
+
SpyAlleyApplication::Validator::Builder::new(
|
568
|
+
process_next_turn_options: resolve('results.process_next_turn_options'),
|
569
|
+
change_orders_initializer: resolve(:change_orders_initializer),
|
570
|
+
wrap_result: resolve(:wrap_result))
|
571
|
+
end
|
572
|
+
|
573
|
+
register :wrap_result do
|
574
|
+
dc = SpyAlleyApplication::InjectionContainer
|
575
|
+
wrap_result = ->(execute) do
|
576
|
+
->(successful_result) do
|
577
|
+
GameValidator::Validator::Result::new(
|
578
|
+
result: successful_result,
|
579
|
+
execute: execute)
|
580
|
+
end
|
581
|
+
end
|
582
|
+
|
583
|
+
{
|
584
|
+
buy_equipment: wrap_result.(dc.resolve('actions.buy_equipment')),
|
585
|
+
choose_new_spy_identity: wrap_result.(dc.resolve('actions.choose_new_spy_identity')),
|
586
|
+
confiscate_materials: wrap_result.(dc.resolve('actions.confiscate_materials')),
|
587
|
+
make_accusation: wrap_result.(dc.resolve('actions.make_accusation')),
|
588
|
+
move: wrap_result.(dc.resolve('actions.choose_space_to_move')),
|
589
|
+
pass: wrap_result.(dc.resolve('actions.pass')),
|
590
|
+
roll_die: wrap_result.(dc.resolve('actions.roll_die')),
|
591
|
+
use_move_card: wrap_result.(dc.resolve('actions.use_move_card'))
|
592
|
+
}
|
593
|
+
end
|
594
|
+
end
|
595
|
+
end
|
596
|
+
|