diff --git a/ability_item_usage_abaddon.lua b/ability_item_usage_abaddon.lua index 90d68a32..2347e0df 100644 --- a/ability_item_usage_abaddon.lua +++ b/ability_item_usage_abaddon.lua @@ -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 diff --git a/ability_item_usage_antimage.lua b/ability_item_usage_antimage.lua index 6880d5b1..05cec576 100644 --- a/ability_item_usage_antimage.lua +++ b/ability_item_usage_antimage.lua @@ -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 @@ -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 @@ -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 diff --git a/ability_item_usage_arc_warden.lua b/ability_item_usage_arc_warden.lua index 4cf4afa6..d43964a9 100644 --- a/ability_item_usage_arc_warden.lua +++ b/ability_item_usage_arc_warden.lua @@ -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 @@ -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 @@ -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 diff --git a/ability_item_usage_ember_spirit.lua b/ability_item_usage_ember_spirit.lua index e1dc85dd..35758d97 100644 --- a/ability_item_usage_ember_spirit.lua +++ b/ability_item_usage_ember_spirit.lua @@ -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 @@ -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 @@ -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 @@ -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 diff --git a/ability_item_usage_faceless_void.lua b/ability_item_usage_faceless_void.lua index 889bbf0d..82ec1665 100644 --- a/ability_item_usage_faceless_void.lua +++ b/ability_item_usage_faceless_void.lua @@ -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 @@ -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()) @@ -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 diff --git a/ability_item_usage_generic.lua b/ability_item_usage_generic.lua index a504ea2d..f22d3d69 100644 --- a/ability_item_usage_generic.lua +++ b/ability_item_usage_generic.lua @@ -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 diff --git a/ability_item_usage_huskar.lua b/ability_item_usage_huskar.lua index b3c287e5..244d4f30 100644 --- a/ability_item_usage_huskar.lua +++ b/ability_item_usage_huskar.lua @@ -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 @@ -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 @@ -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 diff --git a/ability_item_usage_keeper_of_the_light.lua b/ability_item_usage_keeper_of_the_light.lua index 6f598822..d03d3328 100644 --- a/ability_item_usage_keeper_of_the_light.lua +++ b/ability_item_usage_keeper_of_the_light.lua @@ -72,7 +72,7 @@ end -------------------------------------- local cast={} cast.Desire={} cast.Target={} cast.Type={} local Consider ={} -local CanCast={utility.NCanCast,utility.NCanCast,utility.NCanCast,utility.UCanCast} +local CanCast={utility.NCanCast,utility.NCanCast,utility.NCanCast,utility.NCanCast,utility.NCanCast,utility.UCanCast,utility.NCanCast,utility.NCanCast} local enemyDisabled=utility.enemyDisabled function GetComboDamage() @@ -92,7 +92,7 @@ Consider[1]=function() -------------------------------------- local ability=AbilitiesReal[abilityNumber]; - if npcBot:HasScepter() or npcBot:HasModifier("modifier_keeper_of_the_light_spirit_form") or not ability:IsFullyCastable() then + if ( npcBot:HasScepter() or npcBot:HasModifier("modifier_keeper_of_the_light_spirit_form") or not ability:IsFullyCastable() ) then return BOT_ACTION_DESIRE_NONE, 0; end @@ -119,7 +119,7 @@ Consider[1]=function() then if(HeroHealth<=WeakestEnemy:GetActualIncomingDamage(Damage,DAMAGE_TYPE_MAGICAL) or (HeroHealth<=WeakestEnemy:GetActualIncomingDamage(GetComboDamage(),DAMAGE_TYPE_MAGICAL) and npcBot:GetMana()>ComboMana)) then - return BOT_ACTION_DESIRE_HIGH,WeakestEnemy:GetExtrapolatedLocation(CastPoint); + return BOT_ACTION_DESIRE_HIGH,npcBot:GetXUnitsTowardsLocation(WeakestEnemy:GetExtrapolatedLocation(CastPoint),300) ; end end end @@ -205,7 +205,129 @@ Consider[1]=function() end --keeper_of_the_light_spirit_form_illuminate -Consider[8]=Consider[1] +Consider[8]=function() + + local abilityNumber=8 + -------------------------------------- + -- Generic Variable Setting + -------------------------------------- + local ability=AbilitiesReal[abilityNumber]; + + if ( not ability:IsFullyCastable() or ability:IsHidden() ) then + return BOT_ACTION_DESIRE_NONE, 0; + end + + local CastRange = ability:GetCastRange(); + local Damage = ability:GetSpecialValueFloat("damage_per_second")*ability:GetSpecialValueFloat("max_channel_time") + local Radius = ability:GetAOERadius() + local CastPoint = ability:GetCastPoint(); + + local allys = npcBot:GetNearbyHeroes( 1200, false, BOT_MODE_NONE ); + local enemys = npcBot:GetNearbyHeroes(1600,true,BOT_MODE_NONE) + local WeakestEnemy,HeroHealth=utility.GetWeakestUnit(enemys) + local creeps = npcBot:GetNearbyCreeps(1600,true) + local WeakestCreep,CreepHealth=utility.GetWeakestUnit(creeps) + + -------------------------------------- + -- Global high-priorty usage + -------------------------------------- + --try to kill enemy hero + if(npcBot:GetActiveMode() ~= BOT_MODE_RETREAT ) + then + if (WeakestEnemy~=nil) + then + if ( CanCast[abilityNumber]( WeakestEnemy ) ) + then + if(HeroHealth<=WeakestEnemy:GetActualIncomingDamage(Damage,DAMAGE_TYPE_MAGICAL) or (HeroHealth<=WeakestEnemy:GetActualIncomingDamage(GetComboDamage(),DAMAGE_TYPE_MAGICAL) and npcBot:GetMana()>ComboMana)) + then + return BOT_ACTION_DESIRE_HIGH,WeakestEnemy:GetExtrapolatedLocation(CastPoint); + end + end + end + end + -------------------------------------- + -- Mode based usage + -------------------------------------- + -- If we're farming and can kill 3+ creeps with LSA + if ( npcBot:GetActiveMode() == BOT_MODE_FARM ) then + local locationAoE = npcBot:FindAoELocation( true, false, npcBot:GetLocation(), CastRange, Radius, 0, 0 ); + + if ( locationAoE.count >= 3 ) then + return BOT_ACTION_DESIRE_LOW, locationAoE.targetloc; + end + end + + --Last hit + if ( npcBot:GetActiveMode() == BOT_MODE_LANING ) + then + if(WeakestCreep~=nil) + then + if((ManaPercentage>0.5 or npcBot:GetMana()>ComboMana) and GetUnitToUnitDistance(npcBot,WeakestCreep)>=300) + then + local locationAoE = npcBot:FindAoELocation( true, false, npcBot:GetLocation(), CastRange, Radius, 0, Damage ); + if ( locationAoE.count >= 1 ) then + return BOT_ACTION_DESIRE_LOW-0.02, locationAoE.targetloc; + end + end + end + end + + if ( npcBot:GetActiveMode() == BOT_MODE_LANING ) + then + if((ManaPercentage>0.5 or npcBot:GetMana()>ComboMana) and ability:GetLevel()>=2 ) + then + local locationAoE = npcBot:FindAoELocation( true, true, npcBot:GetLocation(), CastRange, Radius, 0, 0 ); + if ( locationAoE.count >= 2 ) then + return BOT_ACTION_DESIRE_LOW-0.01, locationAoE.targetloc; + end + end + end + + -- If we're pushing or defending a lane and can hit 4+ creeps, go for it + if ( npcBot:GetActiveMode() == BOT_MODE_PUSH_TOWER_TOP or + npcBot:GetActiveMode() == BOT_MODE_PUSH_TOWER_MID or + npcBot:GetActiveMode() == BOT_MODE_PUSH_TOWER_BOT or + npcBot:GetActiveMode() == BOT_MODE_DEFEND_TOWER_TOP or + npcBot:GetActiveMode() == BOT_MODE_DEFEND_TOWER_MID or + npcBot:GetActiveMode() == BOT_MODE_DEFEND_TOWER_BOT ) + then + local locationAoE = npcBot:FindAoELocation( true, false, npcBot:GetLocation(), CastRange, Radius, 0, 0 ); + + if ( locationAoE.count >= 4 ) + then + return BOT_ACTION_DESIRE_LOW, locationAoE.targetloc; + end + end + + -- If we're going after someone + if ( npcBot:GetActiveMode() == BOT_MODE_ROAM or + npcBot:GetActiveMode() == BOT_MODE_TEAM_ROAM or + npcBot:GetActiveMode() == BOT_MODE_DEFEND_ALLY or + npcBot:GetActiveMode() == BOT_MODE_ATTACK) + then + local locationAoE = npcBot:FindAoELocation( true, true, npcBot:GetLocation(), CastRange, Radius, 0, 0 ); + if ( locationAoE.count >= 2 ) then + return BOT_ACTION_DESIRE_LOW, locationAoE.targetloc; + end + + local npcEnemy = npcBot:GetTarget(); + + if ( npcEnemy ~= nil ) + then + if ( CanCast[abilityNumber]( npcEnemy ) ) + then + return BOT_ACTION_DESIRE_HIGH, npcEnemy:GetExtrapolatedLocation(CastPoint); + end + end + end + + return BOT_ACTION_DESIRE_NONE, 0; + +end + +Consider[7]=function() + return BOT_ACTION_DESIRE_NONE, 0; +end Consider[2]=function() local abilityNumber=2 @@ -363,18 +485,23 @@ Consider[3]=function() local CastPoint = ability:GetCastPoint(); local allys = npcBot:GetNearbyHeroes( 1200, false, BOT_MODE_NONE ); + local bestTarget = npcBot; + local minMana = ManaPercentage; + + for _,myFriend in pairs(allys) do + tempMana=myFriend:GetMana() / myFriend:GetMaxMana() + if ( CanCast[abilityNumber](myFriend) and tempMana < ManaPercentage ) + then + bestTarget=myFriend + minMana=tempMana; + end + end - if npcBot:GetMana() / npcBot:GetMaxMana() < 0.75 then - return BOT_ACTION_DESIRE_MODERATE, npcBot; - else - for _,myFriend in pairs(allys) do - if ( CanCast[abilityNumber](myFriend) and myFriend:GetMana() / myFriend:GetMaxMana() < 0.65 ) - then - return BOT_ACTION_DESIRE_MODERATE, myFriend; - end - end + if(bestTarget~=nil and minMana<=0.8) + then + return BOT_ACTION_DESIRE_MODERATE, bestTarget; end - + return BOT_ACTION_DESIRE_NONE, 0; end @@ -386,7 +513,8 @@ Consider[4]=function() -------------------------------------- local ability=AbilitiesReal[abilityNumber]; - if not ability:IsFullyCastable() then + if ( not npcBot:HasModifier("modifier_keeper_of_the_light_spirit_form") or ability:IsHidden() or not ability:IsFullyCastable() ) + then return BOT_ACTION_DESIRE_NONE, 0; end @@ -505,7 +633,8 @@ Consider[5]=function() -------------------------------------- local ability=AbilitiesReal[abilityNumber]; - if not ability:IsFullyCastable() then + if ( not npcBot:HasModifier("modifier_keeper_of_the_light_spirit_form") or ability:IsHidden() or not ability:IsFullyCastable() ) + then return BOT_ACTION_DESIRE_NONE, 0; end @@ -570,7 +699,7 @@ Consider[6]=function() -------------------------------------- local ability=AbilitiesReal[abilityNumber]; - if not ability:IsFullyCastable() then + if npcBot:HasScepter() or npcBot:HasModifier("modifier_keeper_of_the_light_spirit_form") or not ability:IsFullyCastable() then return BOT_ACTION_DESIRE_NONE, 0; end diff --git a/ability_item_usage_lycan.lua b/ability_item_usage_lycan.lua index 7f66393f..35e4058e 100644 --- a/ability_item_usage_lycan.lua +++ b/ability_item_usage_lycan.lua @@ -95,9 +95,15 @@ Consider[1]=function() return BOT_ACTION_DESIRE_NONE, 0; end - local CastRange = 300; + local CastRange = 500; local CastPoint = ability:GetCastPoint(); + local allys = npcBot:GetNearbyHeroes( 1200, false, BOT_MODE_NONE ); + local enemys = npcBot:GetNearbyHeroes(CastRange+300,true,BOT_MODE_NONE) + local WeakestEnemy,HeroHealth=utility.GetWeakestUnit(enemys) + local creeps = npcBot:GetNearbyCreeps(CastRange+300,true) + local WeakestCreep,CreepHealth=utility.GetWeakestUnit(creeps) + local wolves = 0; local units = GetUnitList(UNIT_LIST_ALLIES); for _,unit in pairs(units) @@ -163,11 +169,11 @@ Consider[1]=function() npcBot:GetActiveMode() == BOT_MODE_DEFEND_ALLY or npcBot:GetActiveMode() == BOT_MODE_ATTACK ) then - local npcTarget = npcBot:GetTarget(); + local npcEnemy = npcBot:GetTarget(); if ( npcEnemy ~= nil ) then - if ( CanCast[abilityNumber]( npcEnemy ) and GetUnitToUnitDistance(npcBot,npcEnemy)< CastRange + 75*#allys and wolves < 1) + if ( GetUnitToUnitDistance(npcBot,npcEnemy)< CastRange + 75*#allys and wolves < 1) then return BOT_ACTION_DESIRE_MODERATE, npcEnemy end @@ -192,6 +198,12 @@ Consider[2]=function() local CastRange = ability:GetCastRange(); local CastPoint = ability:GetCastPoint(); + + local allys = npcBot:GetNearbyHeroes( 1200, false, BOT_MODE_NONE ); + local enemys = npcBot:GetNearbyHeroes(CastRange+300,true,BOT_MODE_NONE) + local WeakestEnemy,HeroHealth=utility.GetWeakestUnit(enemys) + local creeps = npcBot:GetNearbyCreeps(CastRange+300,true) + local WeakestCreep,CreepHealth=utility.GetWeakestUnit(creeps) -------------------------------------- -- Mode based usage -------------------------------------- @@ -229,7 +241,7 @@ Consider[2]=function() npcBot:GetActiveMode() == BOT_MODE_DEFEND_ALLY or npcBot:GetActiveMode() == BOT_MODE_ATTACK ) then - local npcTarget = npcBot:GetTarget(); + local npcEnemy = npcBot:GetTarget(); if ( npcEnemy ~= nil ) then @@ -258,6 +270,12 @@ Consider[4]=function() local CastRange = ability:GetCastRange(); local CastPoint = ability:GetCastPoint(); + + local allys = npcBot:GetNearbyHeroes( 1200, false, BOT_MODE_NONE ); + local enemys = npcBot:GetNearbyHeroes(CastRange+300,true,BOT_MODE_NONE) + local WeakestEnemy,HeroHealth=utility.GetWeakestUnit(enemys) + local creeps = npcBot:GetNearbyCreeps(CastRange+300,true) + local WeakestCreep,CreepHealth=utility.GetWeakestUnit(creeps) -------------------------------------- -- Mode based usage -------------------------------------- @@ -276,11 +294,11 @@ Consider[4]=function() npcBot:GetActiveMode() == BOT_MODE_DEFEND_ALLY or npcBot:GetActiveMode() == BOT_MODE_ATTACK ) then - local npcTarget = npcBot:GetTarget(); + local npcEnemy = npcBot:GetTarget(); if ( npcEnemy ~= nil ) then - if ( CanCast[abilityNumber]( npcEnemy ) and GetUnitToUnitDistance(npcBot,npcEnemy)< 300 + 75*#allys ) + if ( CanCast[abilityNumber]( npcEnemy ) and GetUnitToUnitDistance(npcBot,npcEnemy)< 1000 + 75*#allys ) then return BOT_ACTION_DESIRE_MODERATE end diff --git a/ability_item_usage_magnataur.lua b/ability_item_usage_magnataur.lua index eb829586..e28b7c70 100644 --- a/ability_item_usage_magnataur.lua +++ b/ability_item_usage_magnataur.lua @@ -226,19 +226,22 @@ Consider[2]=function() npcBot:GetActiveMode() == BOT_MODE_PUSH_TOWER_MID or npcBot:GetActiveMode() == BOT_MODE_PUSH_TOWER_BOTTOM) then - for _,myFriend in pairs(allys) do - if ( GetUnitToUnitDistance( myFriend, npcBot ) < CastRange and not myFriend:HasModifier(modifierName) ) - then - return BOT_ACTION_DESIRE_MODERATE, myFriend; + if(ManaPercentage>0.6) + then + for _,myFriend in pairs(allys) do + if ( GetUnitToUnitDistance( myFriend, npcBot ) < CastRange and not myFriend:HasModifier(modifierName) ) + then + return BOT_ACTION_DESIRE_MODERATE, myFriend; + end + end + if not npcBot:HasModifier(modifierName) then + return BOT_ACTION_DESIRE_MODERATE, npcBot; end - end - if not npcBot:HasModifier(modifierName) then - return BOT_ACTION_DESIRE_MODERATE, npcBot; end end -- If my mana is enough,buff myfriend. - if(ManaPercentage>0.5 and npcBot:GetMana()>ComboMana) + if(ManaPercentage>0.6 and npcBot:GetMana()>ComboMana) then for _,ally in pairs(allys) do diff --git a/ability_item_usage_medusa.lua b/ability_item_usage_medusa.lua index 1c7f606c..28deb4f1 100644 --- a/ability_item_usage_medusa.lua +++ b/ability_item_usage_medusa.lua @@ -260,6 +260,8 @@ Consider[4]=function() local enemys = npcBot:GetNearbyHeroes(CastRange-300,true,BOT_MODE_NONE) local WeakestEnemy,HeroHealth=utility.GetWeakestUnit(enemys) + + local allys = npcBot:GetNearbyHeroes( 1200, false, BOT_MODE_NONE ); -------------------------------------- -- Mode based usage -------------------------------------- @@ -279,7 +281,7 @@ Consider[4]=function() npcBot:GetActiveMode() == BOT_MODE_DEFEND_ALLY or npcBot:GetActiveMode() == BOT_MODE_ATTACK ) then - local npcTarget = npcBot:GetTarget(); + local npcEnemy = npcBot:GetTarget(); if ( npcEnemy ~= nil ) then diff --git a/ability_item_usage_ogre_magi.lua b/ability_item_usage_ogre_magi.lua index f9083f5f..d6146f32 100644 --- a/ability_item_usage_ogre_magi.lua +++ b/ability_item_usage_ogre_magi.lua @@ -356,6 +356,8 @@ Consider[3]=function() npcBot:GetActiveMode() == BOT_MODE_PUSH_TOWER_MID or npcBot:GetActiveMode() == BOT_MODE_PUSH_TOWER_BOTTOM) then + if(ManaPercentage>0.6 and npcBot:GetMana()>ComboMana) + then local tableNearbyFriendlyTowers = npcBot:GetNearbyTowers( CastRange+300, false ); for _,myTower in pairs(tableNearbyFriendlyTowers) do if ( GetUnitToUnitDistance( myTower, npcBot ) < CastRange and not myTower:HasModifier("modifier_ogre_magi_bloodlust") ) @@ -373,10 +375,11 @@ Consider[3]=function() if not npcBot:HasModifier("modifier_ogre_magi_bloodlust") then return BOT_ACTION_DESIRE_MODERATE, npcBot; end + end end -- If my mana is enough,buff myfriend. - if(ManaPercentage>0.5 and npcBot:GetMana()>ComboMana) + if(ManaPercentage>0.6 and npcBot:GetMana()>ComboMana) then for _,ally in pairs(allys) do diff --git a/ability_item_usage_queenofpain.lua b/ability_item_usage_queenofpain.lua index 6d585485..dfc6ced6 100644 --- a/ability_item_usage_queenofpain.lua +++ b/ability_item_usage_queenofpain.lua @@ -230,7 +230,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 @@ -241,13 +241,13 @@ Consider[2]=function() -- If we trapped by the trees if(trees~=nil and #trees>=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 HealthPercentage<=0.5 or npcBot:GetActiveModeDesire() >= BOT_MODE_DESIRE_HIGH) ) 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_ATTACK and ManaPercentage>0.4) @@ -277,7 +277,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 diff --git a/hero_selection.lua b/hero_selection.lua index 7c7d24d2..c15d8f52 100644 --- a/hero_selection.lua +++ b/hero_selection.lua @@ -247,17 +247,17 @@ hero_pool_my={ -- "npc_dota_hero_arc_warden", -- "npc_dota_hero_gyrocopter", - "npc_dota_hero_batrider", - "npc_dota_hero_beastmaster", - "npc_dota_hero_bounty_hunter", - "npc_dota_hero_brewmaster", - "npc_dota_hero_broodmother", + -- "npc_dota_hero_batrider", + -- "npc_dota_hero_beastmaster", + -- "npc_dota_hero_bounty_hunter", + -- "npc_dota_hero_brewmaster", + -- "npc_dota_hero_broodmother", - "npc_dota_hero_chen", - "npc_dota_hero_dark_seer", - "npc_dota_hero_disruptor", - "npc_dota_hero_earth_spirit", - "npc_dota_hero_elder_titan", + -- "npc_dota_hero_chen", + -- "npc_dota_hero_dark_seer", + -- "npc_dota_hero_disruptor", + -- "npc_dota_hero_earth_spirit", + -- "npc_dota_hero_elder_titan", "npc_dota_hero_enchantress", diff --git a/item_purchase_batrider.lua b/item_purchase_batrider.lua index 7595c3fa..cdf81053 100644 --- a/item_purchase_batrider.lua +++ b/item_purchase_batrider.lua @@ -13,8 +13,8 @@ local ItemsToBuy = "item_branches", "item_boots", "item_ring_of_regen", --绿鞋 - "item_circlet", - "item_magic_stick", --大魔棒 + "item_magic_stick", + "item_enchanted_mango", --大魔棒7.07 "item_gauntlets", "item_circlet", "item_recipe_bracer", diff --git a/item_purchase_chen.lua b/item_purchase_chen.lua index d942d616..6534c08a 100644 --- a/item_purchase_chen.lua +++ b/item_purchase_chen.lua @@ -12,8 +12,8 @@ local ItemsToBuy = "item_branches", "item_branches", "item_boots", - "item_circlet", - "item_magic_stick", --大魔棒 + "item_magic_stick", + "item_enchanted_mango", --大魔棒7.07 "item_energy_booster", --秘法鞋 "item_ring_of_regen", diff --git a/item_purchase_disruptor.lua b/item_purchase_disruptor.lua index ec6d67d6..50ea7270 100644 --- a/item_purchase_disruptor.lua +++ b/item_purchase_disruptor.lua @@ -13,8 +13,8 @@ local ItemsToBuy = "item_branches", "item_boots", "item_ring_of_regen", --绿鞋 - "item_circlet", - "item_magic_stick", --大魔棒 + "item_magic_stick", + "item_enchanted_mango", --大魔棒7.07 "item_circlet", "item_ring_of_protection", diff --git a/item_purchase_earth_spirit.lua b/item_purchase_earth_spirit.lua index 03716d61..70416668 100644 --- a/item_purchase_earth_spirit.lua +++ b/item_purchase_earth_spirit.lua @@ -14,8 +14,8 @@ local ItemsToBuy = "item_boots", "item_wind_lace", "item_ring_of_regen", --绿鞋 - "item_circlet", - "item_magic_stick", --大魔棒 + "item_magic_stick", + "item_enchanted_mango", --大魔棒7.07 "item_circlet", "item_ring_of_protection", diff --git a/item_purchase_enigma.lua b/item_purchase_enigma.lua index 878256cc..cc28df5c 100644 --- a/item_purchase_enigma.lua +++ b/item_purchase_enigma.lua @@ -11,8 +11,8 @@ local ItemsToBuy = "item_branches", "item_branches", "item_boots", - "item_circlet", - "item_magic_stick", --大魔棒 + "item_magic_stick", + "item_enchanted_mango", --大魔棒7.07 "item_energy_booster", --秘法鞋 "item_ring_of_regen", diff --git a/item_purchase_medusa.lua b/item_purchase_medusa.lua index 2a9bb7f8..9490ab77 100644 --- a/item_purchase_medusa.lua +++ b/item_purchase_medusa.lua @@ -12,8 +12,8 @@ local ItemsToBuy = "item_branches", "item_branches", "item_boots", - "item_circlet", - "item_magic_stick", --大魔棒 + "item_magic_stick", + "item_enchanted_mango", --大魔棒7.07 "item_blades_of_attack", "item_blades_of_attack", --相位 diff --git a/item_purchase_mirana.lua b/item_purchase_mirana.lua index 13a75fff..637e4389 100644 --- a/item_purchase_mirana.lua +++ b/item_purchase_mirana.lua @@ -12,8 +12,8 @@ local ItemsToBuy = "item_branches", "item_branches", "item_boots", - "item_circlet", - "item_magic_stick", --大魔棒 + "item_magic_stick", + "item_enchanted_mango", --大魔棒7.07 "item_energy_booster", --秘法鞋 "item_slippers", diff --git a/mode_side_shop_enigma.lua b/mode_side_shop_enigma.lua new file mode 100644 index 00000000..8bc1cfc5 --- /dev/null +++ b/mode_side_shop_enigma.lua @@ -0,0 +1,69 @@ +---------------------------------------------------------------------------- +-- Ranked Matchmaking AI v1.0a +-- Author: adamqqq Email:adamqqq@163.com +---------------------------------------------------------------------------- +---------------------------------------------------------------------------------------------------- +local IsChanneling=false + +function GetDesire() + local npcBot = GetBot(); + local ability = npcBot:GetAbilityByName("keeper_of_the_light_illuminate") + if((npcBot:IsUsingAbility() and npcBot:GetActiveMode() ~= BOT_MODE_WARD ) or npcBot:IsChanneling()) + then + IsChanneling=true + return 0.99 + else + IsChanneling=false + end + return SideShopGetDesire() +end + +function Think() + if(IsChanneling==true) + then + --print("keeper of the light is avoid interupt channeling") + --do nothing + else + SideShopThink(); + end +end + +function SideShopGetDesire() + + local npcBot = GetBot(); + + local desire = 0.0; + + local enemys = npcBot:GetNearbyHeroes(600,true,BOT_MODE_NONE) + if ( npcBot:IsUsingAbility() or npcBot:IsChanneling() or npcBot:WasRecentlyDamagedByAnyHero(5.0) or #enemys>=1) --不应打断持续施法 + then + return 0 + end + + if ( npcBot.sideShopMode == true and npcBot:GetGold() >= npcBot:GetNextItemPurchaseValue()) then + local d=npcBot:DistanceFromSideShop() + if d<2500 + then + desire = (2500-d)/2500*0.3+0.3; --根据离边路商店的距离返回欲望值 + end + end + + return desire + +end + +function SideShopThink() + + local npcBot = GetBot(); + + local shopLoc1 = GetShopLocation( GetTeam(), SHOP_SIDE ); + local shopLoc2 = GetShopLocation( GetTeam(), SHOP_SIDE2 ); + + if ( GetUnitToLocationDistance(npcBot, shopLoc1) <= GetUnitToLocationDistance(npcBot, shopLoc2) ) then --选择前往距离自己更近的商店 + npcBot:Action_MoveToLocation( shopLoc1 ); + else + npcBot:Action_MoveToLocation( shopLoc2 ); + end +end +---------------------------------------------------------------------------------------------------- +---------------------------------------------------------------------------------------------------- \ No newline at end of file diff --git a/mode_side_shop_keeper_of_the_light.lua b/mode_side_shop_keeper_of_the_light.lua index df3e8e1c..8bc1cfc5 100644 --- a/mode_side_shop_keeper_of_the_light.lua +++ b/mode_side_shop_keeper_of_the_light.lua @@ -8,10 +8,10 @@ local IsChanneling=false function GetDesire() local npcBot = GetBot(); local ability = npcBot:GetAbilityByName("keeper_of_the_light_illuminate") - if((npcBot:IsUsingAbility() and (npcBot:GetActiveMode() == BOT_MODE_LANING or npcBot:GetActiveMode() == BOT_MODE_ATTACK) ) or npcBot:IsChanneling()) + if((npcBot:IsUsingAbility() and npcBot:GetActiveMode() ~= BOT_MODE_WARD ) or npcBot:IsChanneling()) then IsChanneling=true - return 0.95 + return 0.99 else IsChanneling=false end diff --git a/utility.lua b/utility.lua index 098d3e72..e5fd0e23 100644 --- a/utility.lua +++ b/utility.lua @@ -364,7 +364,6 @@ function utilityModule.SellExtraItem(ItemsToBuy) utilityModule.SellSpecifiedItem("item_bottle") utilityModule.SellSpecifiedItem("item_magic_wand") utilityModule.SellSpecifiedItem("item_magic_stick") - utilityModule.SellSpecifiedItem("item_urn_of_shadows") utilityModule.SellSpecifiedItem("item_ancient_janggo") utilityModule.SellSpecifiedItem("item_ring_of_basilius") utilityModule.SellSpecifiedItem("item_ring_of_aquila") @@ -372,6 +371,7 @@ function utilityModule.SellExtraItem(ItemsToBuy) end if(GameTime()>35*60 or level>=20) then + utilityModule.SellSpecifiedItem("item_urn_of_shadows") utilityModule.SellSpecifiedItem("item_hand_of_midas") if(utilityModule.GetItemSlotsCount()<6) then