diff --git a/CHANGELOG.md b/CHANGELOG.md index 607a0966f..3eef85c35 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) - If that fails you can manually change language from the menu toolbar. - Translations may not be perfect as are auto-generated from bing translate except chinese from jzy-chitong56. - (DevTools) Observer debugging when debug turned on for vanilla AI in VSAI mode. +- (DevTools) New racial setting `racial_burrow` to set unit used for peons not exiting burrow fix. ### Changed @@ -28,6 +29,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) - Tweaked expansion logic so when alot more mines on map it increases chance of doing a fast expansion but isn't certain. - AI will not take into account enemies ally strength of target which was blocking any attack attempts at all. - Insane AI will maphack and determine enemies strength precisely instead of roughly. +- Rally controls will make use of front locations at the home base while all others rally to home to ensure all units exit buildings optimally. - Teleport control improvements and fixes. (jzy-chitong56) - (Installer) Changed name to Installer instead of Electron Manager. - (DevTools) Updated MPQEditor to 4.0.0.924. @@ -46,6 +48,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) - Slightly timing tweak to help AI hardcoded systems better understand which mines are claimed at game start. - Fixed an issue where we would not get a new target after killing target due to incorrectly checking that combat has ended, which is not likely to be the case. - Fix for second nearest ally attack target in ffa matches not taking account of distance correctly if own hero was not available. +- If front locations are not computed don't save resources for units being built at the front. - Fix ally attack target not being reset, particularly expansion seemed to be slower without fix. (jzy-chitong56) - Fix Goblin Tinker Skill not upgrading past rockets on one of the trees. (jzy-chitong56) - Reduce lengthy unnecessary wait during distraction attack. (jzy-chitong56) @@ -53,6 +56,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) - Defeated players should not keep chatting. (jzy-chitong56) - Fix for buy neutral units running attack which is not expected. (jzy-chitong56) - Memory leak and fault tolerance optimizations. (jzy-chitong56) +- When building at mine, lumber or front locations AI's will do a better job of leaving gaps for units and buildings. (jzy-chitong56) +- Fix for hardcoded bug leaving peons in burrows (jzy-chitong56) - (Classic) Fix hero priorities too low for various strategies. - (Classic) Hero Skill fix will only run on versions 1.29 - 1.32.8. 1.32.9 and onwards will not run the fix. (jzy-chitong56) - (Classic) Fix healer mana costs which instead used reforged costs (jzy-chitong56) diff --git a/Jobs/RALLY_POINT.eai b/Jobs/RALLY_POINT.eai index 5891584a3..8bf14e6b5 100644 --- a/Jobs/RALLY_POINT.eai +++ b/Jobs/RALLY_POINT.eai @@ -1,14 +1,50 @@ #IFDEF GLOBAL + location rally_point = null #ELSE + +function CheckBurrow takes nothing returns nothing + local group g = CreateGroup() + call GroupEnumUnitsOfPlayer(g, ai_player, null) + set g = SelectById(g, old_id[racial_burrow], true) + set g = SelectByAlive(g, true) + set g = SelectByHidden(g, false) + call GroupImmediateOrder( g, "standdown" ) //fix orc peon go battlestations , but can not standdown + call DestroyGroup(g) + set g = null +endfunction + +// Set rally point so units come out of buildings at a likely useful location and not the default location. function RallypointJob takes nothing returns nothing local group g = CreateGroup() local unit u = null + local integer i = 0 call DisplayToAllJobDebug("RALLY_POINT JOB START") + if rally_point == null and front_locs_computed then + set i = Max(GetRandomInt(0, front_loc_num - 1),0) + if front_loc[i] != null then + set rally_point = AIGetProjectedLoc(front_loc[0], home_location, -(front_base_distance*0.25), 0) + endif + endif call GroupEnumUnitsOfPlayer(g, ai_player, null) set g = SelectUnittype(g, UNIT_TYPE_STRUCTURE, true) - call GroupPointOrderLoc(g, "setrally", home_location) + set g = SelectByAlive(g, true) + set g = SelectByHidden(g, false) + loop + set u = FirstOfGroup(g) + exitwhen u == null + if rally_point != null and DistanceBetweenPoints_dk(GetUnitLoc(u), home_location) <= expansion_taken_radius then + call IssuePointOrderLoc(u, "setrally", rally_point) + else + call IssuePointOrderLoc(u, "setrally", home_location) + endif + call GroupRemoveUnit(g,u) + endloop + set u = null call DestroyGroup(g) set g = null + if racial_burrow != 0 and TownCountDone(racial_burrow) > 0 then + call CheckBurrow() + endif call TQAddJob(60, RALLY_POINT, 0) endfunction #ENDIF \ No newline at end of file diff --git a/README.md b/README.md index cc45838cc..fab70e374 100644 --- a/README.md +++ b/README.md @@ -263,7 +263,9 @@ InstallTFTToMap.bat "C:\Documents\Warcraft III\Maps\AMAI\.w3m" **Strategy and Profile Editor**: - Supports an unlimited amount of your own profiles. - Supports an unlimited amount of your own strategies. - - Auto Building feature for example: an AMAI computer only needs to know that it shall build a hero and 15 footmen. It will automatically build all needed buildings, workers and farms in order to get this as fast as possible. + - Auto Building feature for example: an AMAI computer only needs to know that it shall build a hero and 15 footmen. + - It will automatically build all needed buildings, workers and farms in order to get this as fast as possible. + - It can also automatically build upgrades or its own counter units when your strategy runs out of items to build. # Commander diff --git a/REFORGED/Orc/Settings.txt b/REFORGED/Orc/Settings.txt index 84d589d4f..8e0e720b3 100644 --- a/REFORGED/Orc/Settings.txt +++ b/REFORGED/Orc/Settings.txt @@ -76,4 +76,5 @@ race_ancient_expansion_hero_rush_level 2 the bonus strength value hero must have ghoul_prio 250 priority for ghoul building race_min_ghouls 2 smallest number of ghouls to build at all times race_max_ghouls 5 maximum number of ghouls to build in low lumber situations -groundid 'ewsp' Used to create path units, must be different from race peon \ No newline at end of file +groundid 'ewsp' Used to create path units, must be different from race peon +racial_burrow BURROW Building id that can house peons/units and then shoot enemies. \ No newline at end of file diff --git a/TFT/Orc/Settings.txt b/TFT/Orc/Settings.txt index f9d836f1e..11f6a7ea7 100644 --- a/TFT/Orc/Settings.txt +++ b/TFT/Orc/Settings.txt @@ -76,4 +76,5 @@ race_ancient_expansion_hero_rush_level 2 the bonus strength value hero must have ghoul_prio 250 priority for ghoul building race_min_ghouls 2 smallest number of ghouls to build at all times race_max_ghouls 5 maximum number of ghouls to build in low lumber situations -groundid 'ewsp' Used to create path units, must be different from race peon \ No newline at end of file +groundid 'ewsp' Used to create path units, must be different from race peon +racial_burrow BURROW Building id that can house peons/units and then shoot enemies. \ No newline at end of file diff --git a/common.eai b/common.eai index d2f0766f7..accf0bff0 100644 --- a/common.eai +++ b/common.eai @@ -420,6 +420,7 @@ globals 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. #PRAGMA END RACIAL SETTINGS @@ -5815,15 +5816,19 @@ endfunction function BuildLumberMillAtBase takes nothing returns boolean local location buildloc = GetLumberLocationAtBase() local unit u = null + local unit temp = null local unit peon = GetExpansionPeon() local boolean b = false if buildloc != null then if peon == null then set peon = GetExpansionPeon2(peon) endif + set temp = CreateUnitAtLoc(Player(PLAYER_NEUTRAL_PASSIVE), old_id[racial_lumber], buildloc, 270.0) set u = CreateUnitAtLoc(Player(PLAYER_NEUTRAL_PASSIVE), old_id[racial_lumber], buildloc, 270.0) call RemoveLocation(buildloc) set buildloc = GetUnitLoc(u) + call RemoveUnit(temp) + set temp = null call RemoveUnit(u) set u = null call IssuePointOrderByIdLoc(peon, old_id[racial_lumber], buildloc) @@ -6947,14 +6952,17 @@ function ComputeFrontPoints takes nothing returns nothing set backuplocs[i] = null endif set i = i + 1 - endloop - if front_loc[0] == null then + endloop + if front_loc_num == 0 then + call Trace("WARN: No front locations at all") + set front_locs_computed = false + elseif front_loc[0] == null then call Trace("ERROR: Unexpected Front Location") if front_loc_num > 0 then set front_loc[0] = front_loc[front_loc_num - 1] endif set front_locs_computed = false - else + else set front_locs_computed = true endif set l = null @@ -10090,11 +10098,13 @@ endfunction //============================================================================ function GetBuildLocation takes integer bloc returns location + local integer i = 0 if bloc == BLOC_MINE then return mine_loc endif - if front_loc[0] != null then - return front_loc[GetRandomInt(0, front_loc_num - 1)] + set i = Max(GetRandomInt(0, front_loc_num - 1),0) + if front_loc[i] != null then + return front_loc[i] endif return home_location endfunction @@ -10185,26 +10195,39 @@ endfunction //============================================================================ function BuildAtSpecialLoc takes integer unitid, integer town, integer bloc returns integer - local unit u = CreateUnitAtLoc(Player(PLAYER_NEUTRAL_PASSIVE), old_id[unitid], GetBuildLocation(bloc), 270.0) - local location l = GetUnitLoc(u) + local unit u = null + local unit spaceunit = null + local unit spaceunit2 = null + local location l = null local unit peon = GetExpansionPeon() if peon == null then set peon = GetExpansionPeon2(peon) // In case we can't get the expansion peon endif + if peon == null then + call Trace("BuildatspecialLoc: No peon available") + return CANNOT_BUILD + endif + set spaceunit = CreateUnitAtLoc(Player(PLAYER_NEUTRAL_PASSIVE), old_id[unitid], GetBuildLocation(bloc), 270.0) + if bloc == BLOC_FRONT then + set spaceunit2 = CreateUnitAtLoc(Player(PLAYER_NEUTRAL_PASSIVE), old_id[unitid], GetBuildLocation(bloc), 270.0) + endif + set u = CreateUnitAtLoc(Player(PLAYER_NEUTRAL_PASSIVE), old_id[unitid], GetBuildLocation(bloc), 270.0) + set l = GetUnitLoc(u) call RemoveUnit(u) set u = null + call RemoveUnit(spaceunit) + set spaceunit = null + if (spaceunit2 != null) then + call RemoveUnit(spaceunit2) + set spaceunit2 = null + endif if l == null then //call Trace("BuildatspecialLoc: No location found") //call RemoveLocation(l) //set l = null set peon = null return CANNOT_BUILD - elseif peon == null then - call Trace("BuildatspecialLoc: No peon available") - call RemoveLocation(l) - set l = null - return CANNOT_BUILD elseif not IssuePointOrderByIdLoc(peon, old_id[unitid], l) then //call Trace("Building at special point") //else @@ -10253,6 +10276,14 @@ function StartUnitAM takes integer ask_qty, integer unitid, integer town, intege if needed3[unitid] == UPGRADED and town != -1 and ai_time < available_time[unitid] then return BUILT_SOME endif + + if bloc == BLOC_FRONT and not front_locs_computed then + return BUILT_SOME + endif + + if bloc == BLOC_MINE and mine_loc == null then + return BUILT_SOME + endif // Used so lower priority town hall upgrades only occur when all peons at a higher priority have been built if unitid == racial_peon then @@ -10453,9 +10484,6 @@ function StartUnitAM takes integer ask_qty, integer unitid, integer town, intege //endif if bloc != BLOC_STD then - if bloc == BLOC_FRONT and not front_locs_computed then - return BUILT_SOME - endif if BuildAtSpecialLoc(unitid, town, bloc) != CANNOT_BUILD then // This only occurs if no peon could be obtained return BUILT_SOME endif