-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.mlog
203 lines (203 loc) · 6.39 KB
/
main.mlog
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
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
set unit @vela
print "Possible units: @vela, @quasar, @pulsar and @nova"
set repAppr 4
print "Approach distance to repair turret"
set vaultAppr 6
print "Approach distance to vault during bomb loading"
set idleAppr 30
print "Approach distance to vault when logic is idle"
set angleChange 30
print "Angle change in carousel logic (more is faster)"
ubind unit
sensor maxHp @unit @maxHealth
sensor maxSpeed @unit @speed
sensor unitRange @unit @range
sensor unitCap @unit @itemCapacity
sensor isDead @unit @dead
jump 10 equal isDead 1
print "Check if the unit is alive to make sure the variable values are correct"
op mul minRepHp maxHp 0.55
print "Minimum health for repair"
op mul maxRepHp maxHp 0.98
print "Maximum health for repair"
op mul maxRepDist maxSpeed 60
print "Maximum distance to repair turret"
op mul dangEnemy maxHp 0.068
print "Minimum health of a dangerous enemy"
op add defDist vaultAppr 10
print "Defense range during repairs and bomb loading"
op add defDistIdle idleAppr 5
print "Defense range during idle"
op mul enUnitAppr unitRange 0.9
print "Approach distance for attacking enemy units"
op mul enBuildDist unitRange 1.5
print "Attack range to enemy buildings"
ubind unit
sensor unitFlag @unit @flag
jump 64 notEqual unitFlag 0
sensor hp @unit @health
jump 64 greaterThanEq hp maxRepHp
ulocate building repair false @copper repX repY 0 repTurr
sensor repPower repTurr @totalPower
jump 64 lessThanEq repPower 0
ucontrol within repX repY defDist isNear 0
jump 58 notEqual isNear 1
ucontrol approach repX repY repAppr 0 0
uradar enemy any any distance 0 1 __fn0_enUnit
jump 50 equal __fn0_enUnit null
ucontrol boost 0 0 0 0 0
ucontrol targetp __fn0_enUnit 1 0 0 0
jump 34 always 0 0
ulocate damaged core true @copper __fn0_outX __fn0_outY 0 0
ucontrol within __fn0_outX __fn0_outY unitRange __fn0_isNear 0
jump 56 notEqual __fn0_isNear 1
ucontrol boost 0 0 0 0 0
ucontrol target __fn0_outX __fn0_outY 1 0 0
jump 34 always 0 0
ucontrol boost 1 0 0 0 0
jump 34 always 0 0
jump 64 greaterThan hp minRepHp
ucontrol within repX repY maxRepDist isRepNear 0
jump 64 notEqual isRepNear 1
ucontrol approach repX repY repAppr 0 0
ucontrol boost 1 0 0 0 0
jump 34 always 0 0
sensor items @unit @totalItems
jump 90 greaterThanEq items unitCap
sensor bombType sorter1 @config
jump 90 equal bombType null
jump 90 equal vault1 null
sensor vaultX vault1 @x
sensor vaultY vault1 @y
ucontrol approach vaultX vaultY vaultAppr 0 0
ucontrol within vaultX vaultY defDist isNear 0
jump 88 notEqual isNear 1
ucontrol itemTake vault1 bombType unitCap 0 0
uradar enemy any any distance 0 1 __fn0_enUnit
jump 80 equal __fn0_enUnit null
ucontrol boost 0 0 0 0 0
ucontrol targetp __fn0_enUnit 1 0 0 0
jump 34 always 0 0
ulocate damaged core true @copper __fn0_outX __fn0_outY 0 0
ucontrol within __fn0_outX __fn0_outY unitRange __fn0_isNear 0
jump 86 notEqual __fn0_isNear 1
ucontrol boost 0 0 0 0 0
ucontrol target __fn0_outX __fn0_outY 1 0 0
jump 34 always 0 0
ucontrol boost 1 0 0 0 0
jump 34 always 0 0
ucontrol boost 1 0 0 0 0
jump 34 always 0 0
ucontrol flag 0 0 0 0 0
sensor isEnabled switch1 @enabled
jump 130 notEqual isEnabled 0
jump 97 notEqual vault1 null
set idleX @thisx
set idleY @thisy
jump 99 always 0 0
sensor idleX vault1 @x
sensor idleY vault1 @y
ucontrol within idleX idleY defDistIdle isNear 0
jump 127 notEqual isNear 1
uradar enemy any any distance 0 1 __fn0_enUnit
jump 106 equal __fn0_enUnit null
ucontrol boost 0 0 0 0 0
ucontrol targetp __fn0_enUnit 1 0 0 0
jump 113 always 0 0
ulocate damaged core true @copper __fn0_outX __fn0_outY 0 0
ucontrol within __fn0_outX __fn0_outY unitRange __fn0_isNear 0
jump 112 notEqual __fn0_isNear 1
ucontrol boost 0 0 0 0 0
ucontrol target __fn0_outX __fn0_outY 1 0 0
jump 113 always 0 0
ucontrol boost 1 0 0 0 0
sensor unitX @unit @x
sensor unitY @unit @y
op sub vectorX unitX idleX
op sub vectorY unitY idleY
op angle angle vectorX vectorY
op add angle angle angleChange
op cos moveX angle 0
op sin moveY angle 0
op mul moveX moveX idleAppr
op mul moveY moveY idleAppr
op add moveX moveX idleX
op add moveY moveY idleY
ucontrol pathfind moveX moveY 0 0 0
jump 34 always 0 0
ucontrol approach idleX idleY vaultAppr 0 0
ucontrol boost 1 0 0 0 0
jump 34 always 0 0
sensor controlled arc1 @controlled
jump 150 notEqual controlled 2
sensor arcX arc1 @shootX
sensor arcY arc1 @shootY
ucontrol within arcX arcY enBuildDist isNear 0
jump 147 notEqual isNear 1
sensor isShooting arc1 @shooting
jump 147 notEqual isShooting 1
ucontrol boost 0 0 0 0 0
ucontrol target arcX arcY 1 0 0
sensor __fn1_isBoosted @unit @boosting
jump 145 notEqual __fn1_isBoosted 1
ucontrol move arcX arcY 0 0 0
ucontrol flag 1 0 0 0 0
jump 34 always 0 0
ucontrol approach arcX arcY unitRange 0 0
jump 34 always 0 0
ucontrol move arcX arcY 0 0 0
ucontrol boost 1 0 0 0 0
jump 34 always 0 0
uradar enemy any any maxHealth 0 1 enUnit
jump 160 equal enUnit null
sensor enMaxHp enUnit @maxHealth
jump 160 lessThan enMaxHp dangEnemy
ucontrol boost 0 0 0 0 0
ucontrol targetp enUnit 1 0 0 0
sensor enemyX enUnit @x
sensor enemyY enUnit @y
ucontrol approach enemyX enemyY enUnitAppr 0 0
jump 34 always 0 0
ulocate building turret true @copper turretX turretY enTurr 0
jump 173 notEqual enTurr 1
ucontrol within turretX turretY enBuildDist isNear 0
jump 173 notEqual isNear 1
ucontrol boost 0 0 0 0 0
ucontrol target turretX turretY 1 0 0
sensor __fn1_isBoosted @unit @boosting
jump 171 notEqual __fn1_isBoosted 1
ucontrol move turretX turretY 0 0 0
ucontrol flag 1 0 0 0 0
jump 34 always 0 0
ucontrol approach turretX turretY unitRange 0 0
jump 34 always 0 0
ulocate building core true @copper coreX coreY 0 0
ucontrol within coreX coreY enBuildDist isNear 0
jump 185 notEqual isNear 1
ucontrol boost 0 0 0 0 0
ucontrol target coreX coreY 1 0 0
sensor __fn1_isBoosted @unit @boosting
jump 183 notEqual __fn1_isBoosted 1
ucontrol move coreX coreY 0 0 0
ucontrol flag 1 0 0 0 0
jump 34 always 0 0
ucontrol approach coreX coreY unitRange 0 0
jump 34 always 0 0
ulocate building generator true @copper genX genY enGener 0
jump 198 notEqual enGener 1
ucontrol within genX genY enBuildDist isNear 0
jump 198 notEqual isNear 1
ucontrol boost 0 0 0 0 0
ucontrol target genX genY 1 0 0
sensor __fn1_isBoosted @unit @boosting
jump 196 notEqual __fn1_isBoosted 1
ucontrol move genX genY 0 0 0
ucontrol flag 1 0 0 0 0
jump 34 always 0 0
ucontrol approach genX genY unitRange 0 0
jump 34 always 0 0
ucontrol autoPathfind 0 0 0 0 0
ucontrol boost 1 0 0 0 0
jump 34 always 0 0
end
print "Compiled by Mindcode - github.com/cardillan/mindcode"