Skip to content

Commit

Permalink
hopefully fixed Zaal DAI
Browse files Browse the repository at this point in the history
  • Loading branch information
Damgam committed Feb 8, 2020
1 parent 840f755 commit 4de378d
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 4 deletions.
37 changes: 34 additions & 3 deletions LuaRules/Gadgets/ai/EvoRTS/taskqueues.lua
Expand Up @@ -1104,7 +1104,24 @@ end
-- end

local function ZaalBuildHatch(tqb, ai, unit)
return "zhatch"
local mc, ms, mp, mi, me = Spring.GetTeamResources(ai.id, "metal")
local ec, es, ep, ei, ee = Spring.GetTeamResources(ai.id, "energy")
local SpawnerCount = GetZaalSpawners(tqb,ai,unit)
if SpawnerCount < 1 then
return "zhatch"
elseif ec >= es*0.7 and mc >= ms*0.5 and GG.TechCheck("tech1", ai.id) then
if SpawnerCount <= Spring.GetGameSeconds()/300
return "zhatch"
else
return "ztenticle"
end
else
return "zmex"
end
end

local function ZaalBuildMetal(tqb, ai, unit)
return "zmex"
end

local function ZaalBuildEnergy(tqb, ai, unit)
Expand All @@ -1115,7 +1132,7 @@ local function ZaalBuildEnergy(tqb, ai, unit)
elseif ec <= es*0.7 and GG.TechCheck("tech1", ai.id) then
return "zespire1"
else
return "zhatch"
return "zmex"
end
end

Expand All @@ -1128,7 +1145,7 @@ local function ZaalBuildSupply(tqb, ai, unit)
elseif su > sm - 35 and sm ~= MaximumSupply then
return "ztiberium"
else
return "zhatch"
return "zmex"
end
end

Expand All @@ -1148,21 +1165,31 @@ local ZaalHive3 = {

local ZaalArm = {
ZaalBuildHatch,
ZaalBuildMetal,
ZaalBuildSupply,
ZaalBuildEnergy,
ZaalBuildMetal,
ZaalBuildSupply,
ZaalBuildEnergy,
ZaalBuildMetal,
ZaalBuildSupply,
ZaalBuildEnergy,
ZaalBuildMetal,
ZaalBuildSupply,
ZaalBuildEnergy,
ZaalBuildMetal,
ZaalBuildSupply,
ZaalBuildEnergy,
ZaalBuildMetal,
}

local ZaalEspire = {
ZaalMorph,
}

local ZaalTenticle = {
assistaround,
}

-- Pattern

Expand Down Expand Up @@ -1301,10 +1328,14 @@ taskqueues = {
zhatch_up2 = ZaalHive3,
zhatch = ZaalHive1,
zhatch_up1 = ZaalHive2,
zmex = ZaalEspire,
zmex_up1 = ZaalEspire,
zmex_up2 = ZaalEspire,
zespire1 = ZaalEspire,
zespire4 = ZaalEspire,
xcommander = xcommanderqueue,
xkconstructor = xk1constructor,
xklab = PatternKLab,
ztenticle = ZaalTenticle,
}
----------------------------------------------------------
2 changes: 1 addition & 1 deletion LuaRules/Gadgets/ai/preload/spring_lua/unittype.lua
Expand Up @@ -71,7 +71,7 @@ function ShardUnitType:WeaponCount()
end

function ShardUnitType:Extractor()
if self.def.name == "xmetalextractor" or self.def.name == "xmetalextractormoho" then
if self.def.name == "xmetalextractor" or self.def.name == "xmetalextractormoho" or string.find(self.def.name, "zmex") then
return true
elseif self.def.customParams.metal_extractor then
return true
Expand Down

0 comments on commit 4de378d

Please sign in to comment.