forked from FAForever/fa
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSorianInstantBuildConditions.lua
More file actions
595 lines (557 loc) · 24.4 KB
/
SorianInstantBuildConditions.lua
File metadata and controls
595 lines (557 loc) · 24.4 KB
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
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
#****************************************************************************
#**
#** File : /lua/SorianInstantBuildConditions.lua
#** Author(s): Michael Robbins aka Sorian
#**
#** Summary : Generic AI Platoon Build Conditions
#** Build conditions always return true or false
#**
#****************************************************************************
local AIUtils = import('/lua/ai/aiutilities.lua')
local ScenarioFramework = import('/lua/scenarioframework.lua')
local ScenarioUtils = import('/lua/sim/ScenarioUtilities.lua')
local Utils = import('/lua/utilities.lua')
local SUtils = import('/lua/AI/sorianutilities.lua')
function DefensivePointNeedsStructure(aiBrain, locationType, locationRadius, category, markerRadius, unitMax, threatMin, threatMax, threatRings, threatType)
local pos, name = AIUtils.AIFindDefensivePointNeedsStructureSorian(aiBrain, locationType, locationRadius, category, markerRadius, unitMax, threatMin, threatMax, threatRings, threatType)
if pos then
return true
end
return false
end
function ExpansionPointNeedsStructure(aiBrain, locationType, locationRadius, category, markerRadius, unitMax, threatMin, threatMax, threatRings, threatType)
local pos, name = AIUtils.AIFindExpansionPointNeedsStructure(aiBrain, locationType, locationRadius, category, markerRadius, unitMax, threatMin, threatMax, threatRings, threatType)
if pos then
return true
end
return false
end
function AIThreatExists(aiBrain, threatThreshold)
for k,v in aiBrain.BaseMonitor.AlertsTable do
if v.Threat >= threatThreshold then
return true
end
end
return false
end
##############################################################################################################
# function: FactoryRatioLessOrEqual = BuildCondition
#
# parameter 0: string aiBrain = "default_brain"
# parameter 1: string locationType = "location type"
# parameter 2: expr unitCategory = "Unit Category"
# parameter 2: expr unitCategory2 = "Unit Category"
# parameter 2: expr unitCategory3 = "Unit Category"
#
##############################################################################################################
function FactoryRatioLessOrEqual(aiBrain, locationType, num, unitCategory, unitCategory2, unitCategory3)
local factoryManager = aiBrain.BuilderManagers[locationType].FactoryManager
local testCat = unitCategory
if type(unitCategory) == 'string' then
testCat = ParseEntityCategory(unitCategory)
end
local testCat2 = unitCategory2
if type(unitCategory2) == 'string' then
testCat2 = ParseEntityCategory(unitCategory2)
end
local testCat3 = unitCategory3
if type(unitCategory3) == 'string' then
testCat3 = ParseEntityCategory(unitCategory3)
end
if not factoryManager then
WARN('*AI WARNING: FactoryComparisonAtLocation - Invalid location - ' .. locationType)
return false
end
local numUnits = factoryManager:GetNumCategoryFactories(testCat)
local numUnits2 = factoryManager:GetNumCategoryFactories(testCat2)
local numUnits3 = factoryManager:GetNumCategoryFactories(testCat3)
if numUnits == 0 and numUnits2 == 0 then
return true
elseif numUnits2 == 0 and (numUnits - numUnits2 <= num or numUnits3 < 1) then
return true
elseif numUnits2 > 0 and (numUnits / numUnits2 <= num or numUnits3 < 1) then
return true
else
return false
end
end
##############################################################################################################
# function: CDRHealthGreaterThan = BuildCondition
#
# parameter 0: string aiBrain = "default_brain"
# parameter 1: int health = "minimum health %"
# parameter 2: int shield = "minimum shield %"
#
##############################################################################################################
function CDRHealthGreaterThan(aiBrain, health, shield)
local cdr = aiBrain:GetListOfUnits(categories.COMMAND, false)[1]
if not cdr then return false end
local cdrhealth = cdr:GetHealthPercent()
local cdrshield
if (cdr:HasEnhancement('Shield') or cdr:HasEnhancement('ShieldGeneratorField') or cdr:HasEnhancement('ShieldHeavy')) and cdr:ShieldIsOn() then
cdrshield = (cdr.MyShield:GetHealth() / cdr.MyShield:GetMaxHealth())
else
cdrshield = 1
end
if cdrhealth >= health and cdrshield >= shield then
return true
end
return false
end
##############################################################################################################
# function: HaveGreaterThanUnitsWithCategory = BuildCondition doc = "Please work function docs."
#
# parameter 0: string aiBrain = "default_brain"
# parameter 1: int numReq = 0 doc = "docs for param1"
# parameter 2: expr category = categories.ALLUNITS doc = "param2 docs"
# parameter 3: expr idleReq = false doc = "docs for param3"
# parameter 4: bool special = "Whether numReq varies depending on game time"
#
##############################################################################################################
function HaveGreaterThanUnitsWithCategory(aiBrain, numReq, category, idleReq)
local numUnits
local total = 0
if type(category) == 'string' then
category = ParseEntityCategory(category)
end
if not idleReq then
numUnits = aiBrain:GetListOfUnits(category, false)
else
numUnits = aiBrain:GetListOfUnits(category, true)
end
for k,v in numUnits do
if v:GetFractionComplete() == 1 then
total = total + 1
if total > numReq then
return true
end
end
end
if total > numReq then
return true
end
return false
end
##############################################################################################################
# function: HaveLessThanUnitsWithCategory = BuildCondition doc = "Please work function docs."
#
# parameter 0: string aiBrain = "default_brain"
# parameter 1: int numReq = 0 doc = "docs for param1"
# parameter 2: expr category = categories.ALLUNITS doc = "param2 docs"
# parameter 3: expr idleReq = false doc = "docs for param3"
#
##############################################################################################################
function HaveLessThanUnitsWithCategory(aiBrain, numReq, category, idleReq)
local numUnits
local total = 0
if type(category) == 'string' then
category = ParseEntityCategory(category)
end
if not idleReq then
numUnits = aiBrain:GetListOfUnits(category, false)
else
numUnits = aiBrain:GetListOfUnits(category, true)
end
for k,v in numUnits do
if v:GetFractionComplete() == 1 then
total = total + 1
if total >= numReq then
return false
end
end
end
if total >= numReq then
return false
end
return true
end
##############################################################################################################
# function: HaveLessThanUnitsForMapSize = BuildCondition doc = "Please work function docs."
#
# parameter 0: string aiBrain = "default_brain"
# parameter 1: int numReq = 0 doc = "docs for param1"
# parameter 2: expr category = categories.ALLUNITS doc = "param2 docs"
# parameter 3: expr idleReq = false doc = "docs for param3"
#
##############################################################################################################
function HaveLessThanUnitsForMapSize(aiBrain, sizetable, category, idleReq)
local numUnits
local total = 0
local mapSizeX, mapSizeZ = GetMapSize()
if not sizetable[mapSizeX] or not sizetable[mapSizeZ] then
return false
end
local numReq = sizetable[mapSizeX] or sizetable[mapSizeZ]
if type(category) == 'string' then
category = ParseEntityCategory(category)
end
if not idleReq then
numUnits = aiBrain:GetCurrentUnits(category)
else
numUnits = table.getn(aiBrain:GetListOfUnits(category, true))
end
if numUnits < numReq then
return true
end
return false
end
##############################################################################################################
# function: HaveLessThanUnitsInCategoryBeingBuilt = BuildCondition
#
# parameter 0: string aiBrain = "default_brain"
# parameter 1: integer numunits = "Number of units"
# parameter 2: integer radius = "radius"
#
##############################################################################################################
function HaveLessThanUnitsInCategoryBeingBuilt(aiBrain, numunits, category)
if type(category) == 'string' then
category = ParseEntityCategory(category)
end
local unitsBuilding = aiBrain:GetListOfUnits(categories.CONSTRUCTION, false)
local numBuilding = 0
for unitNum, unit in unitsBuilding do
if not unit:BeenDestroyed() and unit:IsUnitState('Building') then
local buildingUnit = unit.UnitBeingBuilt
if buildingUnit and not buildingUnit.Dead and EntityCategoryContains(category, buildingUnit) then
numBuilding = numBuilding + 1
end
end
if numunits <= numBuilding then
return false
end
end
if numunits > numBuilding then
return true
end
return false
end
##############################################################################################################
# function: HaveGreaterThanUnitsInCategoryBeingBuilt = BuildCondition
#
# parameter 0: string aiBrain = "default_brain"
# parameter 1: integer numunits = "Number of units"
# parameter 2: integer radius = "radius"
#
##############################################################################################################
function HaveGreaterThanUnitsInCategoryBeingBuilt(aiBrain, numunits, category)
if type(category) == 'string' then
category = ParseEntityCategory(category)
end
local unitsBuilding = aiBrain:GetListOfUnits(categories.CONSTRUCTION, false)
local numBuilding = 0
for unitNum, unit in unitsBuilding do
if not unit:BeenDestroyed() and unit:IsUnitState('Building') then
local buildingUnit = unit.UnitBeingBuilt
if buildingUnit and not buildingUnit.Dead and EntityCategoryContains(category, buildingUnit) then
numBuilding = numBuilding + 1
end
end
if numunits < numBuilding then
return true
end
end
return false
end
##############################################################################################################
# function: LessThanEconTrend = BuildCondition doc = "Please work function docs."
#
# parameter 0: string aiBrain = "default_brain" doc = "docs for param1"
# parameter 1: integer mTrend = 0 doc = "docs for param1"
# parameter 2: integer eTrend = 0 doc = "param2 docs"
#
##############################################################################################################
function LessThanEconTrend(aiBrain, mTrend, eTrend)
if HaveGreaterThanUnitsWithCategory(aiBrain, 0, 'ENERGYPRODUCTION EXPERIMENTAL STRUCTURE') then
#LOG('*AI DEBUG: Found Paragon')
return false
end
local econ = AIUtils.AIGetEconomyNumbers(aiBrain)
local cheatmult = tonumber(ScenarioInfo.Options.CheatMult) or 2
if aiBrain.CheatEnabled and (econ.MassTrend < mTrend * cheatmult and econ.EnergyTrend < eTrend * cheatmult) then
return true
elseif not aiBrain.CheatEnabled and (econ.MassTrend < mTrend and econ.EnergyTrend < eTrend) then
return true
else
return false
end
end
##############################################################################################################
# function: GreaterThanEconEfficiencyOverTimeExp = BuildCondition doc = "Please work function docs."
#
# parameter 0: string aiBrain = "default_brain" doc = "docs for param1"
# parameter 1: int MassEfficiency = 1 doc = "docs for param1"
# parameter 2: int EnergyEfficiency = 1 doc = "param2 docs"
#
##############################################################################################################
function GreaterThanEconEfficiencyOverTimeExp(aiBrain, MassEfficiency, EnergyEfficiency)
local unitsBuilding = aiBrain:GetListOfUnits(categories.CONSTRUCTION, false)
local numBuilding = 0
for unitNum, unit in unitsBuilding do
if not unit:BeenDestroyed() and unit:IsUnitState('Building') then
local buildingUnit = unit.UnitBeingBuilt
if buildingUnit and not buildingUnit.Dead and EntityCategoryContains(categories.EXPERIMENTAL, buildingUnit) then
numBuilding = numBuilding + 1
end
end
end
local econ = AIUtils.AIGetEconomyNumbers(aiBrain)
if (econ.MassEfficiencyOverTime >= MassEfficiency + (numBuilding * .2) and econ.EnergyEfficiencyOverTime >= EnergyEfficiency + (numBuilding * .2)) then
return true
end
return false
end
##############################################################################################################
# function: GreaterThanEconIncome = BuildCondition doc = "Please work function docs."
#
# parameter 0: string aiBrain = "default_brain" doc = "docs for param1"
# parameter 1: int MassIncome = 0.1 doc = "docs for param1"
# parameter 2: int EnergyIncome = 1 doc = "param2 docs"
#
##############################################################################################################
function GreaterThanEconIncome(aiBrain, MassIncome, EnergyIncome)
if HaveGreaterThanUnitsWithCategory(aiBrain, 0, 'ENERGYPRODUCTION EXPERIMENTAL STRUCTURE') then
#LOG('*AI DEBUG: Found Paragon')
return true
end
local econ = AIUtils.AIGetEconomyNumbers(aiBrain)
if (econ.MassIncome >= MassIncome and econ.EnergyIncome >= EnergyIncome) then
return true
end
return false
end
##############################################################################################################
# function: LessThanEconIncome = BuildCondition doc = "Please work function docs."
#
# parameter 0: string aiBrain = "default_brain" doc = "docs for param1"
# parameter 1: int MassIncome = 0.1 doc = "docs for param1"
# parameter 2: int EnergyIncome = 1 doc = "param2 docs"
#
##############################################################################################################
function LessThanEconIncome(aiBrain, MassIncome, EnergyIncome)
if HaveGreaterThanUnitsWithCategory(aiBrain, 0, 'ENERGYPRODUCTION EXPERIMENTAL STRUCTURE') then
#LOG('*AI DEBUG: Found Paragon')
return false
end
local econ = AIUtils.AIGetEconomyNumbers(aiBrain)
if (econ.MassIncome < MassIncome and econ.EnergyIncome < EnergyIncome) then
return true
end
return false
end
##############################################################################################################
# function: GreaterThanEconIncomeOverTime = BuildCondition doc = "Please work function docs."
#
# parameter 0: string aiBrain = "default_brain" doc = "docs for param1"
# parameter 1: int MassIncome = 0.1 doc = "docs for param1"
# parameter 2: int EnergyIncome = 1 doc = "param2 docs"
#
##############################################################################################################
function GreaterThanEconIncomeOverTime(aiBrain, MassIncome, EnergyIncome)
local econ = AIUtils.AIGetEconomyNumbers(aiBrain)
if (econ.MassIncomeOverTime >= MassIncome and econ.EnergyIncomeOverTime >= EnergyIncome) then
return true
end
return false
end
##############################################################################################################
# function: GreaterThanEconEfficiency = BuildCondition doc = "Please work function docs."
#
# parameter 0: string aiBrain = "default_brain" doc = "docs for param1"
# parameter 1: int MassEfficiency = 1 doc = "docs for param1"
# parameter 2: int EnergyEfficiency = 1 doc = "param2 docs"
#
##############################################################################################################
function GreaterThanEconEfficiency(aiBrain, MassEfficiency, EnergyEfficiency)
if HaveGreaterThanUnitsWithCategory(aiBrain, 0, 'ENERGYPRODUCTION EXPERIMENTAL STRUCTURE') then
#LOG('*AI DEBUG: Found Paragon')
return true
end
local econ = AIUtils.AIGetEconomyNumbers(aiBrain)
if (econ.MassEfficiency >= MassEfficiency and econ.EnergyEfficiency >= EnergyEfficiency) then
return true
end
return false
end
function LessThanEconEfficiency(aiBrain, MassEfficiency, EnergyEfficiency)
if HaveGreaterThanUnitsWithCategory(aiBrain, 0, 'ENERGYPRODUCTION EXPERIMENTAL STRUCTURE') then
#LOG('*AI DEBUG: Found Paragon')
return false
end
local econ = AIUtils.AIGetEconomyNumbers(aiBrain)
if (econ.MassEfficiency <= MassEfficiency and econ.EnergyEfficiency <= EnergyEfficiency) then
return true
end
return false
end
##############################################################################################################
# function: GreaterThanEconEfficiencyOverTime = BuildCondition doc = "Please work function docs."
#
# parameter 0: string aiBrain = "default_brain" doc = "docs for param1"
# parameter 1: int MassEfficiency = 1 doc = "docs for param1"
# parameter 2: int EnergyEfficiency = 1 doc = "param2 docs"
#
##############################################################################################################
function GreaterThanEconEfficiencyOverTime(aiBrain, MassEfficiency, EnergyEfficiency)
if HaveGreaterThanUnitsWithCategory(aiBrain, 0, 'ENERGYPRODUCTION EXPERIMENTAL STRUCTURE') then
#LOG('*AI DEBUG: Found Paragon')
return true
end
local econ = AIUtils.AIGetEconomyNumbers(aiBrain)
if (econ.MassEfficiencyOverTime >= MassEfficiency and econ.EnergyEfficiencyOverTime >= EnergyEfficiency) then
return true
end
return false
end
function LessThanEconEfficiencyOverTime(aiBrain, MassEfficiency, EnergyEfficiency)
if HaveGreaterThanUnitsWithCategory(aiBrain, 0, 'ENERGYPRODUCTION EXPERIMENTAL STRUCTURE') then
#LOG('*AI DEBUG: Found Paragon')
return false
end
local econ = AIUtils.AIGetEconomyNumbers(aiBrain)
if (econ.MassEfficiencyOverTime <= MassEfficiency and econ.EnergyEfficiencyOverTime <= EnergyEfficiency) then
return true
end
return false
end
##############################################################################################################
# function: LessThanEconIncomeOverTime = BuildCondition doc = "Please work function docs."
#
# parameter 0: string aiBrain = "default_brain" doc = "docs for param1"
# parameter 1: int MassIncome = 0.1 doc = "docs for param1"
# parameter 2: int EnergyIncome = 1 doc = "param2 docs"
#
##############################################################################################################
function LessThanEconIncomeOverTime(aiBrain, MassIncome, EnergyIncome)
local econ = AIUtils.AIGetEconomyNumbers(aiBrain)
if (econ.MassIncomeOverTime < MassIncome and econ.EnergyIncomeOverTime < EnergyIncome) then
return true
end
return false
end
##############################################################################################################
# function: EngineerNeedsAssistance = BuildCondition
#
# parameter 0: string aiBrain = "default_brain"
# parameter 1: bool doesbool = "true: Engineer does need assistance false: Engineer does not need assistance"
# parameter 2: string LocationType = "LocationType"
# parameter 3: string category = "Being built category"
#
##############################################################################################################
function EngineerNeedsAssistance(aiBrain, doesbool, locationType, category)
local engineerManager = aiBrain.BuilderManagers[locationType].EngineerManager
if not engineerManager then
return false
end
local numFound = 0
for _,cat in category do
local bCategory = ParseEntityCategory(cat)
local engs = engineerManager:GetEngineersBuildingCategory(bCategory, categories.ALLUNITS)
for k,v in engs do
if v.DesiresAssist == true then
if v.MinNumAssistees and SUtils.GetGuards(aiBrain, v) < v.MinNumAssistees then
numFound = numFound + 1
end
end
if numFound > 0 and doesbool then return true end
end
engs = engineerManager:GetEngineersBuildQueue(cat)
for k,v in engs do
if v.DesiresAssist == true then
if v.MinNumAssistees and SUtils.GetGuards(aiBrain, v) < v.MinNumAssistees then
numFound = numFound + 1
end
end
if numFound > 0 and doesbool then return true end
end
end
if numFound == 0 and not doesbool then return true end
return false
end
function LessThanExpansionBases(aiBrain)
local expBaseCount = 0
local numberofAIs = SUtils.GetNumberOfAIs(aiBrain)
local startX, startZ = aiBrain:GetArmyStartPos()
local isWaterMap = false
local checkNum = tonumber(ScenarioInfo.Options.LandExpansionsAllowed) or 5
local navalMarker = AIUtils.AIGetClosestMarkerLocation(aiBrain, 'Naval Area', startX, startZ)
if navalMarker then
isWaterMap = true
end
expBaseCount = aiBrain:GetManagerCount('Start Location')
expBaseCount = expBaseCount + aiBrain:GetManagerCount('Expansion Area')
checkNum = checkNum - numberofAIs
if isWaterMap and expBaseCount < checkNum then
return true
elseif not isWaterMap and expBaseCount < checkNum + 1 then
return true
end
return false
end
function GreaterThanExpansionBases(aiBrain)
return not LessThanExpansionBases(aiBrain)
end
function LessThanNavalBases(aiBrain)
local expBaseCount = 0
local checkNum = tonumber(ScenarioInfo.Options.NavalExpansionsAllowed) or 4
local isIsland = import('/lua/editor/SorianBuildConditions.lua').IsIslandMap(aiBrain)
expBaseCount = aiBrain:GetManagerCount('Naval Area')
#LOG('*AI DEBUG: '.. aiBrain.Nickname ..' LessThanNavalBases Total = '..expBaseCount)
if isIsland and expBaseCount < checkNum then
return true
elseif not isIsland and expBaseCount < checkNum - 2 then
return true
end
return false
end
function GreaterThanNavalBases(aiBrain)
return not LessThanNavalBases(aiBrain)
end
function T4BuildingCheck(aiBrain)
if aiBrain.T4Building then
return false
end
return true
end
function HavePoolUnitComparisonAtLocationExp(aiBrain, locationType, unitCount, unitCategory, compareType)
local engineerManager = aiBrain.BuilderManagers[locationType].EngineerManager
local testCat = unitCategory
if type(unitCategory) == 'string' then
testCat = ParseEntityCategory(unitCategory)
end
if not engineerManager then
WARN('*AI WARNING: HavePoolUnitComparisonAtLocation - Invalid location - ' .. locationType)
return false
end
local poolPlatoon = aiBrain:GetPlatoonUniquelyNamed('ArmyPool')
local numUnits = poolPlatoon:GetNumCategoryUnits(testCat, engineerManager:GetLocationCoords(), engineerManager.Radius * 2.5)
return CompareBody(numUnits, unitCount, compareType)
end
function PoolLessAtLocationExp(aiBrain, locationType, unitCount, unitCategory)
return HavePoolUnitComparisonAtLocationExp(aiBrain, locationType, unitCount, unitCategory, '<')
end
function PoolGreaterAtLocationExp(aiBrain, locationType, unitCount, unitCategory)
return HavePoolUnitComparisonAtLocationExp(aiBrain, locationType, unitCount, unitCategory, '>')
end
function CompareBody(numOne, numTwo, compareType)
if compareType == '>' then
if numOne > numTwo then
return true
end
elseif compareType == '<' then
if numOne < numTwo then
return true
end
elseif compareType == '>=' then
if numOne >= numTwo then
return true
end
elseif compareType == '<=' then
if numOne <= numTwo then
return true
end
else
error('*AI ERROR: Invalid compare type: ' .. compareType)
return false
end
return false
end