forked from FAForever/fa
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCAiBrain.lua
431 lines (364 loc) · 13.8 KB
/
CAiBrain.lua
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
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
--- Class CAiBrain
-- @classmod Sim.CAiBrain
--- Assigns threat value to given position.
-- Threat is used for calculation where to attack with unit.
-- Or what place to avoid with engineers.
-- @param position Table with position {x, y z}.
-- @param threat Number reptresenting the threat.
-- @param decay Number, the thread is decreasing by time.
-- @param threatType Types: TODO.
function CAiBrain:AssignThreatAtPosition(position, threat, decay, threatType)
end
--- Assign unit to platoon.
-- If the unit is already in a platoon, it gets removed from it.
-- @param platoon Either platoon or string with platoon's unique name.
-- @param unit Unit to assign.
-- @param squad Platoon's squad to assign the unit to, types: 'Attack', 'Artillery', 'Guard' 'None', 'Scout', 'Support', 'Unassigned'.
-- @param formation Types: 'AttackFormation', 'GrowthFormation', 'NoFormation'.
function CAiBrain:AssignUnitsToPlatoon(platoon, unit, squad, formation)
end
--- Orders factories to build a platoon.
-- @param template Format: {name, plan, {bpID, min, max, squad, formation}, {...}, ...} .
-- @param factories Table of units-factories to build the platoon.
-- @param count How many times to built it.
function CAiBrain:BuildPlatoon(template, factories, count)
end
--- Orders the builder to build a unit.
-- @param builder Unit, (engineer) to use.
-- @param blueprintID Unit's bp ID to build, example: 'ueb0101'.
-- @param locationInfo Table {x, z, 0}.
-- @param something TODO: true/false.
-- @return true/false
function CAiBrain:BuildStructure(builder, blueprintID, locationInfo, something)
end
--- Orders a mobile factory to build a unit.
-- @param builder Unit, mobile factory.
-- @param unitToBuild BlueprintID of unit to build, example 'uel0303'.
-- @param count Number, how many units to build.
function CAiBrain:BuildUnit(builder, unitToBuild, count)
end
--- Filteres factories that can build the platoon and returns them.
-- Usually passed table with only one factory as AI picks the highest tech factory as a primary and others are assisting.
-- @param tempate Platoon's template.
-- @param factories Table containing units-factories.
-- @return tblUnits Table containing units-factories.
function CAiBrain:CanBuildPlatoon(template, factories)
end
--- Returns true if structure can be built at given location.
-- @param blueprintID Unit's bp ID to build, example 'ueb0101'.
-- @param location Table with position {x, y z}.
-- @return true/false
function CAiBrain:CanBuildStructureAt(blueprintID, location)
end
--- TODO.
-- @param startPos Table with position {x, y z}, current position.
-- @param endPos position Table with position {x, y z}, desired position.
-- @param arcType Types: 'high', 'low', 'none'.
-- @return true/false
function CAiBrain:CheckBlockingTerrain(startPos, endPos, arcType)
end
--- Spawns a resource building near position.
-- Used for spawning prebuild base resource structures.
-- @param blueprintID Unit's bp ID to spawn, example 'ueb0101'.
-- @param posX Position on X axis.
-- @param posY Position on Z axis (wrong name, also named like this in the functions that uses it, but it actually is the Z axis as Y is elevation).
-- @return Spawned unit or nil.
function CAiBrain:CreateResourceBuildingNearest(blueprintID, posX, posY)
end
--- Spawn a structure near position.
-- Used for spawning prebuild base.
-- @param blueprintID Unit's bp ID to spawn, example 'ueb0101'.
-- @param posX Position on X axis.
-- @param posY Position on Z axis (wrong name, also named like this in the functions that uses it, but it actually is the Z axis as Y is elevation).
-- @return Spawned unit or nil.
function CAiBrain:CreateUnitNearSpot(blueprintID, posX, posY).
end
--- TODO.
-- @param builder Unit-engineer to build with.
-- @param type
-- @param buildingTypes
function CAiBrain:DecideWhatToBuild(builder, type, buildingTypes)
end
--- Disbands a given platoon.
-- @param platoon Platoon to disband.
function CAiBrain:DisbandPlatoon(platoon)
end
--- Disbands a given platoon.
-- @param name Unique name of a platoon to disband.
function CAiBrain:DisbandPlatoonUniquelyNamed(name)
end
--- TODO.
function CAiBrain:FindClosestArmyWithBase()
end
--- TODO.
-- @return x, z, distance
function CAiBrain:FindPlaceToBuild(type, structureName, buildingTypes, relative, builder, optIgnoreAlliance, optOverridePosX, optOverridePosZ, optIgnoreThreatOver)
end
--- Return an unit that matches the unit name.
-- Can specify idle or not.
-- @param category Unit's category, example: categories.TECH2 * categories.ENGINEER .
-- @param needToBeIdle true/false.
-- @return Unit.
function CAiBrain:FindUnit(category, needToBeIdle)
end
--- Return a unit and it's upgrade blueprint.
-- TODO untested.
-- @param upgradeList Table, see '/lua/upgradetemplates.lua'.
-- @return TODO.
function CAiBrain:FindUnitToUpgrade(upgradeList)
end
--- Return an upgrade blueprint for the unit passed in.
-- @param unitName Blueprint ID of the unit to upgrade, example 'ueb0101'.
-- @param upgradeList Table, see '/lua/upgradetemplates.lua'.
-- @return BlueprintID, example 'ueb0201'
function CAiBrain:FindUpgradeBP(unitName, upgradeList)
end
--- Returns the ArmyIndex of the army represented by this brain.
-- @return Number.
function CAiBrain:GetArmyIndex()
end
--- Retrun army start position.
-- return x, z
function CAiBrain:GetArmyStartPos()
end
--- Returns the relevant stat or default value.
-- @param statName String, name of the stats to get.
-- @param defaultValue Ff the stat doesn't exists, it creates it and returns this value.
-- @return Number.
function CAiBrain:GetArmyStat(statName, defaultValue)
end
--- TODO.
function CAiBrain:GetAttackVectors()
end
--- Returns list of factories at location.
-- @param location Table with location, it's not a position but location created by PBMAddBuildLocation function.
-- @param radius Number in game units.
-- @return tblUnits List of factories.
function CAiBrain:GetAvailableFactories(location, radius)
end
--- Return a blueprint stat filtered by category.
-- @param statName String, name of the stats to get, example: "Enemies_Killed".
-- @param category Unit's category, example: categories.TECH2 .
-- @return Number.
function CAiBrain:GetBlueprintStat(statName, category)
end
--- Return this brain's current enemy.
-- @return Number, target's army number.
function CAiBrain:GetCurrentEnemy()
end
--- Return how many units of the given categories exist.
-- @param category Unit's category, example: categories.TECH2 .
-- @return Number.
function CAiBrain:GetCurrentUnits(category)
end
--- Returns current resource income.
-- @param resource 'Energy' or 'Mass'.
-- @return Number.
function CAiBrain:GetEconomyIncome(resource)
end
--- Return how much of the resource the brains wants to use.
-- This is used for calculating Paragon's production.
-- @param resource 'Energy' or 'Mass'.
-- @return Number.
function CAiBrain:GetEconomyRequested(resource)
end
--- Return current resource amout in storage.
-- @param resource 'Energy' or 'Mass'.
-- @return Number.
function CAiBrain:GetEconomyStored(resource)
end
--- Returns the ratio between resource in storage to maximum storage amout.
-- @param resource 'Energy' or 'Mass'.
-- @return Float Number 0.0 - 1
function CAiBrain:GetEconomyStoredRatio(resource)
end
--- TODO.
-- @param resource 'Energy' or 'Mass'.
-- @return TODO.
function CAiBrain:GetEconomyTrend(resource)
end
--- Returns current resource usage.
-- When stalling, this number is same as the current income.
-- @param resource 'Energy' or 'Mass'.
-- @return Number.
function CAiBrain:GetEconomyUsage(resource)
end
--- Returns the faction of the army represented by this brain.
-- 1 UEF, 2 Aeon, 3 Cybran, 4 Seraphim.
-- @return Number.
function CAiBrain:GetFactionIndex()
end
--- Returns a position with highest threat and the threat value.
-- Always reports a threatvalue of zero for Allies or self.
-- threatType and armyIndex are not required.
-- @param ring Number, in game unit.
-- @param restriction TODO.
-- @param threatType TODO Find out all threat types.
-- @param armyIndex Army's number, if not specified, uses all enemy armies.
-- @return position, value Position table {x, y, z}, value Number.
function CAiBrain:GetHighestThreatPosition(ring, restriction, threatType, armyIndex)
end
--- Returns list of units by category.
-- @param category Unit's category, example: categories.TECH2 .
-- @param needToBeIdle true/false Unit has to be idle.
-- @param requireBuilt true/false defaults to false which excludes units that are NOT finished.
-- @return tblUnits Table containing units.
function CAiBrain:GetListOfUnits(category, needToBeIdle, requireBuilt)
end
--- Returns a ratio between water and land.
-- @return Float number 0.0 - 1.
function CAiBrain:GetMapWaterRatio()
end
--- TODO. Number of no rush ticks left?
-- @return Number.
function CAiBrain:GetNoRushTicks()
end
--- TODO.
-- Probably has to do something with first param of MakePlatoon().
-- @return Number.
function CAiBrain:GetNumPlatoonsTemplateNamed()
end
--- TODO.
-- @return Number.
function CAiBrain:GetNumPlatoonsWithAI()
end
--- Return number of units around position.
-- @param category Unit's category, example: categories.TECH2 .
-- @param position Table with position {x, y, z}.
-- @param radius Number in game units.
-- @param alliance Types: 'Ally', 'Enemy', 'Neutral'.
-- @return Number.
function CAiBrain:GetNumUnitsAroundPoint(category, position, radius, alliance)
end
--- Return the personality for this brain to use.
-- @return TODO.
function CAiBrain:GetPersonality()
end
--- Returns platoon by unique name.
-- @param name String, unique platoon's name set by platoon:UniquelyNamePlatoon(name) function.
-- @return platoon
function CAiBrain:GetPlatoonUniquelyNamed(name)
end
--- Returns brain's platoons.
-- @return tblPlatoons Table containing platoons.
function CAiBrain:GetPlatoonsList()
end
--- Returns threat at given position.
-- @param position Table with position {x, y, z}.
-- @param radius Number in game units.
-- @param restriction TODO.
-- @param threatType TODO.
-- @param armyIndex Army's number, if specified uses, only this brain.
-- @return Number.
function CAiBrain:GetThreatAtPosition(position, radius, restriction, threatType, armyIndex)
end
--- Returns threat between two positions.
-- @param position Table with position {x, y, z}.
-- @param position2 Table with position {x, y, z}.
-- @param restriction
-- @param threatType
-- @param armyIndex Army's number, if specified uses, only this brain.
-- @return Number.
function CAiBrain:GetThreatBetweenPositions(position, position2, restriction, threatType, armyIndex)
end
--- Return threats around position.
-- @param position Table with position {x, y, z}.
-- @param radius Number in game units.
-- @param restriction
-- @param threatType
-- @param armyIndex
-- @return Table {{x, z, threatValue}, {...}, ...}.
function CAiBrain:GetThreatsAroundPosition(position, radius, restriction, threatType, armyIndex)
end
--- Returns unit blueprint if given blueprint name.
-- @param bpName Example 'ual0201'.
-- @return Blueprint.
function CAiBrain:GetUnitBlueprint(bpName)
end
--- Return list of units around position.
-- @param category Unit's category, example: categories.TECH2 .
-- @param position Table with position {x, y, z}.
-- @param radius Number in game units.
-- @param alliance Types: 'Ally', 'Enemy', 'Neutral'.
-- @return tblUnits Table containing units.
function CAiBrain:GetUnitsAroundPoint(category, position, radius, alliance)
end
--- Gives resources to brain.
-- @param type 'Energy', 'Mass'.
-- @param amout Number, how much to give.
function CAiBrain:GiveResource(type, amount)
end
--- Gives storage to brain.
-- @param type 'Energy', 'Mass'.
-- @param amout Number, how much to give.
function CAiBrain:GiveStorage(type, amount)
end
--- TODO.
function CAiBrain:IsAnyEngineerBuilding(category)
end
--- Returns true if opponent AI should be running.
-- @return true/false
function CAiBrain:IsOpponentAIRunning()
end
--- Creates a new platoon.
-- @param name or '', This is NOT platoon's unique name. TODO: probably template's name.
-- @param aiPlan Plan to follow for this platoon or '', the function for the plan is in '/lua/platoon.lua'.
-- @return Platoon.
function CAiBrain:MakePlatoon(name, aiPlan)
end
--- Return number of unit's categories being built.
-- @param entityCategoryOfBuildee Unit's category that is being built.
-- @param entityCategoryOfBuilder Unit's category of the unit building, example: categories.CONSTRUCTION .
-- @return Number.
function CAiBrain:NumCurrentlyBuilding(entityCategoryOfBuildee, entityCategoryOfBuilder)
end
--- TODO.
function CAiBrain:PickBestAttackVector()
end
--- Returns true if platoon exists.
-- @return true/false.
function CAiBrain:PlatoonExists(platoon)
end
--- Remove an army stats trigger.
-- TODO.
function CAiBrain:RemoveArmyStatsTrigger()
end
--- Sets army's stat to value.
-- @param statName String, army's stat, example: "Economy_Ratio_Mass".
-- @param value Number.
function CAiBrain:SetArmyStat(statName, value)
end
--- Creates a new stat trigger.
-- @param statName String, army's stat, example: "Economy_Ratio_Mass".
-- @param triggerName String, unique name of the trigger.
-- @param compareType String, available types: 'LessThan', 'LessThanOrEqual', 'GreaterThan', 'GreaterThanOrEqual', 'Equal'.
-- @param value Number.
function CAiBrain:SetArmyStatsTrigger(statName, triggerName, compareType, value)
end
--- Set the current enemy for this brain to attack.
-- @param armyIndex Target's army number.
function CAiBrain:SetCurrentEnemy(armyIndex)
end
--- Set the current plan for this brain to run.
-- TODO.
function CAiBrain:SetCurrentPlan()
end
--- TODO.
function CAiBrain:SetGreaterOf(statname, val)
end
--- Set if the brain should share resources to the allies.
-- @param bool ture/false
function CAiBrain:SetResourceSharing(bool)
end
--- TODO.
function CAiBrain:SetUpAttackVectorsToArmy(category)
end
--- Removes resources from brain.
-- @param type 'Energy', 'Mass'.
-- @param amout Number, how much to take.
function CAiBrain:TakeResource(type, amount)
end
---
--
function CAiBrain:moho.aibrain_methods()
end