Skip to content

Commit

Permalink
Fixed some bugs.
Browse files Browse the repository at this point in the history
  • Loading branch information
adamqqqplay committed Jan 3, 2018
1 parent e8875b6 commit 490a26f
Show file tree
Hide file tree
Showing 24 changed files with 312 additions and 84 deletions.
2 changes: 1 addition & 1 deletion ability_item_usage_abaddon.lua
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ Consider[2]=function()
then
local npcEnemy = npcBot:GetTarget();

if(ManaPercentage>0.4)
if(ManaPercentage>0.4 and HealthPercentage<=0.66)
then
if ( npcEnemy ~= nil )
then
Expand Down
8 changes: 4 additions & 4 deletions ability_item_usage_antimage.lua
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ Consider[2]=function()
then
if(HeroHealth<=WeakestEnemy:GetActualIncomingDamage(GetComboDamage(),DAMAGE_TYPE_MAGICAL) and npcBot:GetMana()>ComboMana and GetUnitToUnitDistance(npcBot,WeakestEnemy) > 500)
then
return BOT_ACTION_DESIRE_HIGH,GetUnitsTowardsLocation(npcBot,WeakestEnemy,CastRange+200);
return BOT_ACTION_DESIRE_HIGH,utility.GetUnitsTowardsLocation(npcBot,WeakestEnemy,CastRange+200);
end
end
end
Expand All @@ -129,13 +129,13 @@ Consider[2]=function()
-- If we trapped by the trees
if(trees~=nil and #trees>=10 or (utility.PointToPointDistance(npcBot:GetLocation(),npcBot.Blink.Point)<=100 and DotaTime()-npcBot.Blink.Timer<10 and DotaTime()-npcBot.Blink.Timer>8))
then
return BOT_ACTION_DESIRE_HIGH, GetUnitsTowardsLocation(npcBot,GetAncient(GetTeam()),CastRange)
return BOT_ACTION_DESIRE_HIGH, utility.GetUnitsTowardsLocation(npcBot,GetAncient(GetTeam()),CastRange)
end

-- If we're seriously retreating, see if we can land a stun on someone who's damaged us recently
if ( npcBot:GetActiveMode() == BOT_MODE_RETREAT and npcBot:DistanceFromFountain()>=2000 and (ManaPercentage>=0.6 or npcBot:GetActiveModeDesire() >= BOT_MODE_DESIRE_HIGH or HealthPercentage<=0.6))
then
return BOT_ACTION_DESIRE_HIGH, GetUnitsTowardsLocation(npcBot,GetAncient(GetTeam()),CastRange)
return BOT_ACTION_DESIRE_HIGH, utility.GetUnitsTowardsLocation(npcBot,GetAncient(GetTeam()),CastRange)
end

-- If we're going after someone
Expand All @@ -155,7 +155,7 @@ Consider[2]=function()
then
if ( CanCast[abilityNumber]( npcEnemy ) and GetUnitToUnitDistance(npcBot,npcEnemy)< CastRange + 75*#allys and GetUnitToUnitDistance(npcBot,npcEnemy) > 500)
then
return BOT_ACTION_DESIRE_MODERATE, GetUnitsTowardsLocation(npcBot,npcEnemy,CastRange+200);
return BOT_ACTION_DESIRE_MODERATE, utility.GetUnitsTowardsLocation(npcBot,npcEnemy,CastRange+200);
end
end
end
Expand Down
6 changes: 3 additions & 3 deletions ability_item_usage_arc_warden.lua
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ Consider[2]=function()
do
if ( npcBot:WasRecentlyDamagedByHero( npcEnemy, 2.0 ) and CanCast[abilityNumber]( npcEnemy ) or GetUnitToUnitDistance(npcBot,npcEnemy)<400)
then
return BOT_ACTION_DESIRE_HIGH, GetUnitsTowardsLocation(npcEnemy,npcBot,Radius);
return BOT_ACTION_DESIRE_HIGH, utility.GetUnitsTowardsLocation(npcEnemy,npcBot,Radius);
end
end
end
Expand All @@ -312,7 +312,7 @@ Consider[2]=function()
then
if ( CanCast[abilityNumber]( npcEnemy ) )
then
return BOT_ACTION_DESIRE_HIGH, GetUnitsTowardsLocation(npcBot,npcEnemy,Radius);
return BOT_ACTION_DESIRE_HIGH, utility.GetUnitsTowardsLocation(npcBot,npcEnemy,Radius);
end
end
end
Expand Down Expand Up @@ -386,7 +386,7 @@ Consider[3]=function()
then
if ( CanCast[abilityNumber]( WeakestEnemy ) )
then
return BOT_ACTION_DESIRE_LOW,GetUnitsTowardsLocation(npcBot,WeakestEnemy,GetUnitToUnitDistance(npcBot,WeakestEnemy)+300)
return BOT_ACTION_DESIRE_LOW,utility.GetUnitsTowardsLocation(npcBot,WeakestEnemy,GetUnitToUnitDistance(npcBot,WeakestEnemy)+300)
end
end
end
Expand Down
8 changes: 4 additions & 4 deletions ability_item_usage_ember_spirit.lua
Original file line number Diff line number Diff line change
Expand Up @@ -552,7 +552,7 @@ Consider[4]=function()
if(HeroHealth<=WeakestEnemy:GetActualIncomingDamage(Damage,DAMAGE_TYPE_MAGICAL) or (HeroHealth<=WeakestEnemy:GetActualIncomingDamage(GetComboDamage(),DAMAGE_TYPE_MAGICAL) and npcBot:GetMana()>ComboMana))
then
local d=GetUnitToUnitDistance(npcBot,WeakestEnemy)
return BOT_ACTION_DESIRE_HIGH,GetUnitsTowardsLocation(npcBot,WeakestEnemy,d+300)
return BOT_ACTION_DESIRE_HIGH,utility.GetUnitsTowardsLocation(npcBot,WeakestEnemy,d+300)
end
end
end
Expand All @@ -566,7 +566,7 @@ Consider[4]=function()
then
if ( npcBot:WasRecentlyDamagedByAnyHero(2) or #enemys >=1)
then
return BOT_ACTION_DESIRE_HIGH, GetUnitsTowardsLocation(enemys[1],npcBot,CastRange);
return BOT_ACTION_DESIRE_HIGH, utility.GetUnitsTowardsLocation(enemys[1],npcBot,CastRange);
end
end

Expand Down Expand Up @@ -599,7 +599,7 @@ Consider[4]=function()
local d=GetUnitToUnitDistance(npcBot,npcEnemy)
if ( CanCast[abilityNumber]( npcEnemy ) and not enemyDisabled(npcEnemy) and d< CastRange + 75*#allys)
then
return BOT_ACTION_DESIRE_MODERATE, GetUnitsTowardsLocation(npcBot,npcEnemy,d+300)
return BOT_ACTION_DESIRE_MODERATE, utility.GetUnitsTowardsLocation(npcBot,npcEnemy,d+300)
end
end
end
Expand Down Expand Up @@ -672,7 +672,7 @@ Consider[5]=function_r()
local d=GetUnitToUnitDistance(npcBot,npcEnemy)
if ( CanCast[abilityNumber]( npcEnemy ) and not enemyDisabled(npcEnemy) and d< CastRange + 75*#allys)
then
return BOT_ACTION_DESIRE_MODERATE, GetUnitsTowardsLocation(npcBot,npcEnemy,d+300)
return BOT_ACTION_DESIRE_MODERATE, utility.GetUnitsTowardsLocation(npcBot,npcEnemy,d+300)
end
end
end
Expand Down
8 changes: 4 additions & 4 deletions ability_item_usage_faceless_void.lua
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ Consider[1]=function()
then
if(HeroHealth<=WeakestEnemy:GetActualIncomingDamage(GetComboDamage(),DAMAGE_TYPE_MAGICAL) and npcBot:GetMana()>ComboMana)
then
return BOT_ACTION_DESIRE_HIGH,GetUnitsTowardsLocation(npcBot,WeakestEnemy,CastRange+200);
return BOT_ACTION_DESIRE_HIGH,utility.GetUnitsTowardsLocation(npcBot,WeakestEnemy,CastRange+200);
end
end
end
Expand All @@ -129,13 +129,13 @@ Consider[1]=function()
-- If we trapped by the trees
if(trees~=nil and #trees>=10)
then
return BOT_ACTION_DESIRE_HIGH, GetUnitsTowardsLocation(npcBot,GetAncient(GetTeam()),CastRange)
return BOT_ACTION_DESIRE_HIGH, utility.GetUnitsTowardsLocation(npcBot,GetAncient(GetTeam()),CastRange)
end

-- If we're seriously retreating
if ( npcBot:GetActiveMode() == BOT_MODE_RETREAT or npcBot.FacelessVoidSkill1.Hp-HealthPercentage>=0.15+0.03*#enemys)
then
return BOT_ACTION_DESIRE_HIGH, GetUnitsTowardsLocation(npcBot,GetAncient(GetTeam()),CastRange)
return BOT_ACTION_DESIRE_HIGH, utility.GetUnitsTowardsLocation(npcBot,GetAncient(GetTeam()),CastRange)
end

if(npcBot:GetActiveMode() ~= BOT_MODE_RETREAT and ManaPercentage>ComboMana and AbilitiesReal[4]:IsFullyCastable())
Expand Down Expand Up @@ -164,7 +164,7 @@ Consider[1]=function()
then
if ( CanCast[abilityNumber]( npcEnemy ) and GetUnitToUnitDistance(npcBot,npcEnemy)>CastRange-200 and GetUnitToUnitDistance(npcBot,npcEnemy)<1200)
then
return BOT_ACTION_DESIRE_MODERATE, GetUnitsTowardsLocation(npcBot,npcEnemy,CastRange+200);
return BOT_ACTION_DESIRE_MODERATE, utility.GetUnitsTowardsLocation(npcBot,npcEnemy,CastRange+200);
end
end
end
Expand Down
3 changes: 2 additions & 1 deletion ability_item_usage_generic.lua
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,8 @@ function PrintDebugInfo(AbilitiesReal,cast)
do
if ( cast.Desire[i]~=nil and cast.Desire[i] > 0 )
then
if (cast.Type[i]==nil or cast.Type[i]=="Target") and cast.Target[i]~=nil
local ability=AbilitiesReal[i]
if (cast.Type[i]==nil or cast.Type[i]=="Target") and cast.Target[i]~=nil and utility.CheckFlag(ability:GetBehavior(),ABILITY_BEHAVIOR_UNIT_TARGET)
then
utility.DebugTalk("try to use skill "..i.." at "..cast.Target[i]:GetUnitName().." Desire= "..cast.Desire[i])
else
Expand Down
9 changes: 6 additions & 3 deletions ability_item_usage_huskar.lua
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,10 @@ Consider[1]=function()
if(npcBot:GetHealth()/npcBot:GetMaxHealth()<(0.5+#enemys*0.05+0.2*ManaPercentage) or
(npcBot:GetActiveMode() == BOT_MODE_RETREAT and npcBot:GetActiveModeDesire() >= BOT_MODE_DESIRE_MODERATE))
then
return BOT_ACTION_DESIRE_HIGH, npcBot;
if(CanCast[abilityNumber]( npcBot ))
then
return BOT_ACTION_DESIRE_HIGH, npcBot;
end
end

-- If we're going after someone
Expand All @@ -147,7 +150,7 @@ Consider[1]=function()

if ( npcEnemy ~= nil)
then
if(GetUnitToUnitDistance( npcBot, npcEnemy ) <= 500)
if(GetUnitToUnitDistance( npcBot, npcEnemy ) <= 500 and CanCast[abilityNumber]( npcBot ))
then
return BOT_ACTION_DESIRE_MODERATE, npcBot;
end
Expand All @@ -157,7 +160,7 @@ Consider[1]=function()
--protect teammate
if(WeakestAlly~=nil)
then
if(WeakestAlly:GetHealth()/WeakestAlly:GetMaxHealth()<(0.4+#enemys*0.05+0.2*ManaPercentage))
if(WeakestAlly:GetHealth()/WeakestAlly:GetMaxHealth()<(0.4+#enemys*0.05+0.2*ManaPercentage) and CanCast[abilityNumber]( WeakestAlly ))
then
return BOT_ACTION_DESIRE_LOW, WeakestAlly;
end
Expand Down
Loading

0 comments on commit 490a26f

Please sign in to comment.