Skip to content

Commit

Permalink
Fix set react calculation issue and made easier to predict build order
Browse files Browse the repository at this point in the history
…#466

Priority works backwards for setbuildreact to improve predictability
  • Loading branch information
SMUnlimited committed Dec 8, 2024
1 parent c1ef5b4 commit a3d23b9
Show file tree
Hide file tree
Showing 9 changed files with 194 additions and 225 deletions.
80 changes: 32 additions & 48 deletions REFORGED/Elf/BuildSequence.ai
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,7 @@ function build_sequence_MassHD takes nothing returns nothing
if tier == 3 then

call BuildUnit(2, MOUNTAIN_GIANT, 60)
call SetBuildReact(40, 20, HUNTRESS, 0, ARCHER, enemy_air, 5, 20, 50)
call SetBuildReact(40, 20, HUNTRESS, 0, ARCHER, enemy_air, 5, 20, 90)
call BuildUnit(12, DRYAD, 70)
call BuildUnit(1, hero[1], 140)
call BuildUnit(1, hero[2], 130)
Expand Down Expand Up @@ -548,7 +548,7 @@ if tier == 3 then
elseif tier == 2 then

call BuildUnit(1, MOUNTAIN_GIANT, 50)
call SetBuildReact(30, 12, HUNTRESS, 0, ARCHER, enemy_air, 5, 20, 50)
call SetBuildReact(30, 12, HUNTRESS, 0, ARCHER, enemy_air, 5, 20, 80)
call BuildUnit(6, DRYAD, 70)
call BuildUnit(1, TREE_ETERNITY, 45)
call BuildUnit(1, hero[1], 140)
Expand Down Expand Up @@ -586,7 +586,7 @@ elseif tier == 2 then

else

call SetBuildReact(26, 6, HUNTRESS, 3, ARCHER, (enemy_unarmored + (enemy_lightarmor * 2) + enemy_air + enemy_magic - (enemy_normal * 2)), 3, 18, 24)
call SetBuildReact(26, 6, HUNTRESS, 3, ARCHER, (enemy_unarmored + (enemy_lightarmor * 2) + enemy_air + enemy_magic - (enemy_normal * 2)), 3, 18, 56)
call BuildUnit(1, TREE_AGES, 50)
call BuildUnit(1, hero[1], 150)

Expand Down Expand Up @@ -733,8 +733,7 @@ elseif tier == 2 then

else

call SetBuildReact(26, 6, ARCHER, 0, HUNTRESS, (enemy_normal + enemy_mediumarmor - (enemy_air * 2) - enemy_piercing - enemy_siege), 4, 25, 38)
call BuildUnit(1, HUNTRESS, 52)
call SetBuildReact(26, 6, ARCHER, 1, HUNTRESS, (enemy_normal + enemy_mediumarmor - (enemy_air * 2) - enemy_piercing - enemy_siege), 4, 25, 60)
call BuildUnit(1, TREE_AGES, 55)
call BuildUnit(1, hero[1], 150)

Expand Down Expand Up @@ -894,8 +893,7 @@ elseif tier == 2 then

else

call SetBuildReact(26, 6, ARCHER, 0, HUNTRESS, (enemy_normal + enemy_mediumarmor - (enemy_air * 2) - enemy_piercing - enemy_siege), 4, 25, 38)
call BuildUnit(4, HUNTRESS, 52)
call SetBuildReact(26, 6, ARCHER, 4, HUNTRESS, (enemy_normal + enemy_mediumarmor - (enemy_air * 2) - enemy_piercing - enemy_siege), 4, 25, 60)
call BuildUnit(1, TREE_AGES, 50)
call BuildUnit(1, hero[1], 150)

Expand Down Expand Up @@ -961,10 +959,8 @@ endfunction
function build_sequence_Ballista takes nothing returns nothing
if tier == 3 then

call SetBuildReact(14, 0, HUNTRESS, 0, BALLISTA, enemy_unarmored, 4, 8, 50)
call SetBuildReact(14, 4, HUNTRESS, 6, BALLISTA, enemy_unarmored, 4, 8, 70)
call BuildUnit(12, DRYAD, 55)
call BuildUnit(4, HUNTRESS, 60)
call BuildUnit(6, BALLISTA, 60)
call BuildUnit(1, hero[1], 140)
call BuildUnit(1, hero[2], 130)
call BuildUnit(1, hero[3], 120)
Expand All @@ -990,10 +986,8 @@ if tier == 3 then

elseif tier == 2 then

call SetBuildReact(14, 0, HUNTRESS, 0, BALLISTA, enemy_unarmored, 4, 8, 50)
call SetBuildReact(14, 4, HUNTRESS, 5, BALLISTA, enemy_unarmored, 4, 8, 74)
call BuildUnit(6, DRYAD, 55)
call BuildUnit(4, HUNTRESS, 60)
call BuildUnit(5, BALLISTA, 60)
call BuildUnit(1, TREE_ETERNITY, 50)
call BuildUnit(1, hero[1], 140)
call BuildUnit(1, hero[2], 130)
Expand Down Expand Up @@ -1088,8 +1082,7 @@ function build_sequence_Talon takes nothing returns nothing
if tier == 3 then
call BuildUnit(14, DRUID_TALON, 90)
call BuildUnit(12, FAERIE_DRAGON, 100)
call SetBuildReact(14, 0, MOUNTAIN_GIANT, 0, HIPPO, enemy_air, 8, 12, 65)
call BuildUnit(4, MOUNTAIN_GIANT, 70)
call SetBuildReact(14, 4, MOUNTAIN_GIANT, 0, HIPPO, enemy_air, 8, 12, 90)
call BuildUnit(1, hero[1], 150)
call BuildUnit(1, hero[2], 140)
call BuildUnit(1, hero[3], 130)
Expand Down Expand Up @@ -1130,8 +1123,7 @@ if tier == 3 then
elseif tier == 2 then
call BuildUnit(12, DRUID_TALON, 40)
call BuildUnit(8, FAERIE_DRAGON, 100)
call SetBuildReact(14, 0, MOUNTAIN_GIANT, 0, HIPPO, enemy_air, 8, 12, 65)
call BuildUnit(3, MOUNTAIN_GIANT, 70)
call SetBuildReact(14, 3, MOUNTAIN_GIANT, 0, HIPPO, enemy_air, 8, 12, 76)
call BuildUnit(1, TREE_ETERNITY, 55)
call BuildUnit(1, hero[1], 140)
call BuildUnit(1, hero[2], 130)
Expand Down Expand Up @@ -1172,8 +1164,7 @@ elseif tier == 2 then

else

call SetBuildReact(26, 6, ARCHER, 0, HUNTRESS, (enemy_normal + enemy_mediumarmor - (enemy_air * 2) - enemy_piercing - enemy_siege), 4, 25, 38)
call BuildUnit(4, HUNTRESS, 52)
call SetBuildReact(26, 6, ARCHER, 4, HUNTRESS, (enemy_normal + enemy_mediumarmor - (enemy_air * 2) - enemy_piercing - enemy_siege), 4, 25, 58)
call BuildUnit(1, TREE_AGES, 50)
call BuildUnit(1, hero[1], 150)

Expand Down Expand Up @@ -1337,8 +1328,7 @@ elseif tier == 2 then

else

call SetBuildReact(26, 6, ARCHER, 0, HUNTRESS, (enemy_normal + enemy_mediumarmor - (enemy_air * 2) - enemy_piercing - enemy_siege), 4, 25, 38)
call BuildUnit(4, HUNTRESS, 52)
call SetBuildReact(26, 6, ARCHER, 4, HUNTRESS, (enemy_normal + enemy_mediumarmor - (enemy_air * 2) - enemy_piercing - enemy_siege), 4, 25, 60)
call BuildUnit(1, TREE_AGES, 55)
call BuildUnit(1, hero[1], 150)

Expand Down Expand Up @@ -1501,8 +1491,7 @@ elseif tier == 2 then

else

call SetBuildReact(26, 6, ARCHER, 0, HUNTRESS, (enemy_normal + enemy_mediumarmor - (enemy_air * 2) - enemy_piercing - enemy_siege), 4, 25, 38)
call BuildUnit(4, HUNTRESS, 52)
call SetBuildReact(26, 6, ARCHER, 4, HUNTRESS, (enemy_normal + enemy_mediumarmor - (enemy_air * 2) - enemy_piercing - enemy_siege), 4, 25, 60)
call BuildUnit(1, TREE_AGES, 50)
call BuildUnit(1, hero[1], 150)

Expand Down Expand Up @@ -1577,8 +1566,7 @@ endfunction
function build_sequence_Archer takes nothing returns nothing
if tier == 3 then

call SetBuildReact(20, 0, ARCHER, 0, HUNTRESS, enemy_unarmored, 4, 8, 50)
call BuildUnit(32, ARCHER, 10)
call SetBuildReact(20, 32, ARCHER, 0, HUNTRESS, enemy_unarmored, 4, 8, 74)
call BuildUnit(1, hero[1], 140)
call BuildUnit(1, hero[2], 130)
call BuildUnit(1, hero[3], 120)
Expand Down Expand Up @@ -1612,8 +1600,7 @@ if tier == 3 then

elseif tier == 2 then

call SetBuildReact(14, 0, ARCHER, 0, HUNTRESS, enemy_unarmored, 4, 8, 50)
call BuildUnit(22, ARCHER, 30)
call SetBuildReact(14, 22, ARCHER, 0, HUNTRESS, enemy_unarmored, 4, 8, 74)
call BuildUnit(1, TREE_ETERNITY, 45)
call BuildUnit(1, hero[1], 150)
call BuildUnit(1, hero[2], 140)
Expand Down Expand Up @@ -1645,7 +1632,7 @@ elseif tier == 2 then

else

call SetBuildReact(26, 12, ARCHER, 0, HUNTRESS, (enemy_normal + enemy_mediumarmor - (enemy_air * 2) - enemy_piercing - enemy_siege), 4, 25, 40)
call SetBuildReact(26, 12, ARCHER, 0, HUNTRESS, (enemy_normal + enemy_mediumarmor - (enemy_air * 2) - enemy_piercing - enemy_siege), 4, 25, 66)
call BuildUnit(1, TREE_AGES, 50)
call BuildUnit(1, hero[1], 150)

Expand Down Expand Up @@ -1783,8 +1770,7 @@ elseif tier == 2 then

else

call SetBuildReact(26, 6, ARCHER, 0, HUNTRESS, (enemy_normal + enemy_mediumarmor - (enemy_air * 2) - enemy_piercing - enemy_siege), 4, 25, 38)
call BuildUnit(4, HUNTRESS, 52)
call SetBuildReact(26, 6, ARCHER, 4, HUNTRESS, (enemy_normal + enemy_mediumarmor - (enemy_air * 2) - enemy_piercing - enemy_siege), 4, 25, 60)
call BuildUnit(1, TREE_AGES, 55)
call BuildUnit(1, hero[1], 150)

Expand Down Expand Up @@ -1858,8 +1844,8 @@ endfunction
function build_sequence_MassHuntress takes nothing returns nothing
if tier == 3 then

call SetBuildReact(20, 0, HUNTRESS, 0, BALLISTA, enemy_unarmored, 4, 8, 50)
call SetBuildReact(42, 15, HUNTRESS, 0, ARCHER, enemy_air, 5, 20, 50)
call SetBuildReact(20, 0, HUNTRESS, 0, BALLISTA, enemy_unarmored, 4, 8, 70)
call SetBuildReact(42, 15, HUNTRESS, 0, ARCHER, enemy_air, 5, 20, 92)
call BuildUnit(1, hero[1], 140)
call BuildUnit(1, hero[2], 130)
call BuildUnit(1, hero[3], 120)
Expand Down Expand Up @@ -1902,8 +1888,8 @@ if tier == 3 then

elseif tier == 2 then

call SetBuildReact(12, 0, HUNTRESS, 0, BALLISTA, enemy_unarmored, 4, 8, 50)
call SetBuildReact(42, 12, HUNTRESS, 0, ARCHER, enemy_air, 5, 20, 50)
call SetBuildReact(12, 0, HUNTRESS, 0, BALLISTA, enemy_unarmored, 4, 8, 62)
call SetBuildReact(42, 12, HUNTRESS, 0, ARCHER, enemy_air, 5, 20, 92)
call BuildUnit(1, TREE_ETERNITY, 45)
call BuildUnit(1, hero[1], 140)
call BuildUnit(1, hero[2], 130)
Expand Down Expand Up @@ -1942,7 +1928,7 @@ elseif tier == 2 then

else

call SetBuildReact(26, 8, HUNTRESS, 4, ARCHER, (enemy_unarmored + (enemy_lightarmor * 2) + enemy_air + enemy_magic - (enemy_normal * 2)), 3, 18, 26)
call SetBuildReact(26, 8, HUNTRESS, 4, ARCHER, (enemy_unarmored + (enemy_lightarmor * 2) + enemy_air + enemy_magic - (enemy_normal * 2)), 3, 18, 60)
call BuildUnit(1, TREE_AGES, 50)
call BuildUnit(1, hero[1], 150)

Expand Down Expand Up @@ -2084,8 +2070,7 @@ elseif tier == 2 then

else

call SetBuildReact(26, 6, ARCHER, 0, HUNTRESS, (enemy_normal + enemy_mediumarmor - (enemy_air * 2) - enemy_piercing - enemy_siege), 4, 25, 38)
call BuildUnit(4, HUNTRESS, 52)
call SetBuildReact(26, 6, ARCHER, 4, HUNTRESS, (enemy_normal + enemy_mediumarmor - (enemy_air * 2) - enemy_piercing - enemy_siege), 4, 25, 60)
call BuildUnit(1, TREE_AGES, 50)
call BuildUnit(1, hero[1], 150)

Expand Down Expand Up @@ -2168,8 +2153,8 @@ endfunction
function build_sequence_AoWMix takes nothing returns nothing
if tier == 3 then

call SetBuildReact(20, 2, ARCHER, 3, BALLISTA, (enemy_unarmored + enemy_towers + enemy_casters)/2, 4, 25, 50)
call SetBuildReact(50, 15, HUNTRESS, 10, ARCHER, (enemy_unarmored + enemy_air - enemy_normal), 4, 25, 50)
call SetBuildReact(20, 2, ARCHER, 3, BALLISTA, (enemy_unarmored + enemy_towers + enemy_casters)/2, 4, 25, 70)
call SetBuildReact(50, 15, HUNTRESS, 10, ARCHER, (enemy_unarmored + enemy_air - enemy_normal), 4, 25, 100)
call BuildUnit(1, hero[1], 140)
call BuildUnit(1, hero[2], 130)
call BuildUnit(1, hero[3], 120)
Expand Down Expand Up @@ -2218,8 +2203,8 @@ if tier == 3 then

elseif tier == 2 then

call SetBuildReact(14, 2, ARCHER, 3, BALLISTA, (enemy_unarmored + enemy_towers + enemy_casters)/2, 4, 25, 50)
call SetBuildReact(40, 10, HUNTRESS, 8, ARCHER, (enemy_unarmored + enemy_air - enemy_normal), 4, 25, 50)
call SetBuildReact(14, 2, ARCHER, 3, BALLISTA, (enemy_unarmored + enemy_towers + enemy_casters)/2, 4, 25, 74)
call SetBuildReact(40, 10, HUNTRESS, 8, ARCHER, (enemy_unarmored + enemy_air - enemy_normal), 4, 25, 90)
call BuildUnit(1, TREE_ETERNITY, 50)
call BuildUnit(1, hero[1], 140)
call BuildUnit(1, hero[2], 130)
Expand Down Expand Up @@ -2267,7 +2252,7 @@ elseif tier == 2 then

else

call SetBuildReact(26, 8, HUNTRESS, 4, ARCHER, (enemy_unarmored + (enemy_lightarmor * 2) + enemy_air + enemy_magic - (enemy_normal * 2)), 3, 18, 35)
call SetBuildReact(26, 8, HUNTRESS, 4, ARCHER, (enemy_unarmored + (enemy_lightarmor * 2) + enemy_air + enemy_magic - (enemy_normal * 2)), 3, 18, 60)
call BuildUnit(1, TREE_AGES, 55)
call BuildUnit(1, hero[1], 150)

Expand Down Expand Up @@ -2359,8 +2344,8 @@ endfunction
function build_sequence_AoLMix takes nothing returns nothing
if tier == 3 then

call SetBuildReact(16, 2, DRYAD, 1, MOUNTAIN_GIANT, (enemy_towers + enemy_piercing - enemy_casters - enemy_normal), 4, 25, 60)
call SetBuildReact(50, 10, DRUID_CLAW, 8, DRYAD, (enemy_unarmored + enemy_air + (enemy_magic * 2) + enemy_normal - enemy_piercing - enemy_siege)/3, 4, 25, 60)
call SetBuildReact(16, 2, DRYAD, 1, MOUNTAIN_GIANT, (enemy_towers + enemy_piercing - enemy_casters - enemy_normal), 4, 25, 76)
call SetBuildReact(50, 10, DRUID_CLAW, 8, DRYAD, (enemy_unarmored + enemy_air + (enemy_magic * 2) + enemy_normal - enemy_piercing - enemy_siege)/3, 4, 25, 110)
call BuildUnit(3, CHIMAERA, 58)
call BuildUnit(1, hero[1], 140)
call BuildUnit(1, hero[2], 130)
Expand Down Expand Up @@ -2416,8 +2401,8 @@ if tier == 3 then

elseif tier == 2 then

call SetBuildReact(16, 2, DRYAD, 1, MOUNTAIN_GIANT, (enemy_towers + enemy_piercing - enemy_casters - enemy_normal), 4, 25, 60)
call SetBuildReact(50, 5, DRUID_CLAW, 4, DRYAD, (enemy_unarmored + enemy_air + (enemy_magic * 2) + enemy_normal - enemy_piercing - enemy_siege)/3, 4, 25, 60)
call SetBuildReact(16, 2, DRYAD, 1, MOUNTAIN_GIANT, (enemy_towers + enemy_piercing - enemy_casters - enemy_normal), 4, 25, 80)
call SetBuildReact(50, 5, DRUID_CLAW, 4, DRYAD, (enemy_unarmored + enemy_air + (enemy_magic * 2) + enemy_normal - enemy_piercing - enemy_siege)/3, 4, 25, 110)
call BuildUnit(1, TREE_ETERNITY, 80)
call BuildUnit(1, hero[1], 140)
call BuildUnit(1, hero[2], 130)
Expand Down Expand Up @@ -2469,8 +2454,7 @@ elseif tier == 2 then

else

call SetBuildReact(26, 6, ARCHER, 0, HUNTRESS, (enemy_normal + enemy_mediumarmor - (enemy_air * 2) - enemy_piercing - enemy_siege), 4, 25, 38)
call BuildUnit(4, HUNTRESS, 52)
call SetBuildReact(26, 6, ARCHER, 4, HUNTRESS, (enemy_normal + enemy_mediumarmor - (enemy_air * 2) - enemy_piercing - enemy_siege), 4, 25, 60)
call BuildUnit(1, TREE_AGES, 55)
call BuildUnit(1, hero[1], 150)

Expand Down
Loading

0 comments on commit a3d23b9

Please sign in to comment.