blob: e738733633418b7c9232b3fcbd0baeba45599f92 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
# frozen_string_literal: true
require_relative 'fln_action'
module ColonialTwilight
module Actions
module FLN
# March 3.3.2
class March < FlnAction
def initialize(space, mode)
super(space, mode, cost: 1)
end
def cost
# Cost is 1 Resource per destination space moved into
mode.keys.size
end
def validate!
super
raise 'select at least 1 destination' if mode.empty?
total_moved = mode.values.sum
raise "total moved #{total_moved} exceeds available #{space.guerrillas}" if total_moved > space.guerrillas
end
# move any number of Guerrillas to adjacent spaces as a group
def apply!(board)
raise NotImplementedError
end
class << self
def op?
true
end
# any space with FLN cubes
def applicable?(space)
space.guerrillas.positive?
end
def available_modes(space)
space.adjacents.to_h { |idx| [idx, space.guerrillas] }
end
# the group must stop if moving across a Wilaya border or an International border
def must_stop?(space_from, space_to)
space_from.wilaya != space_to.wilaya || space_from.country? || space_to.country?
end
# if destination is at Support: activate group if moved FLN + Gov cubes > 3
# when crossing International border: activate group if moved FLN + Gov cubes + Border level > 3
def must_activate?(board, space_from, space_to, num = 1)
international = space_from.country? || space_to.country?
(international || space_to.support?) &&
(num + space_to.gov_cubes + (international ? board.border_zone_track : 0)) > 3
end
end
end
end
end
end
|