Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
Keithenneu committed Mar 27, 2017
2 parents 4789845 + 3a7a367 commit cbdcb8e
Show file tree
Hide file tree
Showing 11 changed files with 216 additions and 117 deletions.
4 changes: 2 additions & 2 deletions abilityUse/abilityUse_crystal_maiden.lua
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ function ConsiderQ()
end

-- If we're seriously retreating, see if we can land a stun on someone who's damaged us recently
if modeName == "retreat" then
if modeName == "retreat" or modeName == "shrine" then
local tableNearbyEnemyHeroes = gHeroVar.GetNearbyEnemies( bot, CastRange + Radius + 200 )
for _, npcEnemy in pairs( tableNearbyEnemyHeroes ) do
if bot:WasRecentlyDamagedByHero( npcEnemy, 2.0 ) then
Expand Down Expand Up @@ -402,7 +402,7 @@ function ConsiderW()
end

-- If we're seriously retreating, see if we can land a stun on someone who's damaged us recently
if modeName == "retreat" then
if modeName == "retreat" or modeName == "shrine" then
local tableNearbyEnemyHeroes = gHeroVar.GetNearbyEnemies( bot, CastRange )
for _, npcEnemy in pairs( tableNearbyEnemyHeroes ) do
if bot:WasRecentlyDamagedByHero( npcEnemy, 2.0 ) then
Expand Down
2 changes: 1 addition & 1 deletion abilityUse/abilityUse_drow_ranger.lua
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ function ConsiderW()
end

-- protect myself
if modeName == "retreat" then
if modeName == "retreat" or modeName == "shrine" then
local closeEnemies = gHeroVar.GetNearbyEnemies(bot, 350)
for _, npcEnemy in pairs( closeEnemies ) do
if utils.ValidTarget(npcEnemy) and not utils.IsTargetMagicImmune( npcEnemy ) and not utils.IsCrowdControlled(npcEnemy) then
Expand Down
8 changes: 4 additions & 4 deletions abilityUse/abilityUse_invoker.lua
Original file line number Diff line number Diff line change
Expand Up @@ -778,7 +778,7 @@ function ConsiderTornado()
--------------------------------------

--------- RETREATING -----------------------
if modeName == "retreat" then
if modeName == "retreat" or modeName == "shrine" then
for _, npcEnemy in pairs( nearbyEnemyHeroes ) do
if utils.ValidTarget(npcEnemy) and bot:WasRecentlyDamagedByHero( npcEnemy, 2.0 ) and
not utils.IsTargetMagicImmune(npcEnemy) then
Expand Down Expand Up @@ -847,7 +847,7 @@ function ConsiderIceWall()
end

--------- RETREATING -----------------------
if modeName == "retreat" then
if modeName == "retreat" or modeName == "shrine" then
local nearbyEnemyHeroes = gHeroVar.GetNearbyEnemies(bot, 1200)
for _, npcEnemy in pairs( nearbyEnemyHeroes ) do
if utils.ValidTarget(npcEnemy) and bot:WasRecentlyDamagedByHero( npcEnemy, 2.0 ) and
Expand Down Expand Up @@ -1137,7 +1137,7 @@ function ConsiderGhostWalk()
end

-- WE ARE RETREATING AND THEY ARE ON US
if modeName == "retreat" then
if modeName == "retreat" or modeName == "shrine" then
local nearbyEnemyHeroes = gHeroVar.GetNearbyEnemies(bot, 1200)
for _, npcEnemy in pairs( nearbyEnemyHeroes ) do
if utils.ValidTarget(npcEnemy) and (bot:WasRecentlyDamagedByHero( npcEnemy, 1.0 )
Expand Down Expand Up @@ -1259,7 +1259,7 @@ function ConsiderColdSnap()
end

-- If we're seriously retreating, see if we can land a stun on someone who's damaged us recently
if modeName == "retreat" then
if modeName == "retreat" or modeName == "shrine" then
local tableNearbyEnemyHeroes = gHeroVar.GetNearbyEnemies( bot, nCastRange )
for _, npcEnemy in pairs( tableNearbyEnemyHeroes ) do
if bot:WasRecentlyDamagedByHero( npcEnemy, 2.0 ) then
Expand Down
36 changes: 30 additions & 6 deletions abilityUse/abilityUse_legion_commander.lua
Original file line number Diff line number Diff line change
Expand Up @@ -201,8 +201,8 @@ function ConsiderW()
end

-- If we're farming
local creeps = gHeroVar.GetNearbyEnemyCreep( bot, 900 )
if modeName == "laning" or modeName == "jungling" then
local creeps = gHeroVar.GetNearbyEnemyCreep( bot, 900 )
if #creeps >= 2 and HealthPerc < 0.5 then
if ManaPerc > 0.4 then
if not utils.IsTargetMagicImmune( bot ) then
Expand All @@ -223,6 +223,10 @@ function ConsiderR()
end

local CastRange = abilityR:GetCastRange()
local Duration = abilityR:GetSpecialValueFloat("duration")
if bot:HasScepter() then
Duration = abilityR:GetSpecialValueFloat("duration_scepter")
end

local modeName = bot.SelfRef:getCurrentMode():GetName()

Expand All @@ -239,7 +243,13 @@ function ConsiderR()
if modeName ~= "retreat" then
if utils.ValidTarget(WeakestEnemy) then
if not WeakestEnemy:IsInvulnerable() then
if HeroHealth <= WeakestEnemy:GetActualIncomingDamage( bot:GetOffensivePower(), DAMAGE_TYPE_ALL ) and
local extraDmg = 0.0
if utils.IsItemAvailable("item_blade_mail") then
extraDmg = WeakestEnemy:GetEstimatedDamageToTarget(true, bot, Min(4.5, Duration), DAMAGE_TYPE_PHYSICAL)
extraDmg = WeakestEnemy:GetActualIncomingDamage(extraDmg, DAMAGE_TYPE_PHYSICAL)
end

if HeroHealth <= (bot:GetEstimatedDamageToTarget(true, WeakestEnemy, Duration, DAMAGE_TYPE_PHYSICAL) + extraDmg) and
#allies >= #enemies then
return BOT_ACTION_DESIRE_HIGH, WeakestEnemy
end
Expand All @@ -256,9 +266,17 @@ function ConsiderR()
if npcEnemy == nil then npcEnemy = getHeroVar("Target") end

if utils.ValidTarget(npcEnemy) then
if not npcEnemy:IsInvulnerable() and GetUnitToUnitDistance(bot, npcEnemy) < CastRange and
#allies >= #enemies then
return BOT_ACTION_DESIRE_MODERATE, npcEnemy
local extraDmg = 0.0
if utils.IsItemAvailable("item_blade_mail") then
extraDmg = npcEnemy:GetEstimatedDamageToTarget(true, bot, Min(4.5, Duration), DAMAGE_TYPE_PHYSICAL)
extraDmg = npcEnemy:GetActualIncomingDamage(extraDmg, DAMAGE_TYPE_PHYSICAL)
end

if not npcEnemy:IsInvulnerable() and GetUnitToUnitDistance(bot, npcEnemy) < CastRange then
if HeroHealth <= (bot:GetEstimatedDamageToTarget(true, npcEnemy, Duration, DAMAGE_TYPE_PHYSICAL) + extraDmg) and
#allies >= #enemies then
return BOT_ACTION_DESIRE_MODERATE, npcEnemy
end
end
end
end
Expand Down Expand Up @@ -299,7 +317,13 @@ function genericAbility:AbilityUsageThink(bot)
end

if castRDesire > 0 then
gHeroVar.HeroUseAbilityOnEntity(bot, abilityR, castRTarget )
if utils.IsItemAvailable("item_blade_mail") then
bot:Action_ClearActions(false)
item_usage.UseBladeMail(bot)
gHeroVar.HeroQueueUseAbilityOnEntity(bot, abilityR, castRTarget )
else
gHeroVar.HeroUseAbilityOnEntity(bot, abilityR, castRTarget )
end
return true
end

Expand Down
2 changes: 1 addition & 1 deletion abilityUse/abilityUse_lina.lua
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ function ConsiderW()
end

-- If we're seriously retreating, see if we can land a stun on someone who's damaged us recently
if modeName == "retreat" then
if modeName == "retreat" or modeName == "shrine" then
local tableNearbyEnemyHeroes = gHeroVar.GetNearbyEnemies( bot, CastRange )
for _, npcEnemy in pairs( tableNearbyEnemyHeroes ) do
if bot:WasRecentlyDamagedByHero( npcEnemy, 2.0 ) then
Expand Down
Loading

0 comments on commit cbdcb8e

Please sign in to comment.