-
Notifications
You must be signed in to change notification settings - Fork 12
/
TerranHigh.galaxy
2193 lines (2018 loc) · 115 KB
/
TerranHigh.galaxy
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
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
//==================================================================================================
// Terran higher difficulty shared logic
//==================================================================================================
//==================================================================================================
// Terran Openings
//==================================================================================================
// rush builds
const int e_hdBuildIndex_TOpenRush_Marine = 70; // heavy early marine rush
const int e_hdBuildIndex_TOpenRush_MarineReaper = 71; // marine w/ early reaper harass
const int e_hdBuildIndex_TOpenRush_ProxyBarracks = 72; // proxy barracks marine rush
// 1 base timing builds
const int e_hdBuildIndex_TOpenTiming_MMStim = 73; // stim timing push
const int e_hdBuildIndex_TOpenTiming_HellionMarauder = 74; // hellion marauder timing push
const int e_hdBuildIndex_TOpenTiming_MariSiege = 75; // marine + siege push
const int e_hdBuildIndex_TOpenTiming_CloakBanshee = 76; // cloak banshee timing
// power & macro builds
const int e_hdBuildIndex_TOpenPowerMacro_QuickExpGnd = 77; // aggresive quick expand
const int e_hdBuildIndex_TOpenPowerMacro_MarineExpGnd = 78; // gasless marines expand
const int e_hdBuildIndex_TOpenPowerMacro_DefenseExpGnd = 79; // safer marine/siege expand
// air openings
const int e_hdBuildIndex_TOpenAir_OneBaseAir = 80; // single base "island" air build
const int e_hdBuildIndex_TOpenAir_OneBaseDrop = 81; // single base "island" drop build
const int e_hdBuildIndex_TOpenAir_CloakBanshee = 82; // single base "island" cloak banshee
const int e_hdBuildIndex_TOpenAir_QuickExpandAir = 83; // quick expand air build
//==================================================================================================
// Terran MidGame
//==================================================================================================
// rush/timing continuation builds
const int e_hdBuildIndex_TMidRushTiming_MMMedivac = 90; // continued agression with mmm
const int e_hdBuildIndex_TMidRushTiming_DefensiveExpand = 91; // transition from early pressure to a macro game
// 2-3 base power attack builds
const int e_hdBuildIndex_TMidPower_MMMedivac = 92; // standard bio attack
const int e_hdBuildIndex_TMidPower_MMSiege = 93; // bio+siege
const int e_hdBuildIndex_TMidPower_SiegeBanshee = 94; // delayed 1,1,1
const int e_hdBuildIndex_TMidPower_HellionSiege = 95; // low-tech mech
const int e_hdBuildIndex_TMidPower_SiegeThor = 96; // high-tech mech
// 3 base macro oriented builds
const int e_hdBuildIndex_TMidMacro_Bio = 97; // macro toward late game bio
const int e_hdBuildIndex_TMidMacro_Mech = 98; // macro toward late game mech
const int e_hdBuildIndex_TMidMacro_ThorBC = 99; // macro toward late game thor/bc
// air/island builds
const int e_hdBuildIndex_TMidAir_OneBaseAir = 100; // continue single base "island" air build
const int e_hdBuildIndex_TMidAir_OneBaseDrop = 101; // continue single base "island" drop build
const int e_hdBuildIndex_TMidAir_ExpansionVikingBanshee = 102; // quick expand viking/banshee attack
const int e_hdBuildIndex_TMidAir_ExpansionBC = 103; // quick expand battlecruiser attack
const int e_hdBuildIndex_TMidAir_ExpansionDropAir = 104; // quick expand drop + air attack
const int e_hdBuildIndex_TMidAir_Macro = 105; // macro toward a large late game air force
//==================================================================================================
// Terran LateGame
//==================================================================================================
// core builds
const int e_hdBuildIndex_TLateCore_MMMediViking = 110; // Bio with vikings against Broodlord/Colossi
const int e_hdBuildIndex_TLateCore_MMMediSiege = 111; // Bio with siegetanks against Baneling/Terran
const int e_hdBuildIndex_TLateCore_MMMediHarass = 112; // Bio with minor harrass from ghosts(nuke) & cloak banshee
const int e_hdBuildIndex_TLateCore_MMMediBC = 113; // Bio with high tech air
// high tech builds
const int e_hdBuildIndex_TLateHighTech_HellionSeige = 114; // Lower tech mech
const int e_hdBuildIndex_TLateHighTech_SiegeThor = 115; // Higher tech mech
const int e_hdBuildIndex_TLateHighTech_MechBC = 116; // Mech with a few battlecruisers
// air builds
const int e_hdBuildIndex_TLateAir_VikingBC = 117; // Focusses on vikings and battlecruisers
const int e_hdBuildIndex_TLateAir_MixedAir = 118; // Uses a mix of all the air units
// special/caster builds
const int e_hdBuildIndex_TLateSpecial_MMMediHarass = 119; // Bio with lots of harrass from ghosts(nuke) & cloak banshee
const int e_hdBuildIndex_TLateSpecial_MMMediGhostRaven = 120; // Bio with emp & pdd
const int e_hdBuildIndex_TLateSpecial_MechBansheeRaven = 121; // Mech with banshee harass and raven backup
//==================================================================================================
// ChooseHDTerranBuildFromSpecificBuild
//==================================================================================================
int ChooseHDTerranBuildFromSpecificBuild (int player, int specific, int mainState) {
int randomRoll = RandomInt(1, 100);
if (mainState == e_mainState_Open) {
if (specific == e_buildType_t1b_MMStim) {
return e_hdBuildIndex_TOpenTiming_MMStim;
} else if (specific == e_buildType_t1b_HellionMara) {
return e_hdBuildIndex_TOpenTiming_HellionMarauder;
} else if (specific == e_buildType_t1b_MariSiege) {
return e_hdBuildIndex_TOpenTiming_MariSiege;
} else if (specific == e_buildType_t1b_CloakBanshee) {
return e_hdBuildIndex_TOpenTiming_CloakBanshee;
} else if (specific == e_buildType_t2b_MMMedivac) {
if (randomRoll < 10) { return e_hdBuildIndex_TOpenPowerMacro_QuickExpGnd; } // 10%
else if (randomRoll < 25) { return e_hdBuildIndex_TOpenPowerMacro_DefenseExpGnd; } // 15%
else { return e_hdBuildIndex_TOpenPowerMacro_MarineExpGnd; } // 75%
} else if (specific == e_buildType_t2b_MMSiege) {
if (randomRoll < 10) { return e_hdBuildIndex_TOpenPowerMacro_QuickExpGnd; } // 10%
else if (randomRoll < 25) { return e_hdBuildIndex_TOpenPowerMacro_DefenseExpGnd; } // 15%
else { return e_hdBuildIndex_TOpenPowerMacro_MarineExpGnd; } // 75%
} else if (specific == e_buildType_t2b_SiegeBanshee) { // do a riskier expand to tech quicker
if (randomRoll < 30) { return e_hdBuildIndex_TOpenPowerMacro_QuickExpGnd; } // 30%
else if (randomRoll < 60) { return e_hdBuildIndex_TOpenPowerMacro_DefenseExpGnd; } // 30%
else { return e_hdBuildIndex_TOpenPowerMacro_MarineExpGnd; } // 40%
} else if (specific == e_buildType_t2b_HellionSiege) {
if (randomRoll < 10) { return e_hdBuildIndex_TOpenPowerMacro_QuickExpGnd; } // 10%
else if (randomRoll < 25) { return e_hdBuildIndex_TOpenPowerMacro_DefenseExpGnd; } // 15%
else { return e_hdBuildIndex_TOpenPowerMacro_MarineExpGnd; } // 75%
} else if (specific == e_buildType_t2b_SiegeThor) { // do a riskier expand to tech quicker
if (randomRoll < 20) { return e_hdBuildIndex_TOpenPowerMacro_QuickExpGnd; } // 20%
else if (randomRoll < 30) { return e_hdBuildIndex_TOpenPowerMacro_DefenseExpGnd; } // 10%
else { return e_hdBuildIndex_TOpenPowerMacro_MarineExpGnd; } // 70%
} else if (specific == e_buildType_tm_MacroMMM) {
if (randomRoll < 10) { return e_hdBuildIndex_TOpenPowerMacro_QuickExpGnd; } // 10%
else if (randomRoll < 25) { return e_hdBuildIndex_TOpenPowerMacro_DefenseExpGnd; } // 15%
else { return e_hdBuildIndex_TOpenPowerMacro_MarineExpGnd; } // 75%
} else if (specific == e_buildType_tm_MacroMech) {
if (randomRoll < 10) { return e_hdBuildIndex_TOpenPowerMacro_QuickExpGnd; } // 10%
else if (randomRoll < 25) { return e_hdBuildIndex_TOpenPowerMacro_DefenseExpGnd; } // 15%
else { return e_hdBuildIndex_TOpenPowerMacro_MarineExpGnd; } // 75%
} else if (specific == e_buildType_tm_MacroThorBC) {
if (randomRoll < 10) { return e_hdBuildIndex_TOpenPowerMacro_QuickExpGnd; } // 10%
else if (randomRoll < 25) { return e_hdBuildIndex_TOpenPowerMacro_DefenseExpGnd; } // 15%
else { return e_hdBuildIndex_TOpenPowerMacro_MarineExpGnd; } // 75%
}
}
else if (mainState == e_mainState_Mid) {
if (specific == e_buildType_t1b_MMStim) {
if (randomRoll < 25) { return e_hdBuildIndex_TMidRushTiming_MMMedivac; } // 25%
else { return e_hdBuildIndex_TMidRushTiming_DefensiveExpand; } // 75%
} else if (specific == e_buildType_t1b_HellionMara) {
if (randomRoll < 25) { return e_hdBuildIndex_TMidRushTiming_MMMedivac; } // 25%
else { return e_hdBuildIndex_TMidRushTiming_DefensiveExpand; } // 75%
} else if (specific == e_buildType_t1b_MariSiege) {
if (randomRoll < 25) { return e_hdBuildIndex_TMidRushTiming_MMMedivac; } // 25%
else { return e_hdBuildIndex_TMidRushTiming_DefensiveExpand; } // 75%
} else if (specific == e_buildType_t1b_CloakBanshee) {
return e_hdBuildIndex_TMidRushTiming_DefensiveExpand;
} else if (specific == e_buildType_t2b_MMMedivac) {
return e_hdBuildIndex_TMidPower_MMMedivac;
} else if (specific == e_buildType_t2b_MMSiege) {
return e_hdBuildIndex_TMidPower_MMSiege;
} else if (specific == e_buildType_t2b_SiegeBanshee) {
return e_hdBuildIndex_TMidPower_SiegeBanshee;
} else if (specific == e_buildType_t2b_HellionSiege) {
return e_hdBuildIndex_TMidPower_HellionSiege;
} else if (specific == e_buildType_t2b_SiegeThor) {
return e_hdBuildIndex_TMidPower_SiegeThor;
} else if (specific == e_buildType_tm_MacroMMM) {
return e_hdBuildIndex_TMidMacro_Bio;
} else if (specific == e_buildType_tm_MacroMech) {
return e_hdBuildIndex_TMidMacro_Mech;
} else if (specific == e_buildType_tm_MacroThorBC) {
return e_hdBuildIndex_TMidMacro_ThorBC;
}
}
else if (mainState == e_mainState_Late) {
// only the macro builds are still applicable late game
if (specific == e_buildType_tm_MacroMMM) {
if (randomRoll < 40) { return e_hdBuildIndex_TLateCore_MMMediViking; } // 40%
else if (randomRoll < 90) { return e_hdBuildIndex_TLateCore_MMMediSiege; } // 50%
else if (randomRoll < 95) { return e_hdBuildIndex_TLateCore_MMMediHarass; } // 5%
else { return e_hdBuildIndex_TLateCore_MMMediBC; } // 5%
} else if (specific == e_buildType_tm_MacroMech) {
if (randomRoll < 40) { return e_hdBuildIndex_TLateHighTech_HellionSeige; } // 40%
else if (randomRoll < 90) { return e_hdBuildIndex_TLateHighTech_SiegeThor; } // 50%
else { return e_hdBuildIndex_TLateHighTech_MechBC; } // 10%
} else if (specific == e_buildType_tm_MacroThorBC) {
if (randomRoll < 80) { return e_hdBuildIndex_TLateAir_VikingBC; } // 80%
else { return e_hdBuildIndex_TLateAir_MixedAir; } // 20%
}
}
// not forced into a specific build at this stage
return e_buildType_Invalid;
}
//==================================================================================================
// OpenChooseHDTerranBuildFromType
//==================================================================================================
int OpenChooseHDTerranBuildFromType (int player, int openingType) {
AINewChooseSubState(player, e_openRollState, 1, 1000, e_hdBuildIndex_TOpenPowerMacro_MarineExpGnd);
if (openingType == e_buildType_Rush) {
AISetSubStateChance( e_hdBuildIndex_TOpenRush_Marine, 80 ); // 80
AISetSubStateChance( e_hdBuildIndex_TOpenRush_MarineReaper, 20 ); // 100
//AISetSubStateChance( e_hdBuildIndex_TOpenRush_Marine, 50 ); // 50
//AISetSubStateChance( e_hdBuildIndex_TOpenRush_MarineReaper, 10 ); // 60
//AISetSubStateChance( e_hdBuildIndex_TOpenRush_ProxyBarracks, 40 ); // 100
} else if (openingType == e_buildType_Timing) {
// random protoss terran zerg
AISetSubStateChanceRace( e_hdBuildIndex_TOpenTiming_MMStim, 50, 45, 40, 35 ); // 50, 45, 40, 35
AISetSubStateChanceRace( e_hdBuildIndex_TOpenTiming_HellionMarauder, 15, 10, 10, 35 ); // 65, 55, 50, 70
AISetSubStateChanceRace( e_hdBuildIndex_TOpenTiming_MariSiege, 20, 30, 35, 15 ); // 85, 85, 85, 85
AISetSubStateChanceRace( e_hdBuildIndex_TOpenTiming_CloakBanshee, 15, 15, 15, 15 ); // 100, 100, 100, 100
} else if (openingType == e_buildType_Macro) {
// on average play a bit safer and head toward late game
// random protoss terran zerg
AISetSubStateChanceRace( e_hdBuildIndex_TOpenPowerMacro_QuickExpGnd, 15, 10, 20, 10 ); // 15, 10, 20, 10
AISetSubStateChanceRace( e_hdBuildIndex_TOpenPowerMacro_MarineExpGnd, 65, 70, 60, 70 ); // 80, 80, 80, 80
AISetSubStateChanceRace( e_hdBuildIndex_TOpenPowerMacro_DefenseExpGnd, 20, 20, 20, 20 ); // 100, 100, 100, 100
} else if (openingType == e_buildType_Air) {
if (!AIHasNearbyOpenExpansion(player) && !AIIsExpandingOrHasExpanded(player)) {
// can't easily expand, go for a one base attack
AISetSubStateChance( e_hdBuildIndex_TOpenAir_OneBaseAir, 50 ); // 50
AISetSubStateChance( e_hdBuildIndex_TOpenAir_CloakBanshee, 30 ); // 80
AISetSubStateChance( e_hdBuildIndex_TOpenAir_OneBaseDrop, 20 ); // 100
} else {
AISetSubStateChance( e_hdBuildIndex_TOpenAir_OneBaseAir, 10 ); // 10
AISetSubStateChance( e_hdBuildIndex_TOpenAir_CloakBanshee, 10 ); // 20
AISetSubStateChance( e_hdBuildIndex_TOpenAir_OneBaseDrop, 5 ); // 25
AISetSubStateChance( e_hdBuildIndex_TOpenAir_QuickExpandAir, 75 ); // 100
}
} else { ///if (openingType == e_buildType_Power)
// be a bit more aggresive to hit a power timing
// random protoss terran zerg
AISetSubStateChanceRace( e_hdBuildIndex_TOpenPowerMacro_QuickExpGnd, 20, 15, 25, 15 ); // 20, 15, 25, 15
AISetSubStateChanceRace( e_hdBuildIndex_TOpenPowerMacro_MarineExpGnd, 75, 80, 70, 80 ); // 95, 95, 95, 95
AISetSubStateChanceRace( e_hdBuildIndex_TOpenPowerMacro_DefenseExpGnd, 5, 5, 5, 5 ); // 100, 100, 100, 100
}
return AIChooseSubState();
}
//==================================================================================================
// MidChooseHDTerranBuildFromType
//==================================================================================================
int MidChooseHDTerranBuildFromType (int player, int openingType, int prevBuildIdx) {
AINewChooseSubState(player, e_middleRollState, 1, 1000, e_hdBuildIndex_TMidPower_MMMedivac);
if (openingType == e_buildType_Rush) {
AISetSubStateChance( e_hdBuildIndex_TMidRushTiming_MMMedivac, 40 ); // 40
AISetSubStateChance( e_hdBuildIndex_TMidRushTiming_DefensiveExpand, 60 ); // 100
} else if (openingType == e_buildType_Timing) {
if (prevBuildIdx == e_hdBuildIndex_TOpenTiming_CloakBanshee) {
AISetSubStateChance( e_hdBuildIndex_TMidRushTiming_DefensiveExpand, 100 ); // 100
} else {
AISetSubStateChance( e_hdBuildIndex_TMidRushTiming_MMMedivac, 35 ); // 35
AISetSubStateChance( e_hdBuildIndex_TMidRushTiming_DefensiveExpand, 65 ); // 100
}
} else if (openingType == e_buildType_Macro) {
AISetSubStateChance( e_hdBuildIndex_TMidMacro_Bio, 90 ); // 90
AISetSubStateChance( e_hdBuildIndex_TMidMacro_Mech, 90 ); // 90
AISetSubStateChance( e_hdBuildIndex_TMidMacro_ThorBC, 10 ); // 100
} else if (openingType == e_buildType_Air) {
if (prevBuildIdx == e_hdBuildIndex_TOpenAir_OneBaseAir ||
prevBuildIdx == e_hdBuildIndex_TMidAir_OneBaseAir) {
AISetSubStateChance( e_hdBuildIndex_TMidAir_OneBaseAir, 15 ); // 15
AISetSubStateChance( e_hdBuildIndex_TMidAir_ExpansionVikingBanshee, 20 ); // 35
AISetSubStateChance( e_hdBuildIndex_TMidAir_ExpansionBC, 25 ); // 60
AISetSubStateChance( e_hdBuildIndex_TMidAir_Macro, 40 ); // 100
}
else if (prevBuildIdx == e_hdBuildIndex_TOpenAir_OneBaseDrop ||
prevBuildIdx == e_hdBuildIndex_TMidAir_OneBaseDrop) {
AISetSubStateChance( e_hdBuildIndex_TMidAir_OneBaseDrop, 25 ); // 25
AISetSubStateChance( e_hdBuildIndex_TMidAir_ExpansionDropAir, 35 ); // 60
AISetSubStateChance( e_hdBuildIndex_TMidAir_Macro, 40 ); // 100
}
else if (!AIHasNearbyOpenExpansion(player) && !AIIsExpandingOrHasExpanded(player)) {
// can't easily expand, continue to be a bit more aggressive
AISetSubStateChance( e_hdBuildIndex_TMidAir_ExpansionVikingBanshee, 30 ); // 30
AISetSubStateChance( e_hdBuildIndex_TMidAir_ExpansionBC, 30 ); // 60
AISetSubStateChance( e_hdBuildIndex_TMidAir_ExpansionDropAir, 20 ); // 80
AISetSubStateChance( e_hdBuildIndex_TMidAir_Macro, 20 ); // 100
} else {
AISetSubStateChance( e_hdBuildIndex_TMidAir_ExpansionVikingBanshee, 25 ); // 25
AISetSubStateChance( e_hdBuildIndex_TMidAir_ExpansionBC, 25 ); // 50
AISetSubStateChance( e_hdBuildIndex_TMidAir_ExpansionDropAir, 10 ); // 60
AISetSubStateChance( e_hdBuildIndex_TMidAir_Macro, 40 ); // 100
}
} else { ///if (openingType == e_buildType_Power)
// random protoss terran zerg
AISetSubStateChanceRace( e_hdBuildIndex_TMidPower_MMMedivac, 15, 20, 10, 20 ); // 15, 20, 10, 20
AISetSubStateChanceRace( e_hdBuildIndex_TMidPower_MMSiege, 35, 35, 40, 35 ); // 50, 55, 50, 55
AISetSubStateChanceRace( e_hdBuildIndex_TMidPower_SiegeBanshee, 40, 35, 40, 35 ); // 90, 90, 90, 90
AISetSubStateChanceRace( e_hdBuildIndex_TMidPower_HellionSiege, 5, 5, 5, 5 ); // 95, 95, 95, 95
AISetSubStateChanceRace( e_hdBuildIndex_TMidPower_SiegeThor, 5, 5, 5, 5 ); // 100, 100, 100, 100
}
return AIChooseSubState();
}
//==================================================================================================
// LateChooseHDTerranBuildFromType
//==================================================================================================
int LateChooseHDTerranBuildFromType (int player, int lateGameType, int prevBuildIdx) {
AINewChooseSubState(player, e_lateRollState, 1, 1000, e_hdBuildIndex_TLateCore_MMMediSiege);
if (lateGameType == e_buildType_HighTech) {
// random protoss terran zerg
AISetSubStateChanceRace( e_hdBuildIndex_TLateHighTech_HellionSeige, 30, 20, 25, 50 ); // 30, 20, 25, 50
AISetSubStateChanceRace( e_hdBuildIndex_TLateHighTech_SiegeThor, 65, 75, 70, 45 ); // 95, 95, 95, 95
AISetSubStateChanceRace( e_hdBuildIndex_TLateHighTech_MechBC, 5, 5, 5, 5 ); // 100, 100, 100, 100
} else if (lateGameType == e_buildType_Special) {
AISetSubStateChance( e_hdBuildIndex_TLateSpecial_MMMediHarass, 30 ); // 30
AISetSubStateChance( e_hdBuildIndex_TLateSpecial_MMMediGhostRaven, 35 ); // 65
AISetSubStateChance( e_hdBuildIndex_TLateSpecial_MechBansheeRaven, 35 ); // 100
} else if (lateGameType == e_buildType_Air) {
if (AIEnemyBuildingsOnlyOnOtherIslands(player)) {
AISetSubStateChance( e_hdBuildIndex_TLateAir_VikingBC, 75 ); // 75
AISetSubStateChance( e_hdBuildIndex_TLateAir_MixedAir, 25 ); // 100
} else {
AISetSubStateChance( e_hdBuildIndex_TLateAir_VikingBC, 50 ); // 50
AISetSubStateChance( e_hdBuildIndex_TLateAir_MixedAir, 50 ); // 100
}
} else { //if (lateGameType == e_buildType_Core)
AISetSubStateChance( e_hdBuildIndex_TLateCore_MMMediViking, 40 ); // 40
AISetSubStateChance( e_hdBuildIndex_TLateCore_MMMediSiege, 50 ); // 90
AISetSubStateChance( e_hdBuildIndex_TLateCore_MMMediHarass, 5 ); // 95
AISetSubStateChance( e_hdBuildIndex_TLateCore_MMMediBC, 5 ); // 100
}
// e_buildType_Mixed should be unused, but will map to a Core build if used
return AIChooseSubState();
}
//==================================================================================================
// OpenChooseHDTerranCounterBuild
//==================================================================================================
int OpenChooseHDTerranCounterBuild (int player, bool onlyMustSwitch) {
// counter logic is primarily aimed at 1v1 games and does not consider allies under attack etc
int currentOpening = AIGetUserInt(player, c_openingBuildType);
int currentExactBuild = AIGetUserInt(player, c_currentBuildIndex);
int lobbyBuild = PlayerAIBuildNumber(player);
// don't use counter logic if we were told to do a specific opening
if (PlayerBeaconBuildMenuWasFromPlayer(player, c_buildMenuOpening)) {
return e_buildType_Invalid;
}
if (AIGetUserInt(player, c_specificLobbyBuild) != e_buildType_Invalid) {
return e_buildType_Invalid;
}
if (lobbyBuild >= e_buildType_Rush && lobbyBuild <= e_buildType_Air) {
return e_buildType_Invalid;
}
if (currentOpening == e_buildType_Rush) {
if (AIHighDontRush(player)) {
// we were planning to rush, but enemy is well prepared, switch to a timing attack
AISetUserInt(player, c_openingBuildType, e_buildType_Timing);
AISetOpeningBuildMenuFromScriptType(player);
// choose a timing build based on our current tech
if (AITechCount(player, c_TB_FactoryTechLab, c_techCountInProgressOrBetter) > 0) {
return e_hdBuildIndex_TOpenTiming_MariSiege;
}
if (AITechCount(player, c_TB_Factory, c_techCountInProgressOrBetter) > 0) {
return e_hdBuildIndex_TOpenTiming_HellionMarauder;
}
return e_hdBuildIndex_TOpenTiming_MMStim;
}
}
else if (currentOpening == e_buildType_Timing) {
if (AIHighCurrentlyUnderHeavyAttack(player)) {
if (currentExactBuild == e_hdBuildIndex_TOpenTiming_CloakBanshee) {
if (AITechCount(player, c_TB_StarportTechLab, c_techCountInProgressOrBetter) > 0) {
// we already have a starport tech lab in progress, try to get banshees
return e_buildType_Invalid;
}
}
if (currentExactBuild != e_hdBuildIndex_TOpenTiming_MMStim) {
if (AITechCount(player, c_TB_Factory, c_techCountInProgressOrBetter) <= 0) {
// unless we're close to having a factory, just switch to bio to hold
return e_hdBuildIndex_TOpenTiming_MMStim;
}
if (currentExactBuild == e_hdBuildIndex_TOpenTiming_MariSiege) {
if (AITechCount(player, c_TB_FactoryTechLab, c_techCountInProgressOrBetter) > 0) {
// we have a factory, but not a techlab, try hellion marauder, instead of siegetanks
return e_hdBuildIndex_TOpenTiming_HellionMarauder;
}
}
}
}
}
else if (currentOpening == e_buildType_Power) {
if (AIIsExpandingOrHasExpanded(player)) {
// if we've already expanded, just stick with a power build, but use the defensive one
if (AIGetUserInt(player, c_currentBuildIndex) != e_hdBuildIndex_TOpenPowerMacro_DefenseExpGnd) {
return e_hdBuildIndex_TOpenPowerMacro_DefenseExpGnd;
}
// already using e_hdBuildIndex_TOpenPowerMacro_DefenseExpGnd
return e_buildType_Invalid;
}
if (AIHighOpponentLikelyRushing(player) || AIHighCurrentlyUnderHeavyAttack(player)) {
// switch to a timing build (since that is more oriented toward immediate army)
AISetUserInt(player, c_openingBuildType, e_buildType_Timing);
AISetOpeningBuildMenuFromScriptType(player);
// choose a timing build based on our current tech
if (AITechCount(player, c_TB_FactoryTechLab, c_techCountInProgressOrBetter) > 0) {
return e_hdBuildIndex_TOpenTiming_MariSiege;
}
if (AITechCount(player, c_TB_Factory, c_techCountInProgressOrBetter) > 0) {
return e_hdBuildIndex_TOpenTiming_HellionMarauder;
}
return e_hdBuildIndex_TOpenTiming_MMStim;
}
}
else if (currentOpening == e_buildType_Macro) {
if (!AIHighOpponentLikelyRushing(player) &&
!AIHighCurrentlyUnderHeavyAttack(player) &&
!AIHighEnemyArmyLarger(player)) {
// not aware that we should switch, so stay with the macro build
return e_buildType_Invalid;
}
if (AIIsExpandingOrHasExpanded(player)) {
// if we've already expanded, switch to defensive power build instead of macro
AISetUserInt(player, c_openingBuildType, e_buildType_Power);
AISetOpeningBuildMenuFromScriptType(player);
return e_hdBuildIndex_TOpenPowerMacro_DefenseExpGnd;
}
else {
// haven't already expanded, switch to a timing build
// (since that is more oriented toward immediate army)
AISetUserInt(player, c_openingBuildType, e_buildType_Timing);
AISetOpeningBuildMenuFromScriptType(player);
// choose a timing build based on our current tech
if (AITechCount(player, c_TB_FactoryTechLab, c_techCountInProgressOrBetter) > 0) {
return e_hdBuildIndex_TOpenTiming_MariSiege;
}
if (AITechCount(player, c_TB_Factory, c_techCountInProgressOrBetter) > 0) {
return e_hdBuildIndex_TOpenTiming_HellionMarauder;
}
return e_hdBuildIndex_TOpenTiming_MMStim;
}
}
return e_buildType_Invalid;
}
//==================================================================================================
// MidHDTerranCounterPowerBuild
//==================================================================================================
int MidHDTerranCounterPowerBuild (int player, int currentExactBuild) {
if (currentExactBuild == e_hdBuildIndex_TMidPower_SiegeThor) {
if (AITechCount(player, c_TB_FactoryTechLab, c_techCountInProgressOrBetter) >= 2) {
// allowed to keep this build
return e_buildType_Invalid;
}
if (AITechCount(player, c_TB_Factory, c_techCountInProgressOrBetter) >= 2) {
// switch to just hellion siege
return e_hdBuildIndex_TMidPower_HellionSiege;
}
}
else if (currentExactBuild == e_hdBuildIndex_TMidPower_SiegeBanshee) {
if (AITechCount(player, c_TB_StarportTechLab, c_techCountInProgressOrBetter) >= 1) {
// allowed to keep this build
return e_buildType_Invalid;
}
if (AITechCount(player, c_TB_Factory, c_techCountInProgressOrBetter) >= 2) {
// switch to just hellion siege
return e_hdBuildIndex_TMidPower_HellionSiege;
}
}
else if (currentExactBuild == e_hdBuildIndex_TMidPower_HellionSiege) {
if (AITechCount(player, c_TB_Factory, c_techCountInProgressOrBetter) >= 2) {
// allowed to keep this build
return e_buildType_Invalid;
}
}
else if (currentExactBuild == e_hdBuildIndex_TMidPower_MMSiege || currentExactBuild == e_hdBuildIndex_TMidPower_MMMedivac) {
// allowed to keep this build
return e_buildType_Invalid;
}
// choose a bio based build
if (RandomInt(1, 100) > 45) {
return e_hdBuildIndex_TMidPower_MMSiege; // 55%
}
return e_hdBuildIndex_TMidPower_MMMedivac; // 45%
}
//==================================================================================================
// MidChooseHDTerranCounterBuild
//==================================================================================================
int MidChooseHDTerranCounterBuild (int player, bool onlyMustSwitch) {
// counter logic is primarily aimed at 1v1 games and does not consider allies under attack etc
int currentOpening = AIGetUserInt(player, c_openingBuildType);
int currentExactBuild = AIGetUserInt(player, c_currentBuildIndex);
int lobbyBuild = PlayerAIBuildNumber(player);
// don't use counter logic if we were told to do a specific opening
if (PlayerBeaconBuildMenuWasFromPlayer(player, c_buildMenuOpening)) {
return e_buildType_Invalid;
}
if (AIGetUserInt(player, c_specificLobbyBuild) != e_buildType_Invalid) {
return e_buildType_Invalid;
}
if (lobbyBuild >= e_buildType_Rush && lobbyBuild <= e_buildType_Air) {
return e_buildType_Invalid;
}
if (currentOpening == e_buildType_Rush || currentOpening == e_buildType_Timing) {
if (!AIIsExpandingOrHasExpanded(player)) {
if (AIHighCurrentlyUnderHeavyAttack(player) || AIHighEnemyArmyLarger(player)) {
if (currentExactBuild == e_hdBuildIndex_TMidRushTiming_DefensiveExpand) {
// don't expand if we're under attack or behind on army
return e_hdBuildIndex_TMidRushTiming_MMMedivac;
}
}
}
}
else if (currentOpening == e_buildType_Power) {
if (!AIIsExpandingOrHasExpanded(player)) {
if (AIHighOpponentLikelyRushing(player) || AIHighCurrentlyUnderHeavyAttack(player)) {
// don't expand if we're under attack or behind on army, instead switch to an army heavy timing build
AISetUserInt(player, c_openingBuildType, e_buildType_Timing);
AISetOpeningBuildMenuFromScriptType(player);
return e_hdBuildIndex_TMidRushTiming_MMMedivac;
}
}
else {
// we've already expanded, just stick with a power build, but use the one that best fits our tech
return MidHDTerranCounterPowerBuild(player, currentExactBuild);
}
}
else if (currentOpening == e_buildType_Macro) {
if (!AIHighOpponentLikelyRushing(player) &&
!AIHighCurrentlyUnderHeavyAttack(player) &&
!AIHighEnemyArmyLarger(player)) {
// not aware that we should switch, so stay with the macro build
return e_buildType_Invalid;
}
if (AIIsExpandingOrHasExpanded(player)) {
// if we've already expanded, switch to defensive power build instead of macro
AISetUserInt(player, c_openingBuildType, e_buildType_Power);
AISetOpeningBuildMenuFromScriptType(player);
return MidHDTerranCounterPowerBuild(player, currentExactBuild);
}
else {
// haven't already expanded, switch to an army heavy timing build
AISetUserInt(player, c_openingBuildType, e_buildType_Timing);
AISetOpeningBuildMenuFromScriptType(player);
return e_hdBuildIndex_TMidRushTiming_MMMedivac;
}
}
return e_buildType_Invalid;
}
//==================================================================================================
// LateChooseHDTerranCounterBuild
//==================================================================================================
int LateChooseHDTerranCounterBuild (int player, bool onlyMustSwitch) {
// counter logic is primarily aimed at 1v1 games and does not consider allies under attack etc
int currentLateGame = AIGetUserInt(player, c_lateGameBuildType);
int currentBuildIndex = AIGetUserInt(player, c_currentBuildIndex);
int newLateGame = e_buildType_Core;
bool needsNewBuild = false;
// don't use counter logic if we were told to do a specific opening
if (PlayerBeaconBuildMenuWasFromPlayer(player, c_buildMenuLateGame)) {
return e_buildType_Invalid;
}
// for variety not much counter logic, only need to worry about using an advanced build when under attack
if (!AIHighLateGameUnderHeavyAttack(player)) {
return e_buildType_Invalid;
}
// we're under heavy attack, don't use caster builds or builds we don't have tech for
// note this logic can't conflict with UpdateHDTerranLateGameArmy or it will switch back and forth
if (currentLateGame == e_buildType_Special || currentLateGame == e_buildType_Mixed) {
needsNewBuild = true;
}
else if (currentLateGame == e_buildType_Air) {
if (!AIEnemyBuildingsOnlyOnOtherIslands(player)) {
if (AITechCount(player, c_TB_Starport, c_techCountCompleteOnly) < 2) {
needsNewBuild = true;
}
}
}
else if (currentLateGame == e_buildType_HighTech) {
if (AITechCount(player, c_TB_Factory, c_techCountCompleteOnly) < 2) {
needsNewBuild = true;
}
}
if (!needsNewBuild) {
return e_buildType_Invalid;
}
// pick a new build
newLateGame = AIRandomlyChooseLateGameBuild(player);
if (newLateGame == currentLateGame) {
// this shouldn't happen, but just in case
return e_buildType_Invalid;
}
AISetUserInt(player, c_lateGameBuildType, newLateGame);
AISetLateGameBuildMenuFromScriptType(player);
return LateChooseHDTerranBuildFromType(player, newLateGame, currentBuildIndex);
}
//==================================================================================================
// PickHDTerranOpening
//==================================================================================================
int PickHDTerranOpening(int player) {
int race = AIGetEnemyRaceVal(player);
int currentBuildIndex;
int openingType;
int specificBuild;
if (AIState(player, e_mainState) != e_mainState_Open) {
AISetUserInt(player, c_currentBuildIndex, e_buildType_Invalid);
}
// read opening data from lobby / build options menu
AIChooseNextOpeningBuild(player);
// if a specific build was choosen use that
specificBuild = AIGetUserInt(player, c_specificLobbyBuild);
if (specificBuild != e_buildType_Invalid) {
currentBuildIndex = ChooseHDTerranBuildFromSpecificBuild(player, specificBuild, e_mainState_Open);
if (currentBuildIndex != e_buildType_Invalid) {
return currentBuildIndex;
}
}
// should we do a specific counter build?
currentBuildIndex = OpenChooseHDTerranCounterBuild(player, false);
if (currentBuildIndex != e_buildType_Invalid) {
return currentBuildIndex;
}
// if our previous current build is still valid then keep that
currentBuildIndex = AIGetUserInt(player, c_currentBuildIndex);
if (currentBuildIndex != e_buildType_Invalid) {
return currentBuildIndex;
}
// otherwise pick an opening within the openingBuildType constraint
openingType = AIGetUserInt(player, c_openingBuildType);
currentBuildIndex = OpenChooseHDTerranBuildFromType(player, openingType);
return currentBuildIndex;
}
//==================================================================================================
// UpdateHDTerranOpening
//==================================================================================================
void UpdateHDTerranOpening (int player) {
int mainSubState = AIState(player, e_mainSubState);
int buildIndex = AIGetUserInt(player, c_currentBuildIndex);
int counterBuild;
if ( mainSubState != e_mainSubState_Build ||
buildIndex == e_hdBuildIndex_Invalid ||
AIHasPlayerChangedCurrentOpening(player) ) {
// we should pick a new opening build
AISetMainState(player, e_mainState_Open, e_mainSubState_Init);
buildIndex = PickHDTerranOpening(player);
AISetUserInt(player, c_currentBuildIndex, buildIndex);
AISetMainState(player, e_mainState_Open, e_mainSubState_Build);
} else {
counterBuild = OpenChooseHDTerranCounterBuild(player, true);
if (counterBuild != e_buildType_Invalid) {
AISetUserInt(player, c_currentBuildIndex, counterBuild);
}
}
}
//==================================================================================================
// PickHDTerranMidGame
//==================================================================================================
int PickHDTerranMidGame(int player) {
int prevBuildIndex = AIGetUserInt(player, c_currentBuildIndex);
int race = AIGetEnemyRaceVal(player);
int currentBuildIndex;
int openingType;
int specificBuild;
if (AIState(player, e_mainState) != e_mainState_Mid) {
AISetUserInt(player, c_currentBuildIndex, e_buildType_Invalid);
}
// read opening data from lobby / build options menu
AIChooseNextOpeningBuild(player);
// if a specific build was choosen use that
specificBuild = AIGetUserInt(player, c_specificLobbyBuild);
if (specificBuild != e_buildType_Invalid) {
currentBuildIndex = ChooseHDTerranBuildFromSpecificBuild(player, specificBuild, e_mainState_Mid);
if (currentBuildIndex != e_buildType_Invalid) {
return currentBuildIndex;
}
}
// should we do a specific counter build?
currentBuildIndex = MidChooseHDTerranCounterBuild(player, false);
if (currentBuildIndex != e_buildType_Invalid) {
return currentBuildIndex;
}
// if our previous current build is still valid then keep that
currentBuildIndex = AIGetUserInt(player, c_currentBuildIndex);
if (currentBuildIndex != e_buildType_Invalid) {
return currentBuildIndex;
}
// otherwise pick an midgame within the openingBuildType constraint
openingType = AIGetUserInt(player, c_openingBuildType);
currentBuildIndex = MidChooseHDTerranBuildFromType(player, openingType, prevBuildIndex);
return currentBuildIndex;
}
//==================================================================================================
// UpdateHDTerranMidGame
//==================================================================================================
void UpdateHDTerranMidGame (int player) {
int mainSubState = AIState(player, e_mainSubState);
int buildIndex = AIGetUserInt(player, c_currentBuildIndex);
int counterBuild;
if ( mainSubState != e_mainSubState_Build ||
buildIndex == e_hdBuildIndex_Invalid ||
AIHasPlayerChangedCurrentOpening(player) ) {
// we should pick a new midGame build
AISetMainState(player, e_mainState_Mid, e_mainSubState_Init);
buildIndex = PickHDTerranMidGame(player);
AISetUserInt(player, c_currentBuildIndex, buildIndex);
AISetMainState(player, e_mainState_Mid, e_mainSubState_Build);
} else {
counterBuild = MidChooseHDTerranCounterBuild(player, true);
if (counterBuild != e_buildType_Invalid) {
AISetUserInt(player, c_currentBuildIndex, counterBuild);
}
}
}
//==================================================================================================
// PickHDTerranLateGame
//==================================================================================================
int PickHDTerranLateGame(int player) {
int prevBuildIndex = AIGetUserInt(player, c_currentBuildIndex);
int race = AIGetEnemyRaceVal(player);
int currentBuildIndex;
int lateGameType;
int specificBuild;
if (AIState(player, e_mainState) != e_mainState_Late) {
AISetUserInt(player, c_currentBuildIndex, e_buildType_Invalid);
}
// read late game data from lobby / build options menu
AIChooseNextLateGameBuild(player);
// if a specific build was choosen use that
specificBuild = AIGetUserInt(player, c_specificLobbyBuild);
if (specificBuild != e_buildType_Invalid) {
currentBuildIndex = ChooseHDTerranBuildFromSpecificBuild(player, specificBuild, e_mainState_Late);
if (currentBuildIndex != e_buildType_Invalid) {
return currentBuildIndex;
}
}
// should we do a specific counter build?
currentBuildIndex = LateChooseHDTerranCounterBuild(player, false);
if (currentBuildIndex != e_buildType_Invalid) {
return currentBuildIndex;
}
// if our previous current build is still valid then keep that
currentBuildIndex = AIGetUserInt(player, c_currentBuildIndex);
if (currentBuildIndex != e_buildType_Invalid) {
return currentBuildIndex;
}
// otherwise pick an opening within the lateGameBuildType constraint
lateGameType = AIGetUserInt(player, c_lateGameBuildType);
currentBuildIndex = LateChooseHDTerranBuildFromType(player, lateGameType, prevBuildIndex);
return currentBuildIndex;
}
//==================================================================================================
// UpdateHDTerranLateGameArmy
//==================================================================================================
void UpdateHDTerranLateGameArmy (int player) {
int mainSubState = AIState(player, e_mainSubState);
int buildIndex = AIGetUserInt(player, c_currentBuildIndex);
int lateGameType = AIGetUserInt(player, c_lateGameBuildType);
int newArmyTime = AIGetUserInt(player, c_nextArmyTime);
bool pickNewArmy = false;
int counterBuild;
// should we choose a very specific counter build given the current game situation
counterBuild = LateChooseHDTerranCounterBuild(player, true);
if (counterBuild != e_buildType_Invalid) {
AIHighSetLateGameArmy(player, counterBuild);
return;
}
if (mainSubState != e_mainSubState_Build || buildIndex == e_hdBuildIndex_Invalid) {
// if we haven't picked a lategame build, we should do so now
pickNewArmy = true;
}
else if (AIHasPlayerChangedCurrentLateGame(player)) {
// or the player has ordered us to change, pick a new build now
pickNewArmy = true;
}
else if (newArmyTime < FixedToInt(AIGetTime()) && !AIHighCurrentlyUnderHeavyAttack(player)) {
// been using the previous army a while and not currently under attack, switch to a new one
pickNewArmy = true;
}
else if (AIEnemyBuildingsOnlyOnOtherIslands(player) && (lateGameType != e_buildType_Air)) {
// if the enemy is hiding on an island and we're not using an air build, switch to air
pickNewArmy = true;
}
if (pickNewArmy) {
AISetMainState(player, e_mainState_Late, e_mainSubState_Init);
buildIndex = PickHDTerranLateGame(player);
AIHighSetLateGameArmy(player, buildIndex);
}
}
//--------------------------------------------------------------------------------------------------
// TerranHDInitMid
//--------------------------------------------------------------------------------------------------
void TerranHDInitMid (int player) {
// pick a midGame build using the generic logic
int buildIndex = PickHDTerranMidGame(player);
AISetFlag(player, e_flagsLateScout, true);
AISetUserInt(player, c_currentBuildIndex, buildIndex);
AISetMainState(player, e_mainState_Mid, e_mainSubState_Build);
}
//==================================================================================================
// Terran Shared Late Game
//==================================================================================================
//--------------------------------------------------------------------------------------------------
// TerranHDInitLate
//--------------------------------------------------------------------------------------------------
void TerranHDInitLate (int player) {
int delay;
// turn on attacking if it's not already on, but delay the next attack 5-7 minutes
if (AIState(player, e_attackState) == e_attackState_Wait) {
AIWaveMerge(player, c_waveMain, c_waveAttack);
AISetAttackState(player, e_attackState_Idle);
delay = FixedToInt(AIGetTime()) + RandomInt(300, 420);
AISetUserInt(player, c_delayNextAttack, delay);
}
// set initial late game flags
AISetFlag(player, e_flagsTimeout, true);
AISetFlag(player, e_flagsDetect, true);
AISetFlag(player, e_flagsLateScout, true);
AISetFlag(player, e_flagsClearObs, true);
AISetFlag(player, e_flagsDiversion, true);
AISetFlag(player, e_flagsEarlyDefScout, false);
AISetDifficulty(player, c_diffEarlyGameRepair, false);
AIEarlyDefenseEnable(player, false, false);
// we'll pick a late game build in the regular late game logic
AISetUserInt(player, c_currentBuildIndex, e_hdBuildIndex_Invalid);
AISetMainState(player, e_mainState_Late, e_mainSubState_Build);
}
//--------------------------------------------------------------------------------------------------
// TerranHDRecoveryStart
//--------------------------------------------------------------------------------------------------
void TerranHDRecoveryStart (int player) {
AISetStock( player, 1, c_TB_CommandCenter_Alias );
AISetStock( player, 1, c_TU_SCV );
AISetStockFarms( player, c_TB_SupplyDepot, c_stockNeededFarms);
AISetStock( player, 10, c_TU_SCV );
}
//--------------------------------------------------------------------------------------------------
// TerranHDVitalUpgrades
//--------------------------------------------------------------------------------------------------
void TerranHDVitalUpgrades (int player) {
if (AIHighCurrentlyUnderHeavyAttack(player)) {
return;
}
if (AITechCount(player, c_TU_Banshee, c_techCountCompleteOnly) >= 2) {
AISetStock( player, 1, c_TR_BansheeCloak );
}
if (AITechCount(player, c_TU_Marine, c_techCountInProgressOrBetter) +
AITechCount(player, c_TU_Marauder, c_techCountInProgressOrBetter) +
AITechCount(player, c_TU_Reaper, c_techCountInProgressOrBetter) >= 12)
{
AISetStock( player, 1, c_TR_InfantryWeapons1 );
AISetStock( player, 1, c_TR_InfantryArmor1 );
AISetStockUnitNext( player, 2, c_TB_EngineeringBay, c_stockAlways );
}
if (AITechCount(player, c_TU_SiegeTank_Alias, c_techCountInProgressOrBetter) +
AITechCount(player, c_TU_Hellion, c_techCountInProgressOrBetter) >= 6)
{
AISetStock( player, 1, c_TR_MechWeapons1 );
AISetStock( player, 1, c_TR_MechPlating1 );
AISetStockUnitNext( player, 2, c_TB_Armory, c_stockAlways );
}
}
//--------------------------------------------------------------------------------------------------
// TerranHDGeneralUpgrades
//--------------------------------------------------------------------------------------------------
void TerranHDGeneralUpgrades (int player) {
if (AIHighCurrentlyUnderHeavyAttack(player)) {
return;
}
if (AITechCount(player, c_TU_Marine, c_techCountInProgressOrBetter) >= 12) {
AISetStock( player, 1, c_TR_MarineStimPack );
AISetStock( player, 1, c_TR_MarineShield );
}
if (AITechCount(player, c_TU_Marauder, c_techCountInProgressOrBetter) >= 8) {
AISetStock( player, 1, c_TR_MarineStimPack );
AISetStock( player, 1, c_TR_MarauderSlow );
}
if (AITechCount(player, c_TU_Marine, c_techCountInProgressOrBetter) +
AITechCount(player, c_TU_Marauder, c_techCountInProgressOrBetter) +
AITechCount(player, c_TU_Reaper, c_techCountInProgressOrBetter) >= 12)
{
AINewTechStock(player);
AITechStockAdd(c_TR_InfantryWeapons1);
AITechStockAdd(c_TR_InfantryWeapons2);
AITechStockAdd(c_TR_InfantryWeapons3);
AITechStockAdd(c_TR_InfantryArmor1);
AITechStockAdd(c_TR_InfantryArmor2);
AITechStockAdd(c_TR_InfantryArmor3);
AISetStockTechNextUnCap(player,1000,1000);
AISetStockUnitNext( player, 2, c_TB_EngineeringBay, c_stockAlways );
}
if (AITechCount(player, c_TU_Hellion, c_techCountInProgressOrBetter) >= 6) {
AISetStock( player, 1, c_TR_HellionDamage );
}
if (AITechCount(player, c_TU_SiegeTank_Alias, c_techCountInProgressOrBetter) +
AITechCount(player, c_TU_Hellion, c_techCountInProgressOrBetter) >= 6)
{
AINewTechStock(player);
AITechStockAdd(c_TR_MechWeapons1);
AITechStockAdd(c_TR_MechWeapons2);
AITechStockAdd(c_TR_MechWeapons3);
AITechStockAdd(c_TR_MechPlating1);
AITechStockAdd(c_TR_MechPlating2);
AITechStockAdd(c_TR_MechPlating3);
AISetStockTechNextUnCap(player,1000,1000);
AISetStockUnitNext( player, 2, c_TB_Armory, c_stockAlways );
}
if (AITechCount(player, c_TU_Ghost, c_techCountCompleteOnly) >= 2) {
AISetStock( player, 1, c_TR_GhostCloak );
}
if (AITechCount(player, c_TU_Viking_Alias, c_techCountInProgressOrBetter) +
AITechCount(player, c_TU_Banshee, c_techCountInProgressOrBetter) +
AITechCount(player, c_TU_Battlecruiser, c_techCountInProgressOrBetter) >= 8)
{
AINewTechStock(player);
AITechStockAdd(c_TR_MechWeapons1);
AITechStockAdd(c_TR_MechWeapons2);
AITechStockAdd(c_TR_MechWeapons3);
AITechStockAdd(c_TR_MechPlating1);
AITechStockAdd(c_TR_MechPlating2);
AITechStockAdd(c_TR_MechPlating3);
AISetStockTechNextUnCap(player,1000,1000);
AISetStockUnitNext( player, 2, c_TB_Armory, c_stockAlways );
}
if (AITechCount(player, c_TU_Battlecruiser, c_techCountInProgressOrBetter) >= 3) {
AISetStock( player, 1, c_TR_BattlecruiserYamato );
}
}
//--------------------------------------------------------------------------------------------------
// TerranHDMinorUpgrades
//--------------------------------------------------------------------------------------------------
void TerranHDMinorUpgrades (int player) {
if (AITechCount(player, c_TU_Medivac, c_techCountInProgressOrBetter) >= 4) {
AISetStock( player, 1, c_TR_MedivacEnergy );
}
if (AITechCount(player, c_TU_Battlecruiser, c_techCountInProgressOrBetter) >= 3) {
AISetStock( player, 1, c_TR_BattlecruiserEnergy );
}