-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Update common.eai * fix * Update FAST_BUILD.eai * Update TOWER_RUSH.eai * Update WISP_CHECK.eai * Update MILITIA_EXPAND.eai * Update common.eai * fix * Update common.eai * fix * fix * fix * fix up and down cannot set zoom * Update ANCIENT_EXPANSION.eai * Update ITEM_EXPANSION.eai * Update MICRO_HERO.eai * Update MICRO_UNITS.eai * Update MILITIA_CHECK.eai * Update common.eai * Update races.eai * Update Jobs.txt * Add files via upload * Delete Jobs/WISP_CHECK.eai * Add files via upload * Update RETREAT_CONTROL.eai * Update RETREAT_CONTROL.eai * Update RETREAT_CONTROL.eai * Update RETREAT_CONTROL.eai * Update MILITIA_CHECK.eai * Update FOCUSFIRE_CONTROL.eai * fix Compilation error * fix Compilation error * optimized code * Update README.md * Update Blizzard.eai * Optimized * - Fixed add water_expansion_list no check Resource Amount * Update common.eai * optimize * patrol Order not send UNIT_TYPE_FLYING * patrol Order not send UNIT_TYPE_FLYING * fix not buy item * Update common.eai * improve ally shop buyitem * improve zoom tis * fix Observer Player zoom * Review PR Review PR and fix water expansions breaking expansion logic when no zepplins possible. * Further tweak to zeppelin expansion to not block when zeppelins don't exist Mainly for maps where zeppelins do not exist, but also far expansions can still be built on even if zeppelin is not available to prevent AI being blocked. * Update CHANGELOG.md --------- Co-authored-by: jzy-chitong56 <[email protected]>
- Loading branch information
1 parent
0767d38
commit 36eb0ea
Showing
17 changed files
with
989 additions
and
731 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,162 @@ | ||
#IFDEF GLOBAL | ||
unit secondmine = null | ||
#ELSE | ||
function PeonMineCheck takes unit mine returns boolean | ||
local group g = CreateGroup() | ||
local group tempg = null | ||
local location unitloc = GetUnitLoc(mine) | ||
local unit u = null | ||
local unit savewisp = null | ||
local integer i = 0 | ||
local integer peon = TownCount(racial_peon) | ||
local integer peond = TownCountDone(racial_peon) | ||
local integer delaywisps = ver_optimal_gold - 1 | ||
call DisplayToAllJobDebug("HARVEST CHECK Job Start") | ||
if peond > 6 then | ||
set delaywisps = ver_optimal_gold | ||
endif | ||
if race_manual_loading then | ||
call GroupEnumUnitsOfPlayer(g, ai_player, null) | ||
set g = SelectById(g, old_id[race_manual_loading_wisp], true) | ||
set g = SelectByAlive(g, true) | ||
set tempg = CreateGroup() | ||
loop | ||
set u = FirstOfGroup(g) | ||
exitwhen u == null | ||
if IsUnitInTransport(u, mine) then | ||
set savewisp = u | ||
set i = i + 1 | ||
elseif not IsUnitHidden(u) then | ||
call GroupAddUnit(tempg, u) | ||
endif | ||
call GroupRemoveUnit(g, u) | ||
endloop | ||
if FoodSpace() <= 0 and i >= 3 then // no foodspace , no peon(at least keep 2 harvest mine) , need one harvest mine peon build Farms | ||
if peon == peond and peon <= 4 then | ||
set delaywisps = 2 | ||
call IssueTargetOrder(mine, "unload", savewisp) | ||
endif | ||
elseif peond < 7 and not hero_built[1] then | ||
set delaywisps = ver_optimal_gold - 2 | ||
endif | ||
if i < delaywisps then | ||
set tempg = SelectByLoaded(tempg, false) | ||
set tempg = SelectUnittype(tempg, UNIT_TYPE_STRUCTURE, false) // Preventing Tree Transformation | ||
set tempg = GetNearestSubGroupOfGroup(tempg, unitloc, delaywisps - i) | ||
//call GroupRemoveGuardPositionInstant(g) // this gets wisps to come off the trees. | ||
//call GroupTargetOrder(g, "harvest", mine) | ||
loop //use accurate quantity control , prevent any wips harvestmine , but mine no vacancies | ||
set u = FirstOfGroup(tempg) | ||
exitwhen u == null or i == delaywisps | ||
call IssueTargetOrder(u, "harvest", mine) | ||
set i = i + 1 | ||
call GroupRemoveUnit(tempg, u) | ||
endloop | ||
endif | ||
call DestroyGroup(tempg) | ||
set tempg = null | ||
set savewisp = null | ||
elseif race_uses_mine_expansion then | ||
set delaywisps = Min(ver_optimal_gold,peond) | ||
call GroupEnumUnitsOfPlayer(g, ai_player, null) | ||
set g = SelectUnittype(g, UNIT_TYPE_PEON, true) | ||
set g = SelectByAlive(g, true) | ||
set g = SelectByHidden(g, false) | ||
set tempg = CreateGroup() | ||
loop | ||
set u = FirstOfGroup(g) | ||
exitwhen u == null or i == delaywisps | ||
if GetUnitCurrentOrder(u) == OrderId("harvest") and DistanceBetweenUnits(u,mine) < 225 then // UD harvest gold max Distance is 221 | ||
set i = i + 1 | ||
elseif GetUnitCurrentOrder(u) == 0 and not IsUnitBuying(u) and not IsUnitInGroup(u, unit_zepplin_move) then | ||
call GroupAddUnit(tempg,u) // prevent the mine harvest peon more than 5 | ||
endif | ||
call GroupRemoveUnit(g, u) | ||
endloop | ||
if i < delaywisps then | ||
loop | ||
set u = FirstOfGroup(tempg) | ||
exitwhen u == null or i == delaywisps | ||
call IssueTargetOrder(u, "harvest", mine) | ||
set i = i + 1 | ||
call GroupRemoveUnit(tempg, u) | ||
endloop | ||
endif | ||
call DestroyGroup(tempg) | ||
set tempg = null | ||
else //human and orc | ||
call GroupEnumUnitsOfPlayer(g, ai_player, null) | ||
set g = SelectUnittype(g, UNIT_TYPE_PEON, true) | ||
set g = SelectByAlive(g, true) | ||
set g = SelectByHidden(g, false) | ||
set g = GetNearestSubGroupOfGroup(g, home_location, 10) | ||
loop | ||
set u = FirstOfGroup(g) | ||
exitwhen u == null or i == delaywisps | ||
if (GetUnitCurrentOrder(u) == 0 or GetUnitCurrentOrder(u) == OrderId("harvest")) and not IsUnitBuying(u) and not IsUnitInGroup(u, unit_zepplin_move) then // no get other order peon , maybe the peon go buy unit or build some | ||
call IssueTargetOrder(u, "harvest", mine) | ||
endif | ||
call GroupRemoveUnit(g, u) | ||
set i = i + 1 | ||
endloop | ||
set i = delaywisps //human and orc no need full | ||
endif | ||
call RemoveLocation(unitloc) | ||
set unitloc = null | ||
call DestroyGroup(g) | ||
set g = null | ||
set u = null | ||
return i < delaywisps | ||
endfunction | ||
|
||
function HarvestCheckJob takes nothing returns nothing | ||
local group g = null | ||
local unit u = null | ||
local integer i = 0 | ||
local boolean mines_not_full = true | ||
// call DisplayToAll("Harvest Start") | ||
if first_town_mine == -1 then | ||
return // home_location no more mine , ORC and HUMAN no need run | ||
endif | ||
set g = CreateGroup() | ||
if race_manual_loading then | ||
call GroupEnumUnitsOfPlayer(g, ai_player, null) | ||
set g = SelectNumberOfId(g, 100, old_id[race_manual_loading_mine]) | ||
elseif not TownThreatened() then | ||
if race_uses_mine_expansion then | ||
call GroupEnumUnitsInRangeOfLoc(g, home_location, 1500, null) | ||
set g = SelectByPlayer(g, ai_player, true) | ||
set g = SelectById(g, old_id[racial_expansion], true) | ||
elseif GetResourceAmount(secondmine) <= 0 and TownCountDone(racial_peon) > 10 then //human and orc | ||
call GroupEnumUnitsInRangeOfLoc(g, home_location, 1500, null) | ||
call GroupRemoveUnit(g,own_town_mine[0]) | ||
set g = SelectById(g, old_id[GOLD_MINE], true) | ||
loop | ||
set u = FirstOfGroup(g) | ||
exitwhen u == null | ||
if GetResourceAmount(u) > i then // find Resource max mine | ||
set i = GetResourceAmount(u) | ||
set secondmine = u | ||
endif | ||
call GroupRemoveUnit(g, u) | ||
endloop | ||
call GroupAddUnit(g, secondmine) // only first take secondmine run PeonMineCheck , Prevention have more peon harvest | ||
endif | ||
endif | ||
loop | ||
set u = FirstOfGroup(g) | ||
exitwhen u == null | ||
if UnitAlive(u) then | ||
set mines_not_full = PeonMineCheck(u) and mines_not_full | ||
endif | ||
call GroupRemoveUnit(g, u) | ||
endloop | ||
call DestroyGroup(g) | ||
set g = null | ||
if mines_not_full then | ||
call TQAddJob(4, HARVEST_CHECK, 0) | ||
else | ||
call TQAddJob(40, HARVEST_CHECK, 0) | ||
endif | ||
endfunction | ||
#ENDIF |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.