-
Notifications
You must be signed in to change notification settings - Fork 34
/
common.eai
13684 lines (12517 loc) · 478 KB
/
common.eai
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
//==================================================================================================
// $Id: common.ai,v 1.68 2003/05/12 02:34:18 bfitch Exp $ (the base blizzard version 1.19 - 1.20c)
//
// AMAI (Advanced Melee AI) common.ai by Strategy Master
//==================================================================================================
#DEFINE $ONE$ 1
#DEFINE $ZERO$ 0
#INCLUDE <Natives.j>
globals
//============================================================================
// Standard Constants and Variables
//============================================================================
constant integer M1 = 60
constant integer M2 = 2*60
constant integer M3 = 3*60
constant integer M4 = 4*60
constant integer M5 = 5*60
constant integer M6 = 6*60
constant integer M7 = 7*60
constant integer M8 = 8*60
constant integer M9 = 9*60
constant integer M10 = 10*60
constant integer M11 = 11*60
constant integer M12 = 12*60
constant integer M13 = 13*60
constant integer M14 = 14*60
constant integer M15 = 15*60
constant integer EASY = 1
constant integer NORMAL = 2
constant integer HARD = 3
constant integer INSANE = 4 // not used
constant integer MELEE_NEWBIE = 1
constant integer MELEE_NORMAL = 2
constant integer MELEE_INSANE = 3
constant integer ATTACK_CAPTAIN = 1
constant integer DEFENSE_CAPTAIN = 2
constant integer BOTH_CAPTAINS = 3
constant integer BUILD_UNIT = 1
constant integer BUILD_UPGRADE = 2
constant integer BUILD_EXPAND = 3
constant integer UPKEEP_TIER1 = 50
constant integer UPKEEP_TIER2 = 80
//--------------------------------------------------------------------
player ai_player
integer sleep_seconds
integer total_gold = 0
integer total_wood = 0
integer gold_buffer = 0 // usually for potion money
integer difficulty = NORMAL
integer exp_seen = 0
integer racial_farm = 'hhou'
integer hero_id = 'Hamg'
integer hero_id2 = 'Hmkg'
integer hero_id3 = 'Hpal'
integer array skill
integer array skills1
integer array skills2
integer array skills3
integer max_hero_level = 0
integer array harass_qty
integer array harass_max
integer array harass_units
integer harass_length = 0
integer array defense_qty
integer array defense_units
integer defense_length = 0
integer array build_qty
integer array build_type
integer array build_item
integer array build_town
integer build_length = 0
integer campaign_gold_peons = 5
integer campaign_wood_peons = 3
integer campaign_basics_speed = 5
integer min_creeps = -1
integer max_creeps = -1
boolean harvest_town1 = true
boolean harvest_town2 = true
boolean harvest_town3 = true
boolean do_campaign_farms = true
boolean two_heroes = false
boolean allow_air_creeps = false
boolean take_exp = false
boolean allow_signal_abort = false
boolean ready_for_zeppelin = true
boolean get_zeppelin = false
boolean build_campaign_attackers = true
boolean do_debug_cheats = false
boolean trace_on = true
boolean zep_next_wave = false
boolean form_group_timeouts = true
// =============================================================
// AMAI constants
// =============================================================
constant integer o0 = 0
string array unitNames
#INCLUDETABLE <$VER$\StandardUnits.txt> #EFR
integer %1 = %row // Cannot be constants for VS AI support
constant integer o%1 = '%2'
#AFTERINCLUDE
constant integer OBJECT_NUM = %row
#ENDINCLUDE
#INCLUDETABLE <$VER$\UnitEquivalence.txt> #EFR #COND "%2" eq "AI_COMP"
integer %3 = %1
integer o%3 = o%1
#ENDINCLUDE
#INCLUDETABLE <$VER$\HeroAbilities.txt> #EFR
constant integer %1 = '%2'
#ENDINCLUDE
constant integer BUILD_ITEM = 4
constant integer BLOC_STD = 1
constant integer BLOC_FRONT = 2
constant integer BLOC_MINE = 3
constant integer NOT_ENOUGH_RES = 1
constant integer CANNOT_BUILD = 2
constant integer BUILT_ALL = 3
constant integer BUILT_SOME = 4
constant integer SR_RANDOM = 0
constant integer SR_ELF = 1
constant integer SR_HUMAN = 2
constant integer SR_ORC = 3
constant integer SR_UNDEAD = 4
constant integer R_RANDOM = 0
#DEFINE $RACENUM$ 0
#INCLUDETABLE <$VER$\Races.txt>
constant integer R_%1 = %row
#DEFINE $RACENUM$ %row
#AFTERINCLUDE
constant integer R_NEUTRAL = #EVAL{%row+1}
constant integer RACE_NUMBER = %row
#ENDINCLUDE
#DEFINE $HEROLEVELNUM$ 0
#INCLUDETABLE <$VER$\HeroLevels.txt>
#DEFINE $HEROLEVELNUM$ %row
#AFTERINCLUDE
constant integer HERO_LEVEL_NUMBER = %row
#ENDINCLUDE
#SEARCHTREE Jobs <Jobs.txt> %1 %2 %3 #EFR
#SEARCHLIST Jobs
constant integer %1 = %row
#ENDSEARCHLIST
constant integer STRATEGY_TYPE_MELEE = 0
constant integer STRATEGY_TYPE_RANGED = 1
constant integer STRATEGY_TYPE_AIR = 2
constant integer STRATEGY_TYPE_CASTER = 3
constant integer NEUTRAL_TAVERN = 0
constant integer NEUTRAL_OBSERVATORY = 1
constant integer NEUTRAL_MERC_CAMP = 2
constant integer NEUTRAL_DRAGON_ROOST = 3
constant integer NEUTRAL_HEALING_FOUNTAIN = 4
constant integer NEUTRAL_MERCHANT = 5
constant integer NEUTRAL_MANA_FOUNTAIN = 6
constant integer NEUTRAL_SHIPYARD = 7
constant integer NEUTRAL_MARKETPLACE = 8
constant integer NEUTRAL_POWER_FOUNTAIN = 9
constant integer NEUTRAL_HEAL_WARD = 10
constant integer NEUTRAL_COUNT = 11
constant integer UPKEEP_UNDECIDED = 0
constant integer UPKEEP_NOT_ALLOWED = 1
constant integer UPKEEP_ALLOWED = 2
#INCLUDETABLE <$VER$\Upkeep.txt> #EFR
constant integer UPKEEP_%1 = #EVAL{%row-1}
#AFTERINCLUDE
constant integer UPKEEP_NUM = %row
#ENDINCLUDE
constant integer HEALER_TYPE_NO_TARGET = 0
constant integer HEALER_TYPE_SUDDEN = 1
constant integer HEALER_TYPE_CONTINUOUS = 2
constant integer HEALER_TYPE_WARD = 3
constant integer HEALER_TYPE_HERO = 4
constant integer UPGRADED = 9999
constant integer BT_UNIT = 0
constant integer BT_BUILDING = 1
constant integer BT_HERO = 2
constant integer BT_UPGRADE = 3
constant integer BT_ML_UPGRADE = 4
constant integer BT_RACIAL_ITEM = 5
constant integer BT_NEUTRAL_HERO = 6
constant integer BT_MERC = 7
constant integer BT_GOBLIN_MERC = 8
constant integer BT_DRAGON = 9
constant integer BT_MERCHANT_ITEM = 10
constant integer COMPARE_TRUE = 0
constant integer COMPARE_EQ = 1
constant integer COMPARE_UNEQ = 2
constant integer COMPARE_GREATER = 3
constant integer COMPARE_GREATER_EQ = 4
constant integer COMPARE_LESS = 5
constant integer COMPARE_LESS_EQ = 6
constant integer HEALINGITEM_MASS = 0
constant integer HEALINGITEM_SINGLE = 1
constant integer MERCHANTITEM_MASS = 2
constant integer GLOBALHEALING = 3
constant integer HEALINGITEM_HERO = 4
constant integer MANAITEM_HERO = 5
constant integer ITEMTYPE_SUDDEN = 0
constant integer ITEMTYPE_CONTINUOUS = 1
constant integer HERO_SKILL_MAJOR = 0
constant integer HERO_SKILL_MINOR = 1
constant integer HERO_SKILL_RARE = 2
//==============================================================
// (AMAI) Global Settings
//==============================================================
#PRAGMA START VERSION SETTINGS
real sleep_multiplier = 1 // increases performance by checking stuff not so often
integer slm_start = 4 // how many computer players is needed tor the sleep multiplier to start increasing
integer slm_end = 10 // how many computer players is needed tor the sleep multiplier to stop increasing
real slm_start_mult = 1 // how much is the sleep multiplied when it´s below the slm_start codition
real slm_end_mult = 2 // how much is the sleep multiplied when it´s above the slm_end codition
real hero_radius = 200 // scanning this small area around hero to detect if the hero gets surrounded by enemy or is in danger of becoming that so it should move
boolean use_linear_upkeep_saving = false // should the computers save the upkeep threshold gold over the time above or save it all at once when it get's to the upkeep border?
integer repair_threshold = 6 // computers only repair buildings if they have more than this many workers
integer repair_threshold_threatened = 8 // computers only repair buildings when the town is under attack if they got more than this many workers
real max_follow_dist = 1000 // Max Distance behind the army a zeppelin follows
integer neutral_hero_time = 25 // when is neutral heroes available in seconds /5
real buy_timeout_large = 120 // time in seconds the hero goes to a shop before it gives up if it haven't reached it
real buy_timeout_small = 15 // time in seconds a hero tries to buy items at shop before giving up
real buy_distance = 350 // how close to a shop does a unit have to be for buying?
integer build_array_reset_time = 100 // every this * 5 seconds, the build array is reset
integer rp_strat_normal = 250 // normalizing strategy priorities added from strengths with this value
integer strategy_tier_bonus = 35 // the priority bonus added to a strategy if the computer is in the same tier as specified for the strategy
integer attacking_strategy = 4 // strategy when attacking enemy players
real focus_fire_limit = 35 // if a enemy heros hp fall below the computers combined strength of ranged attackers in a battle * this, they will focus fire on the hero
real focus_fire_ranged_dist = 600 // Distance from ranged units enemy units can be targeted with focus fire
real focus_fire_melee_dist = 50 // Distance from melee units enemy units can be targeted with focus fire
real flee_health_percentage = 0.25 // Units flee from battle if the health goes below his % value(0.25 = 25%)
real flee_minimum_health = 100 // Units flee from battle if the health goes below this
real statue_distance = 300 // how near the units a statue used by undead should be in the fights
real teleport_radius = 800 // units will stay within this radius from a hero that is using town portal
integer gold_exchange_level = 650 // computers give extra gold above this value to other computers on the same team in need of gold
integer wood_exchange_level = 350 // computers give extra lumber above this value to other computers on the same team in need of lumber
integer max_towns = 5 // how many towns is a computer allowed to have?
boolean add_tag = true // Add the [AMAI] tag in front of name
boolean add_skill = true // Add the current skill after the name
integer fav_hero_add = 20 // priority added to heroes to be picked if they are favorites of the used profile
integer max_harass_groups = 10 // how many different harass groups you can use
integer attacking_aggression = -12 // the base agression value for all computers, higher value and they will play more agressive. Recomended -5 to 5
real expansion_radius = 650 // the radius araound a mine computers check for creeps before expanding there
real harass_radius_attack_ranged = 800 // how far away from ranged enemy units harassing units attack a inferior enemy unit
real harass_radius_attack_melee = 400 // how far away from melee enemy units harassing units attack a inferior enemy unit
real harass_radius_flee_ranged = 1200 // how far away from ranged enemy units harassing units turn and flee
real harass_radius_flee_melee = 800 // how far away from melee enemy units harassing units turn and flee
boolean chatting = true // set to false to turn off computer taunts and chatting (Can still talk in observer mode)
real full_threat_distance = 600 // a enemy army within this distance is counted as a full threat
real no_threat_distance = 3000 // a enemy army outside this distance is counted as no threat
real distance_threat_exponent = 0.8 // how fast the threat increases as the enemy army gets from the no_threat_distance to the full_threat_distance
real distance_threat_mult = 540 // how much the threat vlaue goes up on a town when a enemy army aproaches, higher value means higher threat to town
real atl_time_start = 300 // accepted threat level increase starts at this time
real atl_time_end = 900 // and ends at that time
real atl_time_start_val = 10 // it starts with this value
real atl_time_end_val = 20 // and ends with that value
real atl_enemy_start = 1 // accepted threat level multiplier increases at that enemy number
real atl_enemy_end = 4 // until that enemy number
real atl_enemy_start_mult = 1 // the multiplier starts for accepted threat level starts with this
real atl_enemy_end_mult = 1.5 // and ends with this
real teleport_low_threat = 40 // Army uses TP to get home and defend if a threat is greater than this
real teleport_high_threat = 80 // Army uses TP to get home and defend if a threat is greater than this
real teleport_low_threat_distance = 6000 // Army won't use TP home if they are closer to base than this and a low threat level appears
real teleport_high_threat_distance = 3000 // Army won't use TP home if they are closer to base than this and a high threat level appears
real teleport_army_min_strength = 20 // how big the army need to be for use of TP to threatened town
real teleport_min_threat = 70 // minimum threat level TP use is allowed on
integer shredder_peon_count = 12 // how many peons does a goblin shredder replace in lumber harvesting
integer minimum_peon_wood = 2000 // computers don't build any workers for lumber harvesting if they have more lumber than this
integer maximum_peon_wood = 200 // computers build all needed workers for lumber harvesting if they have lumber lower than this
#PRAGMA END VERSION SETTINGS
//==============================================================
// (AMAI) Version Properties
//==============================================================
#PRAGMA START VERSION SETTINGS
boolean ver_neutral_heroes_available = true // does the version have neutral heroes ?
integer ver_neutral_hero_number = 0 // how many neutral heroes ?
boolean ver_only_heroes_buy = false // can only heroes buy stuff ?
integer ver_food_limit = 100 // what is the food limit ?
integer ver_strat_change_enemy_strength_min = 25 // don't allow strategy change unless the maximum strength of all enemy players in the game is above this.
integer ver_hero_base_value = 4 // what is the base strength of a hero (the level number is added to get the actual strength) ?
integer ver_hero_ultimate_level = 6 // at what level do the heroes get their ultimates ?
integer ver_hero_ultimate_value = 4 // how much extra strength does the ultimate give to the hero ?
real ver_creeps_attack_buildings_dist = 1000 // how far away do creeps attack buildings ?
boolean ver_mercs_night_buy = false // can mercs be bought at night without waking up creeps ?
real ver_tower_check_radius = 2000 // check for towers in this radius around a target
real ver_harass_tower_check_radius = 1400 // check for towers in this radius during harassing
integer ver_optimal_gold = 5 // The optimal number of peons that should be harvesting gold
real ver_flee_multiple1 = 1 // Multiplier to players strength at lowest aggression to measure if amai is allowed to flee
real ver_flee_multiple2 = 2 // Multiplier to players strength at highest aggression to measure if amai allowed to flee
real ver_flee_multiple3 = 3 // Multipler to players strength at highest aggression to measure if amai will flee
real ver_low_aggression = -15 // Aggression below this uses the lowest strength flee multiplier
real ver_high_aggression = 45 // Agression above this uses the highest strength flee multiplier
#PRAGMA END VERSION SETTINGS
//==============================================================
// (AMAI) Race Properties
//==============================================================
#PRAGMA START RACIAL SETTINGS
integer hero1_revive_prio = 200 // priority for reviving hero1
integer hero2_revive_prio = 120 // priority for reviving hero2
integer hero3_revive_prio = 80 // priority for reviving hero1
integer prio_n_inc = 2 // priority increase for building needed buildings
integer prio_t_inc = 1 // priority increase in time
integer prio_q_inc = 2 // priority increase in quantity
integer farm_food2 = 1 // builds another farm at the same time when this near food used to food produced
integer farm_prio = 400 // priority for farm building
integer peon_prio = 280 // priority for peon building
integer ghoul_prio = 250 // priority for ghoul building
integer expa_prio = 200 // priority for expansion building
integer expa_emergency_prio = 300 // priority for rebuilding an expansion
integer expa_rebuild_prio = 200 // priority for rebuilding an expansion
integer peon_1_mine_number = 15 // maximum number of peons to build when 1 mine is owned (redundent if race uses ghouls)
integer peon_2_mines_number = 20 // maximum number of peons to build when 2 mines are owned (redundent if race uses ghouls)
integer peon_mines_number = 24 // maximum number of peons to build when more mines are owned (redundent if race uses ghouls)
integer min_peon_number_single_mine = 6 // minimum number of peons when 1 mine is owned
integer min_peon_number_multi_mine = 11 // minimum number of peons when more than 1 mine is owned
integer strat_food_persistence = 2 // * current food use added to priority for current strategy (prevents computers from changing styrategy when having large army)
integer relevant_strat_change_number = 3 // number of strategies with highest RPs that can be chosen when changing strategy
integer kb_add1 = 8 // priority added to all strategies having a building the computer already got as a key building
integer kb_add2 = 9 // priority added to all strategies having a building the computer already started to build as key building
integer kb_add3 = 7 // priority added to all strategies having both building the computer already got as key buildings
integer kb_add4 = 10 // value for 2 of a key buildings
integer ku_add1 = 4 // priority added to all strategies having a upgrade the computer already got as key upgrade in first level
integer ku_add2 = 7 // priority added to all strategies having a upgrade the computer already got as key upgrade in second level
integer ku_add3 = 8 // priority added to all strategies having a upgrade the computer already got as key upgrade in third level
integer fav_unit_add = 20 // priority added to strategies havign the current profiles favorite unit as key units.
integer debug_strategy = -1 // this race is locked to this strategy number for testing.(-1 is unlocked)
boolean race_use_fountain = true // does the race use healing fountains ?
boolean race_manual_loading = true // does the race need manual loading of wisps in goldmines ?
integer race_manual_loading_wisp = 0 //
integer race_manual_loading_mine = 0 //
boolean race_towerrush_available = false // does the race have a towerrush ?
integer race_towerrush_requirement = 0 // what is the building required to build towers ?
integer race_tower_id = 0 // what is the id of the races towers?
integer race_tower_upgrade = 0 //what is the id of the tower upgrade ?
integer race_towerrush_probability = 33 // how high (in percent) is the probability of doing a tower rush?
integer race_towerrush_hero_rush_level = 2 // the bonus strength value hero must have to be able to do the tower rush
boolean race_militia_expansion_available = false // does the race have a militia expansion ?
integer race_hero_number = 4 // how many racial heroes ?
integer race_simple_melee = 0 // a basic melee unit, only necessary when basic_melee is used
integer race_advanced_melee = 0 // an advanced melee unit to replace the basic one, only necessary when basic_melee is used
boolean race_has_ghouls = false // has the race a ghoul-like wood harvester/fighter unit ?
boolean race_ghouls_attack = true // do those ghouls go with the army on attacks ?
integer race_min_ghouls = 2 // smallest number of ghouls to build at all times
integer race_max_ghouls = 5 // maximum number of ghouls to build in low lumber situations
boolean race_has_power_build = false // can multiple racial workers work on the same building ?
boolean race_no_wood_harvest = false // has the race no wood harvesters ?
boolean race_ignore_injured = false // should the race leave injured units at home ?
boolean race_uses_mine_expansion = false // does the race expand with a mine building like undead ?
boolean race_uses_shredder = true // does the race use the goblin shredder ?
boolean race_militia_available = false // does the race have militia ?
real race_militia_max_distance = 1000 // how far away from the town hall are the militia allowed ?
integer race_militia_id = 'hmil' // what is the militia unit type id?
integer race_militia_ability = 'Amil' // what is the militia ability id ?
integer race_militia_hall_ability = 'Amic' // what is the militia ability of the hall ?
string race_militia_unitstring = "militia" // what is the unitstring/name of the militia ?
string race_militiaworker_unitstring = "peasant" // what is the string of the unit that can be turned to militia ?
boolean race_ancient_expansion_available = false // can the race expand with an uprooted building that also helps fighting the creeps ?
integer race_ancient_expansion_probability = 33 // how high (in percent) is the probability of doing an ancient expansion when possible ?
integer race_ancient_expansion_strength = 15 // up to how much expansion strength is an ancient expansion allowed ?
integer race_ancient_expansion_help_id = 'earc' // the unit id of the unit that should help in ancient expansion
integer race_ancient_expansion_hero_rush_level = 2 // the bonus strength value hero must have to be able to do the ancient expansion
integer race_item_expansion_item_id = 0 // what is expand item name(from StandardUnits.txt) ?
boolean race_item_expansion_available = false // can expand with item building ?
integer race_item_expansion_probability = 5 // how high (in percent) is the probability of doing a item expansion?
integer race_item_sale_level = 0 // buy expand item need hall level ?
boolean race_sell_ziggurats = false // does the race sell ziggurats that are at no more needed expansions ?
real race_ziggurat_keep_distance = 1500 // keep ziggurat if this near another building except a ziggurat is
boolean race_build_farms_front = false // should the race build farms towards the front (as soon as the front is computed) ?
integer race_farms_front_limit = 4 // limit the number of farms at the front to this number
integer race_farms_at_mine = 0 // the first that many farms will be built at the mine
real race_max_expa_mine_distance = 850 // the maximum distance between the mine and the expansion building
integer min_peon_number_double_mine = 11 // minimum number of peons when 2 mines are owned
boolean race_has_moonwells = false // Racial farms have healing properties
integer groundid = 'ewsp' // Used to create path units, must be different from race peon
integer racial_burrow = 0 // Building id that can house peons/units and then shoot enemies.
integer structid = 'ngnh' // Used to trigger melee defeat conditions on surrender.
#PRAGMA END RACIAL SETTINGS
//==============================================================
// (AMAI) Misc Properties
//==============================================================
#PRAGMA START VERSION SETTINGS
boolean destroy_buildings_on_defeat = false // Should the buildings of the AI be destroyed on defeat or given to neutral player ?
integer attack_reform_length = 20 // reform the attack group (getting new units) every that time on an attack (in seconds / 2)
real front_base_distance = 1100 // the distance of the front locations from the start location
boolean ver_heroes = true // Does this version have heroes?
boolean fixedcomputername = false // Enable to force computers to have there fixed name instead of a profile name
integer green_creep_camp_strength_bonus = 0 // Bonus strength added to minor creep camps
integer orange_creep_camp_strength_bonus = 5 // Bonus strength added to mediocre creep camps
integer red_creep_camp_strength_bonus = 10 // Bonus strength added to major creep camps
boolean disable_surrender = false // Set to true to stop amai from giving up early when it detects its going to lose
real strategy_change_threshold = 1.2 // New strategy priority must be larger than this (default 1.20) multiple to the current strategy prority
boolean debugging = false // Can turn on for debugging mode to display debug type messages
integer major_hero_skill_value = 60 // Priority to choose the first line of hero skills
integer minor_hero_skill_value = 30 // Priority to choose the second line of hero skills
integer rare_hero_skill_value = 10 // Priority to choose the third line of hero skills
#PRAGMA END VERSION SETTINGS
//==============================================================
// (AMAI) General Stuff
//==============================================================
boolean IsAMAI = false
boolean leadally = false
boolean campaign_ai = false
string language = "English"
string ai_id = ""
string message_add = ""
real command_wait = 3
real time_of_day = 0
boolean water_map = false
string array digit_map
integer array player_race
integer array player_race_pref
string array race_name
boolean game_is_ffa = false
boolean game_is_1on1 = false
integer total_food = 0
integer wood_buffer = 0
real gold_income = 0
integer income_per_mine = 10 // rate per second
real gold_unit_percentage = 0.9
boolean take_all_ghouls_along = false
integer racial_peon = 0
integer neededPeons = 0
integer array racial_hall
integer array racial_goldmine
integer minearray = 0
integer array gold_mines_ids
integer gold_mine_ids_size = 0
integer array racial_zigg
integer ziggarray = 0
integer racial_expansion = 0
integer racial_altar = 0
integer racial_shop = 0
integer racial_militia = 0
integer racial_militiahero = 0
integer racial_ghoul = 0
integer racial_lumber = 0
integer racial_rushcreep = 0
unit rushcreep_target = null
integer neutral_shredder = 0
integer neutral_zeppelin = 0
integer tp_item = 0
integer tiernum = 3
integer mapSize = 0
integer array hero
integer array hero_skills // The skill line chosen for the hero, major, minor or rare
integer array skills
integer array tempskills
integer array allskills
integer first_choosable_hero = 0
boolean array hero_built
integer array hero_revive_prio
unit array hero_unit
integer array all_heroes
integer array all_heroes_copy
integer array hero_rp
integer hero_number = 0
integer chosen = 0
real array action_points
integer action_numbers = 0
real enemy_density = 0
location enemy_density_loc = Location(0,0)
real ally_density = 0
location ally_density_loc = Location(0,0)
real nearest_enemy_range = 10000000
player nearest_enemy = null
player nearest_human_enemy = null
integer array upkeep_allowed
integer array last_upkeep_allowed
integer array upkeep_border
real array upkeep_goldchange
integer array upkeep_resistance
integer array upkeep_save_time
integer array upkeep_time
integer array upkeep_mines_needed
integer array attack_qty
integer array attack_max
integer array attack_units
integer attack_length = 0
//==============================================================
// (AMAI) Build Variables
//==============================================================
// integer array build_qty
// integer array build_type
// integer array build_item
// integer array build_town
integer array build_prio
integer array build_loc
// integer build_length = 0
integer array t_build_qty
integer array t_build_type
integer array t_build_item
integer array t_build_town
integer array t_build_prio
integer array t_build_loc
integer t_build_length = 0
integer array bl_req_qty
integer array bl_req_type
integer array bl_allow_qty
integer array bl_allow_type
integer array bl_expire_time
boolean array bl_only_done
integer bl_length = 0
integer blocked_gold = 0
integer blocked_wood = 0
integer blocked_food = 0
integer array rbl_req_gold
integer array rbl_req_wood
integer array rbl_req_food // Food required before building unit
integer array rbl_allow_qty
integer array rbl_allow_type
integer array rbl_expire_time
integer rbl_length = 0
boolean build_lock = true
//==============================================================
// (AMAI) Standard Unit Variables
//==============================================================
integer array old_id
integer array needed1 // needed building and factory if unit
integer array needed2 // needed building 2
integer array needed3 // needed for upgrade level 3
integer array build_free // free buildings
integer array gold_sum
integer array build_time_sum
integer array build_num
real array income_percentage
integer array prio_sum
integer array tc_add1 // building that has to be added for TownCount
integer array tc_add2 // building that has to be added for TownCount
integer array available_time
integer array regenerate_time
integer array attacking_max_num
integer array upgrade_time
integer array gold_price
integer array wood_price
integer array hero_rush_bonus
integer array buy_type
//==============================================================
// (AMAI) Misc Globals
//==============================================================
integer array building
integer building_length = 0
integer array campaign_defenders
integer array creep_strength
integer creep_strength_length = 0
unit follow_zeppelin = null
boolean zeppelin_following = false
boolean array neutral_available
unit array nearest_neutral
boolean array neutral_guarded
integer array neutral_enemy
boolean array neutral_ordered
unit array neutral_sent
boolean array neutral_night_buy
integer array neutral_id
real array buy_time_large
real array buy_time_small
integer array neutral_wanted
boolean no_sleep = false
integer array dragons
integer array merc_unit
integer merc_number = 0
integer dragon_number = 0
#INCLUDETABLE <$VER$\MercTypes.txt>
integer merc_%1 = 0
#ENDINCLUDE
integer minimum_attack_strength = 11
integer max_farms = 0
integer exp_time_count = 0
integer exp_first_time = 30
integer exp_second_time = 180
real expansion_taken_radius = 1000 // the radius around a mine where enemy or allied buildings are considered as possessing that mine (it is considered taken then)
integer creep_camp_radius = 550
integer camp_scan_depth = 3
integer camp_last_checked = 40
integer air_strength = 0
integer array p_str_cache
integer array p_str_cache_timeout
integer p_str_cache_valid_time = 2
boolean ai_no_creep = false
boolean town_threat_break = true
//boolean captain_flee = true
//==============================================================
// (AMAI) Strategy System Variables
//==============================================================
integer strategy = 0
integer chosen_strategy = 0
integer last_strategy = 100
string array strategy_name
string array strategy_default_name
string array strategy_default_report
integer array key_building1
integer array key_building2
integer array key_upgrade1
integer array key_upgrade2
integer array key_unit
integer array rp_strat
integer array rp_strat_sort
boolean array beginning_strat
integer array strat_minimum_time
integer rp_strat_length = 0
integer rp_strat_sort_length = 0
integer small_map_tier1_bonus = 20
real k_add_start_mult = 3
real k_add_end_mult = 1
real k_add_start_time = 120
real k_add_end_time = 1200
boolean array strategy_type_used
// integer used_strategies = 0
integer array strategy_type
integer strategy_type_used_penalty = 30
integer array strategy_tier
integer array strategy_first_exp_time
integer array strategy_second_exp_time
integer array strategy_first_hero
integer array strategy_first_hero_bonus
integer array strategy_second_hero
integer array strategy_second_hero_bonus
integer array strategy_third_hero
integer array strategy_third_hero_bonus
integer array strategy_race_aggression
boolean attacking_expansion = false
boolean recalculate_heros = false // Tavern heros cannot be trained so get a normal hero
integer tier = 0
integer own_strength = 0
integer uncertainty = 10
integer tower_factor = 10
integer array race_aggression
integer array b_race_aggression
integer added_aggression = 0 // aggression added when upkeep becomes higher
boolean h_siege = false
unit alli_target = null
integer expansion_target_bonus = 7
integer comp_chosen_target_bonus = 5
real comp_chosen_target_rate = 0.5
boolean balancing = false
texttag debugstrattag = CreateTextTag()
texttag debugcountertag = CreateTextTag()
texttag debugjobtag = CreateTextTag()
//==============================================================
// (AMAI) Healing System Globals
//==============================================================
group healer_group = CreateGroup()
boolean ward_cast = false
group urgent_healing_group = CreateGroup()
group medium_healing_group = CreateGroup()
group small_healing_group = CreateGroup()
integer urgent_healing_count = 0
integer medium_healing_count = 0
integer small_healing_count = 0
boolean fountain_available = false
integer build_emergency_healing_item = 0
unit item_unit = null
integer array healer_id
integer array healer_spell
integer array healer_type
integer array healer_mana_cost
integer array healer_upg_id
integer array healer_upg_level
integer healer_length = 0
//==============================================================
// (AMAI) Misc Globals
//==============================================================
integer array c_enemy // number of enemy players of certain races or random
integer c_enemy_total = 0
integer array c_ally // number of allied players of certain races
integer c_ally_total = 0
integer c_enemy_user_total = 0 //number of enemy human player
integer c_ally_user_total = 0 //number of ally human player
integer c_ai_total = 0
boolean enemy_revealed = false
integer strat_prev = 0 // strategy chosen by the ai before this one
integer hero_prev = 0 // hero chosen by the ai before this one
integer picked_hero = 0
//boolean first_ai = true
//integer next_ai = 0
boolean no_ai_ally = false
boolean no_ally_ctrl = true
boolean player_defeated = false
#INCLUDETABLE <$VER$\Strengths.txt>
real enemy_%1 = 0
real ally_%1 = 0
#ENDINCLUDE
boolean array town_built
location array own_town_loc
real array own_town_dist
unit array own_town_mine
integer first_town_mine = 0
location array exist_town
integer exist_town_num = 0
integer attacking_ghouls = 0
integer harvesting_ghouls = 0
integer ai_time = 0
integer tq_length = 0
real array tq_time
integer array tq_jid
integer array tq_par
unit array tq_unit_par
group array tq_group_par
unit array tq_unit_par2
//hashtable tq_hashtable = InitHashtable()
boolean tq_lock = true
timer tq_timer = CreateTimer()
boolean attack_running = false
boolean no_attack_allowed = false
integer order_cancel = 851976
integer order_attack = 851983
//==============================================================
// (AMAI) Chatting variables
//==============================================================
sound chatSound = CreateSound( "Sound\\Interface\\InGameChatWhat1.wav", false, false, false, 10, 10, "" )
sound importantSound = CreateSound( "Sound\\Interface\\CreepAggroWhat1.wav", false, false, false, 10, 10, "" )
boolean array chat_target_obs
boolean array chat_target_ally
boolean array chat_target_enemy
boolean array chat_important
string array chat_list
string array chat_list_race
integer array chat_list_eq
integer chat_list_length = 0
string chat_race = ""
integer chat_eq = 0
string array chat_queue
boolean array chat_queue_importance
player array chat_queue_player
string chat_strategy = null
integer chat_queue_size = -1
constant integer C_STRATEGY = 0
#INCLUDETABLE <ChatEvents.txt> #EFR
string array chat_%1
boolean array chat_cond_%1
integer chat_%1_length = 0
constant integer C_%1 = %row
#ENDINCLUDE
string chat_no_unit_selected = ""
string chat_confirm_attack_unit = ""
string chat_towerrush = ""
string chat_no_orc = ""
string invalid_strategy_number = ""
string chat_dynamic_counter = "and countering "
string militia_expansion_chat = ""
//gamecache translation_map = InitGameCache("AMAI_TM.w3v")
hashtable translation_map = InitHashtable()
string array translation
integer translation_length = 0
//gamecache additional_info = InitGameCache("AMAI_AI.w3v") // Used for harrass data
//gamecache com = InitGameCache("AMAI_Com.w3v")
hashtable additional_info = InitHashtable() // For harass logic
constant integer START_STRENGTH = 0
constant integer AVOID_TOWERS = 1
constant integer STRENGTH_LIMIT = 2
constant integer STATE_ATTACKING = 3
constant integer FLEE_PERCENT = 4
constant integer FLEE_NUMBER = 5
constant integer INVISIBLE_COUNT = 6
constant integer LOCX = 7
constant integer LOCY = 8
constant integer STATE_RETREAT = 9
constant integer WINDWALK_COUNT = 10
constant integer HARASS_GROUP = 11
constant integer START_STRENGTH_TEMP = 12
hashtable com = InitHashtable()
constant integer TEAM_STATEGY_INUSE = 1
constant integer IS_AMAI = 2
constant integer RACE = 3
constant integer RACE_PREF = 4
constant integer USE_SPECIAL_RACES = 5
constant integer PROFILE_SELECTION = 6
constant integer NEUTRAL_GUARDS = 7
constant integer TYPECASTING = 8
gamecache amaiCache = InitGameCache("AMAI_AI.w3v")
constant integer PROFILE_USED = 0
constant integer GREETINGS_NUM = 1
constant integer CHAT_LOCK = 2
constant integer ALLIANCE_TARGET = 3
//gamecache settings = InitGameCache("AMAI_Set.w3v")
string array char_table
string array char_bug_table
integer char_table_length = 0
hashtable language_table = InitHashtable()
constant integer CHAR_TABLE = 0
constant integer CHAT_VARS_TABLE = 1
string array chat_vars
integer chat_vars_length = 1
//gamecache chat_vars_map = InitGameCache("AMAI_CVM.w3v")
//hashtable chat_vars_map = InitHashtable()
//===========================================================================
// (AMAI) Job variables
//===========================================================================
#DEFINE GLOBAL
#INCLUDETABLE <Jobs.txt> #EFR
#INCLUDESCRIPT <Jobs\%1.eai>
#ENDINCLUDE
#UNDEF GLOBAL
//===========================================================================
// (AMAI) Variables for controlling the AI (different states)
//===========================================================================
boolean console_on = false
boolean creeping_only = false
boolean break_attack = false
boolean go_home = false
boolean attack_player = false
boolean attack_point = false
boolean attack_unit = false
boolean no_attack = false
boolean no_creep_attack = false
boolean no_player_attack = false
boolean strat_change_allowed = true
integer attack_target_p = 0
integer attack_target_x = 0
integer attack_target_y = 0
#INCLUDETABLE <$VER$\CommandBuilds.txt> #EFR
integer bn_%1 = 0
#ENDINCLUDE
unit target_unit = null
integer array target_queue_x
integer array target_queue_y
unit array target_queue_u
integer queue_length = 0
integer queue_pointer = 0
boolean queue_running = false
boolean queue_attack_p = false
boolean queue_attack_u = false
integer queue_t_x = 0
integer queue_t_y = 0
unit queue_t_u = null
real lastcaptainx = 0
real lastcaptainy = 0
//==============================================================
// (AMAI) Profile system globals
//==============================================================
integer profile_length = 0
integer profile = 0
integer debug_profile = -1
string ai_name = "Computer"
integer own_race = 0
real taunt_rate = 1.00 // how man % of the time computers taunt, set by profiles. Recommended values 0.50 to 1.50
integer taunt_start_time = 60 // the time for the computers to start taunting (in seconds * 5)
integer farm_food = 8 // build farm when this near food used to food produced
integer strat_persistence = 1000 // extra priority to the current strategy to make computer not change strategy too fast
// Profile settings
string array profilename
integer array fav_hero
integer array fav_unit
integer array p_race // Desired race for the profile to be picked (default random)
integer array p_aggression // aggression modify to total attacking_aggression. reccomended -10 to 10
integer array p_uncertainty // adds or subtracts this value to the enemies strength every so often. reccomended 5 to 15
integer array p_minimum_attack_strength // How much strength required before amai can start attacking. reccomended 3 to 6
integer array p_farm_food // How much food to have left before building a new farm
integer array p_exp_first_time // Make amai build expansion earlier or later by this number of seconds. reccomended -10 to 10
integer array p_exp_second_time
integer array p_strat_persistence // How persistance amai is to keep its current strategy. reccomended 1.05 to 2.00
integer array p_expansion_target_bonus // aggression bonus for expansion targets
integer array p_comp_chosen_target_bonus // aggression bonus for targets chosen by the hard coded AI
integer array p_surrender // How likly amai will give up, 0 being never give up and 4 being give up really easily
integer array p_rare // Ensures the profile is rarely picked
real array p_gold_unit_percentage // The higher this is the more unit production buildings are constructed. reccomended 0.9 to 1
real array p_taunt_rate // Will display a taunt every 5th second for this percent of the time. Reccomended 1 to 2
// real taunt_rate = 1.00 // how man % of the time computers taunt, set by profiles. Recommended values 0.50 to 1.50
// integer taunt_start_time = 60 // the time for the computers to start taunting (in seconds * 5)
real array p_comp_chosen_target_rate // how often the computer considers an attack target chosen by the hard coded AI
//==============================================================
// (AMAI) Pathing variables
//==============================================================
real path_top = GetCameraBoundMaxY()+GetCameraMargin(CAMERA_MARGIN_TOP)
real path_bottom = GetCameraBoundMinY()-GetCameraMargin(CAMERA_MARGIN_BOTTOM)
real path_left = GetCameraBoundMinX()-GetCameraMargin(CAMERA_MARGIN_LEFT)
real path_right = GetCameraBoundMaxX()+GetCameraMargin(CAMERA_MARGIN_RIGHT)
//rect playable_rect = Rect(path_left, path_bottom, path_right, path_top)
unit array expansion_list