reinforce 0.1.1 → 0.2.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.
- checksums.yaml +4 -4
- data/lib/reinforce/factory.rb +23 -3
- data/lib/reinforce/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ce4b276c117912159c3ae62126f7b8f64e9742696a7e1d266e9da4f80f12e55c
|
4
|
+
data.tar.gz: dce5ee59db328ccbb329abf60325f46443ec2525e16684df73cf8b7dab6cec0c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 37167278ccbab5f28625b1c65ba5b32597ffd4956714b46c9b3478286c63d73dda7f2e8f09235ed435844fe900945dfab50bf1b40d264aded5f067428745c179
|
7
|
+
data.tar.gz: b1ef2dd4a85fcbbab874d2095a1c9e507dc682249dc9365e10330a34edee90f53a6c73b5d6082398fc004f24453d9fae25d0dc455007625d06d52093487bf467
|
data/lib/reinforce/factory.rb
CHANGED
@@ -6,7 +6,8 @@ module Reinforce
|
|
6
6
|
PRODUCTION_COMMANDS = %w[BuildSquad BuildGlobalUpgrade].freeze
|
7
7
|
BATTLEGROUP_COMMANDS = %w[SelectBattlegroup SelectBattlegroupAbility UseBattlegroupAbility].freeze
|
8
8
|
CANCEL_COMMANDS = %w[CancelConstruction CancelProduction].freeze
|
9
|
-
|
9
|
+
AI_COMMANDS = %w[AITakeover].freeze
|
10
|
+
ALL_COMMANDS = BUILDING_COMMANDS + PRODUCTION_COMMANDS + BATTLEGROUP_COMMANDS + CANCEL_COMMANDS + AI_COMMANDS
|
10
11
|
|
11
12
|
def initialize(player, build_number)
|
12
13
|
@player = player.to_h
|
@@ -14,10 +15,11 @@ module Reinforce
|
|
14
15
|
@buildings = []
|
15
16
|
@productions = {}
|
16
17
|
@battlegroup = []
|
18
|
+
@takeover = []
|
17
19
|
end
|
18
20
|
|
19
21
|
def build(with_cancellations: false)
|
20
|
-
commands.each { |c| classify_command(c) }
|
22
|
+
commands.each { |c| break if classify_command(c) == false }
|
21
23
|
result = consolidate
|
22
24
|
result = rectify_suspects(result)
|
23
25
|
result = result.reject(&:cancelled?) unless with_cancellations
|
@@ -40,16 +42,22 @@ module Reinforce
|
|
40
42
|
classify_battlegroup_command(command)
|
41
43
|
elsif CANCEL_COMMANDS.include?(command.action_type)
|
42
44
|
process_cancellation(command)
|
45
|
+
elsif AI_COMMANDS.include?(command.action_type)
|
46
|
+
process_takeover(command)
|
43
47
|
end
|
44
48
|
end
|
45
49
|
|
46
50
|
def classify_building_command(command)
|
47
51
|
@buildings << command if command.details.autobuild?
|
52
|
+
|
53
|
+
true
|
48
54
|
end
|
49
55
|
|
50
56
|
def classify_production_command(command)
|
51
57
|
@productions[command.source] ||= []
|
52
58
|
@productions[command.source] << command
|
59
|
+
|
60
|
+
true
|
53
61
|
end
|
54
62
|
|
55
63
|
def classify_battlegroup_command(command)
|
@@ -58,6 +66,8 @@ module Reinforce
|
|
58
66
|
else
|
59
67
|
@battlegroup << command
|
60
68
|
end
|
69
|
+
|
70
|
+
true
|
61
71
|
end
|
62
72
|
|
63
73
|
def process_cancellation(command)
|
@@ -66,10 +76,20 @@ module Reinforce
|
|
66
76
|
else
|
67
77
|
@productions[command.source][command.index - 1].cancel
|
68
78
|
end
|
79
|
+
|
80
|
+
true
|
81
|
+
end
|
82
|
+
|
83
|
+
def process_takeover(command)
|
84
|
+
return true unless @player[:human]
|
85
|
+
|
86
|
+
@takeover << command
|
87
|
+
|
88
|
+
false
|
69
89
|
end
|
70
90
|
|
71
91
|
def consolidate
|
72
|
-
build = @buildings + @battlegroup + @productions.values.flatten
|
92
|
+
build = @buildings + @battlegroup + @takeover + @productions.values.flatten
|
73
93
|
build.sort_by(&:tick)
|
74
94
|
end
|
75
95
|
|
data/lib/reinforce/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: reinforce
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ryantaylor
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '6'
|
19
|
+
version: '6.2'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '6'
|
26
|
+
version: '6.2'
|
27
27
|
description: A tool for extracting accurate build orders from Company of Heroes 3
|
28
28
|
replay files.
|
29
29
|
email:
|