Skip to content
Permalink
Browse files

Adapted DAI to latest Zaal changes and fixed some Forb's fuck ups

  • Loading branch information...
Damgam committed Jul 6, 2019
1 parent 727b15f commit 5cb6471819d956e6dc02a11519aa847a0ab6646d
@@ -154,7 +154,7 @@ end
function NoMex(x,z, batchextracts,teamID) -- Is there any better mex at this location (returns false if there is)
local mexesatspot = Spring.GetUnitsInCylinder(x,z,128)
for ct, uid in pairs(mexesatspot) do
if (string.find(UnitDefs[Spring.GetUnitDefID(uid)].name, "emetalextractor") or string.find(UnitDefs[Spring.GetUnitDefID(uid)].name, "zhive")) and (teamID and Spring.AreTeamsAllied(Spring.GetUnitTeam(uid), teamID)) then
if (string.find(UnitDefs[Spring.GetUnitDefID(uid)].name, "emetalextractor") or string.find(UnitDefs[Spring.GetUnitDefID(uid)].name, "zhive") or string.find(UnitDefs[Spring.GetUnitDefID(uid)].name, "zhatch") or string.find(UnitDefs[Spring.GetUnitDefID(uid)].name, "zlair")) and (teamID and Spring.AreTeamsAllied(Spring.GetUnitTeam(uid), teamID)) then
return false
end
end
@@ -164,7 +164,7 @@ end
function EnemyMex(x,z, batchextracts,teamID) -- Is there any better mex at this location (returns false if there is)
local mexesatspot = Spring.GetUnitsInCylinder(x,z,128)
for ct, uid in pairs(mexesatspot) do
if (string.find(UnitDefs[Spring.GetUnitDefID(uid)].name, "emetalextractor") or string.find(UnitDefs[Spring.GetUnitDefID(uid)].name, "zhive")) and (teamID and not Spring.AreTeamsAllied(Spring.GetUnitTeam(uid), teamID)) then
if (string.find(UnitDefs[Spring.GetUnitDefID(uid)].name, "emetalextractor") or string.find(UnitDefs[Spring.GetUnitDefID(uid)].name, "zhive") or string.find(UnitDefs[Spring.GetUnitDefID(uid)].name, "zhatch") or string.find(UnitDefs[Spring.GetUnitDefID(uid)].name, "zlair")) and (teamID and not Spring.AreTeamsAllied(Spring.GetUnitTeam(uid), teamID)) then
return true
end
end
@@ -179,7 +179,7 @@ function MetalSpotHandler:ClosestFreeSpot(unittype,position,maxdis)
for i,v in ipairs(self.spots) do
local p = v
local dist = distance(position,p)
if NoMex(p.x, p.z, string.find(UnitDefs[unittype.id].name, "emetalextractor"), teamID) or NoMex(p.x, p.z, string.find(UnitDefs[unittype.id].name, "zhive"), teamID) then
if NoMex(p.x, p.z, string.find(UnitDefs[unittype.id].name, "emetalextractor"), teamID) or NoMex(p.x, p.z, string.find(UnitDefs[unittype.id].name, "zhive"), teamID) or NoMex(p.x, p.z, string.find(UnitDefs[unittype.id].name, "zhatch"), teamID) or NoMex(p.x, p.z, string.find(UnitDefs[unittype.id].name, "zlair"), teamID) then
if EnemyMex(p.x, p.z, string.find(UnitDefs[unittype.id].name, "emetalextractor"), teamID) == false then
if dist < bestDistance then
bestDistance = dist
@@ -199,7 +199,7 @@ function MetalSpotHandler:ClosestEnemySpot(unittype,position)
for i,v in ipairs(self.spots) do
local p = v
local dist = distance(position,p)
if EnemyMex(p.x, p.z, string.find(UnitDefs[unittype.id].name, "emetalextractor"), teamID) or EnemyMex(p.x, p.z, string.find(UnitDefs[unittype.id].name, "zhive"), teamID) then
if EnemyMex(p.x, p.z, string.find(UnitDefs[unittype.id].name, "emetalextractor"), teamID) or EnemyMex(p.x, p.z, string.find(UnitDefs[unittype.id].name, "zhive"), teamID) or EnemyMex(p.x, p.z, string.find(UnitDefs[unittype.id].name, "zhatch"), teamID) or EnemyMex(p.x, p.z, string.find(UnitDefs[unittype.id].name, "zlair"), teamID) then
if dist < bestDistance then
bestDistance = dist
pos = p
@@ -1025,42 +1025,38 @@ end

------------------------------------------------- ZAAAAAAAAAAAAAALS

local function ZaalMorph(tqb, ai, unit)
local r = math.random(1,5)
if r == 1 then
return ezMorph
else
return skip
end
end


local function ZaalUnitLists(tqb, ai, unit)
local hivecount = Spring.GetTeamUnitDefCount(ai.id, UnitDefNames.zhive.id) - UUDC("zhive", ai.id)
--GG.TechCheck("techX", ai.id)
local techs = 0
if GG.TechCheck("tech1", ai.id) then techs = techs + 1 end
if GG.TechCheck("tech2", ai.id) then techs = techs + 1 end
if GG.TechCheck("tech3", ai.id) then techs = techs + 1 end
--local hivecount = Spring.GetTeamUnitDefCount(ai.id, UnitDefNames.zhive.id) - UUDC("zhive", ai.id)
--Spring.Echo(hivecount.." hives for team "..ai.id)
local r = math.random(0,hivecount)
if r == 0 or r == 1 then
local options = {"zlightswarm",}
return FindBest(options,ai)
elseif r == 2 then
local options = {"zlightswarm", "zairscout",}
return FindBest(options,ai)
elseif r == 3 then
local options = {"zlightswarm", "zairscout", "zmedswarm",}
return FindBest(options,ai)
elseif r == 4 then
local options = {"zlightswarm", "zairscout", "zmedswarm", "zairtoairfighter", "zairtogroundfighter",}
return FindBest(options,ai)
elseif r == 5 then
local options = {"zlightswarm", "zairscout", "zmedswarm", "zairtoairfighter", "zairtogroundfighter", "zairbomber",}
return FindBest(options,ai)
elseif r == 6 then
local options = {"zlightswarm", "zairscout", "zmedswarm", "zairtoairfighter", "zairtogroundfighter", "zairbomber", "zarty", "zassault", "zkamikaze", "zskirmisher",}
return FindBest(options,ai)
elseif r == 7 then
local options = {"zlightswarm", "zairscout", "zmedswarm", "zairtoairfighter", "zairtogroundfighter", "zairbomber", "zarty", "zassault", "zkamikaze", "zskirmisher",}
return FindBest(options,ai)
elseif r == 8 then
local options = {"zlightswarm", "zairscout", "zmedswarm", "zairtoairfighter", "zairtogroundfighter", "zairbomber", "zarty", "zassault", "zkamikaze", "zskirmisher", "zpyro",}
return FindBest(options,ai)
elseif r == 9 then
local options = {"zlightswarm", "zairscout", "zmedswarm", "zairtoairfighter", "zairtogroundfighter", "zairbomber", "zarty", "zassault", "zkamikaze", "zskirmisher", "zpyro",}
return FindBest(options,ai)
elseif r >= 10 then
local r = math.random(1,techs)

if GG.TechCheck("tech3", ai.id) then
local options = {"zlightswarm", "zairscout", "zmedswarm", "zairtoairfighter", "zairtogroundfighter", "zairbomber", "zarty", "zassault", "zkamikaze", "zskirmisher", "zpyro", "zqueen",}
return FindBest(options,ai)
return FindBest(options, ai)
elseif GG.TechCheck("tech2", ai.id) then
local options = {"zlightswarm", "zairscout", "zmedswarm", "zairtoairfighter", "zairtogroundfighter", "zairbomber", "zarty", "zassault", "zkamikaze", "zskirmisher", "zpyro",}
return FindBest(options, ai)
elseif GG.TechCheck("tech1", ai.id) then
local options = {"zlightswarm", "zairscout", "zmedswarm", "zairtoairfighter",}
return FindBest(options, ai)
end

--local options = {"zlightswarm", "zairscout", "zmedswarm", "zairtoairfighter", "zairtogroundfighter", "zairbomber", "zarty", "zassault", "zkamikaze", "zskirmisher", "zpyro", "zqueen",}
--
--if GG.TechCheck("1 hive", ai.id) then
-- local build = random{zlightswarm, zairscout}
@@ -1082,15 +1078,20 @@ local function ZaalArmLists(tqb, ai, unit)
end


local ZaalHive = {
local ZaalHive1 = {
ZaalUnitLists,
ZaalMorph,
}

local ZaalHive2 = {
ZaalUnitLists,
}

local ZaalArm = {
ZaalArmLists,
"zhive",
"zhive",
"zhive",
"zhatch",
"zhatch",
"zhatch",
}


@@ -1124,6 +1125,8 @@ taskqueues = {
ebasefactory_up2 = HoverFactoryQueueUP2,
ebasefactory_up3 = HoverFactoryQueueUP3,
zarm = ZaalArm,
zhive = ZaalHive,
zhive = ZaalHive2,
zhatch = ZaalHive1,
zlair = ZaalHive1,
}
----------------------------------------------------------
@@ -31,11 +31,8 @@ unitDef = {
maxSlope = 25,
maxWaterDepth = 99999999999,
metalStorage = 0,
<<<<<<< HEAD
metalMake = 1,
=======
metalMake = metalMultiplier,
>>>>>>> Get the tech structure all set up and set some tentative balance for Zaal
name = humanName,
objectName = objectName,
script = script,

0 comments on commit 5cb6471

Please sign in to comment.
You can’t perform that action at this time.