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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
|
function scripts.power_reinforcements_control_KR5.insert(this, store, script)
local x, y = this.pos.x, this.pos.y
local spawned_special = false
local special_spawn_radius = 30
local special_angle_offset = 15
local spawns_amount = 5
local special_spawn_index = 1
local common_spawn_indexes = {
1,
2
}
local upg_power_trio = UP:get_upgrade("reinforcements_power_trio")
local upg_power_trio_dark = UP:get_upgrade("reinforcements_power_trio_dark")
local upg_shadow_archer = UP:get_upgrade("reinforcements_shadow_archer")
local upg_rebel_militia = UP:get_upgrade("reinforcements_rebel_militia")
upg_power_trio=true
upg_power_trio_dark=true
upg_shadow_archer=true
upg_rebel_militia=true
if upg_power_trio or upg_power_trio_dark then
spawned_special = true
end
local function spawn_unit(template, spawn_index, offset)
local e = E:create_entity(template)
spawned_special=true
if spawned_special then
local a = 2 * math.pi / spawns_amount
local spawn_pos = U.point_on_ellipse(V.v(x, y), special_spawn_radius, spawn_index * a - math.pi / 2 + special_angle_offset)
e.pos = V.vclone(spawn_pos)
else
e.pos.x = x + offset.x
e.pos.y = y + offset.y
end
e.nav_rally.center = V.v(x, y)
e.nav_rally.pos = V.vclone(e.pos)
e.reinforcement.squad_id = this.id
queue_insert(store, e)
return e
end
if game.store.level_idx == 40 then
special_spawn_radius = 40
special_angle_offset = 15
spawns_amount = 5
local stage_mechanic_spawns = {}
special_spawn_index = 4
upg_shadow_archer=true
if upg_shadow_archer then
special_spawn_index = 4
common_spawn_indexes = {
1,
2,3,5
}
stage_mechanic_spawns = {
{
index = 3,
template = "soldier_dragon_warden_warrior_reinforcement",
offset = {
x = 30,
y = 10
}
},
{
index = 5,
template = "soldier_dragon_warden_warrior_reinforcement",
offset = {
x = 50,
y = -10
}
},
{
index = 1,
template = "soldier_dragon_warden_warrior_reinforcement",
offset = {
x = -50,
y = 10
}
},
{
index = 2,
template = "soldier_dragon_warden_warrior_reinforcement",
offset = {
x = -30,
y = -10
}
}
}
elseif upg_rebel_militia then
special_spawn_index = 4
common_spawn_indexes = {
3,
5
}
stage_mechanic_spawns = {
{
index = 1,
template = "soldier_warden_stage_40_reinforcement",
offset = {
x = -50,
y = 10
}
},
{
index = 2,
template = "soldier_warden_stage_40_reinforcement",
offset = {
x = -30,
y = -10
}
}
}
else
stage_mechanic_spawns = {
{
index = 1,
template = "soldier_dragon_warden_warrior_reinforcement",
offset = {
x = 30,
y = 10
}
},
{
index = 2,
template = "soldier_warden_stage_40_reinforcement",
offset = {
x = -30,
y = -10
}
}
}
end
for _, s in ipairs(stage_mechanic_spawns) do
spawn_unit(s.template, s.index, s.offset)
end
end
spawn_unit("soldier_reinforcement_special_linirea", special_spawn_index, nil)
spawn_unit("soldier_reinforcement_special_dark_army", special_spawn_index, nil)
local soldier_stage_40
local variants = 3
if upg_shadow_archer then
variants = 1
elseif upg_rebel_militia then
variants = 2
end
spawn_unit("re_current_1", 1, V.v(10, -10))
spawn_unit("re_current_1", 2, V.v(-10, 10))
spawn_unit("re_current_1", 3, V.v(10, -10))
spawn_unit("re_current_1", 5, V.v(-10, 10))
return false
end
|