Skip to content

Commit

Permalink
Merge pull request #187 from Keithenneu/master
Browse files Browse the repository at this point in the history
fix #186
  • Loading branch information
Nostrademous authored Mar 27, 2017
2 parents 3a7a367 + cbdcb8e commit 34c3469
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 10 deletions.
35 changes: 26 additions & 9 deletions global_hero_data.lua
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,31 @@ function X.GetNearbyAllies(bot, range)
end

function X.GetNearbyEnemyTowers(bot, range)
local endList = bot:GetNearbyTowers(range, true)
--local startList = X[bot:GetPlayerID()].NearbyEnemyTowers
--local endList = {}
--for _, val in pairs(startList) do
-- if GetUnitToUnitDistance(bot, val) <= range then
-- table.insert(endList, val)
-- end
--end
local startList = bot:GetNearbyTowers(range, true)

endList = {}
for _, val in pairs(startList) do
if string.find(val:GetUnitName(), "tower") then
table.insert(endList, val)
end
end
return endList
end

function X.GetNearbyEnemyBarracks(bot, range)
local endList = bot:GetNearbyBarracks(range, true)
if #endList > 0 then
print("[CRITICAL]: API bug fixed. plas adjust code. random uniqe marker: AWESDFWRGWFE")
end

local startList = bot:GetNearbyTowers(range, true)

endList = {}
for _, val in pairs(startList) do
if string.find(val:GetUnitName(), "rax") then
table.insert(endList, val)
end
end
return endList
end

Expand Down Expand Up @@ -320,4 +337,4 @@ function X.ExecuteHeroActionQueue(bot)
return
end

return X
return X
13 changes: 12 additions & 1 deletion modes/pushlane.lua
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ function X:Think(bot)

local Towers = gHeroVar.GetNearbyEnemyTowers(bot, 750)
local Shrines = bot:GetNearbyShrines(1200, true)
local Barracks = bot:GetNearbyBarracks(1200, true)
local Barracks = gHeroVar.GetNearbyEnemyBarracks(bot, 1200)
local Ancient = GetAncient(utils.GetOtherTeam())

-- if there are no structures near by
Expand Down Expand Up @@ -237,6 +237,17 @@ function X:Desire(bot)
end
end

local nearbyEBarracks = gHeroVar.GetNearbyEnemyBarracks(bot, Max(750, bot:GetAttackRange()))
if #nearbyEBarracks > 0 then
if not modifiers.IsBuildingGlyphed(nearbyEBarracks[1]) then
return BOT_MODE_DESIRE_HIGH
end
end

if GetUnitToUnitDistance(GetAncient(utils.GetOtherTeam()), bot) < 1200 then
return BOT_MODE_DESIRE_HIGH
end

if #gHeroVar.GetNearbyAlliedCreep(bot, 1000) >= 1 and #gHeroVar.GetNearbyEnemies(bot, 1200) == 0 then
return BOT_MODE_DESIRE_LOW
end
Expand Down

0 comments on commit 34c3469

Please sign in to comment.