diff --git a/.gitignore b/.gitignore index 15632c0c..b36a9257 100644 --- a/.gitignore +++ b/.gitignore @@ -40,4 +40,5 @@ luac.out *.hex LICENSE -.vscode \ No newline at end of file +.vscode +.idea diff --git a/ability_item_usage_abaddon.lua b/ability_item_usage_abaddon.lua index 4e70f353..812a9cfc 100644 --- a/ability_item_usage_abaddon.lua +++ b/ability_item_usage_abaddon.lua @@ -7,6 +7,7 @@ -------------------------------------- local utility = require( GetScriptDirectory().."/utility" ) require(GetScriptDirectory() .. "/ability_item_usage_generic") +local AbilityExtensions = require(GetScriptDirectory().."/util/AbilityAbstraction") local debugmode=false local npcBot = GetBot() @@ -106,7 +107,7 @@ end local CanCast={CanCast1,CanCast2} -Consider[1]=function() +Consider[1]=function() -- TODO: lv 25 AOE mist coil local abilityNumber=1 -------------------------------------- -- Generic Variable Setting @@ -424,6 +425,7 @@ Consider[4]=function() return BOT_ACTION_DESIRE_NONE end +AbilityExtensions:AutoModifyConsiderFunction(npcBot, Consider, AbilitiesReal) function AbilityUsageThink() diff --git a/ability_item_usage_abyssal_underlord.lua b/ability_item_usage_abyssal_underlord.lua index 8d652a5a..0f013c72 100644 --- a/ability_item_usage_abyssal_underlord.lua +++ b/ability_item_usage_abyssal_underlord.lua @@ -7,6 +7,7 @@ -------------------------------------- local utility = require( GetScriptDirectory().."/utility" ) require(GetScriptDirectory() .. "/ability_item_usage_generic") +local AbilityExtensions = require(GetScriptDirectory().."/util/AbilityAbstraction") local debugmode=false local npcBot = GetBot() @@ -384,6 +385,7 @@ Consider[4]=function() return BOT_ACTION_DESIRE_NONE, 0; end +AbilityExtensions:AutoModifyConsiderFunction(npcBot, Consider, AbilitiesReal) function AbilityUsageThink() -- Check if we're already using an ability diff --git a/ability_item_usage_alchemist.lua b/ability_item_usage_alchemist.lua index f921a56c..f2afc493 100644 --- a/ability_item_usage_alchemist.lua +++ b/ability_item_usage_alchemist.lua @@ -7,6 +7,7 @@ -------------------------------------- local utility = require( GetScriptDirectory().."/utility" ) require(GetScriptDirectory() .. "/ability_item_usage_generic") +local AbilityExtensions = require(GetScriptDirectory().."/util/AbilityAbstraction") local debugmode=false local npcBot = GetBot() @@ -21,6 +22,7 @@ local abilityName = { "alchemist_acid_spray", "alchemist_unstable_concoction", " local abilityIndex = utility.ReverseTable(abilityName) + local AbilityToLevelUp= { Abilities[3], @@ -77,7 +79,7 @@ end -------------------------------------- local cast={} cast.Desire={} cast.Target={} cast.Type={} local Consider ={} -local CanCast={utility.NCanCast,utility.NCanCast,utility.NCanCast,utility.UCanCast,utility.NCanCast} +local CanCast={utility.NCanCast,utility.NCanCast,utility.NCanCast,utility.UCanCast,utility.CanCastNoTarget} local enemyDisabled=utility.enemyDisabled function GetComboDamage() @@ -314,66 +316,154 @@ function Consider2() end -Consider[abilityIndex.alchemist_unstable_concoction_throw]=function() - local abilityNumber=abilityIndex.alchemist_unstable_concoction_throw - -------------------------------------- - -- Generic Variable Setting - -------------------------------------- - local ability=AbilitiesReal[abilityNumber]; - - if not ability:IsFullyCastable() then - return BOT_ACTION_DESIRE_NONE, 0; - end - - local CastRange = ability:GetCastRange(); - local Damage = ability:GetAbilityDamage(); - 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) - -------------------------------------- - -- Global high-priorty usage - -------------------------------------- - if ( ManaPercentage+HealthPercentage<=1.2) - then - return BOT_ACTION_DESIRE_LOW - end - - -- If we're in a teamfight, use it on the scariest enemy - local tableNearbyAttackingAlliedHeroes = npcBot:GetNearbyHeroes( 1000, false, BOT_MODE_ATTACK ); - if ( #tableNearbyAttackingAlliedHeroes >= 2) - then - return BOT_ACTION_DESIRE_HIGH - end - -------------------------------------- - -- Mode based usage - -------------------------------------- - -- 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:GetActiveModeDesire() >= BOT_MODE_DESIRE_HIGH ) - then - if ( npcBot:WasRecentlyDamagedByAnyHero( 2.0 ) and HealthPercentage<=0.70+#enemys*0.05) - then - return BOT_ACTION_DESIRE_HIGH - 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 - if ( HealthPercentage<=0.70+#enemys*0.05 ) - then - return BOT_ACTION_DESIRE_HIGH - end - end +Consider[abilityIndex.alchemist_chemical_rage]=function() + local abilityNumber=abilityIndex.alchemist_chemical_rage + AbilityExtensions:GetTargetHealModifierPercent(npcBot) + -------------------------------------- + -- Generic Variable Setting + -------------------------------------- + local ability=AbilitiesReal[abilityNumber]; + + if not ability:IsFullyCastable() then + return BOT_ACTION_DESIRE_NONE, 0; + end + + local CastRange = ability:GetCastRange(); + local Damage = ability:GetAbilityDamage(); + 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) + -------------------------------------- + -- Global high-priorty usage + -------------------------------------- + if HealthPercentage <= 0.2 then + return BOT_ACTION_DESIRE_HIGH + end + if ( HealthPercentage<=0.4) + then + return BOT_ACTION_DESIRE_LOW + end + + -- If we're in a teamfight, use it on the scariest enemy + local tableNearbyAttackingAlliedHeroes = npcBot:GetNearbyHeroes( 1000, false, BOT_MODE_ATTACK ); + if ( #tableNearbyAttackingAlliedHeroes >= 2) + then + return BOT_ACTION_DESIRE_HIGH + end + -------------------------------------- + -- Mode based usage + -------------------------------------- + -- 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:GetActiveModeDesire() >= BOT_MODE_DESIRE_HIGH ) + then + if ( npcBot:WasRecentlyDamagedByAnyHero( 2.0 ) and HealthPercentage<=0.70+#enemys*0.05) + then + return BOT_ACTION_DESIRE_HIGH + 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 + if ( HealthPercentage<=0.70+#enemys*0.05 ) + then + return BOT_ACTION_DESIRE_HIGH + end + end + + return BOT_ACTION_DESIRE_NONE +end - return BOT_ACTION_DESIRE_NONE, 0; - +Consider[abilityIndex.alchemist_berserk_potion]=function() + local abilityNumber=abilityIndex.alchemist_berserk_potion + -------------------------------------- + -- Generic Variable Setting + -------------------------------------- + local ability=AbilitiesReal[abilityNumber]; + + if not ability:IsFullyCastable() then + return BOT_ACTION_DESIRE_NONE, 0; + end + + local CastRange = ability:GetCastRange(); + local Damage = ability:GetAbilityDamage(); + local CastPoint = ability:GetCastPoint(); + + local allys = npcBot:GetNearbyHeroes( CastRange+200, false, BOT_MODE_NONE ); + -- use at myself when chemical rage is not available + local useTable = {} + if not npcBot:HasModifier("modifier_alchemist_chemical_rage") and not npcBot:HasModifier("modifier_alchemist_berserk_potion") then + local useChemicalRageDesire = Consider[abilityIndex.alchemist_chemical_rage]() + if useChemicalRageDesire ~= 0 then + table.insert(useTable, {useChemicalRageDesire, npcBot}) + end + end + + local checkAlly = function(ally) + if HealthPercentage <= 0.2 then + return BOT_ACTION_DESIRE_HIGH + end + if ( HealthPercentage<=0.4) + then + return BOT_ACTION_DESIRE_LOW + end + + -- If we're in a teamfight, use it on the scariest enemy + local tableNearbyAttackingAlliedHeroes = npcBot:GetNearbyHeroes( 1000, false, BOT_MODE_ATTACK ); + if ( #tableNearbyAttackingAlliedHeroes >= 2) + then + return BOT_ACTION_DESIRE_HIGH + end + -------------------------------------- + -- Mode based usage + -------------------------------------- + -- If we're seriously retreating, see if we can land a stun on someone who's damaged us recently + if ( ally:GetActiveMode() == BOT_MODE_RETREAT and ally:GetActiveModeDesire() >= BOT_MODE_DESIRE_HIGH ) + then + if ( ally:WasRecentlyDamagedByAnyHero( 2.0 ) and HealthPercentage<=0.70+#enemys*0.05) + then + return BOT_ACTION_DESIRE_HIGH + end + end + + -- If we're going after someone + if ( ally:GetActiveMode() == BOT_MODE_ROAM or + ally:GetActiveMode() == BOT_MODE_TEAM_ROAM or + ally:GetActiveMode() == BOT_MODE_DEFEND_ALLY or + ally:GetActiveMode() == BOT_MODE_ATTACK ) + then + if ( HealthPercentage<=0.70+#enemys*0.05 ) + then + return BOT_ACTION_DESIRE_HIGH + end + end + + return BOT_ACTION_DESIRE_NONE + end + for _, ally in ipairs(allys) do + local useAtAllyDesire = checkAlly(ally) - 0.2 + if useAtAllyDesire > 0 then + table.insert(useTable, {useAtAllyDesire, ally}) + end + end + local highestDesire = {-1, -1} + for _, target in ipairs(useTable) do + if highestDesire[1] < target[1] then + highestDesire = target + end + end + if highestDesire[1] == -1 then + return 0 + else + return highestDesire[1], highestDesire[2] + end end Consider[abilityIndex.alchemist_unstable_concoction_throw]=function() @@ -418,7 +508,7 @@ Consider[abilityIndex.alchemist_unstable_concoction_throw]=function() then if(HeroHealth<=WeakestEnemy:GetActualIncomingDamage(Damage,DAMAGE_TYPE_MAGICAL) or (HeroHealth<=WeakestEnemy:GetActualIncomingDamage(GetComboDamage(),DAMAGE_TYPE_MAGICAL) and npcBot:GetMana()>ComboMana)) then - if((GetUnitToUnitDistance(npcBot,WeakestEnemy)>CastRange-100 and GetUnitToUnitDistance(npcBot,WeakestEnemy)4 and TimeSinceCast<5) or WeakestEnemy:GetMaxHealth()/WeakestEnemy:GetMaxHealth()<=0.2) + if((GetUnitToUnitDistance(npcBot,WeakestEnemy)>CastRange-100 and GetUnitToUnitDistance(npcBot,WeakestEnemy)3 and TimeSinceCast<5) or WeakestEnemy:GetHealth()/WeakestEnemy:GetMaxHealth()<=0.2) then return BOT_ACTION_DESIRE_HIGH,WeakestEnemy end @@ -431,16 +521,12 @@ Consider[abilityIndex.alchemist_unstable_concoction_throw]=function() -- Mode based usage -------------------------------------- -- 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:GetActiveModeDesire() >= BOT_MODE_DESIRE_HIGH ) - then - for _,npcEnemy in pairs( enemys ) - do - if ( npcBot:WasRecentlyDamagedByHero( npcEnemy, 2.0 ) ) - then - if ( CanCast[abilityNumber]( npcEnemy ) and not enemyDisabled(npcEnemy)) - then - if((GetUnitToUnitDistance(npcBot,npcEnemy)>CastRange-100 and GetUnitToUnitDistance(npcBot,npcEnemy)4 and TimeSinceCast<5) or npcEnemy:GetMaxHealth()/npcEnemy:GetMaxHealth()<=0.2) - then + if npcBot:GetActiveMode() == BOT_MODE_RETREAT and npcBot:GetActiveModeDesire() >= BOT_MODE_DESIRE_HIGH then + for _,npcEnemy in pairs( enemys )do + if ( npcBot:WasRecentlyDamagedByHero( npcEnemy, 2.0 ) ) then + if ( CanCast[abilityNumber]( npcEnemy ) and not enemyDisabled(npcEnemy)) then + if (GetUnitToUnitDistance(npcBot,npcEnemy)>CastRange-100 and GetUnitToUnitDistance(npcBot,npcEnemy)3 and TimeSinceCast<5) + or npcEnemy:GetHealth()/npcEnemy:GetMaxHealth() <= 0.2 then return BOT_ACTION_DESIRE_HIGH,npcEnemy end end @@ -458,9 +544,9 @@ Consider[abilityIndex.alchemist_unstable_concoction_throw]=function() if ( npcEnemy ~= nil ) then - if ( CanCast[abilityNumber]( npcEnemy ) and not enemyDisabled(npcEnemy) ) - then - if((GetUnitToUnitDistance(npcBot,npcEnemy)>CastRange-100 and GetUnitToUnitDistance(npcBot,npcEnemy)4 and TimeSinceCast<5) or npcEnemy:GetMaxHealth()/npcEnemy:GetMaxHealth()<=0.2) + if CanCast[abilityNumber]( npcEnemy ) and not enemyDisabled(npcEnemy) then + if GetUnitToUnitDistance(npcBot,npcEnemy)>CastRange-100 and GetUnitToUnitDistance(npcBot,npcEnemy)3 and TimeSinceCast<5) or npcEnemy:GetHealth()/npcEnemy:GetMaxHealth() <= 0.2 then return BOT_ACTION_DESIRE_HIGH,npcEnemy end @@ -473,10 +559,16 @@ Consider[abilityIndex.alchemist_unstable_concoction_throw]=function() return BOT_ACTION_DESIRE_HIGH+0.1,enemys[1] end - return BOT_ACTION_DESIRE_NONE, 0; - - + -- throw when I'm hurt + if (npcBot:GetHealth()/npcBot:GetMaxHealth() <= 0.25 and TimeSinceCast >= 1) then + local es = npcBot:GetNearbyHeroes(CastRange,true,BOT_MODE_NONE) + if #es > 0 then + return BOT_ACTION_DESIRE_HIGH, es[1] + end + end + return BOT_ACTION_DESIRE_NONE, 0 end +AbilityExtensions:AutoModifyConsiderFunction(npcBot, Consider, AbilitiesReal) function AbilityUsageThink() diff --git a/ability_item_usage_ancient_apparition.lua b/ability_item_usage_ancient_apparition.lua index 431d9741..a32cc6bc 100644 --- a/ability_item_usage_ancient_apparition.lua +++ b/ability_item_usage_ancient_apparition.lua @@ -7,6 +7,7 @@ -------------------------------------- local utility = require( GetScriptDirectory().."/utility" ) require(GetScriptDirectory() .. "/ability_item_usage_generic") +local AbilityExtensions = require(GetScriptDirectory().."/util/AbilityAbstraction") local debugmode=false local npcBot = GetBot() @@ -114,8 +115,7 @@ Consider[1]=function() -- Check for a channeling enemy for _,npcEnemy in pairs( enemys ) do - if ( npcEnemy:IsChanneling() and CanCast[abilityNumber]( npcEnemy )) - then + if npcEnemy:IsChanneling() and CanCast[abilityNumber]( npcEnemy ) then -- TODO: left channel time long enough return BOT_ACTION_DESIRE_HIGH, npcEnemy end end @@ -547,7 +547,8 @@ Consider[5]=function() return BOT_ACTION_DESIRE_NONE; end - +AbilityExtensions:AutoModifyConsiderFunction(npcBot, Consider, AbilitiesReal) + function AbilityUsageThink() -- Check if we're already using an ability diff --git a/ability_item_usage_antimage.lua b/ability_item_usage_antimage.lua index 046d7a2b..f98d2da8 100644 --- a/ability_item_usage_antimage.lua +++ b/ability_item_usage_antimage.lua @@ -7,6 +7,8 @@ -------------------------------------- local utility = require( GetScriptDirectory().."/utility" ) require(GetScriptDirectory() .. "/ability_item_usage_generic") +local AbilityExtensions = require(GetScriptDirectory().."/util/AbilityAbstraction") + local debugmode=false local npcBot = GetBot() @@ -21,8 +23,6 @@ local abilityName = {} local abilityIndex = utility.ReverseTable(abilityName) - - local AbilityToLevelUp= { Abilities[1], @@ -79,7 +79,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.UCanCast,utility.NCanCast} local enemyDisabled=utility.enemyDisabled function GetComboDamage() @@ -180,12 +180,10 @@ Consider[3]=function() return BOT_ACTION_DESIRE_NONE, 0; end - local CastRange = ability:GetSpecialValueInt( "blink_range" ); - local HeroHealth=10000 local CreepHealth=10000 - local allys = npcBot:GetNearbyHeroes( 1200, false, BOT_MODE_NONE ); - local enemys = npcBot:GetNearbyHeroes(CastRange+300,true,BOT_MODE_NONE) + local allys = npcBot:GetNearbyHeroes( 1200, false, BOT_MODE_NONE ) + local enemys = npcBot:GetNearbyHeroes(900,true,BOT_MODE_NONE) local WeakestEnemy,HeroHealth=utility.GetWeakestUnit(enemys) local trees= npcBot:GetNearbyTrees(300) @@ -208,16 +206,16 @@ Consider[3]=function() npcBot:GetActiveMode() == BOT_MODE_ATTACK or (npcBot:GetActiveMode() == BOT_MODE_LANING and ManaPercentage >=0.4 ) ) then - local npcTarget = npcBot:GetTarget(); + local npcTarget = npcBot:GetTarget() if(npcTarget~=nil) then - if CanCast[abilityNumber]( npcTarget ) and GetUnitToUnitDistance(npcBot,npcTarget)<600 + if CanCast[abilityNumber]( npcTarget ) and GetUnitToUnitDistance(npcBot,npcTarget) < 600 then local incProj = npcBot:GetIncomingTrackingProjectiles() for _,p in pairs(incProj) do - if GetUnitToLocationDistance(npcBot, p.location) <= 300 and p.is_attack == false then - return BOT_ACTION_DESIRE_HIGH; + if GetUnitToLocationDistance(npcBot, p.location) <= 300 and p.is_attack == false and p.is_dodgeable and AbilityExtensions:Contains(AbilityExtensions.IgnoreAbilityBlockAbilities, p.ability:GetName()) then -- ability (etc spectre_spectral_dagger) cannot be blocked + return BOT_ACTION_DESIRE_HIGH end end end @@ -280,13 +278,14 @@ Consider[5]=function() do if ( npcEnemy:IsChanneling() and CanCast[abilityNumber]( npcEnemy )) then - return BOT_ACTION_DESIRE_HIGH, npcEnemy + return BOT_ACTION_DESIRE_MODERATE, npcEnemy end end return BOT_ACTION_DESIRE_NONE, 0; end +AbilityExtensions:AutoModifyConsiderFunction(npcBot, Consider, AbilitiesReal) function AbilityUsageThink() diff --git a/ability_item_usage_arc_warden.lua b/ability_item_usage_arc_warden.lua index 7c12dcb3..92e08bf4 100644 --- a/ability_item_usage_arc_warden.lua +++ b/ability_item_usage_arc_warden.lua @@ -11,6 +11,7 @@ end local utility = require( GetScriptDirectory().."/utility" ) require(GetScriptDirectory() .. "/ability_item_usage_generic") +local AbilityExtensions = require(GetScriptDirectory().."/util/AbilityAbstraction") local debugmode=false local npcBot = nil; @@ -527,6 +528,7 @@ Consider[4]=function() return BOT_ACTION_DESIRE_NONE, 0; end +AbilityExtensions:AutoModifyConsiderFunction(npcBot, Consider, AbilitiesReal) function AbilityUsageThink() diff --git a/ability_item_usage_axe.lua b/ability_item_usage_axe.lua index 5ed5d2a1..7aec1b44 100644 --- a/ability_item_usage_axe.lua +++ b/ability_item_usage_axe.lua @@ -7,6 +7,7 @@ -------------------------------------- local utility = require( GetScriptDirectory().."/utility" ) require(GetScriptDirectory() .. "/ability_item_usage_generic") +local AbilityExtensions = require(GetScriptDirectory().."/util/AbilityAbstraction") local debugmode=false local npcBot = GetBot() @@ -58,7 +59,7 @@ local TalentTree={ return Talents[3] end, function() - return Talents[5] + return Talents[6] end, function() return Talents[8] @@ -389,6 +390,9 @@ Consider[4]=function() return BOT_ACTION_DESIRE_NONE, 0; end + +AbilityExtensions:AutoModifyConsiderFunction(npcBot, Consider, AbilitiesReal) + function AbilityUsageThink() -- Check if we're already using an ability diff --git a/ability_item_usage_bane.lua b/ability_item_usage_bane.lua index 6fc15850..f7863ef5 100644 --- a/ability_item_usage_bane.lua +++ b/ability_item_usage_bane.lua @@ -7,6 +7,7 @@ -------------------------------------- local utility = require( GetScriptDirectory().."/utility" ) require(GetScriptDirectory() .. "/ability_item_usage_generic") +local AbilityExtensions = require(GetScriptDirectory().."/util/AbilityAbstraction") local role = require(GetScriptDirectory() .. "/util/RoleUtility") local debugmode=false @@ -553,6 +554,8 @@ Consider[5]=function() return BOT_ACTION_DESIRE_NONE, 0; end +AbilityExtensions:AutoModifyConsiderFunction(npcBot, Consider, AbilitiesReal) + function AbilityUsageThink() -- Check if we're already using an ability diff --git a/ability_item_usage_batrider.lua b/ability_item_usage_batrider.lua index 6c269b7c..12d53745 100644 --- a/ability_item_usage_batrider.lua +++ b/ability_item_usage_batrider.lua @@ -7,6 +7,7 @@ -------------------------------------- local utility = require( GetScriptDirectory().."/utility" ) require(GetScriptDirectory() .. "/ability_item_usage_generic") +local AbilityExtensions = require(GetScriptDirectory().."/util/AbilityAbstraction") local debugmode=false local npcBot = GetBot() @@ -595,6 +596,7 @@ Consider[4]=function() end +AbilityExtensions:AutoModifyConsiderFunction(npcBot, Consider, AbilitiesReal) function AbilityUsageThink() -- Check if we're already using an ability diff --git a/ability_item_usage_beastmaster.lua b/ability_item_usage_beastmaster.lua index a6acbf2e..b1b0e71f 100644 --- a/ability_item_usage_beastmaster.lua +++ b/ability_item_usage_beastmaster.lua @@ -7,6 +7,7 @@ -------------------------------------- local utility = require( GetScriptDirectory().."/utility" ) require(GetScriptDirectory() .. "/ability_item_usage_generic") +local AbilityExtensions = require(GetScriptDirectory().."/util/AbilityAbstraction") local debugmode=false local npcBot = GetBot() @@ -504,6 +505,7 @@ Consider[abilityIndex.beastmaster_primal_roar]=function() --Target Ability Examp end +AbilityExtensions:AutoModifyConsiderFunction(npcBot, Consider, AbilitiesReal) function AbilityUsageThink() -- Check if we're already using an ability diff --git a/ability_item_usage_bloodseeker.lua b/ability_item_usage_bloodseeker.lua index e5a7af85..e69f06b1 100644 --- a/ability_item_usage_bloodseeker.lua +++ b/ability_item_usage_bloodseeker.lua @@ -7,6 +7,7 @@ -------------------------------------- local utility = require( GetScriptDirectory().."/utility" ) require(GetScriptDirectory() .. "/ability_item_usage_generic") +local AbilityExtensions = require(GetScriptDirectory().."/util/AbilityAbstraction") local debugmode=false local npcBot = GetBot() diff --git a/ability_item_usage_bounty_hunter.lua b/ability_item_usage_bounty_hunter.lua index 85ce8ecb..e57ca940 100644 --- a/ability_item_usage_bounty_hunter.lua +++ b/ability_item_usage_bounty_hunter.lua @@ -7,6 +7,7 @@ -------------------------------------- local utility = require( GetScriptDirectory().."/utility" ) require(GetScriptDirectory() .. "/ability_item_usage_generic") +local AbilityExtensions = require(GetScriptDirectory().."/util/AbilityAbstraction") local debugmode=false local npcBot = GetBot() @@ -346,6 +347,8 @@ Consider[4]=function() return BOT_ACTION_DESIRE_NONE, 0; end +AbilityExtensions:AutoModifyConsiderFunction(npcBot, Consider, AbilitiesReal) + function AbilityUsageThink() -- Check if we're already using an ability diff --git a/ability_item_usage_brewmaster.lua b/ability_item_usage_brewmaster.lua index b776a045..792ba695 100644 --- a/ability_item_usage_brewmaster.lua +++ b/ability_item_usage_brewmaster.lua @@ -7,6 +7,7 @@ -------------------------------------- local utility = require( GetScriptDirectory().."/utility" ) require(GetScriptDirectory() .. "/ability_item_usage_generic") +local AbilityExtensions = require(GetScriptDirectory().."/util/AbilityAbstraction") local role = require(GetScriptDirectory() .. "/util/RoleUtility") local AbilityHelper = dofile(GetScriptDirectory() .. "/util/AbilityHelper") @@ -521,6 +522,7 @@ Consider[4]=function() end +AbilityExtensions:AutoModifyConsiderFunction(npcBot, Consider, AbilitiesReal) function AbilityUsageThink() -- Check if we're already using an ability diff --git a/ability_item_usage_bristleback.lua b/ability_item_usage_bristleback.lua index 96ab0e60..82214da6 100644 --- a/ability_item_usage_bristleback.lua +++ b/ability_item_usage_bristleback.lua @@ -8,6 +8,9 @@ -------------------------------------- local utility = require( GetScriptDirectory().."/utility" ) require(GetScriptDirectory() .. "/ability_item_usage_generic") +local AbilityExtensions = require(GetScriptDirectory().."/util/AbilityAbstraction") + + local debugmode=false local npcBot = GetBot() @@ -76,9 +79,17 @@ end -------------------------------------- -- Ability Usage Thinking -------------------------------------- + +local bristleback_viscous_nasal_goo_CanCast = function(enemy) + return npcBot:HasScepter() or utility.NCanCast(enemy) +end local cast={} cast.Desire={} cast.Target={} cast.Type={} local Consider ={} -local CanCast={utility.NCanCast,utility.NCanCast,utility.NCanCast,utility.UCanCast} +local CanCast={bristleback_viscous_nasal_goo_CanCast, + utility.NCanCast, + utility.NCanCast, + utility.UCanCast,} + local enemyDisabled=utility.enemyDisabled function GetComboDamage() @@ -301,13 +312,7 @@ Consider[2]=function() return BOT_ACTION_DESIRE_NONE, 0; end - - - - - - - +AbilityExtensions:AutoModifyConsiderFunction(npcBot, Consider, AbilitiesReal) function AbilityUsageThink() diff --git a/ability_item_usage_broodmother.lua b/ability_item_usage_broodmother.lua index 68932340..6d721bd6 100644 --- a/ability_item_usage_broodmother.lua +++ b/ability_item_usage_broodmother.lua @@ -7,6 +7,7 @@ -------------------------------------- local utility = require( GetScriptDirectory().."/utility" ) require(GetScriptDirectory() .. "/ability_item_usage_generic") +local AbilityExtensions = require(GetScriptDirectory().."/util/AbilityAbstraction") local debugmode = false local npcBot = GetBot() @@ -23,19 +24,19 @@ local AbilityToLevelUp = Abilities[1], Abilities[2], Abilities[1], - Abilities[4], + Abilities[5], Abilities[1], Abilities[2], Abilities[2], "talent", Abilities[3], - Abilities[4], + Abilities[5], Abilities[3], Abilities[3], "talent", Abilities[3], "nil", - Abilities[4], + Abilities[5], "nil", "talent", "nil", @@ -352,8 +353,8 @@ Consider[2] = function() end -Consider[4] = function() - local abilityNumber = 4 +Consider[5] = function() + local abilityNumber = 5 -------------------------------------- -- Generic Variable Setting -------------------------------------- @@ -410,6 +411,7 @@ Consider[4] = function() end +AbilityExtensions:AutoModifyConsiderFunction(npcBot, Consider, AbilitiesReal) function AbilityUsageThink() -- Check if we're already using an ability diff --git a/ability_item_usage_centaur.lua b/ability_item_usage_centaur.lua index 1d53cb26..efa9bcfa 100644 --- a/ability_item_usage_centaur.lua +++ b/ability_item_usage_centaur.lua @@ -7,6 +7,7 @@ -------------------------------------- local utility = require( GetScriptDirectory().."/utility" ) require(GetScriptDirectory() .. "/ability_item_usage_generic") +local AbilityExtensions = require(GetScriptDirectory().."/util/AbilityAbstraction") local debugmode=false local npcBot = GetBot() @@ -429,6 +430,8 @@ Consider[4]=function() end +AbilityExtensions:AutoModifyConsiderFunction(npcBot, Consider, AbilitiesReal) + function AbilityUsageThink() -- Check if we're already using an ability diff --git a/ability_item_usage_chaos_knight.lua b/ability_item_usage_chaos_knight.lua index f3f3be37..dd600b36 100644 --- a/ability_item_usage_chaos_knight.lua +++ b/ability_item_usage_chaos_knight.lua @@ -7,6 +7,7 @@ -------------------------------------- local utility = require( GetScriptDirectory().."/utility" ) require(GetScriptDirectory() .. "/ability_item_usage_generic") +local AbilityExtensions = require(GetScriptDirectory().."/util/AbilityAbstraction") local debugmode=false local npcBot = GetBot() diff --git a/ability_item_usage_chen.lua b/ability_item_usage_chen.lua index 3fd3e2fc..9b4b17d4 100644 --- a/ability_item_usage_chen.lua +++ b/ability_item_usage_chen.lua @@ -7,6 +7,7 @@ -------------------------------------- local utility = require( GetScriptDirectory().."/utility" ) require(GetScriptDirectory() .. "/ability_item_usage_generic") +local AbilityExtensions = require(GetScriptDirectory().."/util/AbilityAbstraction") local debugmode=false local npcBot = GetBot() @@ -519,6 +520,7 @@ Consider[4]=function() return BOT_ACTION_DESIRE_NONE; end +AbilityExtensions:AutoModifyConsiderFunction(npcBot, Consider, AbilitiesReal) function AbilityUsageThink() -- Check if we're already using an ability diff --git a/ability_item_usage_clinkz.lua b/ability_item_usage_clinkz.lua index ac112f1d..66153d81 100644 --- a/ability_item_usage_clinkz.lua +++ b/ability_item_usage_clinkz.lua @@ -7,6 +7,7 @@ -------------------------------------- local utility = require( GetScriptDirectory().."/utility" ) require(GetScriptDirectory() .. "/ability_item_usage_generic") +local AbilityExtensions = require(GetScriptDirectory().."/util/AbilityAbstraction") local debugmode=false local npcBot = GetBot() @@ -79,7 +80,7 @@ local ManaPercentage; local HealthPercentage; 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.UCanCast,utility.UCanCast} local enemyDisabled=utility.enemyDisabled function GetComboDamage() @@ -426,6 +427,7 @@ Consider[5]=function() end +AbilityExtensions:AutoModifyConsiderFunction(npcBot, Consider, AbilitiesReal) function AbilityUsageThink() -- Check if we're already using an ability diff --git a/ability_item_usage_crystal_maiden.lua b/ability_item_usage_crystal_maiden.lua index d5fed1c0..af8254d9 100644 --- a/ability_item_usage_crystal_maiden.lua +++ b/ability_item_usage_crystal_maiden.lua @@ -7,6 +7,7 @@ -------------------------------------- local utility = require( GetScriptDirectory().."/utility" ) require(GetScriptDirectory() .. "/ability_item_usage_generic") +local AbilityExtensions = require(GetScriptDirectory().."/util/AbilityAbstraction") local debugmode=false local npcBot = GetBot() @@ -250,6 +251,7 @@ Consider[2]=function() return BOT_ACTION_DESIRE_HIGH, npcEnemy end end + --Try to kill enemy hero if(npcBot:GetActiveMode() ~= BOT_MODE_RETREAT ) @@ -432,6 +434,10 @@ Consider[4]=function() return BOT_ACTION_DESIRE_NONE; end +AbilityExtensions:AutoModifyConsiderFunction(npcBot, Consider, AbilitiesReal) + + +AbilityExtensions:AutoModifyConsiderFunction(npcBot, Consider, AbilitiesReal) function AbilityUsageThink() -- Check if we're already using an ability diff --git a/ability_item_usage_dark_seer.lua b/ability_item_usage_dark_seer.lua index 98a9188d..2e418d3b 100644 --- a/ability_item_usage_dark_seer.lua +++ b/ability_item_usage_dark_seer.lua @@ -7,6 +7,7 @@ -------------------------------------- local utility = require( GetScriptDirectory().."/utility" ) require(GetScriptDirectory() .. "/ability_item_usage_generic") +local AbilityExtensions = require(GetScriptDirectory().."/util/AbilityAbstraction") local debugmode=false local npcBot = GetBot() @@ -30,16 +31,16 @@ local AbilityToLevelUp= Abilities[3], Abilities[2], Abilities[1], - Abilities[4], + Abilities[5], "talent", Abilities[3], - Abilities[4], + Abilities[5], Abilities[1], Abilities[1], "talent", Abilities[1], "nil", - Abilities[4], + Abilities[5], "nil", "talent", "nil", @@ -372,7 +373,7 @@ Consider[3]=function() local locationAoE = npcBot:FindAoELocation( false, true, npcBot:GetLocation(), CastRange, Radius, 0, 0 ); if ( locationAoE.count >= 2 and AOESurge:IsTrained()==true ) then - return BOT_ACTION_DESIRE_LOW, locationAoE.targetloc; + return BOT_ACTION_DESIRE_LOW, locationAoE.targetloc, "Location" end -------------------------------------- -- Mode based usage @@ -383,9 +384,9 @@ Consider[3]=function() if ( npcBot:WasRecentlyDamagedByAnyHero( 2.0 ) ) then if(AOESurge:IsTrained()==true) then - return BOT_ACTION_DESIRE_HIGH, locationAoE.targetloc; + return BOT_ACTION_DESIRE_HIGH, locationAoE.targetloc, "Location" else - return BOT_ACTION_DESIRE_HIGH, npcBot; + return BOT_ACTION_DESIRE_HIGH, npcBot, "Target" end end end @@ -397,9 +398,9 @@ Consider[3]=function() then if(AOESurge:IsTrained()==true) then local locationAoE = npcBot:FindAoELocation( false, true, ally:GetLocation(), CastRange, Radius, 0, 0 ); - return BOT_ACTION_DESIRE_HIGH, locationAoE.targetloc; + return BOT_ACTION_DESIRE_HIGH, locationAoE.targetloc, "Location" else - return BOT_ACTION_DESIRE_HIGH, ally; + return BOT_ACTION_DESIRE_HIGH, ally, "Target" end end end @@ -427,9 +428,9 @@ Consider[3]=function() end if(AOESurge:IsTrained()==true) then local locationAoE = npcBot:FindAoELocation( false, true, ClosestBot:GetLocation(), CastRange, Radius, 0, 0 ); - return BOT_ACTION_DESIRE_MODERATE, locationAoE.targetloc; + return BOT_ACTION_DESIRE_MODERATE, locationAoE.targetloc, "Location" else - return BOT_ACTION_DESIRE_MODERATE, ClosestBot; + return BOT_ACTION_DESIRE_MODERATE, ClosestBot, "Target" end end end @@ -440,7 +441,6 @@ Consider[3]=function() end Consider[4]=function() - local abilityNumber=4 -------------------------------------- -- Generic Variable Setting @@ -451,6 +451,77 @@ Consider[4]=function() return BOT_ACTION_DESIRE_NONE, 0; end + local CastRange = ability:GetCastRange(); + local Damage = ability:GetAbilityDamage(); + local Radius = ability:GetAOERadius() + 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) + + -------------------------------------- + -- Global high-priorty usage + -------------------------------------- + -- Check for a channeling enemy + for _,npcEnemy in pairs( enemys ) + do + if ( npcEnemy:IsChanneling() ) + then + return BOT_ACTION_DESIRE_HIGH, npcEnemy + end + 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:GetActiveModeDesire() >= BOT_MODE_DESIRE_HIGH ) + then + for _,npcEnemy in pairs( enemys ) + do + if ( npcBot:WasRecentlyDamagedByHero( npcEnemy, 2.0 ) ) + then + if ( CanCast[abilityNumber]( npcEnemy ) ) + then + return BOT_ACTION_DESIRE_LOW, npcEnemy; + end + end + 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 npcEnemy = npcBot:GetTarget(); + + if ( npcEnemy ~= nil ) + then + if ( CanCast[abilityNumber]( npcEnemy ) ) + then + return BOT_ACTION_DESIRE_LOW, npcEnemy + end + end + end + + return BOT_ACTION_DESIRE_NONE + +end + +Consider[5]=function() + + local abilityNumber=5 + -------------------------------------- + -- Generic Variable Setting + -------------------------------------- + local ability=AbilitiesReal[abilityNumber]; + + if not ability:IsFullyCastable() then + return BOT_ACTION_DESIRE_NONE, 0; + end + local CastRange = ability:GetCastRange(); local Radius = ability:GetAOERadius() local CastPoint = ability:GetCastPoint(); @@ -474,6 +545,7 @@ Consider[4]=function() end +AbilityExtensions:AutoModifyConsiderFunction(npcBot, Consider, AbilitiesReal) function AbilityUsageThink() -- Check if we're already using an ability diff --git a/ability_item_usage_dazzle.lua b/ability_item_usage_dazzle.lua index 37068de1..69d48691 100644 --- a/ability_item_usage_dazzle.lua +++ b/ability_item_usage_dazzle.lua @@ -7,6 +7,7 @@ -------------------------------------- local utility = require( GetScriptDirectory().."/utility" ) require(GetScriptDirectory() .. "/ability_item_usage_generic") +local AbilityExtensions = require(GetScriptDirectory().."/util/AbilityAbstraction") local debugmode=false local npcBot = GetBot() @@ -25,20 +26,20 @@ local AbilityToLevelUp= { Abilities[1], Abilities[3], - Abilities[1], Abilities[2], Abilities[1], - Abilities[4], Abilities[1], Abilities[3], Abilities[3], - "talent", Abilities[3], Abilities[4], + "talent", Abilities[2], Abilities[2], - "talent", Abilities[2], + Abilities[4], + "talent", + Abilities[1], "nil", Abilities[4], "nil", @@ -256,14 +257,14 @@ Consider[2]=function() for _,npcTarget in pairs( allys ) do local enemys2 = npcTarget:GetNearbyHeroes(600,true,BOT_MODE_NONE) - if(npcTarget:GetHealth()/npcTarget:GetMaxHealth()<=0.2+0.05*#enemys2) + if not npcTarget:IsIllusion() and (npcTarget:GetHealth()/npcTarget:GetMaxHealth()<=0.2+0.05*#enemys2) and npcTarget:WasRecentlyDamagedByAnyHero(3) then local Damage2=0 for _,npcEnemy in pairs( enemys2 ) do Damage2 =Damage2 + npcEnemy:GetEstimatedDamageToTarget( true, npcBot, 2.0, DAMAGE_TYPE_ALL ); end - if(npcTarget:GetHealth()= 1 and ManaPercentage>0.4 or npcBot:GetMana()>ComboMana) + if ( #creeps >= 1 and ManaPercentage>0.6 or npcBot:GetMana()>ComboMana) then return BOT_ACTION_DESIRE_LOW, creeps[1]; end @@ -403,6 +404,10 @@ Consider[6]=function() return BOT_ACTION_DESIRE_NONE, 0; end +-- + + +AbilityExtensions:AutoModifyConsiderFunction(npcBot, Consider, AbilitiesReal) function AbilityUsageThink() -- Check if we're already using an ability diff --git a/ability_item_usage_dragon_knight.lua b/ability_item_usage_dragon_knight.lua index 98bb37ff..f2f2a9b3 100644 --- a/ability_item_usage_dragon_knight.lua +++ b/ability_item_usage_dragon_knight.lua @@ -7,6 +7,7 @@ -------------------------------------- local utility = require( GetScriptDirectory().."/utility" ) require(GetScriptDirectory() .. "/ability_item_usage_generic") +local AbilityExtensions = require(GetScriptDirectory().."/util/AbilityAbstraction") local debugmode=false local npcBot = GetBot() @@ -384,6 +385,8 @@ Consider[5]=function() return BOT_ACTION_DESIRE_NONE, 0 end +AbilityExtensions:AutoModifyConsiderFunction(npcBot, Consider, AbilitiesReal) + function AbilityUsageThink() -- Check if we're already using an ability diff --git a/ability_item_usage_drow_ranger.lua b/ability_item_usage_drow_ranger.lua index acbfeb62..85e0b8c0 100644 --- a/ability_item_usage_drow_ranger.lua +++ b/ability_item_usage_drow_ranger.lua @@ -7,6 +7,8 @@ -------------------------------------- local utility = require( GetScriptDirectory().."/utility" ) require(GetScriptDirectory() .. "/ability_item_usage_generic") +local AbilityExtensions = require(GetScriptDirectory().."/util/AbilityAbstraction") + local debugmode=false local npcBot = GetBot() @@ -77,7 +79,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.CanCastNoTarget,utility.UCanCast} local enemyDisabled=utility.enemyDisabled function GetComboDamage() @@ -154,7 +156,7 @@ Consider[1]=function() -------------------------------------- if ( npcBot:GetActiveMode() == BOT_MODE_LANING ) then - if(CreepHealth>=300 and ManaPercentage>=0.5 and HealthPercentage>=0.6 and #creeps2<=1) + if AbilityExtensions:HasEnoughManaToUseAttackAttachedAbility(npcBot, AbilitiesReal[abilityNumber]) and #creeps2<=1 then if (WeakestEnemy~=nil) then @@ -167,7 +169,7 @@ Consider[1]=function() end -- If we're farming - if ( npcBot:GetActiveMode() == BOT_MODE_FARM ) + if ( npcBot:GetActiveMode() == BOT_MODE_FARM and AbilityExtensions:HasEnoughManaToUseAttackAttachedAbility(npcBot, AbilitiesReal[abilityNumber]) ) then if(WeakestCreep~=nil) then @@ -426,6 +428,7 @@ Consider[3]=function() end +AbilityExtensions:AutoModifyConsiderFunction(npcBot, Consider, AbilitiesReal) function AbilityUsageThink() -- Check if we're already using an ability diff --git a/ability_item_usage_earth_spirit.lua b/ability_item_usage_earth_spirit.lua index 4f79e84b..c7c69781 100644 --- a/ability_item_usage_earth_spirit.lua +++ b/ability_item_usage_earth_spirit.lua @@ -7,6 +7,7 @@ -------------------------------------- local utility = require( GetScriptDirectory().."/utility" ) require(GetScriptDirectory() .. "/ability_item_usage_generic") +local AbilityExtensions = require(GetScriptDirectory().."/util/AbilityAbstraction") local debugmode=false local npcBot = GetBot() @@ -679,6 +680,7 @@ Consider[6]=function() return BOT_ACTION_DESIRE_NONE; end +AbilityExtensions:AutoModifyConsiderFunction(npcBot, Consider, AbilitiesReal) function AbilityUsageThink() -- Check if we're already using an ability diff --git a/ability_item_usage_earthshaker.lua b/ability_item_usage_earthshaker.lua index 5b8335b0..7dee1a5a 100644 --- a/ability_item_usage_earthshaker.lua +++ b/ability_item_usage_earthshaker.lua @@ -7,6 +7,7 @@ -------------------------------------- local utility = require( GetScriptDirectory().."/utility" ) require(GetScriptDirectory() .. "/ability_item_usage_generic") +local AbilityExtensions = require(GetScriptDirectory().."/util/AbilityAbstraction") local debugmode=false local npcBot = GetBot() @@ -483,6 +484,7 @@ Consider[4]=function() end +AbilityExtensions:AutoModifyConsiderFunction(npcBot, Consider, AbilitiesReal) function AbilityUsageThink() -- Check if we're already using an ability diff --git a/ability_item_usage_elder_titan.lua b/ability_item_usage_elder_titan.lua index 2efa7ce6..243d6df3 100644 --- a/ability_item_usage_elder_titan.lua +++ b/ability_item_usage_elder_titan.lua @@ -11,6 +11,7 @@ end local utility = require( GetScriptDirectory().."/utility" ) require(GetScriptDirectory() .. "/ability_item_usage_generic") +local AbilityExtensions = require(GetScriptDirectory().."/util/AbilityAbstraction") local debugmode=false local npcBot = GetBot() @@ -410,6 +411,7 @@ Consider[4]=function() end +AbilityExtensions:AutoModifyConsiderFunction(npcBot, Consider, AbilitiesReal) function AbilityUsageThink() -- Check if we're already using an ability diff --git a/ability_item_usage_ember_spirit.lua b/ability_item_usage_ember_spirit.lua index 1965c5c7..dbd01fa7 100644 --- a/ability_item_usage_ember_spirit.lua +++ b/ability_item_usage_ember_spirit.lua @@ -7,6 +7,7 @@ -------------------------------------- local utility = require( GetScriptDirectory().."/utility" ) require(GetScriptDirectory() .. "/ability_item_usage_generic") +local AbilityExtensions = require(GetScriptDirectory().."/util/AbilityAbstraction") local debugmode=false local npcBot = GetBot() @@ -88,6 +89,7 @@ end local CanCast={utility.NCanCast,CanCast2,utility.NCanCast,utility.UCanCast,utility.UCanCast} +AbilityExtensions:AutoModifyConsiderFunction(npcBot, Consider, AbilitiesReal) function AbilityUsageThink() -- Check if we're already using an ability diff --git a/ability_item_usage_enchantress.lua b/ability_item_usage_enchantress.lua index 2b24c715..0a139bdf 100644 --- a/ability_item_usage_enchantress.lua +++ b/ability_item_usage_enchantress.lua @@ -7,6 +7,8 @@ -------------------------------------- local utility = require( GetScriptDirectory().."/utility" ) require(GetScriptDirectory() .. "/ability_item_usage_generic") +local AbilityExtensions = require(GetScriptDirectory().."/util/AbilityAbstraction") + local debugmode=false local npcBot = GetBot() @@ -285,7 +287,7 @@ Consider[1]=function() local t=npcBot:GetAttackTarget() if(t~=nil) then - if (t:IsHero() or t:IsTower()) + if (t:IsHero() or t:IsTower()) or AbilityExtensions:MustBeIllusions(npcBot, t) and (AbilityExtensions:GetManaPercent(npcBot) >= 0.8) then ability:ToggleAutoCast() return BOT_ACTION_DESIRE_NONE, 0; @@ -322,7 +324,7 @@ Consider[1]=function() -------------------------------------- if ( npcBot:GetActiveMode() == BOT_MODE_LANING ) then - if(CreepHealth>=250 and ManaPercentage>=0.5 and HealthPercentage>=0.6 and #creeps2<=1) + if AbilityExtensions:HasEnoughManaToUseAttackAttachedAbility(npcBot, AbilitiesReal[abilityNumber]) and #creeps2<=1 then if (WeakestEnemy~=nil) then @@ -355,8 +357,8 @@ Consider[1]=function() end +AbilityExtensions:AutoModifyConsiderFunction(npcBot, Consider, AbilitiesReal) function AbilityUsageThink() - -- Check if we're already using an ability if ( npcBot:IsUsingAbility() or npcBot:IsChanneling() or npcBot:IsSilenced() ) then @@ -377,6 +379,6 @@ function AbilityUsageThink() ability_item_usage_generic.UseAbility(AbilitiesReal,cast) end -function CourierUsageThink() +function CourierUsageThink() ability_item_usage_generic.CourierUsageThink() end \ No newline at end of file diff --git a/ability_item_usage_enigma.lua b/ability_item_usage_enigma.lua index b567c4e6..a1af756c 100644 --- a/ability_item_usage_enigma.lua +++ b/ability_item_usage_enigma.lua @@ -7,6 +7,7 @@ -------------------------------------- local utility = require( GetScriptDirectory().."/utility" ) require(GetScriptDirectory() .. "/ability_item_usage_generic") +local AbilityExtensions = require(GetScriptDirectory().."/util/AbilityAbstraction") local debugmode=false local npcBot = GetBot() @@ -531,6 +532,8 @@ Consider[4]=function() return BOT_ACTION_DESIRE_NONE, 0; end +AbilityExtensions:AutoModifyConsiderFunction(npcBot, Consider, AbilitiesReal) + function AbilityUsageThink() -- Check if we're already using an ability diff --git a/ability_item_usage_faceless_void.lua b/ability_item_usage_faceless_void.lua index 6499fad7..593f6663 100644 --- a/ability_item_usage_faceless_void.lua +++ b/ability_item_usage_faceless_void.lua @@ -7,6 +7,7 @@ -------------------------------------- local utility = require( GetScriptDirectory().."/utility" ) require(GetScriptDirectory() .. "/ability_item_usage_generic") +local AbilityExtensions = require(GetScriptDirectory().."/util/AbilityAbstraction") local debugmode=false local npcBot = GetBot() @@ -17,11 +18,9 @@ local AbilitiesReal ={} ability_item_usage_generic.InitAbility(Abilities,AbilitiesReal,Talents) -- utility.PrintAbilityName(Abilities) -local abilityName = {} +local abilityName = { "faceless_void_time_walk", "faceless_void_time_dilation", "faceless_void_time_lock", "faceless_void_time_walk_reverse", "faceless_void_chronosphere", } local abilityIndex = utility.ReverseTable(abilityName) --- { 1 : faceless_void_time_walk, 2 : faceless_void_time_dilation, 3 : faceless_void_time_lock, 4 : faceless_void_time_walk_reverse, 5 : faceless_void_chronosphere, } - local AbilityToLevelUp= { Abilities[1], @@ -78,7 +77,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.CanCastNoTarget,utility.UCanCast,} local enemyDisabled=utility.enemyDisabled function GetComboDamage() @@ -375,6 +374,7 @@ Consider[5]=function() return BOT_ACTION_DESIRE_NONE, 0; end +AbilityExtensions:AutoModifyConsiderFunction(npcBot, Consider, AbilitiesReal) function AbilityUsageThink() -- Check if we're already using an ability diff --git a/ability_item_usage_furion.lua b/ability_item_usage_furion.lua index 3f120547..0c71fd4d 100644 --- a/ability_item_usage_furion.lua +++ b/ability_item_usage_furion.lua @@ -8,6 +8,7 @@ -------------------------------------- local utility = require( GetScriptDirectory().."/utility" ) require(GetScriptDirectory() .. "/ability_item_usage_generic") +local AbilityExtensions = require(GetScriptDirectory().."/util/AbilityAbstraction") local debugmode=false local npcBot = GetBot() @@ -457,6 +458,7 @@ Consider[4]=function() end +AbilityExtensions:AutoModifyConsiderFunction(npcBot, Consider, AbilitiesReal) function AbilityUsageThink() -- Check if we're already using an ability diff --git a/ability_item_usage_gyrocopter.lua b/ability_item_usage_gyrocopter.lua index 2afe7598..6bc386a3 100644 --- a/ability_item_usage_gyrocopter.lua +++ b/ability_item_usage_gyrocopter.lua @@ -7,6 +7,7 @@ -------------------------------------- local utility = require( GetScriptDirectory().."/utility" ) require(GetScriptDirectory() .. "/ability_item_usage_generic") +local AbilityExtensions = require(GetScriptDirectory().."/util/AbilityAbstraction") local debugmode=false local npcBot = GetBot() @@ -527,6 +528,7 @@ Consider[4]=function() end +AbilityExtensions:AutoModifyConsiderFunction(npcBot, Consider, AbilitiesReal) function AbilityUsageThink() -- Check if we're already using an ability diff --git a/ability_item_usage_hoodwink.lua b/ability_item_usage_hoodwink.lua index e8f52e4c..2cd3194f 100644 --- a/ability_item_usage_hoodwink.lua +++ b/ability_item_usage_hoodwink.lua @@ -7,6 +7,7 @@ -------------------------------------- local utility = require( GetScriptDirectory().."/utility" ) require(GetScriptDirectory() .. "/ability_item_usage_generic") +local AbilityExtensions = require(GetScriptDirectory().."/util/AbilityAbstraction") local debugmode=false local npcBot = GetBot() @@ -458,6 +459,7 @@ Consider[4]=function() end +AbilityExtensions:AutoModifyConsiderFunction(npcBot, Consider, AbilitiesReal) function AbilityUsageThink() -- Check if we're already using an ability diff --git a/ability_item_usage_huskar.lua b/ability_item_usage_huskar.lua index 7a12c864..59f4477b 100644 --- a/ability_item_usage_huskar.lua +++ b/ability_item_usage_huskar.lua @@ -7,6 +7,7 @@ -------------------------------------- local utility = require( GetScriptDirectory().."/utility" ) require(GetScriptDirectory() .. "/ability_item_usage_generic") +local AbilityExtensions = require(GetScriptDirectory().."/util/AbilityAbstraction") local debugmode=false local npcBot = GetBot() @@ -296,6 +297,7 @@ Consider[4]=function() end +AbilityExtensions:AutoModifyConsiderFunction(npcBot, Consider, AbilitiesReal) function AbilityUsageThink() -- Check if we're already using an ability diff --git a/ability_item_usage_jakiro.lua b/ability_item_usage_jakiro.lua index 65937986..29ccbad1 100644 --- a/ability_item_usage_jakiro.lua +++ b/ability_item_usage_jakiro.lua @@ -7,6 +7,7 @@ -------------------------------------- local utility = require( GetScriptDirectory().."/utility" ) require(GetScriptDirectory() .. "/ability_item_usage_generic") +local AbilityExtensions = require(GetScriptDirectory().."/util/AbilityAbstraction") local debugmode=false local npcBot = GetBot() @@ -76,7 +77,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.UCanCast} local enemyDisabled=utility.enemyDisabled function GetComboDamage() @@ -536,6 +537,7 @@ Consider[abilityIndex.jakiro_macropyre]=function() end +AbilityExtensions:AutoModifyConsiderFunction(npcBot, Consider, AbilitiesReal) function AbilityUsageThink() -- Check if we're already using an ability diff --git a/ability_item_usage_juggernaut.lua b/ability_item_usage_juggernaut.lua index 9a17d6af..2b8ee2df 100644 --- a/ability_item_usage_juggernaut.lua +++ b/ability_item_usage_juggernaut.lua @@ -7,6 +7,7 @@ -------------------------------------- local utility = require( GetScriptDirectory().."/utility" ) require(GetScriptDirectory() .. "/ability_item_usage_generic") +local AbilityExtensions = require(GetScriptDirectory().."/util/AbilityAbstraction") local debugmode=false local npcBot = GetBot() diff --git a/ability_item_usage_keeper_of_the_light.lua b/ability_item_usage_keeper_of_the_light.lua index 4524d993..dce447cb 100644 --- a/ability_item_usage_keeper_of_the_light.lua +++ b/ability_item_usage_keeper_of_the_light.lua @@ -7,6 +7,7 @@ -------------------------------------- local utility = require( GetScriptDirectory().."/utility" ) require(GetScriptDirectory() .. "/ability_item_usage_generic") +local AbilityExtensions = require(GetScriptDirectory().."/util/AbilityAbstraction") local debugmode=false local npcBot = GetBot() @@ -17,11 +18,22 @@ local AbilitiesReal ={} ability_item_usage_generic.InitAbility(Abilities,AbilitiesReal,Talents) -- utility.PrintAbilityName(Abilities) -local abilityName = {} +local abilityName = { + "keeper_of_the_light_illuminate", + "keeper_of_the_light_radiant_blind", + "keeper_of_the_light_chakra_magic", + "keeper_of_the_light_blind_light", + "keeper_of_the_light_will_o_wisp", + "keeper_of_the_light_spirit_form", + "keeper_of_the_light_illuminate_end", + "keeper_of_the_light_spirit_form_illuminate", + "keeper_of_the_light_spirit_form_illiminate_end", + "keeper_of_the_light_recall", +} local abilityIndex = utility.ReverseTable(abilityName) -local AbilityToLevelUp= +local AbilityToLevelUp = { Abilities[1], Abilities[3], @@ -76,8 +88,19 @@ end -- Ability Usage Thinking -------------------------------------- local cast={} cast.Desire={} cast.Target={} cast.Type={} -local Consider ={} -local CanCast={utility.NCanCast,utility.NCanCast,utility.NCanCast,utility.NCanCast,utility.NCanCast,utility.UCanCast,utility.NCanCast,utility.NCanCast} +local Consider = {} +local CanCast= { + utility.NCanCast, + utility.NCanCast, + utility.UCanCast, + utility.NCanCast, + utility.NCanCast, + utility.UCanCast, + utility.NCanCast, + utility.NCanCast, + utility.UCanCast, + utility.UCanCast, +} local enemyDisabled=utility.enemyDisabled function GetComboDamage() @@ -210,23 +233,89 @@ Consider[1]=function() end -Consider[2]=function() +-- Consider[2]=function() + +-- local abilityNumber=2 +-- -------------------------------------- +-- -- Generic Variable Setting +-- -------------------------------------- +-- local ability=AbilitiesReal[abilityNumber]; + +-- if ( not ability:IsFullyCastable() ) +-- then +-- return BOT_ACTION_DESIRE_NONE, 0; +-- end + +-- local CastRange = ability:GetCastRange(); +-- local Damage = ability:GetAbilityDamage(); +-- local Radius = ability:GetAOERadius() +-- 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 +-- -------------------------------------- +-- -- 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:GetActiveModeDesire() >= BOT_MODE_DESIRE_HIGH ) +-- then +-- if ( npcBot:WasRecentlyDamagedByAnyHero( 2.0 ) ) +-- 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 + +-- return BOT_ACTION_DESIRE_HIGH, npcBot +-- 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_LOW, npcEnemy:GetExtrapolatedLocation(CastPoint); +-- end +-- end +-- end + +-- return BOT_ACTION_DESIRE_NONE, 0; - local abilityNumber=2 +-- end + +-- copied from sven_storm_hammer + +Consider[abilityIndex.keeper_of_the_light_radiant_blind]=function() + local abilityNumber=abilityIndex.keeper_of_the_light_radiant_blind -------------------------------------- -- Generic Variable Setting -------------------------------------- local ability=AbilitiesReal[abilityNumber]; - if ( not ability:IsFullyCastable() ) - then + if not ability:IsFullyCastable() then return BOT_ACTION_DESIRE_NONE, 0; end local CastRange = ability:GetCastRange(); local Damage = ability:GetAbilityDamage(); - local Radius = ability:GetAOERadius() local CastPoint = ability:GetCastPoint(); + local Radius = ability:GetAOERadius(); local allys = npcBot:GetNearbyHeroes( 1200, false, BOT_MODE_NONE ); local enemys = npcBot:GetNearbyHeroes(CastRange+300,true,BOT_MODE_NONE) @@ -234,40 +323,135 @@ Consider[2]=function() local creeps = npcBot:GetNearbyCreeps(CastRange+300,true) local WeakestCreep,CreepHealth=utility.GetWeakestUnit(creeps) -------------------------------------- + -- Global high-priorty usage + -------------------------------------- + -- Check for a channeling enemy + for _,npcEnemy in pairs( enemys ) + do + if ( npcEnemy:IsChanneling() and CanCast[abilityNumber]( npcEnemy )) + then + return BOT_ACTION_DESIRE_HIGH, npcEnemy + end + end + + --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; + end + end + end + end + + -- If we're in a teamfight, use it on the scariest enemy + local tableNearbyAttackingAlliedHeroes = npcBot:GetNearbyHeroes( 1000, false, BOT_MODE_ATTACK ); + if ( #tableNearbyAttackingAlliedHeroes >= 2 ) + then + + local npcMostDangerousEnemy = nil; + local nMostDangerousDamage = 0; + + for _,npcEnemy in pairs( enemys ) + do + if ( CanCast[abilityNumber]( npcEnemy ) and not enemyDisabled(npcEnemy)) + then + local Damage2 = npcEnemy:GetEstimatedDamageToTarget( false, npcBot, 3.0, DAMAGE_TYPE_ALL ); + if ( Damage2 > nMostDangerousDamage ) + then + nMostDangerousDamage = Damage2; + npcMostDangerousEnemy = npcEnemy; + end + end + end + + if ( npcMostDangerousEnemy ~= nil ) + then + return BOT_ACTION_DESIRE_HIGH, npcMostDangerousEnemy; + end + end + -------------------------------------- -- Mode based usage -------------------------------------- -- 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:GetActiveModeDesire() >= BOT_MODE_DESIRE_HIGH ) then - if ( npcBot:WasRecentlyDamagedByAnyHero( 2.0 ) ) + for _,npcEnemy in pairs( enemys ) + do + if ( npcBot:WasRecentlyDamagedByHero( npcEnemy, 2.0 ) ) + then + if ( CanCast[abilityNumber]( npcEnemy ) and not enemyDisabled(npcEnemy)) + then + return BOT_ACTION_DESIRE_HIGH, npcEnemy; + end + end + end + end + + -- If my mana is enough,use it at enemy + if ( npcBot:GetActiveMode() == BOT_MODE_LANING ) + then + if((ManaPercentage>0.7 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, locationAoE.targetloc; + if (WeakestEnemy~=nil) + then + if ( CanCast[abilityNumber]( WeakestEnemy ) ) + then + return BOT_ACTION_DESIRE_LOW,WeakestEnemy; + end + end + end + end + -- If we're farming and can hit 2+ creeps and kill 1+ + if ( npcBot:GetActiveMode() == BOT_MODE_FARM ) + then + if ( #creeps >= 2 ) + then + if(CreepHealth<=WeakestCreep:GetActualIncomingDamage(Damage,DAMAGE_TYPE_MAGICAL) and npcBot:GetMana()>ComboMana) + then + return BOT_ACTION_DESIRE_LOW, WeakestCreep; end - - return BOT_ACTION_DESIRE_HIGH, npcBot:GetLocation(); end end + -- If we're pushing or defending a lane + if ( npcBot:GetActiveMode() == BOT_MODE_DEFEND_TOWER_TOP or + npcBot:GetActiveMode() == BOT_MODE_DEFEND_TOWER_MID or + npcBot:GetActiveMode() == BOT_MODE_DEFEND_TOWER_BOT ) + then + if ( #enemys>=1) + then + if (ManaPercentage>0.7 or npcBot:GetMana()>ComboMana ) + then + if (WeakestEnemy~=nil) + then + if ( CanCast[abilityNumber]( WeakestEnemy )and GetUnitToUnitDistance(npcBot,WeakestEnemy)< CastRange + 75*#allys ) + then + return BOT_ACTION_DESIRE_LOW, WeakestEnemy; + end + end + end + 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) + 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 ) + if ( npcEnemy ~= nil ) then - if ( CanCast[abilityNumber]( npcEnemy ) ) + if ( CanCast[abilityNumber]( npcEnemy ) and not enemyDisabled(npcEnemy) and GetUnitToUnitDistance(npcBot,npcEnemy)< CastRange + 75*#allys) then - return BOT_ACTION_DESIRE_LOW, npcEnemy:GetExtrapolatedLocation(CastPoint); + return BOT_ACTION_DESIRE_MODERATE, npcEnemy end end end @@ -312,10 +496,10 @@ Consider[3]=function() return BOT_ACTION_DESIRE_NONE, 0; end -Consider[4] = function() +Consider[abilityIndex.keeper_of_the_light_blind_light] = function() --Location AOE Example - local abilityNumber = 4 + local abilityNumber = abilityIndex.keeper_of_the_light_blind_light -------------------------------------- -- Generic Variable Setting -------------------------------------- @@ -339,7 +523,6 @@ Consider[4] = function() -------------------------------------- -- Global high-priorty usage -------------------------------------- - -- Check for a channeling enemy -- If we're in a teamfight, use it on the scariest enemy local tableNearbyAttackingAlliedHeroes = npcBot:GetNearbyHeroes( 1000, false, BOT_MODE_ATTACK ); if ( #tableNearbyAttackingAlliedHeroes >= 2 ) @@ -364,21 +547,116 @@ Consider[4] = function() return BOT_ACTION_DESIRE_LOW-0.15, locationAoE.targetloc end end + + -- If we're in a teamfight, use it on the scariest enemy + local tableNearbyAttackingAlliedHeroes = npcBot:GetNearbyHeroes( 1000, false, BOT_MODE_ATTACK ); + if ( #tableNearbyAttackingAlliedHeroes >= 2 ) + then + + local npcMostDangerousEnemy = nil; + local nMostDangerousDamage = 0; + + for _,npcEnemy in pairs( enemys ) + do + if ( CanCast[abilityNumber]( npcEnemy ) and not enemyDisabled(npcEnemy)) + then + local Damage2 = npcEnemy:GetEstimatedDamageToTarget( false, npcBot, 3.0, DAMAGE_TYPE_ALL ); + if ( Damage2 > nMostDangerousDamage ) + then + nMostDangerousDamage = Damage2; + npcMostDangerousEnemy = npcEnemy; + end + end + end + + if ( npcMostDangerousEnemy ~= nil ) + then + return BOT_ACTION_DESIRE_HIGH, npcMostDangerousEnemy:GetLocation(); + 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 ) + -- 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, CastPoint, 0 ); - if ( locationAoE.count >= 3 ) - then + if ( locationAoE.count >= 2 ) then return BOT_ACTION_DESIRE_LOW, locationAoE.targetloc end end + + -- If we're in a teamfight, use it + local tableNearbyAttackingAlliedHeroes = npcBot:GetNearbyHeroes( 1000, false, BOT_MODE_ATTACK ); + if ( #tableNearbyAttackingAlliedHeroes >= 2 ) + then + local npcEnemy = npcBot:GetTarget(); + + if ( npcEnemy ~= nil and Enemys~=nil and #Enemys >= 2) + then + return BOT_ACTION_DESIRE_HIGH, locationAoE.targetloc + end + end + + return BOT_ACTION_DESIRE_NONE, 0; + +end + +Consider[abilityIndex.keeper_of_the_light_will_o_wisp] = function() + local abilityNumber = abilityIndex.keeper_of_the_light_will_o_wisp + local ability = AbilitiesReal[abilityNumber] + + if not ability:IsFullyCastable() then + return BOT_ACTION_DESIRE_NONE, 0 + end + + local CastRange = ability:GetCastRange() + local Damage = ability:GetAbilityDamage() + local Radius = ability:GetAOERadius() + local CastPoint = ability:GetCastPoint() + + local allys = npcBot:GetNearbyHeroes(1200, false, BOT_MODE_NONE) + local enemys = npcBot:GetNearbyHeroes(Min(CastRange + 300, 1600), true, BOT_MODE_NONE) + local WeakestEnemy, HeroHealth = utility.GetWeakestUnit(enemys) + local creeps = npcBot:GetNearbyCreeps(Min(CastRange + 300, 1600), true) + local WeakestCreep, CreepHealth = utility.GetWeakestUnit(creeps) + + -------------------------------------- + -- Global high-priorty usage + -------------------------------------- + -- Check for a channeling enemy + for _,npcEnemy in pairs( enemys ) + do + if ( npcEnemy:IsChanneling() and CanCast[abilityNumber]( npcEnemy )) + then + return BOT_ACTION_DESIRE_HIGH, npcEnemy:GetLocation() + end + end + -- If we're in a teamfight, use it on the scariest enemy + local tableNearbyAttackingAlliedHeroes = npcBot:GetNearbyHeroes( 1000, false, BOT_MODE_ATTACK ); + if ( #tableNearbyAttackingAlliedHeroes >= 2 ) + then + for _,npcEnemy in pairs( enemys ) + do + if ( npcEnemy:IsChanneling() ) + then + return BOT_ACTION_DESIRE_MODERATE-0.15, npcEnemy:GetLocation() + end + end + end + -------------------------------------- + -- Mode based usage + -------------------------------------- + -- 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:GetActiveModeDesire() >= BOT_MODE_DESIRE_HIGH ) + then + local locationAoE = npcBot:FindAoELocation( true, true, npcBot:GetLocation(), CastRange, Radius, CastPoint, 0 ); + if ( locationAoE.count >= 2 ) + then + return BOT_ACTION_DESIRE_LOW-0.15, locationAoE.targetloc + end + end -- If we're going after someone if ( npcBot:GetActiveMode() == BOT_MODE_ROAM or @@ -408,6 +686,56 @@ Consider[4] = function() end +-- copied from sven_strength_of_god +Consider[abilityIndex.keeper_of_the_light_spirit_form]=function() + local abilityNumber=abilityIndex.keeper_of_the_light_spirit_form + -------------------------------------- + -- Generic Variable Setting + -------------------------------------- + local ability=AbilitiesReal[abilityNumber] + + if not ability:IsFullyCastable() then + return BOT_ACTION_DESIRE_NONE, 0; + end + + local CastRange = 0; + local Damage = ability:GetAbilityDamage() + local Radius = ability:GetAOERadius() + local CastPoint = ability:GetCastPoint() + + local allys = npcBot:GetNearbyHeroes(1200, false, BOT_MODE_NONE) + local enemys = npcBot:GetNearbyHeroes(Radius,true,BOT_MODE_NONE) + local enemys2 = npcBot:GetNearbyHeroes(Radius,false,BOT_MODE_NONE) + local WeakestEnemy,HeroHealth=utility.GetWeakestUnit(enemys) + local creeps2 = npcBot:GetNearbyCreeps(Radius,false) + + --try to kill enemy hero + if npcBot:GetActiveMode() ~= BOT_MODE_RETREAT then + if WeakestEnemy~=nil then + if HeroHealth<=WeakestEnemy:GetActualIncomingDamage(GetComboDamage(),DAMAGE_TYPE_PHYSICAL) then + return BOT_ACTION_DESIRE_HIGH,WeakestEnemy + end + end + end + -------------------------------------- + -- Mode based usage + -------------------------------------- + -- If we're in a teamfight, use it + local tableNearbyAttackingAlliedHeroes = npcBot:GetNearbyHeroes( 1000, false, BOT_MODE_ATTACK ) + if #tableNearbyAttackingAlliedHeroes >= 2 then + local npcEnemy = npcBot:GetTarget() + if ( npcEnemy ~= nil ) + then + return BOT_ACTION_DESIRE_HIGH + end + end + + return BOT_ACTION_DESIRE_NONE, 0 +end + +Consider.keeper_of_the_light_spirit_form_illuminate = Consider.keeper_of_the_light_illuminate + +AbilityExtensions:AutoModifyConsiderFunction(npcBot, Consider, AbilitiesReal) function AbilityUsageThink() -- Check if we're already using an ability diff --git a/ability_item_usage_kunkka.lua b/ability_item_usage_kunkka.lua index 95182cc3..3b8cfc9a 100644 --- a/ability_item_usage_kunkka.lua +++ b/ability_item_usage_kunkka.lua @@ -8,6 +8,7 @@ -------------------------------------- local utility = require( GetScriptDirectory().."/utility" ) require(GetScriptDirectory() .. "/ability_item_usage_generic") +local AbilityExtensions = require(GetScriptDirectory().."/util/AbilityAbstraction") local debugmode=false local npcBot = GetBot() @@ -78,7 +79,14 @@ 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.NCanCast, +} local enemyDisabled=utility.enemyDisabled function GetComboDamage() @@ -419,6 +427,7 @@ Consider[6]=function() end +AbilityExtensions:AutoModifyConsiderFunction(npcBot, Consider, AbilitiesReal) function AbilityUsageThink() -- Check if we're already using an ability diff --git a/ability_item_usage_legion_commander.lua b/ability_item_usage_legion_commander.lua index a828f5a4..0b8353d1 100644 --- a/ability_item_usage_legion_commander.lua +++ b/ability_item_usage_legion_commander.lua @@ -7,6 +7,7 @@ -------------------------------------- local utility = require( GetScriptDirectory().."/utility" ) require(GetScriptDirectory() .. "/ability_item_usage_generic") +local AbilityExtensions = require(GetScriptDirectory().."/util/AbilityAbstraction") local debugmode=false local npcBot = GetBot() @@ -406,6 +407,7 @@ Consider[4]=function() end +AbilityExtensions:AutoModifyConsiderFunction(npcBot, Consider, AbilitiesReal) function AbilityUsageThink() -- Check if we're already using an ability diff --git a/ability_item_usage_leshrac.lua b/ability_item_usage_leshrac.lua index 1de1844d..c05fe8ef 100644 --- a/ability_item_usage_leshrac.lua +++ b/ability_item_usage_leshrac.lua @@ -7,6 +7,7 @@ -------------------------------------- local utility = require( GetScriptDirectory().."/utility" ) require(GetScriptDirectory() .. "/ability_item_usage_generic") +local AbilityExtensions = require(GetScriptDirectory().."/util/AbilityAbstraction") local debugmode=false local npcBot = GetBot() @@ -549,6 +550,8 @@ Consider[4]=function() end +AbilityExtensions:AutoModifyConsiderFunction(npcBot, Consider, AbilitiesReal) + function AbilityUsageThink() -- Check if we're already using an ability diff --git a/ability_item_usage_lich.lua b/ability_item_usage_lich.lua index b48c33ee..56db23d5 100644 --- a/ability_item_usage_lich.lua +++ b/ability_item_usage_lich.lua @@ -5,6 +5,7 @@ -------------------------------------- -- General Initialization -------------------------------------- +local utility = require( GetScriptDirectory().."/utility" ) require(GetScriptDirectory() .. "/ability_item_usage_generic") local AbilityHelper = dofile(GetScriptDirectory() .. "/util/AbilityHelper") @@ -19,22 +20,22 @@ ability_item_usage_generic.InitAbility(abilities, abilityHandles, talents) local abilityTree = { abilities[2], abilities[1], - abilities[1], + abilities[2], abilities[3], - abilities[1], - abilities[4], - abilities[1], abilities[2], + abilities[5], abilities[2], + abilities[1], + abilities[1], "talent", - abilities[2], - abilities[4], + abilities[1], + abilities[5], abilities[3], abilities[3], "talent", abilities[3], "nil", - abilities[4], + abilities[5], "nil", "talent", "nil", @@ -66,9 +67,9 @@ function AbilityLevelUpThink() ability_item_usage_generic.AbilityLevelUpThink2(abilityTree, talentTree) end -utility.PrintAbilityName(Abilities) -local abilityName = {} -local abilityIndex = utility.ReverseTable(abilityName) +--utility.PrintAbilityName(abilities) +local abilityName = { "lich_frost_nova","lich_frost_shield","lich_sinister_gaze","lich_ice_spire","lich_chain_frost"} +local abilityIndexes = utility.ReverseTable(abilityName) -------------------------------------- @@ -466,9 +467,79 @@ consider[3] = function() return BOT_ACTION_DESIRE_NONE, 0 end -consider[4] = function() +-- copied from terrorblade_reflection + +consider[4]=function() + + local abilityNumber=4 + -------------------------------------- + -- Generic Variable Setting + -------------------------------------- + local ability=AbilitiesReal[abilityNumber]; + + if not ability:IsFullyCastable() then + return BOT_ACTION_DESIRE_NONE, 0; + end + + local CastRange = ability:GetCastRange(); + local Damage = ability:GetAbilityDamage(); + local Radius = ability:GetAOERadius() + 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 + -------------------------------------- + + -- 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:GetActiveModeDesire() >= BOT_MODE_DESIRE_HIGH ) + then + for _,npcEnemy in pairs( enemys ) + do + if ( npcBot:WasRecentlyDamagedByHero( npcEnemy, 2.0 ) ) + then + if ( CanCast[abilityNumber]( npcEnemy ) ) + then + return BOT_ACTION_DESIRE_LOW, npcEnemy:GetExtrapolatedLocation(CastPoint); + end + end + 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 >= 3 ) then + return BOT_ACTION_DESIRE_LOW+0.05, locationAoE.targetloc; + end + + local npcEnemy = npcBot:GetTarget() + + if ( npcEnemy ~= nil ) + then + if ( CanCast[abilityNumber]( npcEnemy ) ) + then + return BOT_ACTION_DESIRE_LOW, npcEnemy:GetExtrapolatedLocation(CastPoint); + end + end + end + + return BOT_ACTION_DESIRE_NONE, 0 + +end + +consider[5] = function() --Target Ability Example - local abilityIndex = 4 + local abilityIndex = 5 -------------------------------------- -- Generic Variable Setting -------------------------------------- @@ -548,6 +619,10 @@ consider[4] = function() return BOT_ACTION_DESIRE_NONE, 0 end + +AbilityExtensions:AutoModifyConsiderFunction(npcBot, consider, abilityHandles) + + function AbilityUsageThink() -- Check if we're already using an ability if (npcBot:IsUsingAbility() or npcBot:IsChanneling() or npcBot:IsSilenced()) then diff --git a/ability_item_usage_life_stealer.lua b/ability_item_usage_life_stealer.lua index a09e8348..06e8f884 100644 --- a/ability_item_usage_life_stealer.lua +++ b/ability_item_usage_life_stealer.lua @@ -7,6 +7,7 @@ -------------------------------------- local utility = require( GetScriptDirectory().."/utility" ) require(GetScriptDirectory() .. "/ability_item_usage_generic") +local AbilityExtensions = require(GetScriptDirectory().."/util/AbilityAbstraction") local debugmode=false local npcBot = GetBot() @@ -430,6 +431,9 @@ Consider[7]=function() end +AbilityExtensions:AutoModifyConsiderFunction(npcBot, Consider, AbilitiesReal) + + function AbilityUsageThink() -- Check if we're already using an ability diff --git a/ability_item_usage_lina.lua b/ability_item_usage_lina.lua index 7e004136..21bda1c8 100644 --- a/ability_item_usage_lina.lua +++ b/ability_item_usage_lina.lua @@ -7,6 +7,7 @@ -------------------------------------- local utility = require( GetScriptDirectory().."/utility" ) require(GetScriptDirectory() .. "/ability_item_usage_generic") +local AbilityExtensions = require(GetScriptDirectory().."/util/AbilityAbstraction") local debugmode=false local npcBot = GetBot() @@ -416,6 +417,7 @@ Consider[4]=function() end +AbilityExtensions:AutoModifyConsiderFunction(npcBot, Consider, AbilitiesReal) function AbilityUsageThink() diff --git a/ability_item_usage_lion.lua b/ability_item_usage_lion.lua index a7309a4d..39017739 100644 --- a/ability_item_usage_lion.lua +++ b/ability_item_usage_lion.lua @@ -7,6 +7,7 @@ -------------------------------------- local utility = require( GetScriptDirectory().."/utility" ) require(GetScriptDirectory() .. "/ability_item_usage_generic") +local AbilityExtensions = require(GetScriptDirectory().."/util/AbilityAbstraction") local debugmode=false local npcBot = GetBot() @@ -501,6 +502,8 @@ Consider[4]=function() end +AbilityExtensions:AutoModifyConsiderFunction(npcBot, Consider, AbilitiesReal) + function AbilityUsageThink() local enemys = npcBot:GetNearbyHeroes(500,true,BOT_MODE_NONE) if(AbilitiesReal[3]:IsInAbilityPhase()==true) diff --git a/ability_item_usage_luna.lua b/ability_item_usage_luna.lua index 8b1b68b2..f7601021 100644 --- a/ability_item_usage_luna.lua +++ b/ability_item_usage_luna.lua @@ -7,6 +7,7 @@ -------------------------------------- local utility = require( GetScriptDirectory().."/utility" ) require(GetScriptDirectory() .. "/ability_item_usage_generic") +local AbilityExtensions = require(GetScriptDirectory().."/util/AbilityAbstraction") local debugmode=false local npcBot = GetBot() @@ -310,6 +311,8 @@ Consider[4]=function() return BOT_ACTION_DESIRE_NONE; end +AbilityExtensions:AutoModifyConsiderFunction(npcBot, Consider, AbilitiesReal) + function AbilityUsageThink() -- Check if we're already using an ability diff --git a/ability_item_usage_lycan.lua b/ability_item_usage_lycan.lua index 384e4a7f..c4d035b3 100644 --- a/ability_item_usage_lycan.lua +++ b/ability_item_usage_lycan.lua @@ -7,6 +7,7 @@ -------------------------------------- local utility = require( GetScriptDirectory().."/utility" ) require(GetScriptDirectory() .. "/ability_item_usage_generic") +local AbilityExtensions = require(GetScriptDirectory().."/util/AbilityAbstraction") local debugmode=false local npcBot = GetBot() @@ -330,6 +331,7 @@ Consider[abilityIndex.lycan_shapeshift]=function() end +AbilityExtensions:AutoModifyConsiderFunction(npcBot, Consider, AbilitiesReal) function AbilityUsageThink() -- Check if we're already using an ability diff --git a/ability_item_usage_magnataur.lua b/ability_item_usage_magnataur.lua index 2ddeeebb..3a95e52d 100644 --- a/ability_item_usage_magnataur.lua +++ b/ability_item_usage_magnataur.lua @@ -7,6 +7,7 @@ -------------------------------------- local utility = require( GetScriptDirectory().."/utility" ) require(GetScriptDirectory() .. "/ability_item_usage_generic") +local AbilityExtensions = require(GetScriptDirectory().."/util/AbilityAbstraction") local debugmode=false local npcBot = GetBot() @@ -459,6 +460,7 @@ Consider[5]=function() end +AbilityExtensions:AutoModifyConsiderFunction(npcBot, Consider, AbilitiesReal) function AbilityUsageThink() -- Check if we're already using an ability diff --git a/ability_item_usage_medusa.lua b/ability_item_usage_medusa.lua index cde12443..2d6200d6 100644 --- a/ability_item_usage_medusa.lua +++ b/ability_item_usage_medusa.lua @@ -7,6 +7,8 @@ -------------------------------------- local utility = require( GetScriptDirectory().."/utility" ) require(GetScriptDirectory() .. "/ability_item_usage_generic") +local AbilityExtensions = require(GetScriptDirectory().."/util/AbilityAbstraction") + local debugmode=false local npcBot = GetBot() @@ -33,10 +35,10 @@ local AbilityToLevelUp= Abilities[1], Abilities[1], "talent", - Abilities[1], + Abilities[3], Abilities[abilityIndex.medusa_stone_gaze], Abilities[1], - Abilities[3], + Abilities[1], "talent", Abilities[3], "nil", @@ -58,7 +60,7 @@ local TalentTree={ return Talents[3] end, function() - return Talents[5] + return Talents[6] end, function() return Talents[8] @@ -77,7 +79,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.UCanCast,utility.NCanCast,utility.NCanCast,utility.CanCastPassive,utility.UCanCast} local enemyDisabled=utility.enemyDisabled function GetComboDamage() @@ -88,6 +90,29 @@ function GetComboMana() return ability_item_usage_generic.GetComboMana(AbilitiesReal) end +Consider[1] = function() + local ability = AbilitiesReal[1] + if not ability:IsFullyCastable() then + return + end + + local enemies = npcBot:GetNearbyHeroes(CastRange+300,true,BOT_MODE_NONE) + local enemiesInRange = npcBot:GetNearbyHeroes(CastRange, true, BOT_MODE_NONE) + local creeps = AbilityExtensions:GetNearbyCreeps(CastRange + 400, true, BOT_MODE_NONE) + if AbilityExtensions:IsFarmingOrPushing(npcBot) then + if #creeps >= 2 and #enemies == 0 then + return true + end + end + if AbilityExtensions:IsAttackingEnemies(npcBot) then + if #enemies > 0 and (#enemiesInRange >= 3 or #enemiesInRange == 2 and ability:GetLevel() >= 3 or #enemiesInRange >= 1 and #creeps >= 2) then + return true + end + end + return false +end +Consider[1] = AbilityExtensions:ToggleFunctionToAction(npcBot, Consider[1], AbilitiesReal[1]) + Consider[2]=function() local abilityNumber=2 -------------------------------------- @@ -104,7 +129,9 @@ Consider[2]=function() local CastPoint = ability:GetCastPoint(); local allys = npcBot:GetNearbyHeroes( 1200, false, BOT_MODE_NONE ); - local enemys = npcBot:GetNearbyHeroes(CastRange+300,true,BOT_MODE_NONE) + local enemys = AbilityExtensions:FilterNot(npcBot:GetNearbyHeroes(CastRange+300,true,BOT_MODE_NONE), function(enemy) + return enemy:HasModifier("modifier_medusa_stone_gaze_stone") + end) local WeakestEnemy,HeroHealth=utility.GetWeakestUnit(enemys) local creeps = npcBot:GetNearbyCreeps(CastRange+300,true) local WeakestCreep,CreepHealth=utility.GetWeakestUnit(creeps) @@ -228,26 +255,26 @@ Consider[2]=function() end Consider[3]=function() - local abilityNumber=3 -------------------------------------- -- Generic Variable Setting -------------------------------------- - local ability=AbilitiesReal[abilityNumber]; + local ability=AbilitiesReal[abilityNumber] if not ability:IsFullyCastable() then - return BOT_ACTION_DESIRE_NONE, 0; - end - - if(ability:GetToggleState()==false) - then - return BOT_ACTION_DESIRE_HIGH + return false end + local healthPercent = AbilityExtensions:GetHealthPercent(npcBot) + local manaPercent = AbilityExtensions:GetManaPercent(npcBot) + if healthPercent >= manaPercent + 0.3 and npcBot:GetHealth() >= 500 and healthPercent >= 0.7 then + return false + end - return BOT_ACTION_DESIRE_NONE, 0; - + return true end +Consider[3] = AbilityExtensions:ToggleFunctionToAction(npcBot, Consider[3], AbilitiesReal[3]) + Consider[abilityIndex.medusa_stone_gaze]=function() local abilityNumber=abilityIndex.medusa_stone_gaze @@ -301,6 +328,8 @@ Consider[abilityIndex.medusa_stone_gaze]=function() end + +AbilityExtensions:AutoModifyConsiderFunction(npcBot, Consider, AbilitiesReal) function AbilityUsageThink() -- Check if we're already using an ability diff --git a/ability_item_usage_mirana.lua b/ability_item_usage_mirana.lua index dab8ed52..8f1f9a97 100644 --- a/ability_item_usage_mirana.lua +++ b/ability_item_usage_mirana.lua @@ -7,6 +7,7 @@ -------------------------------------- local utility = require( GetScriptDirectory().."/utility" ) require(GetScriptDirectory() .. "/ability_item_usage_generic") +local AbilityExtensions = require(GetScriptDirectory().."/util/AbilityAbstraction") local debugmode=false local npcBot = GetBot() @@ -386,6 +387,7 @@ Consider[4]=function() end +AbilityExtensions:AutoModifyConsiderFunction(npcBot, Consider, AbilitiesReal) function AbilityUsageThink() -- Check if we're already using an ability diff --git a/ability_item_usage_monkey_king.lua b/ability_item_usage_monkey_king.lua index 1c1a643c..0c90c1e6 100644 --- a/ability_item_usage_monkey_king.lua +++ b/ability_item_usage_monkey_king.lua @@ -11,6 +11,7 @@ end local utility = require( GetScriptDirectory().."/utility" ) require(GetScriptDirectory() .. "/ability_item_usage_generic") +local AbilityExtensions = require(GetScriptDirectory().."/util/AbilityAbstraction") local debugmode=false local npcBot = GetBot() @@ -561,6 +562,7 @@ Consider[6]=function() return BOT_ACTION_DESIRE_NONE, 0; end +AbilityExtensions:AutoModifyConsiderFunction(npcBot, Consider, AbilitiesReal) function AbilityUsageThink() -- Check if we're already using an ability diff --git a/ability_item_usage_naga_siren.lua b/ability_item_usage_naga_siren.lua index 83e03c4e..8dcbe792 100644 --- a/ability_item_usage_naga_siren.lua +++ b/ability_item_usage_naga_siren.lua @@ -8,6 +8,7 @@ -------------------------------------- local utility = require( GetScriptDirectory().."/utility" ) require(GetScriptDirectory() .. "/ability_item_usage_generic") +local AbilityExtensions = require(GetScriptDirectory().."/util/AbilityAbstraction") local debugmode=false local npcBot = GetBot() @@ -312,7 +313,7 @@ Consider[4]=function() end - +AbilityExtensions:AutoModifyConsiderFunction(npcBot, Consider, AbilitiesReal) function AbilityUsageThink() diff --git a/ability_item_usage_necrolyte.lua b/ability_item_usage_necrolyte.lua index fd134582..664b3966 100644 --- a/ability_item_usage_necrolyte.lua +++ b/ability_item_usage_necrolyte.lua @@ -7,6 +7,8 @@ -------------------------------------- local utility = require( GetScriptDirectory().."/utility" ) require(GetScriptDirectory() .. "/ability_item_usage_generic") +local AbilityExtensions = require(GetScriptDirectory().."/util/AbilityAbstraction") + local debugmode=false local npcBot = GetBot() @@ -76,7 +78,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.UCanCast} local enemyDisabled=utility.enemyDisabled function GetComboDamage() @@ -322,22 +324,26 @@ Consider[5]=function() if ( CanCast[abilityNumber]( npcEnemy ) ) then local Damage=(npcEnemy:GetMaxHealth()-npcEnemy:GetHealth())*DamagePercent + local n1 = npcEnemy:GetHealth() + local n2 = npcEnemy:GetActualIncomingDamage(Damage, DAMAGE_TYPE_MAGICAL) + if(npcBot:GetActiveMode() == BOT_MODE_ATTACK) then Damage=Damage*(1+0.05*#allys) end - - if(npcEnemy:GetHealth()<=npcEnemy:GetActualIncomingDamage(Damage,DAMAGE_TYPE_MAGICAL)) + if npcEnemy:GetHealth()<=npcEnemy:GetActualIncomingDamage(Damage,DAMAGE_TYPE_MAGICAL) * (0.85+#allys*0.05) + and (npcEnemy:GetHealth() >= (ability:GetLevel()*100+300) + or AbilityExtensions:GetHealthPercent(npcEnemy) <= 0.45 and AbilityExtensions:GetHealthPercent(npcEnemy) >= 0.2) then - return BOT_ACTION_DESIRE_HIGH,npcEnemy; + return BOT_ACTION_DESIRE_HIGH,npcEnemy end end end end - return BOT_ACTION_DESIRE_NONE, 0; - + return BOT_ACTION_DESIRE_NONE, 0 end +AbilityExtensions:AutoModifyConsiderFunction(npcBot, Consider, AbilitiesReal) function AbilityUsageThink() diff --git a/ability_item_usage_nevermore.lua b/ability_item_usage_nevermore.lua index 1912c99b..a6ed30bc 100644 --- a/ability_item_usage_nevermore.lua +++ b/ability_item_usage_nevermore.lua @@ -7,6 +7,7 @@ -------------------------------------- local utility = require( GetScriptDirectory().."/utility" ) require(GetScriptDirectory() .. "/ability_item_usage_generic") +local AbilityExtensions = require(GetScriptDirectory().."/util/AbilityAbstraction") local debugmode=false local npcBot = GetBot() @@ -27,10 +28,10 @@ local AbilityToLevelUp= Abilities[1], Abilities[4], Abilities[1], - Abilities[1], Abilities[4], Abilities[1], Abilities[4], + Abilities[1], Abilities[6], "talent", Abilities[5], diff --git a/ability_item_usage_night_stalker.lua b/ability_item_usage_night_stalker.lua index 6fc50fa9..ca157509 100644 --- a/ability_item_usage_night_stalker.lua +++ b/ability_item_usage_night_stalker.lua @@ -7,6 +7,7 @@ -------------------------------------- local utility = require( GetScriptDirectory().."/utility" ) require(GetScriptDirectory() .. "/ability_item_usage_generic") +local AbilityExtensions = require(GetScriptDirectory().."/util/AbilityAbstraction") local debugmode=false local npcBot = GetBot() @@ -321,6 +322,8 @@ Consider[4]=function() return BOT_ACTION_DESIRE_NONE, 0; end +AbilityExtensions:AutoModifyConsiderFunction(npcBot, Consider, AbilitiesReal) + function AbilityUsageThink() -- Check if we're already using an ability diff --git a/ability_item_usage_nyx_assassin.lua b/ability_item_usage_nyx_assassin.lua index 646858dd..92226aee 100644 --- a/ability_item_usage_nyx_assassin.lua +++ b/ability_item_usage_nyx_assassin.lua @@ -8,6 +8,7 @@ -------------------------------------- local utility = require( GetScriptDirectory().."/utility" ) require(GetScriptDirectory() .. "/ability_item_usage_generic") +local AbilityExtensions = require(GetScriptDirectory().."/util/AbilityAbstraction") local debugmode=false local npcBot = GetBot() @@ -77,7 +78,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.UCanCast,utility.CanCastNoTarget,utility.CanCastNoTarget} local enemyDisabled=utility.enemyDisabled function GetComboDamage() @@ -411,6 +412,7 @@ Consider[5]=function() end +AbilityExtensions:AutoModifyConsiderFunction(npcBot, Consider, AbilitiesReal) function AbilityUsageThink() diff --git a/ability_item_usage_obsidian_destroyer.lua b/ability_item_usage_obsidian_destroyer.lua index f7032c0f..d3364a1a 100644 --- a/ability_item_usage_obsidian_destroyer.lua +++ b/ability_item_usage_obsidian_destroyer.lua @@ -8,6 +8,7 @@ -------------------------------------- local utility = require( GetScriptDirectory().."/utility" ) require(GetScriptDirectory() .. "/ability_item_usage_generic") +local AbilityExtensions = require(GetScriptDirectory().."/util/AbilityAbstraction") local debugmode=false local npcBot = GetBot() @@ -95,7 +96,7 @@ Consider[1]=function() -------------------------------------- local ability=AbilitiesReal[abilityNumber]; - if not ability:IsFullyCastable() then + if npcBot:IsIllusion() or not ability:IsFullyCastable() then -- destroyer's illusions (from illusion rune or from shadow_demon_disruption) can use the first ability return BOT_ACTION_DESIRE_NONE, 0; end @@ -181,8 +182,61 @@ Consider[1]=function() end -Consider[2]=function() +local dazzle_shadow_grave = function() + local abilityNumber=2 + -------------------------------------- + -- Generic Variable Setting + -------------------------------------- + local ability=AbilitiesReal[abilityNumber]; + + if not ability:IsFullyCastable() then + return BOT_ACTION_DESIRE_NONE, 0; + end + + local CastRange = ability:GetCastRange(); + local Damage = ability:GetAbilityDamage(); + + local allys = npcBot:GetNearbyHeroes( CastRange+300, false, BOT_MODE_NONE ); + local WeakestAlly,AllyHealth=utility.GetWeakestUnit(allys) + 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) + -------------------------------------- + -- Global high-priorty usage + -------------------------------------- + -- If we're seriously retreating + if ( npcBot:GetActiveMode() == BOT_MODE_RETREAT and npcBot:GetActiveModeDesire() >= BOT_MODE_DESIRE_HIGH ) + then + if(HealthPercentage<=0.3) + then + return BOT_ACTION_DESIRE_VERY_HIGH, npcBot + end + end + + --protect teammate,save allys from control + for _,npcTarget in pairs( allys ) + do + local enemys2 = npcTarget:GetNearbyHeroes(600,true,BOT_MODE_NONE) + if not npcTarget:IsIllusion() and (npcTarget:GetHealth()/npcTarget:GetMaxHealth()<=0.2+0.05*#enemys2) and npcTarget:WasRecentlyDamagedByAnyHero(3) + then + local Damage2=0 + for _,npcEnemy in pairs( enemys2 ) + do + Damage2 =Damage2 + npcEnemy:GetEstimatedDamageToTarget( true, npcBot, 2.0, DAMAGE_TYPE_ALL ); + end + if not npcTarget:IsIllusion() and (npcTarget:GetHealth()=1) - then - for _,linear in pairs(linears) - do - if(GetTeamForPlayer(linear.playerid)~=GetTeam() and GetUnitToLocationDistance(npcBot,linear.location)<=600) - then - return BOT_ACTION_DESIRE_HIGH+0.05 - end - end - end - -------------------------------------- - -- Global high-priorty usage - -------------------------------------- - -- If we're in a teamfight, use it on the scariest enemy - local tableNearbyAttackingAlliedHeroes = npcBot:GetNearbyHeroes( 1000, false, BOT_MODE_ATTACK ); - if ( #tableNearbyAttackingAlliedHeroes >= 2 ) - then - if ( #enemys+#allys >= 6-2*HealthPercentage and #enemys>=2) - then - return BOT_ACTION_DESIRE_HIGH - end - 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:GetActiveModeDesire() >= BOT_MODE_DESIRE_HIGH ) - then - if ( npcBot:WasRecentlyDamagedByAnyHero(2) ) - then - return BOT_ACTION_DESIRE_MODERATE-0.05 - 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 npcEnemy = npcBot:GetTarget(); + if not ability:IsFullyCastable() then + return BOT_ACTION_DESIRE_NONE, 0; + end + + local CastRange = ability:GetCastRange(); + local Damage = ability:GetAbilityDamage(); + local CastPoint = ability:GetCastPoint() + local Radius=ability:GetAOERadius() + + local HeroHealth=10000 + local CreepHealth=10000 + 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) + -------------------------------------- + -- 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+0.5); + end + end + end + end + + -- If we're in a teamfight, use it on the scariest enemy + local tableNearbyAttackingAlliedHeroes = npcBot:GetNearbyHeroes( 1000, false, BOT_MODE_ATTACK ); + if ( #tableNearbyAttackingAlliedHeroes >= 2 ) + then + + local npcMostDangerousEnemy = nil; + local nMostDangerousDamage = 0; + + for _,npcEnemy in pairs( enemys ) + do + if ( CanCast[abilityNumber]( npcEnemy ) ) + then + local Damage2 = npcEnemy:GetEstimatedDamageToTarget( false, npcBot, 3.0, DAMAGE_TYPE_ALL ); + if ( Damage2 > nMostDangerousDamage ) + then + nMostDangerousDamage = Damage2; + npcMostDangerousEnemy = npcEnemy; + end + end + end + + if ( npcMostDangerousEnemy ~= nil ) + then + return BOT_ACTION_DESIRE_HIGH, npcMostDangerousEnemy:GetExtrapolatedLocation(CastPoint+0.5); + end + end + -------------------------------------- + -- Mode based usage + -------------------------------------- + + -- 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, CastPoint, 0 ); + if ( locationAoE.count >= 2 ) + then + return BOT_ACTION_DESIRE_LOW, locationAoE.targetloc + end + + local npcEnemy = npcBot:GetTarget(); + + if ( npcEnemy ~= nil ) + then + if ( enemyDisabled(npcEnemy) and GetUnitToUnitDistance(npcBot,npcEnemy)< CastRange + 75*#allys) + then + return BOT_ACTION_DESIRE_MODERATE, npcEnemy:GetExtrapolatedLocation(CastPoint+0.5); + end + end + end + + return BOT_ACTION_DESIRE_NONE, 0; - if ( npcEnemy ~= nil ) - then - if ( npcEnemy:GetHealth()<=npcEnemy:GetActualIncomingDamage(npcBot:GetOffensivePower(),DAMAGE_TYPE_MAGICAL) and GetUnitToUnitDistance(npcEnemy,npcBot)<=Radius-200) - then - return BOT_ACTION_DESIRE_MODERATE - end - end - end - - return BOT_ACTION_DESIRE_NONE; - end +Consider[abilityIndex.riki_poison_dart] = function() + -- copied from bane_nightmare + local abilityNumber=abilityIndex.riki_poison_dart + -------------------------------------- + -- Generic Variable Setting + -------------------------------------- + local ability=AbilitiesReal[abilityNumber]; + + if not ability:IsFullyCastable() then + return BOT_ACTION_DESIRE_NONE, 0; + end + + local CastRange = ability:GetCastRange(); + local Damage = ability:GetAbilityDamage(); + 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) + -------------------------------------- + -- Global high-priorty usage + -------------------------------------- + -- Check for a channeling enemy + for _,npcEnemy in pairs( enemys ) + do + if ( npcEnemy:IsChanneling() and CanCast[abilityNumber]( npcEnemy )) + then + return BOT_ACTION_DESIRE_HIGH, npcEnemy + end + end + + -- If we're in a teamfight, use it on the scariest enemy + local tableNearbyAttackingAlliedHeroes = npcBot:GetNearbyHeroes( 1000, false, BOT_MODE_ATTACK ); + if ( #tableNearbyAttackingAlliedHeroes >= 2 ) + then + + local npcMostDangerousEnemy = nil; + local nMostDangerousDamage = 0; + + for _,npcEnemy in pairs( enemys ) + do + local allys2=npcEnemy:GetNearbyHeroes( 600, true,BOT_MODE_NONE ); + if ( CanCast[abilityNumber]( npcEnemy ) and not enemyDisabled(npcEnemy) and allys2~=nil and #allys2==0) + then + local Damage2 = npcEnemy:GetEstimatedDamageToTarget( false, npcBot, 3.0, DAMAGE_TYPE_ALL ); + if ( Damage2 > nMostDangerousDamage ) + then + nMostDangerousDamage = Damage2; + npcMostDangerousEnemy = npcEnemy; + end + end + end + + if ( npcMostDangerousEnemy ~= nil ) + then + return BOT_ACTION_DESIRE_HIGH, npcMostDangerousEnemy; + end + end + -------------------------------------- + -- Mode based usage + -------------------------------------- + -- 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:GetActiveModeDesire() >= BOT_MODE_DESIRE_HIGH ) + then + for _,npcEnemy in pairs( enemys ) + do + local allys2=npcEnemy:GetNearbyHeroes( 600, true ,BOT_MODE_NONE ); + if ( npcBot:WasRecentlyDamagedByHero( npcEnemy, 2.0 ) and allys2~=nil and #allys2==0) + then + if ( CanCast[abilityNumber]( npcEnemy ) and not enemyDisabled(npcEnemy)) + then + return BOT_ACTION_DESIRE_HIGH, npcEnemy; + end + end + 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 npcEnemy = npcBot:GetTarget(); + local allys2 + local allys3 + if ( npcEnemy ~= nil) + then + allys2=npcEnemy:GetNearbyHeroes( 600, true,BOT_MODE_NONE ); + allys3=npcEnemy:GetNearbyHeroes( 1600, true,BOT_MODE_NONE ); + if allys2 ==nil then allys2={} end + if allys3 ==nil then allys3={} end + end + + if ( npcEnemy ~= nil and #allys2<#allys3) + then + if ( CanCast[abilityNumber]( npcEnemy ) and not enemyDisabled(npcEnemy) and GetUnitToUnitDistance(npcBot,npcEnemy)< CastRange + 75*#allys) + then + return BOT_ACTION_DESIRE_MODERATE, npcEnemy + end + end + end + + return BOT_ACTION_DESIRE_NONE, 0 +end + +--Consider[abilityIndex.riki_backstab]=function() +-- +-- local abilityNumber=abilityIndex.riki_backstab +-- -------------------------------------- +-- -- Generic Variable Setting +-- -------------------------------------- +-- local ability=AbilitiesReal[abilityNumber]; +-- +-- if not ability:IsFullyCastable() then +-- return BOT_ACTION_DESIRE_NONE, 0; +-- end +-- +-- local CastRange = ability:GetCastRange(); +-- local Radius = ability:GetAOERadius() +-- +-- local HeroHealth=10000 +-- local CreepHealth=10000 +-- local allys = npcBot:GetNearbyHeroes( 1200, false, BOT_MODE_NONE ); +-- local enemys = npcBot:GetNearbyHeroes(Radius,true,BOT_MODE_NONE) +-- local WeakestEnemy,HeroHealth=utility.GetWeakestUnit(enemys) +-- local linears=GetLinearProjectiles() +-- if(npcBot:GetActiveMode() == BOT_MODE_RETREAT and #enemys>=1) +-- then +-- for _,linear in pairs(linears) +-- do +-- if(GetTeamForPlayer(linear.playerid)~=GetTeam() and GetUnitToLocationDistance(npcBot,linear.location)<=600) +-- then +-- return BOT_ACTION_DESIRE_HIGH+0.05 +-- end +-- end +-- end +-- -------------------------------------- +-- -- Global high-priorty usage +-- -------------------------------------- +-- -- If we're in a teamfight, use it on the scariest enemy +-- local tableNearbyAttackingAlliedHeroes = npcBot:GetNearbyHeroes( 1000, false, BOT_MODE_ATTACK ); +-- if ( #tableNearbyAttackingAlliedHeroes >= 2 ) +-- then +-- if ( #enemys+#allys >= 6-2*HealthPercentage and #enemys>=2) +-- then +-- return BOT_ACTION_DESIRE_HIGH +-- end +-- 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:GetActiveModeDesire() >= BOT_MODE_DESIRE_HIGH ) +-- then +-- if ( npcBot:WasRecentlyDamagedByAnyHero(2) ) +-- then +-- return BOT_ACTION_DESIRE_MODERATE-0.05 +-- 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 npcEnemy = npcBot:GetTarget(); +-- +-- if ( npcEnemy ~= nil ) +-- then +-- if ( npcEnemy:GetHealth()<=npcEnemy:GetActualIncomingDamage(npcBot:GetOffensivePower(),DAMAGE_TYPE_MAGICAL) and GetUnitToUnitDistance(npcEnemy,npcBot)<=Radius-200) +-- then +-- return BOT_ACTION_DESIRE_MODERATE +-- end +-- end +-- end +-- +-- return BOT_ACTION_DESIRE_NONE; +-- +--end + +AbilityExtensions:AutoModifyConsiderFunction(npcBot, Consider, AbilitiesReal) function AbilityUsageThink() -- Check if we're already using an ability diff --git a/ability_item_usage_sand_king.lua b/ability_item_usage_sand_king.lua index 4e544a64..2f1bedf2 100644 --- a/ability_item_usage_sand_king.lua +++ b/ability_item_usage_sand_king.lua @@ -7,6 +7,7 @@ -------------------------------------- local utility = require( GetScriptDirectory().."/utility" ) require(GetScriptDirectory() .. "/ability_item_usage_generic") +local AbilityExtensions = require(GetScriptDirectory().."/util/AbilityAbstraction") local debugmode=false local npcBot = GetBot() diff --git a/ability_item_usage_shadow_demon.lua b/ability_item_usage_shadow_demon.lua index 80ad84c4..d7c8b008 100644 --- a/ability_item_usage_shadow_demon.lua +++ b/ability_item_usage_shadow_demon.lua @@ -8,6 +8,7 @@ -------------------------------------- local utility = require( GetScriptDirectory().."/utility" ) require(GetScriptDirectory() .. "/ability_item_usage_generic") +local AbilityExtensions = require(GetScriptDirectory().."/util/AbilityAbstraction") local AbilityHelper = dofile(GetScriptDirectory() .. "/util/AbilityHelper") local debugmode=false @@ -593,6 +594,7 @@ Consider[5]=function() end +AbilityExtensions:AutoModifyConsiderFunction(npcBot, Consider, AbilitiesReal) function AbilityUsageThink() -- Check if we're already using an ability diff --git a/ability_item_usage_shadow_shaman.lua b/ability_item_usage_shadow_shaman.lua index 9adcba83..254a89ca 100644 --- a/ability_item_usage_shadow_shaman.lua +++ b/ability_item_usage_shadow_shaman.lua @@ -7,6 +7,7 @@ -------------------------------------- local utility = require( GetScriptDirectory().."/utility" ) require(GetScriptDirectory() .. "/ability_item_usage_generic") +local AbilityExtensions = require(GetScriptDirectory().."/util/AbilityAbstraction") local debugmode=false local npcBot = GetBot() @@ -516,6 +517,7 @@ Consider[4]=function() end +AbilityExtensions:AutoModifyConsiderFunction(npcBot, Consider, AbilitiesReal) function AbilityUsageThink() -- Check if we're already using an ability diff --git a/ability_item_usage_shredder.lua b/ability_item_usage_shredder.lua index 5143264a..e89a2097 100644 --- a/ability_item_usage_shredder.lua +++ b/ability_item_usage_shredder.lua @@ -8,6 +8,7 @@ -------------------------------------- local utility = require( GetScriptDirectory().."/utility" ) require(GetScriptDirectory() .. "/ability_item_usage_generic") +local AbilityExtensions = require(GetScriptDirectory().."/util/AbilityAbstraction") local debugmode=false local npcBot = GetBot() @@ -602,7 +603,7 @@ Consider[4]=function() --A杖大 return BOT_ACTION_DESIRE_NONE, 0; end - +AbilityExtensions:AutoModifyConsiderFunction(npcBot, Consider, AbilitiesReal) function AbilityUsageThink() -- Check if we're already using an ability diff --git a/ability_item_usage_silencer.lua b/ability_item_usage_silencer.lua index b451715d..15f7fad5 100644 --- a/ability_item_usage_silencer.lua +++ b/ability_item_usage_silencer.lua @@ -7,6 +7,7 @@ -------------------------------------- local utility = require( GetScriptDirectory().."/utility" ) require(GetScriptDirectory() .. "/ability_item_usage_generic") +local AbilityExtensions = require(GetScriptDirectory().."/util/AbilityAbstraction") local debugmode=false local npcBot = GetBot() @@ -539,6 +540,7 @@ Consider[4]=function() return BOT_ACTION_DESIRE_NONE, 0; end +AbilityExtensions:AutoModifyConsiderFunction(npcBot, Consider, AbilitiesReal) function AbilityUsageThink() -- Check if we're already using an ability diff --git a/ability_item_usage_skeleton_king.lua b/ability_item_usage_skeleton_king.lua index 2a688e17..f179704c 100644 --- a/ability_item_usage_skeleton_king.lua +++ b/ability_item_usage_skeleton_king.lua @@ -7,6 +7,7 @@ -------------------------------------- local utility = require( GetScriptDirectory().."/utility" ) require(GetScriptDirectory() .. "/ability_item_usage_generic") +local AbilityExtensions = require(GetScriptDirectory().."/util/AbilityAbstraction") local debugmode=false local npcBot = GetBot() @@ -203,20 +204,23 @@ Consider[1]=function() end ---[[Consider[3]=function() - local abilityNumber=3 - -------------------------------------- - -- Generic Variable Setting - -------------------------------------- - local ability=AbilitiesReal[abilityNumber]; - - if not ability:IsFullyCastable() then - return BOT_ACTION_DESIRE_NONE, 0; - end - +Consider[2]=function() + local abilityNumber=2 + -------------------------------------- + -- Generic Variable Setting + -------------------------------------- + local ability=AbilitiesReal[abilityNumber] + + if not ability:IsFullyCastable() then + return BOT_ACTION_DESIRE_NONE + end + if ability:GetManaCost() + AbilitiesReal[4]:GetManaCost() <= npcBot:GetMana() then + return BOT_ACTION_DESIRE_NONE + end + local CastRange = ability:GetCastRange() local CastPoint = ability:GetCastPoint() - + local HeroHealth=10000 local CreepHealth=10000 local allys = npcBot:GetNearbyHeroes( 1200, false, BOT_MODE_NONE ); @@ -228,11 +232,11 @@ end -- Global high-priorty usage -------------------------------------- --Try to kill enemy hero - if(npcBot:GetActiveMode() ~= BOT_MODE_RETREAT ) + if(npcBot:GetActiveMode() ~= BOT_MODE_RETREAT ) then if (WeakestEnemy~=nil) then - if ( CanCast[abilityNumber]( WeakestEnemy ) and npcBot:HasModifier("modifier_skeleton_king_mortal_strike") + if ( CanCast[abilityNumber]( WeakestEnemy ) and npcBot:HasModifier("modifier_skeleton_king_mortal_strike") and npcBot:GetModifierStackCount(npcBot:GetModifierByName("modifier_skeleton_king_mortal_strike"))> ability:GetLevel()) then if(HeroHealth<=WeakestEnemy:GetActualIncomingDamage(Damage,DAMAGE_TYPE_MAGICAL) or npcBot:GetMana()>ComboMana) @@ -245,31 +249,31 @@ end -------------------------------------- -- Mode based usage -------------------------------------- - + -- If we're farming and can hit 2+ creeps - --[[if ( npcBot:GetActiveMode() == BOT_MODE_FARM ) + if ( npcBot:GetActiveMode() == BOT_MODE_FARM ) then - if ( #creeps >= 2 and npcBot:HasModifier("modifier_skeleton_king_mortal_strike") - and npcBot:GetModifierStackCount(npcBot:GetModifierByName("modifier_skeleton_king_mortal_strike"))> ability:GetLevel()) + if ( #creeps >= 3 and npcBot:HasModifier("modifier_skeleton_king_vampiric_spirit") + and npcBot:GetModifierStackCount(npcBot:GetModifierByName("modifier_skeleton_king_vampiric_spirit"))> ability:GetLevel()) then if(CreepHealth<=WeakestCreep:GetActualIncomingDamage(Damage,DAMAGE_TYPE_MAGICAL) or npcBot:GetMana()>ComboMana) then return BOT_ACTION_DESIRE_LOW end end - end]] + end - - --[[ If we're going after someone + + --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 ) + npcBot:GetActiveMode() == BOT_MODE_ATTACK ) then local npcEnemy = npcBot:GetTarget(); - if ( npcEnemy ~= nil and npcBot:HasModifier("modifier_skeleton_king_mortal_strike") - and npcBot:GetModifierStackCount(npcBot:GetModifierByName("modifier_skeleton_king_mortal_strike"))> ability:GetLevel() + 2) + if ( npcEnemy ~= nil and npcBot:HasModifier("modifier_skeleton_king_mortal_strike") + and npcBot:GetModifierStackCount(npcBot:GetModifierByName("modifier_skeleton_king_mortal_strike"))> ability:GetLevel() + 2) then if ( CanCast[abilityNumber]( npcEnemy ) and not enemyDisabled(npcEnemy) and GetUnitToUnitDistance(npcBot,npcEnemy) <= Radius-CastPoint* npcEnemy:GetCurrentMovementSpeed()) then @@ -278,10 +282,11 @@ end end end - return BOT_ACTION_DESIRE_NONE, 0; - -end]] + return BOT_ACTION_DESIRE_NONE + +end +AbilityExtensions:AutoModifyConsiderFunction(npcBot, Consider, AbilitiesReal) function AbilityUsageThink() -- Check if we're already using an ability diff --git a/ability_item_usage_skywrath_mage.lua b/ability_item_usage_skywrath_mage.lua index f828cc85..fa57db37 100644 --- a/ability_item_usage_skywrath_mage.lua +++ b/ability_item_usage_skywrath_mage.lua @@ -7,6 +7,7 @@ -------------------------------------- local utility = require( GetScriptDirectory().."/utility" ) require(GetScriptDirectory() .. "/ability_item_usage_generic") +local AbilityExtensions = require(GetScriptDirectory().."/util/AbilityAbstraction") local debugmode=false local npcBot = GetBot() @@ -427,6 +428,7 @@ Consider[4]=function() end +AbilityExtensions:AutoModifyConsiderFunction(npcBot, Consider, AbilitiesReal) function AbilityUsageThink() -- Check if we're already using an ability diff --git a/ability_item_usage_slardar.lua b/ability_item_usage_slardar.lua index cd83472e..ef7bb446 100644 --- a/ability_item_usage_slardar.lua +++ b/ability_item_usage_slardar.lua @@ -7,6 +7,7 @@ -------------------------------------- local utility = require( GetScriptDirectory().."/utility" ) require(GetScriptDirectory() .. "/ability_item_usage_generic") +local AbilityExtensions = require(GetScriptDirectory().."/util/AbilityAbstraction") local debugmode=false local npcBot = GetBot() @@ -386,6 +387,7 @@ Consider[4]=function() return BOT_ACTION_DESIRE_NONE, 0; end +AbilityExtensions:AutoModifyConsiderFunction(npcBot, Consider, AbilitiesReal) function AbilityUsageThink() -- Check if we're already using an ability diff --git a/ability_item_usage_slark.lua b/ability_item_usage_slark.lua index 1f997537..42e7c2a6 100644 --- a/ability_item_usage_slark.lua +++ b/ability_item_usage_slark.lua @@ -7,6 +7,7 @@ -------------------------------------- local utility = require( GetScriptDirectory().."/utility" ) require(GetScriptDirectory() .. "/ability_item_usage_generic") +local AbilityExtensions = require(GetScriptDirectory().."/util/AbilityAbstraction") local debugmode=false local npcBot = GetBot() @@ -76,7 +77,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.UCanCast} local enemyDisabled=utility.enemyDisabled function GetComboDamage() @@ -371,6 +372,7 @@ Consider[abilityIndex.slark_shadow_dance]=function() end +AbilityExtensions:AutoModifyConsiderFunction(npcBot, Consider, AbilitiesReal) function AbilityUsageThink() -- Check if we're already using an ability diff --git a/ability_item_usage_sniper.lua b/ability_item_usage_sniper.lua index bfbb3b16..96224d19 100644 --- a/ability_item_usage_sniper.lua +++ b/ability_item_usage_sniper.lua @@ -7,6 +7,7 @@ -------------------------------------- local utility = require( GetScriptDirectory().."/utility" ) require(GetScriptDirectory() .. "/ability_item_usage_generic") +local AbilityExtensions = require(GetScriptDirectory().."/util/AbilityAbstraction") local debugmode=false local npcBot = GetBot() @@ -77,7 +78,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.UCanCast} local enemyDisabled=utility.enemyDisabled function GetComboDamage() @@ -334,6 +335,7 @@ Consider[5]=function() end +AbilityExtensions:AutoModifyConsiderFunction(npcBot, Consider, AbilitiesReal) function AbilityUsageThink() -- Check if we're already using an ability diff --git a/ability_item_usage_spectre.lua b/ability_item_usage_spectre.lua index 0ad69bab..aef8b85c 100644 --- a/ability_item_usage_spectre.lua +++ b/ability_item_usage_spectre.lua @@ -7,6 +7,7 @@ -------------------------------------- local utility = require( GetScriptDirectory().."/utility" ) require(GetScriptDirectory() .. "/ability_item_usage_generic") +local AbilityExtensions = require(GetScriptDirectory().."/util/AbilityAbstraction") local debugmode=false local npcBot = GetBot() @@ -77,7 +78,7 @@ end -------------------------------------- local cast={} cast.Desire={} cast.Target={} cast.Type={} local Consider ={} -local CanCast={utility.NCanCast,utility.NCanCast,utility.NCanCast,utility.NCanCast,utility.NCanCast} +local CanCast={utility.UCanCast,utility.UCanCast,utility.UCanCast,utility.UCanCast,utility.UCanCast,utility.UCanCast,} local enemyDisabled=utility.enemyDisabled function GetComboDamage() @@ -412,6 +413,7 @@ Consider[4]=function() end +AbilityExtensions:AutoModifyConsiderFunction(npcBot, Consider, AbilitiesReal) function AbilityUsageThink() -- Check if we're already using an ability diff --git a/ability_item_usage_spirit_breaker.lua b/ability_item_usage_spirit_breaker.lua index efae5e2f..8a854ffb 100644 --- a/ability_item_usage_spirit_breaker.lua +++ b/ability_item_usage_spirit_breaker.lua @@ -7,6 +7,7 @@ -------------------------------------- local utility = require( GetScriptDirectory().."/utility" ) require(GetScriptDirectory() .. "/ability_item_usage_generic") +local AbilityExtensions = require(GetScriptDirectory().."/util/AbilityAbstraction") local debugmode=false local npcBot = GetBot() @@ -397,6 +398,7 @@ Consider[4]=function() end +AbilityExtensions:AutoModifyConsiderFunction(npcBot, Consider, AbilitiesReal) function AbilityUsageThink() -- Check if we're already using an ability diff --git a/ability_item_usage_sven.lua b/ability_item_usage_sven.lua index 8463b399..01dded68 100644 --- a/ability_item_usage_sven.lua +++ b/ability_item_usage_sven.lua @@ -7,6 +7,7 @@ -------------------------------------- local utility = require( GetScriptDirectory().."/utility" ) require(GetScriptDirectory() .. "/ability_item_usage_generic") +local AbilityExtensions = require(GetScriptDirectory().."/util/AbilityAbstraction") local debugmode=false local npcBot = GetBot() @@ -400,6 +401,7 @@ Consider[4]=function() return BOT_ACTION_DESIRE_NONE, 0; end +AbilityExtensions:AutoModifyConsiderFunction(npcBot, Consider, AbilitiesReal) function AbilityUsageThink() -- Check if we're already using an ability diff --git a/ability_item_usage_templar_assassin.lua b/ability_item_usage_templar_assassin.lua index 3c9283f2..b317fa53 100644 --- a/ability_item_usage_templar_assassin.lua +++ b/ability_item_usage_templar_assassin.lua @@ -8,6 +8,7 @@ -------------------------------------- local utility = require( GetScriptDirectory().."/utility" ) require(GetScriptDirectory() .. "/ability_item_usage_generic") +local AbilityExtensions = require(GetScriptDirectory().."/util/AbilityAbstraction") local debugmode=false local npcBot = GetBot() @@ -380,6 +381,7 @@ Consider[6]=function() end +AbilityExtensions:AutoModifyConsiderFunction(npcBot, Consider, AbilitiesReal) function AbilityUsageThink() -- Check if we're already using an ability diff --git a/ability_item_usage_terrorblade.lua b/ability_item_usage_terrorblade.lua index 6fc1ab61..b6610fc9 100644 --- a/ability_item_usage_terrorblade.lua +++ b/ability_item_usage_terrorblade.lua @@ -8,6 +8,7 @@ -------------------------------------- local utility = require( GetScriptDirectory().."/utility" ) require(GetScriptDirectory() .. "/ability_item_usage_generic") +local AbilityExtensions = require(GetScriptDirectory().."/util/AbilityAbstraction") local debugmode=false local npcBot = GetBot() @@ -77,7 +78,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.CanCastNoTarget,utility.CanCastNoTarget,utility.NCanCast,utility.NCanCast,utility.UCanCast} local enemyDisabled=utility.enemyDisabled function GetComboDamage() @@ -88,8 +89,8 @@ function GetComboMana() return ability_item_usage_generic.GetComboMana(AbilitiesReal) end -Consider[1]=function() - local abilityNumber=1 +Consider[abilityIndex.terrorblade_terror_wave]=function() + local abilityNumber=abilityIndex.terrorblade_terror_wave -------------------------------------- -- Generic Variable Setting -------------------------------------- @@ -147,45 +148,97 @@ Consider[1]=function() end end end - - -- If we're pushing or defending a lane - 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 ) + + + -- 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 - if ( #enemys>=3) + local npcEnemy = npcBot:GetTarget(); + + if ( npcEnemy ~= nil ) then - if (ManaPercentage>0.5 or npcBot:GetMana()>ComboMana) + if ( CanCast[abilityNumber]( npcEnemy ) and GetUnitToUnitDistance(npcBot,npcEnemy)= BOT_MODE_DESIRE_HIGH ) + then + for _,npcEnemy in pairs( enemys ) + do + if ( npcBot:WasRecentlyDamagedByHero( npcEnemy, 2.0 ) ) + then + if ( CanCast[abilityNumber]( npcEnemy ) ) + then + return BOT_ACTION_DESIRE_LOW, npcEnemy:GetExtrapolatedLocation(CastPoint); + end + end + 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 ) + npcBot:GetActiveMode() == BOT_MODE_ATTACK) then - local npcEnemy = npcBot:GetTarget(); + local locationAoE = npcBot:FindAoELocation( true, true, npcBot:GetLocation(), CastRange, Radius, 0, 0 ); + if ( locationAoE.count >= 3 ) then + return BOT_ACTION_DESIRE_LOW+0.05, locationAoE.targetloc; + end + + local npcEnemy = npcBot:GetTarget() if ( npcEnemy ~= nil ) then - if ( CanCast[abilityNumber]( npcEnemy ) and GetUnitToUnitDistance(npcBot,npcEnemy)= 2 ) then @@ -371,9 +423,9 @@ Consider[abilityIndex.terrorblade_sunder]=function() end end - if ( npcMostDangerousEnemy ~= nil and HealthPercentage < 0.3 and GetUnitToUnitDistance(npcMostDangerousEnemy,npcBot) < CastRange - 100) - then - return BOT_ACTION_DESIRE_HIGH, npcMostDangerousEnemy; + if npcMostDangerousEnemy ~= nil and HealthPercentage < 0.3 and GetUnitToUnitDistance(npcMostDangerousEnemy,npcBot) < CastRange - 100 + and nMostHealth >= npcBot:GetHealth() * 2 then + return BOT_ACTION_DESIRE_HIGH, npcMostDangerousEnemy end end @@ -388,8 +440,9 @@ Consider[abilityIndex.terrorblade_sunder]=function() do if ( npcBot:WasRecentlyDamagedByHero( npcEnemy, 2.0 ) ) then - if ( CanCast[abilityNumber]( npcEnemy ) and HealthPercentage < 0.3 and npcEnemy:GetHealth() / npcEnemy:GetMaxHealth() > 0.6) - then + if CanCast[abilityNumber]( npcEnemy ) and HealthPercentage < 0.3 + and npcEnemy:GetHealth() / npcEnemy:GetMaxHealth() > 0.6 + and npcEnemy:GetHealth() >= npcBot:GetHealth() * 2 then return BOT_ACTION_DESIRE_HIGH, npcEnemy; end end @@ -400,6 +453,7 @@ Consider[abilityIndex.terrorblade_sunder]=function() end +AbilityExtensions:AutoModifyConsiderFunction(npcBot, Consider, AbilitiesReal) function AbilityUsageThink() -- Check if we're already using an ability diff --git a/ability_item_usage_tidehunter.lua b/ability_item_usage_tidehunter.lua index 0ad097ac..d9d60f37 100644 --- a/ability_item_usage_tidehunter.lua +++ b/ability_item_usage_tidehunter.lua @@ -8,6 +8,7 @@ -------------------------------------- local utility = require( GetScriptDirectory().."/utility" ) require(GetScriptDirectory() .. "/ability_item_usage_generic") +local AbilityExtensions = require(GetScriptDirectory().."/util/AbilityAbstraction") local debugmode=false local npcBot = GetBot() @@ -536,6 +537,7 @@ Consider[4]=function() end +AbilityExtensions:AutoModifyConsiderFunction(npcBot, Consider, AbilitiesReal) function AbilityUsageThink() -- Check if we're already using an ability diff --git a/ability_item_usage_tiny.lua b/ability_item_usage_tiny.lua index 27ca273a..0b794f5d 100644 --- a/ability_item_usage_tiny.lua +++ b/ability_item_usage_tiny.lua @@ -7,6 +7,7 @@ -------------------------------------- local utility = require( GetScriptDirectory().."/utility" ) require(GetScriptDirectory() .. "/ability_item_usage_generic") +local AbilityExtensions = require(GetScriptDirectory().."/util/AbilityAbstraction") local debugmode=false local npcBot = GetBot() diff --git a/ability_item_usage_treant.lua b/ability_item_usage_treant.lua index a9324ada..c337e728 100644 --- a/ability_item_usage_treant.lua +++ b/ability_item_usage_treant.lua @@ -7,6 +7,8 @@ -------------------------------------- local utility = require( GetScriptDirectory().."/utility" ) require(GetScriptDirectory() .. "/ability_item_usage_generic") +local AbilityExtensions = require(GetScriptDirectory().."/util/AbilityAbstraction") + local debugmode=false local npcBot = GetBot() @@ -351,6 +353,7 @@ Consider[3]=function() local allys = npcBot:GetNearbyHeroes( 1800, false, BOT_MODE_NONE ); local WeakestAlly,AllyHealth=utility.GetWeakestUnit(allys) local allys2 = GetUnitList(UNIT_LIST_ALLIED_HEROES) + allys2 = AbilityExtensions:Filter(allys2, function(b) return not b:IsIllusion() end) local enemys = npcBot:GetNearbyHeroes(1800,true,BOT_MODE_NONE) local WeakestEnemy,HeroHealth=utility.GetWeakestUnit(enemys) -------------------------------------- @@ -377,7 +380,7 @@ Consider[3]=function() then if (WeakestAlly~=nil) then - if(AllyHealth/WeakestAlly:GetMaxHealth()<0.3+0.4*ManaPercentage) + if(AllyHealth/WeakestAlly:GetMaxHealth()<0.3+0.4*ManaPercentage) and not WeakestAlly:IsIllusion() then return BOT_ACTION_DESIRE_MODERATE,WeakestAlly:GetLocation() end @@ -385,7 +388,7 @@ Consider[3]=function() for _,npcTarget in pairs( allys ) do - if(npcTarget:GetHealth()/npcTarget:GetMaxHealth()<(0.6+#enemys*0.05+0.2*ManaPercentage) or npcTarget:WasRecentlyDamagedByAnyHero(5.0)) + if not npcTarget:IsIllusion() and (npcTarget:GetHealth()/npcTarget:GetMaxHealth()<(0.6+#enemys*0.05+0.2*ManaPercentage) or npcTarget:WasRecentlyDamagedByAnyHero(5.0)) then if ( CanCast[abilityNumber]( npcTarget ) ) then @@ -413,7 +416,7 @@ Consider[3]=function() if(HighestFactor>=0.4) then - if ( CanCast[abilityNumber]( npcTarget ) ) + if not WeakestAlly2:IsIllusion() and CanCast[abilityNumber]( npcTarget ) then return BOT_ACTION_DESIRE_MODERATE, WeakestAlly2:GetLocation() end @@ -555,6 +558,7 @@ Consider[4]=function() return BOT_ACTION_DESIRE_NONE; end +AbilityExtensions:AutoModifyConsiderFunction(npcBot, Consider, AbilitiesReal) function AbilityUsageThink() diff --git a/ability_item_usage_troll_warlord.lua b/ability_item_usage_troll_warlord.lua index 8a4b7c69..04787126 100644 --- a/ability_item_usage_troll_warlord.lua +++ b/ability_item_usage_troll_warlord.lua @@ -9,6 +9,7 @@ -------------------------------------- local utility = require( GetScriptDirectory().."/utility" ) require(GetScriptDirectory() .. "/ability_item_usage_generic") +local AbilityExtensions = require(GetScriptDirectory().."/util/AbilityAbstraction") local debugmode=false local npcBot = GetBot() @@ -466,9 +467,7 @@ Consider[5]=function() return BOT_ACTION_DESIRE_NONE, 0; end - - - +AbilityExtensions:AutoModifyConsiderFunction(npcBot, Consider, AbilitiesReal) function AbilityUsageThink() diff --git a/ability_item_usage_tusk.lua b/ability_item_usage_tusk.lua index 2e318779..7ed7fc73 100644 --- a/ability_item_usage_tusk.lua +++ b/ability_item_usage_tusk.lua @@ -8,6 +8,7 @@ -------------------------------------- local utility = require( GetScriptDirectory().."/utility" ) require(GetScriptDirectory() .. "/ability_item_usage_generic") +local AbilityExtensions = require(GetScriptDirectory().."/util/AbilityAbstraction") local debugmode=false local npcBot = GetBot() @@ -612,6 +613,7 @@ Consider[4]=function() --A杖大 return BOT_ACTION_DESIRE_NONE, 0 end +AbilityExtensions:AutoModifyConsiderFunction(npcBot, Consider, AbilitiesReal) function AbilityUsageThink() -- Check if we're already using an ability diff --git a/ability_item_usage_undying.lua b/ability_item_usage_undying.lua index 05861324..d8b6c7e9 100644 --- a/ability_item_usage_undying.lua +++ b/ability_item_usage_undying.lua @@ -7,6 +7,7 @@ -------------------------------------- local utility = require( GetScriptDirectory().."/utility" ) require(GetScriptDirectory() .. "/ability_item_usage_generic") +local AbilityExtensions = require(GetScriptDirectory().."/util/AbilityAbstraction") local debugmode=false local npcBot = GetBot() @@ -530,6 +531,7 @@ Consider[4]=function() end +AbilityExtensions:AutoModifyConsiderFunction(npcBot, Consider, AbilitiesReal) function AbilityUsageThink() -- Check if we're already using an ability diff --git a/ability_item_usage_ursa.lua b/ability_item_usage_ursa.lua index 3d1847b2..0fd45d28 100644 --- a/ability_item_usage_ursa.lua +++ b/ability_item_usage_ursa.lua @@ -7,6 +7,7 @@ -------------------------------------- local utility = require( GetScriptDirectory().."/utility" ) require(GetScriptDirectory() .. "/ability_item_usage_generic") +local AbilityExtensions = require(GetScriptDirectory().."/util/AbilityAbstraction") local debugmode=false local npcBot = GetBot() @@ -399,6 +400,7 @@ Consider[4]=function() end +AbilityExtensions:AutoModifyConsiderFunction(npcBot, Consider, AbilitiesReal) function AbilityUsageThink() -- Check if we're already using an ability diff --git a/ability_item_usage_vengefulspirit.lua b/ability_item_usage_vengefulspirit.lua index d294ca31..fee3f6e8 100644 --- a/ability_item_usage_vengefulspirit.lua +++ b/ability_item_usage_vengefulspirit.lua @@ -7,6 +7,7 @@ -------------------------------------- local utility = require( GetScriptDirectory().."/utility" ) require(GetScriptDirectory() .. "/ability_item_usage_generic") +local AbilityExtensions = require(GetScriptDirectory().."/util/AbilityAbstraction") local debugmode=false local npcBot = GetBot() @@ -76,7 +77,10 @@ end -------------------------------------- local cast={} cast.Desire={} cast.Target={} cast.Type={} local Consider ={} -local CanCast={utility.NCanCast,utility.NCanCast,utility.NCanCast,utility.UCanCast} +local CanCast={function(target) return (npcBot:GetLevel()>=25 and utility.UCanCast(target)) or utility.NCanCast(target) end, + utility.NCanCast, + utility.NCanCast, + utility.UCanCast,} local enemyDisabled=utility.enemyDisabled function GetComboDamage() @@ -398,6 +402,7 @@ Consider[4]=function() end +AbilityExtensions:AutoModifyConsiderFunction(npcBot, Consider, AbilitiesReal) function AbilityUsageThink() -- Check if we're already using an ability diff --git a/ability_item_usage_venomancer.lua b/ability_item_usage_venomancer.lua index e737b192..82277676 100644 --- a/ability_item_usage_venomancer.lua +++ b/ability_item_usage_venomancer.lua @@ -7,6 +7,7 @@ -------------------------------------- local utility = require( GetScriptDirectory().."/utility" ) require(GetScriptDirectory() .. "/ability_item_usage_generic") +local AbilityExtensions = require(GetScriptDirectory().."/util/AbilityAbstraction") local debugmode=false local npcBot = GetBot() @@ -386,6 +387,7 @@ Consider[4]=function() return BOT_ACTION_DESIRE_NONE; end +AbilityExtensions:AutoModifyConsiderFunction(npcBot, Consider, AbilitiesReal) function AbilityUsageThink() -- Check if we're already using an ability diff --git a/ability_item_usage_viper.lua b/ability_item_usage_viper.lua index 57b5fddb..2491d5f6 100644 --- a/ability_item_usage_viper.lua +++ b/ability_item_usage_viper.lua @@ -7,6 +7,7 @@ -------------------------------------- local utility = require( GetScriptDirectory().."/utility" ) require(GetScriptDirectory() .. "/ability_item_usage_generic") +local AbilityExtensions = require(GetScriptDirectory().."/util/AbilityAbstraction") local debugmode=false local npcBot = GetBot() diff --git a/ability_item_usage_warlock.lua b/ability_item_usage_warlock.lua index 21c101ff..335f9431 100644 --- a/ability_item_usage_warlock.lua +++ b/ability_item_usage_warlock.lua @@ -7,6 +7,7 @@ -------------------------------------- local utility = require( GetScriptDirectory().."/utility" ) require(GetScriptDirectory() .. "/ability_item_usage_generic") +local AbilityExtensions = require(GetScriptDirectory().."/util/AbilityAbstraction") local debugmode=false local npcBot = GetBot() @@ -541,6 +542,7 @@ Consider[4]=function() end +AbilityExtensions:AutoModifyConsiderFunction(npcBot, Consider, AbilitiesReal) function AbilityUsageThink() local enemys = npcBot:GetNearbyHeroes(500,true,BOT_MODE_NONE) diff --git a/ability_item_usage_weaver.lua b/ability_item_usage_weaver.lua index 745e19bf..e76342fa 100644 --- a/ability_item_usage_weaver.lua +++ b/ability_item_usage_weaver.lua @@ -8,6 +8,7 @@ -------------------------------------- local utility = require( GetScriptDirectory().."/utility" ) require(GetScriptDirectory() .. "/ability_item_usage_generic") +local AbilityExtensions = require(GetScriptDirectory().."/util/AbilityAbstraction") local debugmode=false local npcBot = GetBot() @@ -335,6 +336,7 @@ Consider[4]=function() return BOT_ACTION_DESIRE_NONE, 0 end +AbilityExtensions:AutoModifyConsiderFunction(npcBot, Consider, AbilitiesReal) function AbilityUsageThink() -- Check if we're already using an ability diff --git a/ability_item_usage_windrunner.lua b/ability_item_usage_windrunner.lua index 31cf196f..88743856 100644 --- a/ability_item_usage_windrunner.lua +++ b/ability_item_usage_windrunner.lua @@ -8,6 +8,7 @@ -------------------------------------- local utility = require( GetScriptDirectory().."/utility" ) require(GetScriptDirectory() .. "/ability_item_usage_generic") +local AbilityExtensions = require(GetScriptDirectory().."/util/AbilityAbstraction") local debugmode=false local npcBot = GetBot() diff --git a/ability_item_usage_winter_wyvern.lua b/ability_item_usage_winter_wyvern.lua index 446a6a89..f87d5fa9 100644 --- a/ability_item_usage_winter_wyvern.lua +++ b/ability_item_usage_winter_wyvern.lua @@ -7,6 +7,7 @@ -------------------------------------- local utility = require( GetScriptDirectory().."/utility" ) require(GetScriptDirectory() .. "/ability_item_usage_generic") +local AbilityExtensions = require(GetScriptDirectory().."/util/AbilityAbstraction") local debugmode=false local npcBot = GetBot() @@ -544,6 +545,7 @@ Consider[4]=function() end +AbilityExtensions:AutoModifyConsiderFunction(npcBot, Consider, AbilitiesReal) function AbilityUsageThink() -- Check if we're already using an ability diff --git a/ability_item_usage_witch_doctor.lua b/ability_item_usage_witch_doctor.lua index c67cd362..b6631773 100644 --- a/ability_item_usage_witch_doctor.lua +++ b/ability_item_usage_witch_doctor.lua @@ -7,6 +7,7 @@ -------------------------------------- local utility = require( GetScriptDirectory().."/utility" ) require(GetScriptDirectory() .. "/ability_item_usage_generic") +local AbilityExtensions = require(GetScriptDirectory().."/util/AbilityAbstraction") local debugmode=false local npcBot = GetBot() diff --git a/ability_item_usage_zuus.lua b/ability_item_usage_zuus.lua index ecd86ccc..3e57b71f 100644 --- a/ability_item_usage_zuus.lua +++ b/ability_item_usage_zuus.lua @@ -7,6 +7,7 @@ -------------------------------------- local utility = require( GetScriptDirectory().."/utility" ) require(GetScriptDirectory() .. "/ability_item_usage_generic") +local AbilityExtensions = require(GetScriptDirectory().."/util/AbilityAbstraction") local debugmode=false local npcBot = GetBot() @@ -457,6 +458,7 @@ Consider[4]=function() return BOT_ACTION_DESIRE_NONE,0 end +AbilityExtensions:AutoModifyConsiderFunction(npcBot, Consider, AbilitiesReal) function AbilityUsageThink() -- Check if we're already using an ability diff --git a/dev/DEV_ability_item_usage_kunkka.lua b/dev/DEV_ability_item_usage_kunkka.lua index b1f858c4..14e4fc9e 100644 --- a/dev/DEV_ability_item_usage_kunkka.lua +++ b/dev/DEV_ability_item_usage_kunkka.lua @@ -7,6 +7,7 @@ -------------------------------------- local utility = require( GetScriptDirectory().."/utility" ) require(GetScriptDirectory() .. "/ability_item_usage_generic") +local AbilityExtensions = require(GetScriptDirectory().."/util/AbilityAbstraction") local debugmode=false local npcBot = GetBot() @@ -553,6 +554,7 @@ Consider[4]=function() end +AbilityExtensions:AutoModifyConsiderFunction(npcBot, Consider, AbilitiesReal) function AbilityUsageThink() -- Check if we're already using an ability diff --git a/dev/DEV_ability_item_usage_morphling.lua b/dev/DEV_ability_item_usage_morphling.lua index ce6c1cf6..e7753596 100644 --- a/dev/DEV_ability_item_usage_morphling.lua +++ b/dev/DEV_ability_item_usage_morphling.lua @@ -7,6 +7,7 @@ -------------------------------------- local utility = require( GetScriptDirectory().."/utility" ) require(GetScriptDirectory() .. "/ability_item_usage_generic") +local AbilityExtensions = require(GetScriptDirectory().."/util/AbilityAbstraction") local debugmode=false local npcBot = GetBot() @@ -435,6 +436,7 @@ Consider[4]=function() end +AbilityExtensions:AutoModifyConsiderFunction(npcBot, Consider, AbilitiesReal) function AbilityUsageThink() -- Check if we're already using an ability diff --git a/dev/DEV_ability_item_usage_normal.lua b/dev/DEV_ability_item_usage_normal.lua index e2948be1..b312fdb6 100644 --- a/dev/DEV_ability_item_usage_normal.lua +++ b/dev/DEV_ability_item_usage_normal.lua @@ -659,6 +659,7 @@ consider[4] = function() return BOT_ACTION_DESIRE_NONE, 0 end +AbilityExtensions:AutoModifyConsiderFunction(npcBot, Consider, AbilitiesReal) function AbilityUsageThink() -- Check if we're already using an ability if (npcBot:IsUsingAbility() or npcBot:IsChanneling() or npcBot:IsSilenced()) then diff --git a/dev/DEV_ability_item_usage_normal2.lua b/dev/DEV_ability_item_usage_normal2.lua index b23aa577..06227cf4 100644 --- a/dev/DEV_ability_item_usage_normal2.lua +++ b/dev/DEV_ability_item_usage_normal2.lua @@ -7,6 +7,7 @@ -------------------------------------- local utility = require( GetScriptDirectory().."/utility" ) require(GetScriptDirectory() .. "/ability_item_usage_generic") +local AbilityExtensions = require(GetScriptDirectory().."/util/AbilityAbstraction") -------------------------------------- -- Hero Area Local Variable Setting -------------------------------------- @@ -180,6 +181,7 @@ local function GetComboMana() return end +AbilityExtensions:AutoModifyConsiderFunction(npcBot, Consider, AbilitiesReal) function AbilityUsageThink() -- Check if we're already using an ability diff --git a/dev/DEV_ability_item_usage_pudge.lua b/dev/DEV_ability_item_usage_pudge.lua index b1f858c4..14e4fc9e 100644 --- a/dev/DEV_ability_item_usage_pudge.lua +++ b/dev/DEV_ability_item_usage_pudge.lua @@ -7,6 +7,7 @@ -------------------------------------- local utility = require( GetScriptDirectory().."/utility" ) require(GetScriptDirectory() .. "/ability_item_usage_generic") +local AbilityExtensions = require(GetScriptDirectory().."/util/AbilityAbstraction") local debugmode=false local npcBot = GetBot() @@ -553,6 +554,7 @@ Consider[4]=function() end +AbilityExtensions:AutoModifyConsiderFunction(npcBot, Consider, AbilitiesReal) function AbilityUsageThink() -- Check if we're already using an ability diff --git a/dev/DEV_ability_item_usage_skeleton_king.lua b/dev/DEV_ability_item_usage_skeleton_king.lua index 851abddb..817351fa 100644 --- a/dev/DEV_ability_item_usage_skeleton_king.lua +++ b/dev/DEV_ability_item_usage_skeleton_king.lua @@ -7,6 +7,7 @@ -------------------------------------- local utility = require( GetScriptDirectory().."/utility" ) require(GetScriptDirectory() .. "/ability_item_usage_generic") +local AbilityExtensions = require(GetScriptDirectory().."/util/AbilityAbstraction") local debugmode=false local npcBot = GetBot() @@ -336,6 +337,7 @@ Consider[3]=function() --Location AOE Example end +AbilityExtensions:AutoModifyConsiderFunction(npcBot, Consider, AbilitiesReal) function AbilityUsageThink() -- Check if we're already using an ability diff --git a/dev/DEV_item_purchase_normal.lua b/dev/DEV_item_purchase_normal.lua index 0b629514..4cfbb142 100644 --- a/dev/DEV_item_purchase_normal.lua +++ b/dev/DEV_item_purchase_normal.lua @@ -53,7 +53,7 @@ function ItemPurchaseThink() --购买辅助物品 对于辅助英雄保留这一行 ItemPurchaseSystem.BuySupportItem() --购买信使 对于5号位保留这一行 - ItemPurchaseSystem.BuyCourier() + -- ItemPurchaseSystem.BuyCourier() --购买装备 ItemPurchaseSystem.ItemPurchase(ItemsToBuy) end \ No newline at end of file diff --git a/item_purchase_abaddon.lua b/item_purchase_abaddon.lua index b05c089a..25ded6ad 100644 --- a/item_purchase_abaddon.lua +++ b/item_purchase_abaddon.lua @@ -34,7 +34,7 @@ local Transfered = ItemPurchaseSystem.Transfer(ItemsToBuy) ItemPurchaseSystem.checkItemBuild(Transfered) function ItemPurchaseThink() - ItemPurchaseSystem.BuyCourier() + -- ItemPurchaseSystem.BuyCourier() ItemPurchaseSystem.BuySupportItem() ItemPurchaseSystem.ItemPurchase(Transfered) end diff --git a/item_purchase_abyssal_underlord.lua b/item_purchase_abyssal_underlord.lua index 291cdaea..af6e4773 100644 --- a/item_purchase_abyssal_underlord.lua +++ b/item_purchase_abyssal_underlord.lua @@ -23,7 +23,6 @@ local ItemsToBuy = "item_recipe_headdress", "item_branches", "item_recipe_pipe", --笛子 - --"item_vladmir", --祭品7.21 "item_recipe_guardian_greaves", --卫士胫甲 "item_lotus_orb", --清莲宝珠 --"item_radiance", --辉耀 diff --git a/item_purchase_alchemist.lua b/item_purchase_alchemist.lua index 84d5d934..45210b74 100644 --- a/item_purchase_alchemist.lua +++ b/item_purchase_alchemist.lua @@ -28,7 +28,7 @@ local ItemsToBuy = "item_recipe_mjollnir", --大电锤 "item_vanguard", "item_recipe_abyssal_blade", --大晕 - "item_hyperstone", + "item_travel_boots", } local Transfered = ItemPurchaseSystem.Transfer(ItemsToBuy) diff --git a/item_purchase_ancient_apparition.lua b/item_purchase_ancient_apparition.lua index 74d32039..9ea70f07 100644 --- a/item_purchase_ancient_apparition.lua +++ b/item_purchase_ancient_apparition.lua @@ -9,14 +9,17 @@ local ItemsToBuy = "item_tango", "item_clarity", "item_branches", + "item_branches", "item_boots", - "item_magic_wand", --大魔棒7.14 + "item_flask", + "item_recipe_magic_wand", + "item_null_talisman", "item_ring_of_basilius", - "item_null_talisman", "item_energy_booster", "item_glimmer_cape", --微光 - "item_cyclone", --风杖 + "item_ghost", "item_ultimate_scepter", --蓝杖 + "item_cyclone", --风杖 "item_sheepstick", --羊刀 "item_lotus_orb" --清莲宝珠 } @@ -26,6 +29,6 @@ ItemPurchaseSystem.checkItemBuild(Transfered) function ItemPurchaseThink() ItemPurchaseSystem.BuySupportItem() - ItemPurchaseSystem.BuyCourier() + -- ItemPurchaseSystem.BuyCourier() ItemPurchaseSystem.ItemPurchase(Transfered) end diff --git a/item_purchase_antimage.lua b/item_purchase_antimage.lua index d57ccb21..55ff7ca5 100644 --- a/item_purchase_antimage.lua +++ b/item_purchase_antimage.lua @@ -13,7 +13,10 @@ local ItemsToBuy = "item_wraith_band", "item_power_treads", --假腿7.21 "item_orb_of_corrosion", - "item_bfury", --狂战7.14 + "item_broadsword", + "item_ring_of_health", + "item_claymore", + "item_void_stone", "item_manta", --分身 "item_basher", --晕锤7.14 "item_vanguard", diff --git a/item_purchase_arc_warden.lua b/item_purchase_arc_warden.lua index 763c4d24..331f1ef3 100644 --- a/item_purchase_arc_warden.lua +++ b/item_purchase_arc_warden.lua @@ -10,7 +10,7 @@ local ItemsToBuy = "item_wraith_band", --系带 "item_flask", "item_wraith_band", --系带 - "item_magic_wand", --大魔棒7.14 + "item_magic_wand", "item_boots", "item_hand_of_midas", --点金 "item_maelstrom", --电锤7.14 @@ -22,7 +22,7 @@ local ItemsToBuy = "item_recipe_silver_edge", --大隐刀 "item_orchid", --紫苑 "item_black_king_bar", --BKB - "item_lesser_crit", --水晶剑 + "item_hyperstone", "item_recipe_bloodthorn", --血棘 "item_butterfly" --蝴蝶 } diff --git a/item_purchase_axe.lua b/item_purchase_axe.lua index e59225bb..60a10374 100644 --- a/item_purchase_axe.lua +++ b/item_purchase_axe.lua @@ -9,7 +9,6 @@ local ItemsToBuy = "item_tango", "item_tango", "item_enchanted_mango", - "item_enchanted_mango", "item_quelling_blade", "item_phase_boots", --相位 "item_magic_wand", --大魔棒7.14 @@ -20,7 +19,8 @@ local ItemsToBuy = "item_broadsword", --刃甲 "item_black_king_bar", --BKB "item_heart", --龙心7.20 - "item_lotus_orb" --清莲宝珠 + "item_lotus_orb", --清莲宝珠, + "item_assault", } local Transfered = ItemPurchaseSystem.Transfer(ItemsToBuy) diff --git a/item_purchase_bane.lua b/item_purchase_bane.lua index 0ffe8e2f..802ada6e 100644 --- a/item_purchase_bane.lua +++ b/item_purchase_bane.lua @@ -20,6 +20,7 @@ local ItemsToBuy = "item_ultimate_scepter", --蓝杖 "item_sheepstick", --羊刀 "item_mekansm", --梅肯 + "item_buckler", "item_recipe_guardian_greaves" --卫士胫甲 } @@ -28,6 +29,6 @@ ItemPurchaseSystem.checkItemBuild(Transfered) function ItemPurchaseThink() ItemPurchaseSystem.BuySupportItem() - ItemPurchaseSystem.BuyCourier() + -- ItemPurchaseSystem.BuyCourier() ItemPurchaseSystem.ItemPurchase(Transfered) end diff --git a/item_purchase_beastmaster.lua b/item_purchase_beastmaster.lua index 50b648d3..62ea5417 100644 --- a/item_purchase_beastmaster.lua +++ b/item_purchase_beastmaster.lua @@ -13,7 +13,7 @@ local ItemsToBuy = "item_bracer", "item_buckler", "item_phase_boots", --相位7.21 - "item_magic_wand", --大魔棒7.14 + "item_magic_wand", "item_ring_of_basilius", "item_lifesteal", --祭品 "item_necronomicon_3", --死灵书 diff --git a/item_purchase_bloodseeker.lua b/item_purchase_bloodseeker.lua index dcfc5e97..da053ac4 100644 --- a/item_purchase_bloodseeker.lua +++ b/item_purchase_bloodseeker.lua @@ -16,6 +16,7 @@ local ItemsToBuy = "item_phase_boots", --相位 "item_recipe_magic_wand", --大魔棒7.14 "item_blade_mail", --刃甲 + "item_orb_of_corrosion", "item_sange_and_yasha", "item_black_king_bar", --bkb "item_basher", --晕锤7.14 diff --git a/item_purchase_bounty_hunter.lua b/item_purchase_bounty_hunter.lua index 07794b4a..17eae0d3 100644 --- a/item_purchase_bounty_hunter.lua +++ b/item_purchase_bounty_hunter.lua @@ -8,23 +8,24 @@ local ItemsToBuy = { "item_orb_of_venom", -- 毒球 "item_tango", - "item_flask", "item_phase_boots", "item_magic_wand", --大魔棒7.14 "item_ancient_janggo", --战鼓 - -- "item_spirit_vessel", --大骨灰7.07 + "item_ghost", + "item_ultimate_scepter", + "item_spirit_vessel", --大骨灰7.07 "item_force_staff", --推推7.14 "item_black_king_bar", --BKB "item_lotus_orb", --清莲宝珠 "item_sheepstick", - "item_pipe" --笛子 + --"item_pipe" --笛子 } local Transfered = ItemPurchaseSystem.Transfer(ItemsToBuy) ItemPurchaseSystem.checkItemBuild(Transfered) function ItemPurchaseThink() - ItemPurchaseSystem.BuyCourier() + -- ItemPurchaseSystem.BuyCourier() ItemPurchaseSystem.BuySupportItem() ItemPurchaseSystem.ItemPurchase(Transfered) end diff --git a/item_purchase_brewmaster.lua b/item_purchase_brewmaster.lua index eab433f9..d2aed705 100644 --- a/item_purchase_brewmaster.lua +++ b/item_purchase_brewmaster.lua @@ -12,7 +12,7 @@ local ItemsToBuy = "item_quelling_blade", "item_bracer", "item_phase_boots", --相位7.21 - "item_magic_wand", --大魔棒7.14 + "item_magic_wand", "item_vladmir", --祭品7.21 "item_blink", --跳刀 "item_black_king_bar", --BKB diff --git a/item_purchase_bristleback.lua b/item_purchase_bristleback.lua index 7736decc..fbb6a3cf 100644 --- a/item_purchase_bristleback.lua +++ b/item_purchase_bristleback.lua @@ -13,18 +13,16 @@ local ItemsToBuy = "item_quelling_blade", "item_bracer", "item_phase_boots", --相位 - "item_magic_wand", --大魔棒7.14 + "item_magic_wand", "item_vanguard", --先锋 "item_pipe", --笛子 "item_helm_of_iron_will", "item_recipe_crimson_guard", --赤红甲 "item_black_king_bar", --BKB - "item_point_booster", - "item_vitality_booster", - "item_energy_booster", - "item_mystic_staff", --玲珑心 + "item_heart", --龙心7.20 "item_lotus_orb", - "item_heart" --龙心7.20 + "item_shivas_guard", + "item_ultimate_scepter_2", } local Transfered = ItemPurchaseSystem.Transfer(ItemsToBuy) diff --git a/item_purchase_broodmother.lua b/item_purchase_broodmother.lua index 0f14ec22..0cbd78d0 100644 --- a/item_purchase_broodmother.lua +++ b/item_purchase_broodmother.lua @@ -16,7 +16,7 @@ local ItemsToBuy = "item_solar_crest", --大勋章7.20 "item_orchid", --紫苑 "item_black_king_bar", --bkb - "item_lesser_crit", + "item_hyperstone", "item_recipe_bloodthorn", --血棘 "item_assault" --强袭 } diff --git a/item_purchase_centaur.lua b/item_purchase_centaur.lua index a721e6d4..4db285d8 100644 --- a/item_purchase_centaur.lua +++ b/item_purchase_centaur.lua @@ -12,13 +12,13 @@ local ItemsToBuy = "item_enchanted_mango", "item_bracer", "item_phase_boots", - "item_magic_wand", --大魔棒7.14 + "item_magic_wand", "item_bracer", "item_blink", --跳刀 "item_crimson_guard", --赤红甲 "item_pipe", --笛子 + "item_heart", --龙心7.20 "item_ultimate_scepter", --蓝杖 - "item_heart" --龙心7.20 } local Transfered = ItemPurchaseSystem.Transfer(ItemsToBuy) diff --git a/item_purchase_chen.lua b/item_purchase_chen.lua index c70847b2..41d6225c 100644 --- a/item_purchase_chen.lua +++ b/item_purchase_chen.lua @@ -11,7 +11,8 @@ local ItemsToBuy = "item_branches", "item_branches", "item_boots", - "item_magic_stick", + "item_flask", + "item_magic_stick", "item_recipe_magic_wand", --大魔棒7.14 "item_energy_booster", "item_ring_of_regen", @@ -40,6 +41,6 @@ ItemPurchaseSystem.checkItemBuild(Transfered) --检查装备列表 function ItemPurchaseThink() ItemPurchaseSystem.BuySupportItem() --购买辅助物品 对于辅助英雄保留这一行 - ItemPurchaseSystem.BuyCourier() --购买信使 对于5号位保留这一行 + -- ItemPurchaseSystem.BuyCourier() --购买信使 对于5号位保留这一行 ItemPurchaseSystem.ItemPurchase(Transfered) --购买装备 end diff --git a/item_purchase_clinkz.lua b/item_purchase_clinkz.lua index e5fe22c7..d10df7ef 100644 --- a/item_purchase_clinkz.lua +++ b/item_purchase_clinkz.lua @@ -16,6 +16,7 @@ local ItemsToBuy = "item_orchid", --紫苑 "item_black_king_bar", --bkb "item_sheepstick", + "item_hyperstone", "item_recipe_bloodthorn", --血棘 "item_monkey_king_bar", --金箍棒7.14 "item_satanic" --撒旦7.07 diff --git a/item_purchase_crystal_maiden.lua b/item_purchase_crystal_maiden.lua index 5b7caa62..6c9492a2 100644 --- a/item_purchase_crystal_maiden.lua +++ b/item_purchase_crystal_maiden.lua @@ -11,7 +11,7 @@ local ItemsToBuy = "item_flask", "item_clarity", "item_ring_of_basilius", - "item_magic_wand", --大魔棒7.14 + "item_magic_wand", "item_boots", "item_ring_of_regen", --绿鞋 "item_bracer", @@ -28,6 +28,6 @@ ItemPurchaseSystem.checkItemBuild(Transfered) --检查装备列表 function ItemPurchaseThink() ItemPurchaseSystem.BuySupportItem() --购买辅助物品 对于辅助英雄保留这一行 - ItemPurchaseSystem.BuyCourier() --购买信使 对于5号位保留这一行 + -- ItemPurchaseSystem.BuyCourier() --购买信使 对于5号位保留这一行 ItemPurchaseSystem.ItemPurchase(Transfered) --购买装备 end diff --git a/item_purchase_dark_seer.lua b/item_purchase_dark_seer.lua index d3ac8407..1498361f 100644 --- a/item_purchase_dark_seer.lua +++ b/item_purchase_dark_seer.lua @@ -16,6 +16,7 @@ local ItemsToBuy = "item_energy_booster", "item_pipe", --笛子 "item_mekansm", --梅肯 + "item_buckler", "item_recipe_guardian_greaves", --卫士胫甲 "item_blink", --跳刀 "item_lotus_orb", --清莲宝珠 diff --git a/item_purchase_dazzle.lua b/item_purchase_dazzle.lua index 916e115b..78c91bec 100644 --- a/item_purchase_dazzle.lua +++ b/item_purchase_dazzle.lua @@ -15,6 +15,9 @@ local ItemsToBuy = "item_energy_booster", "item_spirit_vessel", --大骨灰 "item_mekansm", --梅肯 + "item_ghost", + "item_spirit_vessel", --大骨灰 + "item_buckler", "item_recipe_guardian_greaves", --卫士胫甲 "item_solar_crest", --大勋章7.20 "item_pipe", @@ -26,6 +29,6 @@ ItemPurchaseSystem.checkItemBuild(Transfered) --检查装备列表 function ItemPurchaseThink() ItemPurchaseSystem.BuySupportItem() --购买辅助物品 对于辅助英雄保留这一行 - ItemPurchaseSystem.BuyCourier() --购买信使 对于5号位保留这一行 + -- ItemPurchaseSystem.BuyCourier() --购买信使 对于5号位保留这一行 ItemPurchaseSystem.ItemPurchase(Transfered) --购买装备 end diff --git a/item_purchase_death_prophet.lua b/item_purchase_death_prophet.lua index 4d23825a..684509fb 100644 --- a/item_purchase_death_prophet.lua +++ b/item_purchase_death_prophet.lua @@ -11,7 +11,7 @@ local ItemsToBuy = "item_flask", "item_null_talisman", --无用挂件 "item_boots", - "item_magic_wand", --大魔棒7.14 + "item_magic_wand", "item_blades_of_attack", "item_chainmail", --相位7.21 "item_cyclone", --风杖 diff --git a/item_purchase_disruptor.lua b/item_purchase_disruptor.lua index 12f1fea0..21238b4e 100644 --- a/item_purchase_disruptor.lua +++ b/item_purchase_disruptor.lua @@ -12,10 +12,9 @@ local ItemsToBuy = "item_wind_lace", "item_boots", "item_ring_of_regen", --绿鞋 - "item_magic_wand", --大魔棒7.14 + "item_flask", "item_glimmer_cape", "item_ultimate_scepter", --蓝杖 - -- "item_spirit_vessel", --大骨灰7.07 "item_force_staff", --推推7.14 "item_sheepstick" --羊刀 } @@ -25,6 +24,6 @@ ItemPurchaseSystem.checkItemBuild(Transfered) --检查装备列表 function ItemPurchaseThink() ItemPurchaseSystem.BuySupportItem() --购买辅助物品 对于辅助英雄保留这一行 - ItemPurchaseSystem.BuyCourier() --购买信使 对于5号位保留这一行 + -- ItemPurchaseSystem.BuyCourier() --购买信使 对于5号位保留这一行 ItemPurchaseSystem.ItemPurchase(Transfered) --购买装备 end diff --git a/item_purchase_doom_bringer.lua b/item_purchase_doom_bringer.lua index cf2e8a61..5c82b253 100644 --- a/item_purchase_doom_bringer.lua +++ b/item_purchase_doom_bringer.lua @@ -11,7 +11,9 @@ local ItemsToBuy = "item_enchanted_mango", "item_bracer", "item_boots", - "item_magic_wand", --大魔棒7.14 + "item_branches", + "item_branches", + "item_recipe_magic_wand", "item_blades_of_attack", "item_chainmail", --相位7.21 "item_ancient_janggo", --战鼓7.20 diff --git a/item_purchase_earth_spirit.lua b/item_purchase_earth_spirit.lua index f4fafe6c..a0f33c8f 100644 --- a/item_purchase_earth_spirit.lua +++ b/item_purchase_earth_spirit.lua @@ -25,6 +25,6 @@ ItemPurchaseSystem.checkItemBuild(Transfered) --检查装备列表 function ItemPurchaseThink() ItemPurchaseSystem.BuySupportItem() --购买辅助物品 对于辅助英雄保留这一行 - ItemPurchaseSystem.BuyCourier() --购买信使 对于5号位保留这一行 + -- ItemPurchaseSystem.BuyCourier() --购买信使 对于5号位保留这一行 ItemPurchaseSystem.ItemPurchase(Transfered) --购买装备 end diff --git a/item_purchase_earthshaker.lua b/item_purchase_earthshaker.lua index d639b9ac..ba5b2fa2 100644 --- a/item_purchase_earthshaker.lua +++ b/item_purchase_earthshaker.lua @@ -24,6 +24,6 @@ ItemPurchaseSystem.checkItemBuild(Transfered) --检查装备列表 function ItemPurchaseThink() ItemPurchaseSystem.BuySupportItem() --购买辅助物品 对于辅助英雄保留这一行 - ItemPurchaseSystem.BuyCourier() --购买信使 对于5号位保留这一行 + -- ItemPurchaseSystem.BuyCourier() --购买信使 对于5号位保留这一行 ItemPurchaseSystem.ItemPurchase(Transfered) --购买装备 end diff --git a/item_purchase_elder_titan.lua b/item_purchase_elder_titan.lua index 64f487bc..65ebfadd 100644 --- a/item_purchase_elder_titan.lua +++ b/item_purchase_elder_titan.lua @@ -8,7 +8,6 @@ local ItemsToBuy = { "item_tango", "item_tango", - "item_flask", "item_magic_wand", --大魔棒7.14 "item_bracer", "item_tranquil_boots", @@ -28,6 +27,6 @@ ItemPurchaseSystem.checkItemBuild(Transfered) --检查装备列表 function ItemPurchaseThink() ItemPurchaseSystem.BuySupportItem() --购买辅助物品 对于辅助英雄保留这一行 - ItemPurchaseSystem.BuyCourier() --购买信使 对于5号位保留这一行 + -- ItemPurchaseSystem.BuyCourier() --购买信使 对于5号位保留这一行 ItemPurchaseSystem.ItemPurchase(Transfered) --购买装备 end diff --git a/item_purchase_ember_spirit.lua b/item_purchase_ember_spirit.lua index 2f81aef3..3dec1930 100644 --- a/item_purchase_ember_spirit.lua +++ b/item_purchase_ember_spirit.lua @@ -12,13 +12,17 @@ local ItemsToBuy = "item_wraith_band", "item_bottle", "item_phase_boots", + "item_broadsword", + "item_ring_of_health", + "item_claymore", + "item_void_stone", "item_magic_wand", --大魔棒7.14 + "item_black_king_bar", + "item_greater_crit", "item_maelstrom", --电锤7.14 - "item_sphere", --林肯 + "item_octarine_core", --玲珑心 "item_hyperstone", "item_recipe_mjollnir", --大雷锤 - "item_black_king_bar", - "item_octarine_core" --玲珑心 } local Transfered = ItemPurchaseSystem.Transfer(ItemsToBuy) diff --git a/item_purchase_enchantress.lua b/item_purchase_enchantress.lua index df55cf74..e298a5f8 100644 --- a/item_purchase_enchantress.lua +++ b/item_purchase_enchantress.lua @@ -14,13 +14,13 @@ local ItemsToBuy = "item_null_talisman", "item_boots", "item_magic_wand", --大魔棒7.14 - "item_blades_of_attack", - "item_chainmail", --相位7.21 - "item_hood_of_defiance", --挑战 + "item_robe", + "item_gloves", + --"item_hood_of_defiance", --挑战 "item_dragon_lance", --魔龙枪 + "item_ultimate_scepter", --蓝杖 "item_force_staff", --推推7.14 - "item_crown", --大推推7.20 - "item_ultimate_scepter", --蓝杖 + "item_recipe_hurricane_pike", --大推推7.28 "item_sheepstick", --羊刀 "item_monkey_king_bar" --金箍棒7.14 } diff --git a/item_purchase_enigma.lua b/item_purchase_enigma.lua index d01d2dfa..35bf67a4 100644 --- a/item_purchase_enigma.lua +++ b/item_purchase_enigma.lua @@ -13,6 +13,7 @@ local ItemsToBuy = "item_arcane_boots", --秘法鞋 "item_blink", --跳刀 "item_mekansm", --梅肯 + "item_buckler", "item_recipe_guardian_greaves", --卫士胫甲 "item_black_king_bar", --bkb "item_vitality_booster", diff --git a/item_purchase_furion.lua b/item_purchase_furion.lua index cae15a15..4c3c7cc2 100644 --- a/item_purchase_furion.lua +++ b/item_purchase_furion.lua @@ -9,15 +9,14 @@ local ItemsToBuy = { "item_tango", "item_flask", - "item_orb_of_venom", -- 毒球 - "item_null_talisman", + "item_orb_of_corrosion", "item_null_talisman", "item_phase_boots", --相位7.21 "item_invis_sword", --隐刀 "item_desolator", --黯灭 "item_orchid", --紫苑 "item_black_king_bar", - "item_lesser_crit", + "item_hyperstone", "item_recipe_bloodthorn", --血棘 "item_ultimate_scepter", --蓝杖 "item_ultimate_orb", diff --git a/item_purchase_gyrocopter.lua b/item_purchase_gyrocopter.lua index 5017a702..8f645304 100644 --- a/item_purchase_gyrocopter.lua +++ b/item_purchase_gyrocopter.lua @@ -12,7 +12,7 @@ local ItemsToBuy = "item_wraith_band", --系带 "item_wraith_band", --系带 "item_boots", - "item_magic_wand", --大魔棒7.14 + "item_magic_wand", "item_blades_of_attack", "item_chainmail", --相位7.21 "item_ancient_janggo", --战鼓7.20 diff --git a/item_purchase_hoodwink.lua b/item_purchase_hoodwink.lua index 2d335f6f..e099f621 100644 --- a/item_purchase_hoodwink.lua +++ b/item_purchase_hoodwink.lua @@ -12,7 +12,7 @@ local ItemsToBuy = "item_branches", "item_tranquil_boots", - "item_magic_wand", + "item_recipe_magic_wand", "item_aether_lens", "item_cyclone", diff --git a/item_purchase_jakiro.lua b/item_purchase_jakiro.lua index 641af238..b4a67d49 100644 --- a/item_purchase_jakiro.lua +++ b/item_purchase_jakiro.lua @@ -10,16 +10,18 @@ local ItemsToBuy = "item_ring_of_basilius", "item_tango", "item_clarity", - "item_magic_stick", + "item_magic_stick", "item_arcane_boots", --秘法鞋 "item_force_staff", --推推7.14 + "item_ghost", "item_rod_of_atos", --阿托斯7.20 "item_cyclone", --风杖 "item_ultimate_scepter", --蓝杖 - "item_dragon_lance", - "item_recipe_hurricane_pike", "item_mekansm", - "item_recipe_guardian_greaves" + "item_buckler", + "item_recipe_guardian_greaves", + "item_dragon_lance", + "item_recipe_hurricane_pike", } local Transfered = ItemPurchaseSystem.Transfer(ItemsToBuy) @@ -27,6 +29,6 @@ ItemPurchaseSystem.checkItemBuild(Transfered) --检查装备列表 function ItemPurchaseThink() ItemPurchaseSystem.BuySupportItem() --购买辅助物品 对于辅助英雄保留这一行 - ItemPurchaseSystem.BuyCourier() --购买信使 对于5号位保留这一行 + -- ItemPurchaseSystem.BuyCourier() --购买信使 对于5号位保留这一行 ItemPurchaseSystem.ItemPurchase(Transfered) --购买装备 end diff --git a/item_purchase_juggernaut.lua b/item_purchase_juggernaut.lua index e3e5e97b..c618e12a 100644 --- a/item_purchase_juggernaut.lua +++ b/item_purchase_juggernaut.lua @@ -9,8 +9,6 @@ local ItemsToBuy = "item_tango", "item_tango", "item_quelling_blade", - "item_branches", - "item_branches", "item_wraith_band", "item_magic_wand", --大魔棒7.14 "item_wraith_band", @@ -22,7 +20,7 @@ local ItemsToBuy = "item_recipe_manta", --分身 "item_abyssal_blade", --大晕锤 "item_butterfly", --蝴蝶 - -- "item_ultimate_scepter" + "item_ultimate_scepter_2", } local Transfered = ItemPurchaseSystem.Transfer(ItemsToBuy) diff --git a/item_purchase_keeper_of_the_light.lua b/item_purchase_keeper_of_the_light.lua index 7542b870..8b25031d 100644 --- a/item_purchase_keeper_of_the_light.lua +++ b/item_purchase_keeper_of_the_light.lua @@ -9,14 +9,13 @@ local ItemsToBuy = "item_tango", "item_ring_of_basilius", "item_tango", - -- "item_clarity", "item_wind_lace", "item_boots", - -- "item_magic_stick", + "item_magic_stick", "item_ring_of_regen", --绿鞋 "item_glimmer_cape", --微光 + "item_ghost", --绿杖 "item_force_staff", --推推7.14 - "item_ghost", --绿杖 "item_sheepstick", --羊刀 "item_refresher" } @@ -26,6 +25,6 @@ ItemPurchaseSystem.checkItemBuild(Transfered) --检查装备列表 function ItemPurchaseThink() ItemPurchaseSystem.BuySupportItem() --购买辅助物品 对于辅助英雄保留这一行 - ItemPurchaseSystem.BuyCourier() --购买信使 对于5号位保留这一行 + -- ItemPurchaseSystem.BuyCourier() --购买信使 对于5号位保留这一行 ItemPurchaseSystem.ItemPurchase(Transfered) --购买装备 end diff --git a/item_purchase_kunkka.lua b/item_purchase_kunkka.lua index b51c4eb3..1ab9e486 100644 --- a/item_purchase_kunkka.lua +++ b/item_purchase_kunkka.lua @@ -13,8 +13,9 @@ local ItemsToBuy = "item_phase_boots", --相位7.21 "item_invis_sword", --隐刀 "item_black_king_bar", --bkb - "item_ultimate_scepter", "item_greater_crit", --大炮 + "item_ultimate_scepter", + -- "item_scepter_shard", "item_ultimate_orb", "item_recipe_silver_edge", --大隐刀 "item_assault" diff --git a/item_purchase_legion_commander.lua b/item_purchase_legion_commander.lua index 1a374f97..3b7c0656 100644 --- a/item_purchase_legion_commander.lua +++ b/item_purchase_legion_commander.lua @@ -11,7 +11,7 @@ local ItemsToBuy = "item_flask", "item_quelling_blade", --补刀斧 "item_bracer", - "item_magic_wand", --大魔棒7.14 + "item_magic_wand", "item_phase_boots", --相位7.21 "item_desolator", "item_invis_sword", --隐刀 diff --git a/item_purchase_leshrac.lua b/item_purchase_leshrac.lua index 553f85ff..be4eaf90 100644 --- a/item_purchase_leshrac.lua +++ b/item_purchase_leshrac.lua @@ -6,9 +6,9 @@ local ItemPurchaseSystem = dofile(GetScriptDirectory() .. "/util/ItemPurchaseSys local ItemsToBuy = { + "item_tango", "item_null_talisman", "item_tango", - "item_tango", "item_bottle", "item_magic_wand", --大魔棒7.14 "item_boots", @@ -18,8 +18,9 @@ local ItemsToBuy = "item_cyclone", --风杖 "item_octarine_core", --玲珑心 "item_mekansm", + "item_buckler", "item_recipe_guardian_greaves", - -- "item_ultimate_scepter", + "item_ultimate_scepter", "item_shivas_guard" --希瓦 } diff --git a/item_purchase_lich.lua b/item_purchase_lich.lua index fc8907e6..060cab0d 100644 --- a/item_purchase_lich.lua +++ b/item_purchase_lich.lua @@ -9,18 +9,18 @@ local ItemsToBuy = "item_tango", "item_tango", "item_clarity", - "item_flask", "item_ring_of_basilius", "item_wind_lace", "item_boots", - "item_magic_stick", + "item_magic_wand", "item_ring_of_regen", --绿鞋 "item_urn_of_shadows", + "item_ghost", "item_glimmer_cape", --微光 "item_force_staff", - "item_ultimate_scepter", --蓝杖 "item_lotus_orb", --清莲宝珠 - "item_sheepstick" --羊刀 + "item_sheepstick", --羊刀 + "item_ultimate_scepter", --蓝杖 } local Transfered = ItemPurchaseSystem.Transfer(ItemsToBuy) @@ -28,6 +28,6 @@ ItemPurchaseSystem.checkItemBuild(Transfered) function ItemPurchaseThink() ItemPurchaseSystem.BuySupportItem() - ItemPurchaseSystem.BuyCourier() + -- ItemPurchaseSystem.BuyCourier() ItemPurchaseSystem.ItemPurchase(Transfered) end diff --git a/item_purchase_life_stealer.lua b/item_purchase_life_stealer.lua index 88ca327b..900100ae 100644 --- a/item_purchase_life_stealer.lua +++ b/item_purchase_life_stealer.lua @@ -8,14 +8,18 @@ local ItemsToBuy = { "item_tango", "item_tango", + "item_magic_stick", "item_quelling_blade", --补刀斧 "item_orb_of_venom", "item_phase_boots", --相位7.21 - "item_blight_stoe", - "item_flaffly_hat", + "item_blight_stone", + "item_fluffy_hat", "item_recipe_orb_of_corrosion", - "item_magic_wand", --大魔棒7.14 + "item_branches", + "item_branches", + "item_recipe_magic_wand", --大魔棒7.14 "item_armlet", --臂章 + --"item_scepter_shard", "item_sange_and_yasha", "item_desolator", "item_abyssal_blade", diff --git a/item_purchase_lina.lua b/item_purchase_lina.lua index 26228960..33c465f1 100644 --- a/item_purchase_lina.lua +++ b/item_purchase_lina.lua @@ -9,15 +9,18 @@ local ItemsToBuy = "item_tango", "item_null_talisman", "item_enchanted_mango", - -- "item_null_talisman", "item_bottle", "item_phase_boots", "item_magic_wand", --大魔棒7.14 + "item_witch_blade", "item_cyclone", --风杖 - "item_invis_sword", - "item_black_king_bar", "item_ultimate_scepter", --蓝杖 - "item_shivas_guard" + "item_invis_sword", + "item_black_king_bar", + "item_shivas_guard", + "item_sheepstick", + "item_mystic_staff", + "item_recipe_wind_waker", } local Transfered = ItemPurchaseSystem.Transfer(ItemsToBuy) diff --git a/item_purchase_lion.lua b/item_purchase_lion.lua index c0171cc9..cf633c79 100644 --- a/item_purchase_lion.lua +++ b/item_purchase_lion.lua @@ -9,13 +9,13 @@ local ItemsToBuy = "item_tango", "item_tango", "item_clarity", - "item_flask", "item_ring_of_basilius", "item_wind_lace", "item_boots", - "item_magic_stick", + "item_magic_stick", "item_ring_of_regen", --绿鞋 "item_blink", + "item_ghost", "item_glimmer_cape", --微光 "item_force_staff", "item_ultimate_scepter", --蓝杖 @@ -28,6 +28,6 @@ ItemPurchaseSystem.checkItemBuild(Transfered) function ItemPurchaseThink() ItemPurchaseSystem.BuySupportItem() - ItemPurchaseSystem.BuyCourier() + -- ItemPurchaseSystem.BuyCourier() ItemPurchaseSystem.ItemPurchase(Transfered) end diff --git a/item_purchase_luna.lua b/item_purchase_luna.lua index 5785acc7..0a9948cb 100644 --- a/item_purchase_luna.lua +++ b/item_purchase_luna.lua @@ -9,7 +9,6 @@ local ItemsToBuy = "item_tango", "item_wraith_band", "item_wraith_band", - "item_flask", "item_magic_wand", --大魔棒7.14 "item_power_treads", --假腿7.21 "item_mask_of_madness", --疯狂面具7.06 diff --git a/item_purchase_lycan.lua b/item_purchase_lycan.lua index 66511aef..cd56866a 100644 --- a/item_purchase_lycan.lua +++ b/item_purchase_lycan.lua @@ -17,7 +17,8 @@ local ItemsToBuy = "item_vladmir", --祭品7.21 "item_necronomicon_3", --死灵书 "item_black_king_bar", --bkb - "item_assault" --强袭 + "item_assault", --强袭 + "item_heart", } local Transfered = ItemPurchaseSystem.Transfer(ItemsToBuy) diff --git a/item_purchase_magnataur.lua b/item_purchase_magnataur.lua index 492ce34e..49b84ce7 100644 --- a/item_purchase_magnataur.lua +++ b/item_purchase_magnataur.lua @@ -7,7 +7,6 @@ local ItemPurchaseSystem = dofile(GetScriptDirectory() .. "/util/ItemPurchaseSys local ItemsToBuy = { "item_tango", - "item_flask", "item_quelling_blade", --补刀斧 "item_magic_wand", --大魔棒7.14 "item_bracer", diff --git a/item_purchase_medusa.lua b/item_purchase_medusa.lua index 3b79ca60..5cf185c7 100644 --- a/item_purchase_medusa.lua +++ b/item_purchase_medusa.lua @@ -10,9 +10,8 @@ local ItemsToBuy = "item_wraith_band", --系带 "item_flask", "item_wraith_band", --系带 - "item_magic_wand", --大魔棒7.14 "item_phase_boots", --相位7.21 - "item_magic_wand", --大魔棒7.14 + "item_magic_wand", "item_maelstrom", "item_hurricane_pike", --大推推7.20 "item_manta", diff --git a/item_purchase_mirana.lua b/item_purchase_mirana.lua index 3cfe9279..142c267a 100644 --- a/item_purchase_mirana.lua +++ b/item_purchase_mirana.lua @@ -9,9 +9,10 @@ local ItemsToBuy = "item_tango", "item_wraith_band", --系带 "item_flask", - "item_magic_wand", --大魔棒7.14 + "item_magic_wand", "item_phase_boots", --相位7.21 - "item_magic_wand", --大魔棒7.14 + "item_branches", + "item_branches", "item_maelstrom", "item_hurricane_pike", --大推推7.20 "item_manta", diff --git a/item_purchase_monkey_king.lua b/item_purchase_monkey_king.lua index 6f0e3c05..443c7e50 100644 --- a/item_purchase_monkey_king.lua +++ b/item_purchase_monkey_king.lua @@ -8,10 +8,8 @@ local ItemsToBuy = { "item_tango", "item_quelling_blade", --补刀斧 - "item_flask", "item_orb_of_venom", "item_wraith_band", --系带 - "item_wraith_band", --系带 "item_phase_boots", "item_magic_wand", --大魔棒7.14 "item_maelstrom", diff --git a/item_purchase_naga_siren.lua b/item_purchase_naga_siren.lua index 9358cbb0..1bb452db 100644 --- a/item_purchase_naga_siren.lua +++ b/item_purchase_naga_siren.lua @@ -8,11 +8,12 @@ local ItemPurchaseSystem = dofile(GetScriptDirectory() .. "/util/ItemPurchaseSys local ItemsToBuy = { "item_tango", - "item_magic_stick", + "item_flask", + "item_magic_stick", "item_tranquil_boots", "item_urn_of_shadows", "item_solar_crest", --大勋章7.20 - -- "item_ultimate_scepter", + "item_ultimate_scepter", "item_guardian_greaves", "item_pipe", "item_lotus_orb", --清莲宝珠 @@ -36,7 +37,7 @@ local Transfered = ItemPurchaseSystem.Transfer(ItemsToBuy) ItemPurchaseSystem.checkItemBuild(Transfered) function ItemPurchaseThink() - ItemPurchaseSystem.BuyCourier() + -- ItemPurchaseSystem.BuyCourier() ItemPurchaseSystem.BuySupportItem() ItemPurchaseSystem.ItemPurchase(Transfered) end diff --git a/item_purchase_necrolyte.lua b/item_purchase_necrolyte.lua index b99f6939..eebfcbd9 100644 --- a/item_purchase_necrolyte.lua +++ b/item_purchase_necrolyte.lua @@ -13,14 +13,15 @@ local ItemsToBuy = "item_boots", "item_magic_wand", --大魔棒7.14 "item_veil_of_discord", --纷争7.20 + "item_point_booster", "item_holy_locket", "item_mekansm", --梅肯 + "item_shivas_guard", --希瓦 + "item_bloodthorn", "item_ultimate_scepter", --蓝杖 - "item_point_booster", + "item_buckler", "item_recipe_guardian_greaves", --卫士胫甲 - "item_pipe", --笛子 "item_black_king_bar", --bkb - "item_shivas_guard" --希瓦 } local Transfered = ItemPurchaseSystem.Transfer(ItemsToBuy) diff --git a/item_purchase_nevermore.lua b/item_purchase_nevermore.lua index 29530eca..761aae5e 100644 --- a/item_purchase_nevermore.lua +++ b/item_purchase_nevermore.lua @@ -12,6 +12,7 @@ local ItemsToBuy = "item_flask", "item_magic_wand", --大魔棒7.14 "item_power_treads", --假腿7.21 + "item_desolator", "item_invis_sword", --隐刀 "item_black_king_bar", --bkb "item_sange_and_yasha", diff --git a/item_purchase_night_stalker.lua b/item_purchase_night_stalker.lua index 80807600..5ffc4ebd 100644 --- a/item_purchase_night_stalker.lua +++ b/item_purchase_night_stalker.lua @@ -11,10 +11,10 @@ local ItemsToBuy = "item_quelling_blade", --补刀斧 "item_bracer", "item_phase_boots", --相位7.21 - "item_magic_wand", --大魔棒7.14 - -- "item_ultimate_scepter", + "item_magic_wand", "item_blink", "item_black_king_bar", --bkb + "item_ultimate_scepter", "item_assault", --强袭 "item_heart" } @@ -23,7 +23,7 @@ local Transfered = ItemPurchaseSystem.Transfer(ItemsToBuy) ItemPurchaseSystem.checkItemBuild(Transfered) function ItemPurchaseThink() - ItemPurchaseSystem.BuyCourier() + -- ItemPurchaseSystem.BuyCourier() ItemPurchaseSystem.BuySupportItem() ItemPurchaseSystem.ItemPurchase(Transfered) end diff --git a/item_purchase_nyx_assassin.lua b/item_purchase_nyx_assassin.lua index bd477b24..14bf90a2 100644 --- a/item_purchase_nyx_assassin.lua +++ b/item_purchase_nyx_assassin.lua @@ -10,8 +10,8 @@ local ItemsToBuy = "item_tango", "item_enchanted_mango", "item_flask", - "item_buckler", "item_magic_wand", --大魔棒7.14 + "item_buckler", "item_boots", "item_hand_of_midas", --点金 "item_energy_booster", @@ -23,6 +23,7 @@ local ItemsToBuy = "item_recipe_dagon", "item_force_staff", --推推 "item_mekansm", --梅肯 + "item_buckler", "item_recipe_guardian_greaves", --卫士胫甲 "item_recipe_dagon", "item_recipe_dagon", @@ -35,7 +36,7 @@ local Transfered = ItemPurchaseSystem.Transfer(ItemsToBuy) ItemPurchaseSystem.checkItemBuild(Transfered) function ItemPurchaseThink() - ItemPurchaseSystem.BuyCourier() + -- ItemPurchaseSystem.BuyCourier() ItemPurchaseSystem.BuySupportItem() ItemPurchaseSystem.ItemPurchase(Transfered) end diff --git a/item_purchase_obsidian_destroyer.lua b/item_purchase_obsidian_destroyer.lua index 423b8111..90aacefd 100644 --- a/item_purchase_obsidian_destroyer.lua +++ b/item_purchase_obsidian_destroyer.lua @@ -9,16 +9,16 @@ local ItemsToBuy = { "item_tango", "item_null_talisman", --无用挂件 - "item_null_talisman", "item_power_treads", --假腿7.21 + "item_witch_blade", "item_dragon_lance", --魔龙枪 - "item_force_staff", --推推7.14 - "item_black_king_bar", --bkb "item_orchid", - "item_yasha_and_kaya", + "item_black_king_bar", --bkb + "item_sheepstick", --羊刀 + "item_force_staff", --推推7.14 "item_recipe_hurricane_pike", --大推推7.20 "item_sphere", --林肯 - "item_sheepstick" --羊刀 + "item_ultimate_scepter", } local Transfered = ItemPurchaseSystem.Transfer(ItemsToBuy) diff --git a/item_purchase_ogre_magi.lua b/item_purchase_ogre_magi.lua index 18345f59..0997d467 100644 --- a/item_purchase_ogre_magi.lua +++ b/item_purchase_ogre_magi.lua @@ -11,14 +11,15 @@ local ItemsToBuy = "item_clarity", "item_buckler", "item_boots", - "item_magic_stick", + "item_flask", + "item_hand_of_midas", "item_energy_booster", -- heroes buy a lot of energy boosters because energy booster and boots create an arcane boots so they need to buy more energy booster "item_aether_lens", --以太之镜7.06 + "item_ultimate_scepter", --蓝杖 "item_force_staff", --推推7.14 "item_cyclone", --风杖 - "item_ultimate_scepter", --蓝杖 - "item_lotus_orb" + "item_lotus_orb", } local Transfered = ItemPurchaseSystem.Transfer(ItemsToBuy) @@ -26,6 +27,6 @@ ItemPurchaseSystem.checkItemBuild(Transfered) function ItemPurchaseThink() ItemPurchaseSystem.BuySupportItem() - ItemPurchaseSystem.BuyCourier() + -- ItemPurchaseSystem.BuyCourier() ItemPurchaseSystem.ItemPurchase(Transfered) end diff --git a/item_purchase_omniknight.lua b/item_purchase_omniknight.lua index 401f6d55..8f60457e 100644 --- a/item_purchase_omniknight.lua +++ b/item_purchase_omniknight.lua @@ -17,19 +17,18 @@ local ItemsToBuy = "item_bracer", "item_ancient_janggo", "item_mekansm", --梅肯 + "item_buckler", "item_recipe_guardian_greaves", --卫士胫甲 - "item_vladmir", - "item_pipe", "item_ultimate_scepter", --蓝杖 + "item_force_staff", "item_lotus_orb", --清莲宝珠 - "item_sheepstick" --羊刀 } local Transfered = ItemPurchaseSystem.Transfer(ItemsToBuy) ItemPurchaseSystem.checkItemBuild(Transfered) function ItemPurchaseThink() - ItemPurchaseSystem.BuyCourier() + -- ItemPurchaseSystem.BuyCourier() ItemPurchaseSystem.BuySupportItem() ItemPurchaseSystem.ItemPurchase(Transfered) end diff --git a/item_purchase_oracle.lua b/item_purchase_oracle.lua index fc8907e6..af97d830 100644 --- a/item_purchase_oracle.lua +++ b/item_purchase_oracle.lua @@ -13,9 +13,9 @@ local ItemsToBuy = "item_ring_of_basilius", "item_wind_lace", "item_boots", - "item_magic_stick", "item_ring_of_regen", --绿鞋 "item_urn_of_shadows", + "item_ghost", "item_glimmer_cape", --微光 "item_force_staff", "item_ultimate_scepter", --蓝杖 @@ -28,6 +28,6 @@ ItemPurchaseSystem.checkItemBuild(Transfered) function ItemPurchaseThink() ItemPurchaseSystem.BuySupportItem() - ItemPurchaseSystem.BuyCourier() + -- ItemPurchaseSystem.BuyCourier() ItemPurchaseSystem.ItemPurchase(Transfered) end diff --git a/item_purchase_phantom_assassin.lua b/item_purchase_phantom_assassin.lua index 302f839e..2a125944 100644 --- a/item_purchase_phantom_assassin.lua +++ b/item_purchase_phantom_assassin.lua @@ -12,7 +12,10 @@ local ItemsToBuy = "item_wraith_band", --系带 "item_magic_wand", --大魔棒7.14 "item_phase_boots", --相位7.21 - "item_bfury", + "item_broadsword", + "item_ring_of_health", + "item_claymore", + "item_void_stone", "item_desolator", "item_black_king_bar", --bkb "item_abyssal_blade", --大晕锤 diff --git a/item_purchase_phantom_lancer.lua b/item_purchase_phantom_lancer.lua index 453457be..5211d854 100644 --- a/item_purchase_phantom_lancer.lua +++ b/item_purchase_phantom_lancer.lua @@ -12,7 +12,7 @@ local ItemsToBuy = "item_quelling_blade", --补刀斧 "item_flask", "item_wraith_band", - "item_magic_wand", --大魔棒7.14 + "item_magic_wand", "item_wraith_band", "item_power_treads", --假腿7.21 "item_diffusal_blade", --散失刀 diff --git a/item_purchase_pudge.lua b/item_purchase_pudge.lua index 50ec4269..07f968a0 100644 --- a/item_purchase_pudge.lua +++ b/item_purchase_pudge.lua @@ -9,12 +9,14 @@ local ItemsToBuy = "item_tango", "item_tango", "item_clarity", - "item_flask", + "item_magic_stick", "item_wind_lace", "item_boots", "item_buckler", "item_bracer", - "item_magic_stick", + "item_branches", + "item_branches", + "item_recipe_magic_wand", "item_ring_of_regen", --绿鞋 "item_urn_of_shadows", "item_blade_mail", @@ -29,7 +31,7 @@ local Transfered = ItemPurchaseSystem.Transfer(ItemsToBuy) ItemPurchaseSystem.checkItemBuild(Transfered) function ItemPurchaseThink() - ItemPurchaseSystem.BuyCourier() + -- ItemPurchaseSystem.BuyCourier() ItemPurchaseSystem.BuySupportItem() ItemPurchaseSystem.ItemPurchase(Transfered) end diff --git a/item_purchase_pugna.lua b/item_purchase_pugna.lua index 8d065d79..baff4beb 100644 --- a/item_purchase_pugna.lua +++ b/item_purchase_pugna.lua @@ -10,10 +10,7 @@ local ItemsToBuy = "item_mantle", "item_circlet", "item_mantle", --无用挂件 - "item_branches", - "item_branches", - "item_magic_stick", - "item_recipe_magic_wand", --大魔棒7.14 + "item_magic_wand", "item_boots", "item_recipe_null_talisman", "item_circlet", @@ -21,8 +18,8 @@ local ItemsToBuy = "item_energy_booster", "item_robe", "item_staff_of_wizardry", --慧光 - "item_void_stone", "item_energy_booster", + "item_void_stone", "item_recipe_aether_lens", --以太之镜7.06 "item_point_booster", "item_staff_of_wizardry", diff --git a/item_purchase_queenofpain.lua b/item_purchase_queenofpain.lua index b1bb06d9..f039b324 100644 --- a/item_purchase_queenofpain.lua +++ b/item_purchase_queenofpain.lua @@ -9,11 +9,11 @@ local ItemsToBuy = "item_null_talisman", "item_tango", "item_enchanted_mango", - "item_null_talisman", "item_boots", "item_magic_wand", --大魔棒7.14 "item_belt_of_strength", "item_gloves", --假腿7.21 + "item_witch_blade", "item_veil_of_discord", --纷争7.20 "item_orchid", --紫苑 "item_black_king_bar", --bkb diff --git a/item_purchase_riki.lua b/item_purchase_riki.lua index 1d95839f..34f4a0f4 100644 --- a/item_purchase_riki.lua +++ b/item_purchase_riki.lua @@ -10,10 +10,10 @@ local ItemsToBuy = "item_tango", "item_orb_of_venom", "item_magic_wand", --大魔棒7.14 - "item_phase_boots", + "item_power_treads", "item_diffusal_blade", --散失刀 "item_sange_and_yasha", --双刀 - "item_echo_sabre", --连击刀 + "item_mage_slayer", "item_black_king_bar", --bkb "item_abyssal_blade" --大晕锤 } @@ -22,7 +22,7 @@ local Transfered = ItemPurchaseSystem.Transfer(ItemsToBuy) ItemPurchaseSystem.checkItemBuild(Transfered) function ItemPurchaseThink() - ItemPurchaseSystem.BuyCourier() + -- ItemPurchaseSystem.BuyCourier() ItemPurchaseSystem.BuySupportItem() ItemPurchaseSystem.ItemPurchase(Transfered) end diff --git a/item_purchase_sand_king.lua b/item_purchase_sand_king.lua index 61e8363e..5f946a1f 100644 --- a/item_purchase_sand_king.lua +++ b/item_purchase_sand_king.lua @@ -7,7 +7,6 @@ local ItemPurchaseSystem = dofile(GetScriptDirectory() .. "/util/ItemPurchaseSys local ItemsToBuy = { "item_tango", - "item_flask", "item_quelling_blade", --补刀斧 "item_enchanted_mango", "item_bracer", @@ -24,7 +23,7 @@ local Transfered = ItemPurchaseSystem.Transfer(ItemsToBuy) ItemPurchaseSystem.checkItemBuild(Transfered) function ItemPurchaseThink() - ItemPurchaseSystem.BuyCourier() + -- ItemPurchaseSystem.BuyCourier() ItemPurchaseSystem.BuySupportItem() ItemPurchaseSystem.ItemPurchase(Transfered) end diff --git a/item_purchase_shadow_demon.lua b/item_purchase_shadow_demon.lua index e4aff23a..4a9ad0ce 100644 --- a/item_purchase_shadow_demon.lua +++ b/item_purchase_shadow_demon.lua @@ -10,11 +10,10 @@ local ItemsToBuy = "item_tango", "item_tango", "item_clarity", - "item_flask", + "item_magic_stick", "item_ring_of_basilius", "item_wind_lace", "item_boots", - "item_magic_stick", "item_ring_of_regen", --绿鞋 "item_glimmer_cape", --微光 "item_force_staff", @@ -28,6 +27,6 @@ ItemPurchaseSystem.checkItemBuild(Transfered) function ItemPurchaseThink() ItemPurchaseSystem.BuySupportItem() - ItemPurchaseSystem.BuyCourier() + -- ItemPurchaseSystem.BuyCourier() ItemPurchaseSystem.ItemPurchase(Transfered) end diff --git a/item_purchase_shadow_shaman.lua b/item_purchase_shadow_shaman.lua index 63692a06..5bca48de 100644 --- a/item_purchase_shadow_shaman.lua +++ b/item_purchase_shadow_shaman.lua @@ -9,11 +9,12 @@ local ItemsToBuy = "item_tango", "item_tango", "item_clarity", - "item_flask", + "item_magic_stick", "item_ring_of_basilius", "item_arcane_boots", "item_blink", "item_glimmer_cape", --微光 + "item_ghost", "item_force_staff", "item_ultimate_scepter", --蓝杖 "item_lotus_orb", --清莲宝珠 @@ -25,6 +26,6 @@ ItemPurchaseSystem.checkItemBuild(Transfered) function ItemPurchaseThink() ItemPurchaseSystem.BuySupportItem() - ItemPurchaseSystem.BuyCourier() + -- ItemPurchaseSystem.BuyCourier() ItemPurchaseSystem.ItemPurchase(Transfered) end diff --git a/item_purchase_shredder.lua b/item_purchase_shredder.lua index 961665fe..0f36da95 100644 --- a/item_purchase_shredder.lua +++ b/item_purchase_shredder.lua @@ -8,10 +8,9 @@ local ItemPurchaseSystem = dofile(GetScriptDirectory() .. "/util/ItemPurchaseSys local ItemsToBuy = { "item_tango", - "item_flask", + "item_flask", "item_quelling_blade", --补刀斧 - "item_soul_ring", - "item_magic_wand", --大魔棒7.14 + "item_magic_wand", "item_arcane_boots", --秘法鞋 "item_bloodstone", "item_pipe", --笛子 diff --git a/item_purchase_silencer.lua b/item_purchase_silencer.lua index b3bd4acb..aec1e1e9 100644 --- a/item_purchase_silencer.lua +++ b/item_purchase_silencer.lua @@ -9,21 +9,25 @@ local ItemsToBuy = "item_tango", "item_tango", "item_null_talisman", - "item_magic_stick", + "item_magic_stick", "item_power_treads", --假腿7.21 + "item_witch_blade", "item_hurricane_pike", --大推推7.20 "item_rod_of_atos", --阿托斯7.20 "item_orchid", - "item_bloodthorn", + "item_hyperstone", + "item_recipe_bloodthorn", + "item_sheepstick", --羊刀 + "item_maelstrom", + "item_recipe_gleipnir", "item_ultimate_scepter", --蓝杖 - "item_sheepstick" --羊刀 } local Transfered = ItemPurchaseSystem.Transfer(ItemsToBuy) ItemPurchaseSystem.checkItemBuild(Transfered) function ItemPurchaseThink() - ItemPurchaseSystem.BuyCourier() --购买信使 + -- ItemPurchaseSystem.BuyCourier() --购买信使 ItemPurchaseSystem.BuySupportItem() ItemPurchaseSystem.ItemPurchase(Transfered) end diff --git a/item_purchase_skeleton_king.lua b/item_purchase_skeleton_king.lua index e7bee40f..0165f3a2 100644 --- a/item_purchase_skeleton_king.lua +++ b/item_purchase_skeleton_king.lua @@ -7,16 +7,19 @@ local ItemPurchaseSystem = dofile(GetScriptDirectory() .. "/util/ItemPurchaseSys local ItemsToBuy = { "item_tango", - "item_flask", "item_quelling_blade", --补刀斧 + "item_bracer", "item_magic_wand", --大魔棒7.14 - "item_power_treads", --假腿7.21 - "item_echo_sabre", --连击刀 - "item_blink", - "item_blade_mail", --刃甲 + "item_gloves", + "item_boots", + "item_recipe_hand_of_midas", + "item_belt_of_strength", + "item_gloves", + "item_radiance", "item_black_king_bar", --bkb + "item_blink", "item_assault", --强袭 - "item_ultimate_scepter" --蓝杖 + "item_ultimate_scepter", --蓝杖 } local Transfered = ItemPurchaseSystem.Transfer(ItemsToBuy) diff --git a/item_purchase_skywrath_mage.lua b/item_purchase_skywrath_mage.lua index 654efb67..7df4c974 100644 --- a/item_purchase_skywrath_mage.lua +++ b/item_purchase_skywrath_mage.lua @@ -11,21 +11,24 @@ local ItemsToBuy = "item_tango", "item_enchanted_mango", "item_enchanted_mango", - "item_null_talisman", - "item_null_talisman", + "item_magic_wand", + "item_boots", + "item_energy_booster", + "item_witch_blade", + "item_kaya", "item_aether_lens", "item_rod_of_atos", --阿托斯7.20 "item_force_staff", "item_ultimate_scepter", --蓝杖 - "item_yasha_and_kaya", - "item_sheepsrick" --羊刀 + "item_sheepstick", --羊刀 + "item_yasha", } local Transfered = ItemPurchaseSystem.Transfer(ItemsToBuy) ItemPurchaseSystem.checkItemBuild(Transfered) function ItemPurchaseThink() - ItemPurchaseSystem.BuyCourier() + -- ItemPurchaseSystem.BuyCourier() ItemPurchaseSystem.BuySupportItem() ItemPurchaseSystem.ItemPurchase(Transfered) end diff --git a/item_purchase_slardar.lua b/item_purchase_slardar.lua index 953c686a..7cf10044 100644 --- a/item_purchase_slardar.lua +++ b/item_purchase_slardar.lua @@ -10,7 +10,7 @@ local ItemsToBuy = "item_flask", "item_quelling_blade", "item_bracer", - "item_magic_wand", --大魔棒7.14 + "item_magic_wand", "item_power_treads", "item_blink", --跳刀 "item_echo_sabre", --连击刀 @@ -24,6 +24,6 @@ ItemPurchaseSystem.checkItemBuild(Transfered) function ItemPurchaseThink() ItemPurchaseSystem.ItemPurchase(Transfered) - ItemPurchaseSystem.BuyCourier() + -- ItemPurchaseSystem.BuyCourier() ItemPurchaseSystem.BuySupportItem() end diff --git a/item_purchase_slark.lua b/item_purchase_slark.lua index 2cb82152..2a8f7804 100644 --- a/item_purchase_slark.lua +++ b/item_purchase_slark.lua @@ -12,10 +12,10 @@ local ItemsToBuy = "item_orb_of_venom", "item_wraith_band", "item_power_treads", --假腿7.21 - "item_blight_stoe", - "item_flaffly_hat", + "item_blight_stone", + "item_fluffy_hat", "item_recipe_orb_of_corrosion", - "item_magic_wand", --大魔棒7.14 + "item_magic_wand", "item_skadi", "item_black_king_bar", --bkb "item_diffusal_blade", --散失 diff --git a/item_purchase_spectre.lua b/item_purchase_spectre.lua index 1862580d..ef2a7b37 100644 --- a/item_purchase_spectre.lua +++ b/item_purchase_spectre.lua @@ -9,16 +9,16 @@ local ItemsToBuy = "item_tango", "item_tango", "item_quelling_blade", --补刀斧 - "item_flask", "item_wraith_band", --系带 - "item_magic_stick", + "item_flask", "item_phase_boots", "item_radiance", "item_manta", --分身 "item_diffusal_blade", --散失刀 "item_heart", --龙心7.20 - "item_black_king_bar", - "item_butterfly" + -- "item_black_king_bar", + "item_butterfly", + "item_ultimate_scepter_2", } local Transfered = ItemPurchaseSystem.Transfer(ItemsToBuy) diff --git a/item_purchase_spirit_breaker.lua b/item_purchase_spirit_breaker.lua index 819711df..8bbf4fb2 100644 --- a/item_purchase_spirit_breaker.lua +++ b/item_purchase_spirit_breaker.lua @@ -9,7 +9,6 @@ local ItemsToBuy = "item_tango", "item_orb_of_venom", "item_tango", - "item_flask", "item_magic_wand", --大魔棒7.14 "item_bracer", "item_bracer", @@ -26,7 +25,7 @@ local Transfered = ItemPurchaseSystem.Transfer(ItemsToBuy) ItemPurchaseSystem.checkItemBuild(Transfered) function ItemPurchaseThink() - ItemPurchaseSystem.BuyCourier() + -- ItemPurchaseSystem.BuyCourier() ItemPurchaseSystem.BuySupportItem() ItemPurchaseSystem.ItemPurchase(Transfered) end diff --git a/item_purchase_sven.lua b/item_purchase_sven.lua index afca05ae..cb44b48f 100644 --- a/item_purchase_sven.lua +++ b/item_purchase_sven.lua @@ -7,7 +7,6 @@ local ItemPurchaseSystem = dofile(GetScriptDirectory() .. "/util/ItemPurchaseSys local ItemsToBuy = { "item_tango", - "item_flask", "item_magic_wand", --大魔棒7.14 "item_bracer", "item_phase_boots", diff --git a/item_purchase_templar_assassin.lua b/item_purchase_templar_assassin.lua index 177d4bee..3c1fba1f 100644 --- a/item_purchase_templar_assassin.lua +++ b/item_purchase_templar_assassin.lua @@ -11,14 +11,12 @@ local ItemsToBuy = "item_wraith_band", --系带 "item_flask", "item_power_treads", --假腿7.21 - "item_wraith_band", --系带 - "item_magic_wand", --大魔棒7.14 + "item_magic_wand", "item_desolator", --黯灭 "item_black_king_bar", --bkb "item_orchid", - "item_assault", "item_butterfly", --蝴蝶 - "item_lesser_crit", + "item_hyperstone", "item_recipe_bloodthorn" --血棘 } diff --git a/item_purchase_tidehunter.lua b/item_purchase_tidehunter.lua index 5c22b07f..242e3aec 100644 --- a/item_purchase_tidehunter.lua +++ b/item_purchase_tidehunter.lua @@ -13,7 +13,7 @@ local ItemsToBuy = "item_enchanted_mango", "item_soul_ring", "item_phase_boots", - "item_magic_wand", --大魔棒7.14 + "item_magic_wand", "item_vladmir", "item_medallion_of_courage", "item_pipe", diff --git a/item_purchase_tiny.lua b/item_purchase_tiny.lua index d88b65b6..5af7410d 100644 --- a/item_purchase_tiny.lua +++ b/item_purchase_tiny.lua @@ -19,7 +19,7 @@ local ItemsToBuy = "item_echo_sabre", --连击刀 "item_black_king_bar", --bkb "item_assault", --强袭 - -- "item_ultimate_scepter" + "item_ultimate_scepter" } local Transfered = ItemPurchaseSystem.Transfer(ItemsToBuy) diff --git a/item_purchase_treant.lua b/item_purchase_treant.lua index 9ee3a1f9..e0b4d512 100644 --- a/item_purchase_treant.lua +++ b/item_purchase_treant.lua @@ -10,7 +10,7 @@ local ItemsToBuy = "item_buckler", "item_tango", "item_enchanted_mango", - "item_magic_stick", + "item_magic_stick", "item_bracer", "item_arcane_boots", --秘法鞋 "item_medallion_of_courage", --勋章 @@ -34,7 +34,7 @@ local Transfered = ItemPurchaseSystem.Transfer(ItemsToBuy) ItemPurchaseSystem.checkItemBuild(Transfered) function ItemPurchaseThink() - ItemPurchaseSystem.BuyCourier() + -- ItemPurchaseSystem.BuyCourier() ItemPurchaseSystem.BuySupportItem() ItemPurchaseSystem.ItemPurchase(Transfered) end diff --git a/item_purchase_troll_warlord.lua b/item_purchase_troll_warlord.lua index d1b301ae..12acfbb1 100644 --- a/item_purchase_troll_warlord.lua +++ b/item_purchase_troll_warlord.lua @@ -9,14 +9,17 @@ local ItemsToBuy = { "item_tango", "item_tango", - "item_flask", "item_quelling_blade", "item_wraith_band", "item_wraith_band", - "item_magic_wand", --大魔棒7.14 + "item_magic_wand", "item_phase_boots", --相位7.21 - "item_diffusal_blade", --散失刀 + "item_broadsword", + "item_ring_of_health", + "item_claymore", + "item_void_stone", "item_sange_and_yasha", --双刀 + "item_diffusal_blade", --散失刀 "item_black_king_bar", --bkb "item_butterfly", "item_demon_edge", diff --git a/item_purchase_tusk.lua b/item_purchase_tusk.lua index 15db0aad..436bdee3 100644 --- a/item_purchase_tusk.lua +++ b/item_purchase_tusk.lua @@ -11,10 +11,9 @@ local ItemsToBuy = "item_buckler", "item_tango", "item_enchanted_mango", - "item_enchanted_mango", "item_bracer", "item_phase_boots", - "item_magic_stick", + "item_magic_stick", "item_invis_sword", --隐刀 "item_solar_crest", "item_black_king_bar", --bkb @@ -27,7 +26,7 @@ local Transfered = ItemPurchaseSystem.Transfer(ItemsToBuy) ItemPurchaseSystem.checkItemBuild(Transfered) function ItemPurchaseThink() - ItemPurchaseSystem.BuyCourier() + -- ItemPurchaseSystem.BuyCourier() ItemPurchaseSystem.ItemPurchase(Transfered) ItemPurchaseSystem.BuySupportItem() end diff --git a/item_purchase_undying.lua b/item_purchase_undying.lua index f3b2cd8e..89dc0b53 100644 --- a/item_purchase_undying.lua +++ b/item_purchase_undying.lua @@ -8,12 +8,10 @@ local ItemsToBuy = { "item_tango", "item_tango", - "item_flask", "item_enchanted_mango", - "item_enchanted_mango", - "item_buckler", - "item_boots", "item_magic_wand", --大魔棒7.14 + "item_boots", + "item_buckler", "item_energy_booster", "item_blade_mail", --刃甲 "item_mekansm", --梅肯 @@ -28,7 +26,7 @@ local Transfered = ItemPurchaseSystem.Transfer(ItemsToBuy) ItemPurchaseSystem.checkItemBuild(Transfered) function ItemPurchaseThink() - ItemPurchaseSystem.BuyCourier() + -- ItemPurchaseSystem.BuyCourier() ItemPurchaseSystem.ItemPurchase(Transfered) ItemPurchaseSystem.BuySupportItem() end diff --git a/item_purchase_ursa.lua b/item_purchase_ursa.lua index ba048074..d0b6bb5d 100644 --- a/item_purchase_ursa.lua +++ b/item_purchase_ursa.lua @@ -14,8 +14,8 @@ local ItemsToBuy = "item_magic_wand", --大魔棒7.14 "item_blades_of_attack", "item_chainmail", --相位7.21 - "item_blight_stoe", - "item_flaffly_hat", + "item_blight_stone", + "item_fluffy_hat", "item_recipe_orb_of_corrosion", "item_vladmir", --祭品7.21 "item_blink", --跳刀 diff --git a/item_purchase_vengefulspirit.lua b/item_purchase_vengefulspirit.lua index c3486b2b..50003bd4 100644 --- a/item_purchase_vengefulspirit.lua +++ b/item_purchase_vengefulspirit.lua @@ -7,10 +7,9 @@ local ItemPurchaseSystem = dofile(GetScriptDirectory() .. "/util/ItemPurchaseSys local ItemsToBuy = { "item_tango", - "item_flask", "item_clarity", "item_ring_of_basilius", - "item_magic_stick", + "item_magic_stick", "item_power_treads", --假腿7.21 "item_medallion_of_courage", --勋章 "item_force_staff", --推推7.14 @@ -29,6 +28,6 @@ ItemPurchaseSystem.checkItemBuild(Transfered) function ItemPurchaseThink() ItemPurchaseSystem.BuySupportItem() - ItemPurchaseSystem.BuyCourier() + -- ItemPurchaseSystem.BuyCourier() ItemPurchaseSystem.ItemPurchase(Transfered) end diff --git a/item_purchase_venomancer.lua b/item_purchase_venomancer.lua index 3541e0bb..c5ef5d08 100644 --- a/item_purchase_venomancer.lua +++ b/item_purchase_venomancer.lua @@ -9,14 +9,17 @@ local ItemsToBuy = "item_wraith_band", --系带 "item_tango", "item_tango", - "item_flask", + "item_magic_stick", "item_wraith_band", --系带 "item_boots", - "item_magic_stick", + "item_branches", + "item_branches", + "item_recipe_magic_wand", "item_energy_booster", "item_veil_of_discord", --纷争7.20 "item_hurricane_pike", --大推推7.20 "item_mekansm", --梅肯 + "item_buckler", "item_recipe_guardian_greaves", --卫士胫甲 "item_ultimate_scepter", --蓝杖 "item_black_king_bar", @@ -27,7 +30,7 @@ local Transfered = ItemPurchaseSystem.Transfer(ItemsToBuy) ItemPurchaseSystem.checkItemBuild(Transfered) function ItemPurchaseThink() - ItemPurchaseSystem.BuyCourier() + -- ItemPurchaseSystem.BuyCourier() ItemPurchaseSystem.BuySupportItem() ItemPurchaseSystem.ItemPurchase(Transfered) end diff --git a/item_purchase_viper.lua b/item_purchase_viper.lua index 40eb00e9..13343aaf 100644 --- a/item_purchase_viper.lua +++ b/item_purchase_viper.lua @@ -14,7 +14,7 @@ local ItemsToBuy = "item_maelstrom", "item_hurricane_pike", --大推推7.20 "item_black_king_bar", --bkb - -- "item_ultimate_scepter", + "item_ultimate_scepter", "item_manta", --分身斧 "item_heart", --龙心7.20 "item_hyperstone", diff --git a/item_purchase_warlock.lua b/item_purchase_warlock.lua index 226dcc00..98bb597f 100644 --- a/item_purchase_warlock.lua +++ b/item_purchase_warlock.lua @@ -11,7 +11,7 @@ local ItemsToBuy = "item_branches", "item_branches", "item_boots", - "item_magic_stick", + "item_magic_stick", "item_recipe_magic_wand", --大魔棒7.14 "item_energy_booster", "item_cloak", @@ -19,24 +19,28 @@ local ItemsToBuy = "item_ring_of_regen", "item_staff_of_wizardry", "item_recipe_force_staff", --推推7.14 - "item_point_booster", - "item_staff_of_wizardry", - "item_ogre_axe", - "item_blade_of_alacrity", --蓝杖 - "item_ring_of_health", - "item_void_stone", - "item_ring_of_health", - "item_void_stone", - "item_recipe_refresher", --刷新球 - "item_mystic_staff", - "item_ultimate_orb", - "item_void_stone" --羊刀 + "item_ghost", + "item_ultimate_scepter", + "item_refresher", + "item_sheepstick", + --"item_point_booster", + --"item_staff_of_wizardry", + --"item_ogre_axe", + --"item_blade_of_alacrity", --蓝杖 + --"item_ring_of_health", + --"item_void_stone", + --"item_ring_of_health", + --"item_void_stone", + --"item_recipe_refresher", --刷新球 + --"item_mystic_staff", + --"item_ultimate_orb", + --"item_void_stone" --羊刀 } ItemPurchaseSystem.checkItemBuild(ItemsToBuy) function ItemPurchaseThink() ItemPurchaseSystem.BuySupportItem() - ItemPurchaseSystem.BuyCourier() + -- ItemPurchaseSystem.BuyCourier() ItemPurchaseSystem.ItemPurchase(ItemsToBuy) end diff --git a/item_purchase_weaver.lua b/item_purchase_weaver.lua index c48adefb..7df70ae1 100644 --- a/item_purchase_weaver.lua +++ b/item_purchase_weaver.lua @@ -12,7 +12,7 @@ local ItemsToBuy = "item_tango", "item_flask", "item_wraith_band", --系带 - "item_magic_wand", --大魔棒7.14 + "item_magic_wand", "item_power_treads", --假腿7.21 "item_desolator", "item_greater_crit", diff --git a/item_purchase_windrunner.lua b/item_purchase_windrunner.lua index 0434dd21..4927d9c1 100644 --- a/item_purchase_windrunner.lua +++ b/item_purchase_windrunner.lua @@ -9,8 +9,7 @@ local ItemsToBuy = "item_tango", "item_null_talisman", "item_tango", - "item_flask", - "item_magic_stick", + "item_magic_wand", "item_boots", "item_javelin", "item_blades_of_attack", diff --git a/item_purchase_winter_wyvern.lua b/item_purchase_winter_wyvern.lua index 9a586ad1..b3987f8c 100644 --- a/item_purchase_winter_wyvern.lua +++ b/item_purchase_winter_wyvern.lua @@ -9,11 +9,10 @@ local ItemsToBuy = "item_tango", "item_tango", "item_clarity", - "item_flask", + "item_magic_stick", "item_buckler", "item_wind_lace", "item_boots", - "item_magic_stick", "item_ring_of_regen", --绿鞋 "item_soul_ring", "item_urn_of_shadows", @@ -29,6 +28,6 @@ ItemPurchaseSystem.checkItemBuild(Transfered) function ItemPurchaseThink() ItemPurchaseSystem.BuySupportItem() - ItemPurchaseSystem.BuyCourier() + -- ItemPurchaseSystem.BuyCourier() ItemPurchaseSystem.ItemPurchase(Transfered) end diff --git a/item_purchase_witch_doctor.lua b/item_purchase_witch_doctor.lua index 257c62df..bf4762df 100644 --- a/item_purchase_witch_doctor.lua +++ b/item_purchase_witch_doctor.lua @@ -9,12 +9,13 @@ local ItemsToBuy = "item_tango", "item_tango", "item_clarity", - "item_flask", - "item_buckler", + "item_magic_stick", + "item_bracer", "item_boots", - "item_magic_stick", "item_energy_booster", "item_urn_of_shadows", + "item_buckler", + "item_ghost", "item_glimmer_cape", --微光 "item_force_staff", "item_ultimate_scepter", --蓝杖 @@ -27,6 +28,6 @@ ItemPurchaseSystem.checkItemBuild(Transfered) function ItemPurchaseThink() ItemPurchaseSystem.BuySupportItem() - ItemPurchaseSystem.BuyCourier() + -- ItemPurchaseSystem.BuyCourier() ItemPurchaseSystem.ItemPurchase(Transfered) end diff --git a/item_purchase_zuus.lua b/item_purchase_zuus.lua index 67d53dce..d25c1992 100644 --- a/item_purchase_zuus.lua +++ b/item_purchase_zuus.lua @@ -11,10 +11,7 @@ local ItemsToBuy = "item_clarity", "item_bottle", "item_boots", - "item_magic_stick", - "item_branches", - "item_branches", - "item_recipe_magic_wand", --大魔棒7.14 + "item_magic_wand", --大魔棒7.14 "item_null_talisman", "item_energy_booster", "item_veil_of_discord", --纷争 diff --git a/util/AbilityAbstraction.lua b/util/AbilityAbstraction.lua new file mode 100644 index 00000000..ee261f53 --- /dev/null +++ b/util/AbilityAbstraction.lua @@ -0,0 +1,405 @@ +local M = {} + +local binlib = require(GetScriptDirectory().."/util/BinDecHex") + +M.Contains = function(self, tb, value) + for _, v in pairs(tb) do + if v == value then + return true + end + end + return false +end + +M.Filter = function(self, tb, filter) + local g = {} + for k, v in pairs(tb) do + if filter(v) then + g[k] = v + end + end + return g +end +M.FilterNot = function(self, tb, filter) + local g = {} + for k, v in pairs(tb) do + if not filter(v) then + g[k] = v + end + end + return g +end + +M.Map = function(self, tb, transform) + local g = {} + for k,v in pairs(tb) do + g[k] = transform(v) + end + return g +end + +M.ForEach = function(self, tb, action) + for _, v in pairs(tb) do + action(v) + end +end + +M.ShallowCopy = function(self, tb) + local g = {} + for k, v in pairs(tb) do + g[k] = v + end + return g +end + +local function deepCopy(self, tb) + local copiedTables = {} + local g = {} + table.insert(copiedTables, tb) + for k, v in pairs(tb) do + if type(v) ~= "table" then + g[k] = v + else + if self:Contains(copiedTables, v) then + print("Copy loop!") + return {} + end + g[k] = deepCopy(self, v) + end + end + return g +end +M.DeepCopy = deepCopy + +M.Concat = function(self, a, b) + if type(a) ~= "table" or type(b) ~= "table" then + return a..b + end + local g = self:ShallowCopy(a) + local f = #a + for k, v in ipairs(b) do + g[k+f] = v + end + return g +end + +M.Prepend = function(self, a, b) + return self:Concat(b, a) +end + + + +M.SeriouslyRetreatingStunSomeone = function(self, npcBot, abilityIndex, ability, targetType) + if not ability:IsFullyCastable() then + return BOT_ACTION_DESIRE_NONE, 0 + end + + local CastRange = ability:GetCastRange() + local Damage = ability:GetAbilityDamage() + local Radius = ability:GetAOERadius() + 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) + + if ( npcBot:GetActiveMode() == BOT_MODE_RETREAT and npcBot:GetActiveModeDesire() >= BOT_MODE_DESIRE_HIGH ) then + for _,npcEnemy in pairs( enemys ) + do + if ( npcBot:WasRecentlyDamagedByHero( npcEnemy, 2.0 ) ) + then + if ( CanCast[abilityNumber]( npcEnemy ) ) + then + return BOT_ACTION_DESIRE_LOW, npcEnemy:GetExtrapolatedLocation(CastPoint) + end + end + end + end +end + +local Trim = function(v, left, right) + if right >= left then + if v > right then + return right + elseif v < left then + return left + else + return v + end + else + if v > left then + return left + elseif v < right then + return right + else + return v + end + end +end + +M.TrimDesire = function(self, desire) + return Trim(desire, 0, 1) +end + +M.GetAbilityImportance = function(self, cooldown) + return Trim(cooldown/120, 0, 1) +end + +M.IsFarmingOrPushing = function(self, npcBot) + local mode = npcBot:GetActiveMode() + return mode==BOT_MODE_FARM or mode==BOT_MODE_PUSH_TOWER_BOT or mode==BOT_MODE_PUSH_TOWER_MID or mode==BOT_MODE_PUSH_TOWER_TOP +end + +M.IsAttackingEnemies = function(self, npcBot) + local mode = npcBot:GetActiveMode() + return mode == BOT_MODE_ROAM or mode == BOT_MODE_TEAM_ROAM or mode == BOT_MODE_ATTACK or mode == BOT_MODE_DEFEND_ALLY +end + +M.HasEnoughManaToUseAttackAttachedAbility = function(self, npcBot, ability) + local percent = self:GetManaPercent(npcBot) + if percent >= 0.8 and npcBot:GetMana() >= 650 then + return true + end + return percent >= 0.4 and npcBot:GetMana() >= 300 and npcBot:GetManaRegen() >= npcBot:GetAttacksPerSecond() * ability:GetManaCost() * 0.75 +end + +-- turn a function that returns true, false, nil to a function that decides whether to toggle the ability or not +M.ToggleFunctionToAction = function(self, npcBot, oldConsider, ability) + return function() + local value = oldConsider() + if value == nil or value == ability:GetToggleState() then + return 0 + else + return BOT_ACTION_DESIRE_HIGH + end + end +end + +local GetOtherTeam = function(team) + if team == TEAM_RADIANT then + return TEAM_DIRE + end + if team == TEAM_DIRE then + return TEAM_RADIANT + end +end + +M.RadiantPlayerId = GetTeamPlayers(TEAM_RADIANT) +M.DirePlayerId = GetTeamPlayers(TEAM_DIRE) + +M.GetTeamPlayers = function(self, team) + if team == TEAM_RADIANT then + return self.RadiantPlayerId + else + return self.DirePlayerId + end +end + +M.MustBeIllusion = function(self, npcBot, target) + if npcBot:GetTeam() == target:GetTeam() then + return target:IsIllusion() + end + if self:Contains(self:GetTeamPlayers(npcBot:GetTeam()), target:GetPlayerID()) then + return true + end + return false +end +M.MayNotBeIllusion = function(self, npcBot, target) return not self:MustBeIllusion(npcBot, target) end + +M.IgnoreAbilityBlockAbilities = { + "dark_seer_ion_shell", + "grimstroke_soulbind", + "rubick_spell_steal", + "spectre_spectral_dagger", + "morphling_morph", + "batrider_flaming_lasso", + "urn_of_shadows_soul_release", + "spirit_vessel_soul_release", + "medallion_of_courage_valor", + "solar_crest_armor_shine", +} + +M.DebugTable = function(self, tb) + local msg = "{ " + local DebugRec + DebugRec = function(tb) + for k,v in pairs(tb) do + if type(v) == "number" or type(v) == "string" then + msg = msg..k.." = "..v + msg = msg..", " + end + if type(v) == "table" then + msg = msg..k.." = ".."{ " + DebugRec(v) + msg = msg.."}, " + end + end + end + DebugRec(tb) + msg = msg.." }" + print(msg) +end + +M.IsVector = function(self, object) + return type(object)=="userdata" and type(object.x)=="number" and type(object.y)=="number" and type(object.z)=="number" and type(object.Length) == "function" +end +M.ToStringVector = function(self, object) + return string.format("(%d,%d,%d)",object.x,object.y,object.z) +end + +M.PreventAbilityAtIllusion = function(self, npcBot, oldConsiderFunction, ability) + return function() + local desire, target, targetTypeString = oldConsiderFunction() + if desire == 0 or target == nil or target == 0 or self:IsVector(target) or targetTypeString == "Location" then + return desire, target, targetTypeString + end + if self:MustBeIllusion(npcBot, target) then + return 0 + end + return desire, target, targetTypeString + end +end + +M.PreventEnemyTargetAbilityUsageAtAbilityBlock = function(self, npcBot, oldConsiderFunction, ability) + local newConsider = function() + -- TODO: do we consider the base cooldown or the modified cooldown (arcane rune, octarine orb)? Will you crack a sphere's spell block with an ultimate ability when you're on arcane rune? + local desire, target, targetTypeString = oldConsiderFunction() + if desire == 0 or target == nil or target == 0 or self:IsVector(target) or targetTypeString == "Location" then + if self:IsVector(target) then + print("npcBot "..npcBot:GetUnitName().." lands target ability "..ability:GetName().." at location "..self:ToStringVector(target)) + end + return desire, target, targetTypeString + end + local oldDesire = desire + if npcBot:GetTeam() ~= target:GetTeam() then -- some ability can cast to both allies and enemies (abbadon_mist_coil, etc) + local cooldown = ability:GetCooldown() + local abilityImportance = self:GetAbilityImportance(cooldown) + + if target:HasModifier("modifier_antimage_counterspell") then + return 0 + end + if target:HasModifier "modifier_item_sphere" or target:HasModifier("modifier_roshan_spell_block") or target:HasModifier("modifier_special_bonus_spell_block") then -- qop lv 25 + if cooldown >= 30 then + desire = desire - abilityImportance + elseif cooldown <= 20 then + desire = desire + abilityImportance + end + end + if target:HasModifier("modifier_item_sphere_target") then + if cooldown >= 30 then + desire = desire - abilityImportance + 0.1 + elseif cooldown <= 20 then + desire = desire + abilityImportance + if abilityImportance > 0.1 then + desire = desire - 0.1 + end + end + end + if target:HasModifier("modifier_item_lotus_orb_active") then + desire = desire - abilityImportance/2 + end + if target:HasModifier("modifier_mirror_shield_delay") then + desire = desire - abilityImportance*1.5 + end + + desire = self:TrimDesire(desire) + end + if desire ~= oldDesire then + print("desire modified from "..oldDesire.." to "..desire) + end + return desire, target, targetTypeString + end + return newConsider +end + +M.AutoModifyConsiderFunction = function(self, npcBot, considers, abilitiesReal) + for index, ability in pairs(abilitiesReal) do + if not binlib.Test(ability:GetBehavior(), ABILITY_BEHAVIOR_PASSIVE) and considers[index] == nil then + print("Missing consider function "..ability:GetName()) + elseif binlib.Test(ability:GetTargetTeam(), ABILITY_TARGET_TEAM_ENEMY) and binlib.Test(ability:GetTargetType(), binlib.Or(ABILITY_TARGET_TYPE_HERO, ABILITY_TARGET_TYPE_CREEP, ABILITY_TARGET_TYPE_BUILDING)) and binlib.Test(ability:GetBehavior(), ABILITY_BEHAVIOR_UNIT_TARGET) then + print("Modify ability to prevent ability usage at illusion "..ability:GetName()) + considers[index] = self.PreventAbilityAtIllusion(self, npcBot, considers[index], ability) + if not self:Contains(self.IgnoreAbilityBlockAbilities, ability:GetName()) then + print("Modify ability to avoid spell block: "..ability:GetName()) + considers[index] = self.PreventEnemyTargetAbilityUsageAtAbilityBlock(self, npcBot, considers[index], ability) + end + end + end +end + +M.GetHealthPercent = function(self, npc) + return npc:GetHealth() / npc:GetMaxHealth() +end + +M.GetManaPercent = function(self, npc) + return npc:GetMana() / npc:GetMaxMana() +end + +M.GetTargetHealAmplifyPercent = function(self, npc) + local modifiers = npc:FindAllModifiers() + local amplify = 1 + for i, modifier in pairs(modifiers) do + local a = (modifier:GetModifierHealAmplify_PercentageSource()) + if a ~= 0 then + print("modifier: "..modifier:GetName()..", heal amplify source:"..a..", target:"..modifier:GetModifierHealAmplify_PercentageTarget()) + end + local modifierName = modifier:GetName() + if modifierName == "modifier_ice_blast" then + return 0 + end + if modifierName == "modifier_item_spirit_vessel_damage" then + amplify = amplify - 0.45 + end + if modifierName == "modifier_holy_blessing" then + amplify = amplify + 0.3 + end + if modifierName == "modifier_necrolyte_sadist_active" then -- ghost shroud + amplify = amplify + 0.75 + end + if modifierName == "modifier_wisp_tether_haste" then + amplify = amplify + 0.6 -- 0.8/1/1.2 + end + if modifierName == "modifier_oracle_false_promise" then + amplify = amplify + 1 + end + end + return amplify +end + +M.PreventHealAtHealSuppressTarget = function(self, npcBot, oldConsiderFunction, ability) + return function() + local desire, target, targetTypeString = oldConsiderFunction() + if desire == 0 or target == nil or target == 0 or targetTypeString == "Location" then + return desire, target, targetTypeString + end + if npcBot:GetTeam() == target:GetTeam() then + desire = desire * self:GetTargetHealAmplifyPercent(target) + end + desire = self:TrimDesire(desire) + return desire, target, targetTypeString + end +end + +M.PURCHASE_ITEM_OUT_OF_STOCK=82 +M.PURCHASE_ITEM_INVALID_ITEM_NAME=33 +M.PURCHASE_ITEM_DISALLOWED_ITEM=78 +M.PURCHASE_ITEM_INSUFFICIENT_GOLD=63 +M.PURCHASE_ITEM_NOT_AT_SECRET_SHOP=62 +M.PURCHASE_ITEM_NOT_AT_HOME_SHOP=67 +M.PURCHASE_ITEM_SUCCESS=-1 +-- invalid order(3) unrecognised order name +-- invalid order(40) order not allowed for illusions +-- attempt to purchase "item_energy_booster" failed code 68 + +M.CannotBeKilledNormally = function(self, target) + return target:IsInvulnerable() or target:HasModifier("modifier_abaddon_borrowed_time") or target:HasModifier("modifier_dazzle_shallow_grave") or target:HasModifier("modifier_aeon_disk") +end + +M.HasScepter = function(self, npc) + return npc:HasScepter() or npc:HasModifier("modifier_wisp_tether_scepter") +end + + +return M diff --git a/util/BinDecHex.lua b/util/BinDecHex.lua new file mode 100644 index 00000000..131c0df9 --- /dev/null +++ b/util/BinDecHex.lua @@ -0,0 +1,573 @@ +--[[ +/* + * Copyright (c) 2007 Tim Kelly/Dialectronics + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to permit + * persons to whom the Software is furnished to do so, subject to the + * following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT + * OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +--]] + +--[[ +/* + * Copyright (c) 2007 Tim Kelly/Dialectronics + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to permit + * persons to whom the Software is furnished to do so, subject to the + * following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT + * OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +/* Thanks to Bernard Clabots for string.gfind to make forward compatible to Lua 5.2 */ + +--]] + +module(..., package.seeall); + +string.gfind = string.gfind or string.gmatch + +local hex2bin = { + ["0"] = "0000", + ["1"] = "0001", + ["2"] = "0010", + ["3"] = "0011", + ["4"] = "0100", + ["5"] = "0101", + ["6"] = "0110", + ["7"] = "0111", + ["8"] = "1000", + ["9"] = "1001", + ["a"] = "1010", + ["b"] = "1011", + ["c"] = "1100", + ["d"] = "1101", + ["e"] = "1110", + ["f"] = "1111" + } + + + +local bin2hex = { + ["0000"] = "0", + ["0001"] = "1", + ["0010"] = "2", + ["0011"] = "3", + ["0100"] = "4", + ["0101"] = "5", + ["0110"] = "6", + ["0111"] = "7", + ["1000"] = "8", + ["1001"] = "9", + ["1010"] = "A", + ["1011"] = "B", + ["1100"] = "C", + ["1101"] = "D", + ["1110"] = "E", + ["1111"] = "F" + } + +--[[ +local dec2hex = { + ["0"] = "0", + ["1"] = "1", + ["2"] = "2", + ["3"] = "3", + ["4"] = "4", + ["5"] = "5", + ["6"] = "6", + ["7"] = "7", + ["8"] = "8", + ["9"] = "9", + ["10"] = "A", + ["11"] = "B", + ["12"] = "C", + ["13"] = "D", + ["14"] = "E", + ["15"] = "F" + } +--]] + + +-- These functions are big-endian and take up to 32 bits + +-- Hex2Bin +-- Bin2Hex +-- Hex2Dec +-- Dec2Hex +-- Bin2Dec +-- Dec2Bin + + +function Hex2Bin(s) + +-- s -> hexadecimal string + +local ret = "" +local i = 0 + + + for i in string.gfind(s, ".") do + i = string.lower(i) + + ret = ret..hex2bin[i] + + end + + return ret +end + + +function Bin2Hex(s) + +-- s -> binary string + +local l = 0 +local h = "" +local b = "" +local rem + +l = string.len(s) +rem = l % 4 +l = l-1 +h = "" + + -- need to prepend zeros to eliminate mod 4 + if (rem > 0) then + s = string.rep("0", 4 - rem)..s + end + + for i = 1, l, 4 do + b = string.sub(s, i, i+3) + h = h..bin2hex[b] + end + + return h + +end + + +function Bin2Dec(s) + +-- s -> binary string + +local num = 0 +local ex = string.len(s) - 1 +local l = 0 + + l = ex + 1 + for i = 1, l do + b = string.sub(s, i, i) + if b == "1" then + num = num + 2^ex + end + ex = ex - 1 + end + + return string.format("%u", num) + +end + + + +function Dec2Bin(s, num) + +-- s -> Base10 string +-- num -> string length to extend to + +local n + + if (num == nil) then + n = 0 + else + n = num + end + + s = string.format("%x", s) + + s = Hex2Bin(s) + + while string.len(s) < n do + s = "0"..s + end + + return s + +end + + + + +function Hex2Dec(s) + +-- s -> hexadecimal string + +local s = Hex2Bin(s) + + return Bin2Dec(s) + +end + + + +function Dec2Hex(s) + +-- s -> Base10 string + + s = string.format("%x", s) + + return s + +end + + + + +-- These functions are big-endian and will extend to 32 bits + +-- BMAnd +-- BMNAnd +-- BMOr +-- BMXOr +-- BMNot + + +function BMAnd(v, m) + +-- v -> hex string to be masked +-- m -> hex string mask + +-- s -> hex string as masked + +-- bv -> binary string of v +-- bm -> binary string mask + +local bv = Hex2Bin(v) +local bm = Hex2Bin(m) + +local i = 0 +local s = "" + + while (string.len(bv) < 32) do + bv = "0000"..bv + end + + while (string.len(bm) < 32) do + bm = "0000"..bm + end + + + for i = 1, 32 do + cv = string.sub(bv, i, i) + cm = string.sub(bm, i, i) + if cv == cm then + if cv == "1" then + s = s.."1" + else + s = s.."0" + end + else + s = s.."0" + + end + end + + return Bin2Hex(s) + +end + + +function BMNAnd(v, m) + +-- v -> hex string to be masked +-- m -> hex string mask + +-- s -> hex string as masked + +-- bv -> binary string of v +-- bm -> binary string mask + +local bv = Hex2Bin(v) +local bm = Hex2Bin(m) + +local i = 0 +local s = "" + + while (string.len(bv) < 32) do + bv = "0000"..bv + end + + while (string.len(bm) < 32) do + bm = "0000"..bm + end + + + for i = 1, 32 do + cv = string.sub(bv, i, i) + cm = string.sub(bm, i, i) + if cv == cm then + if cv == "1" then + s = s.."0" + else + s = s.."1" + end + else + s = s.."1" + + end + end + + return Bin2Hex(s) + +end + + + +function BMOr(v, m) + +-- v -> hex string to be masked +-- m -> hex string mask + +-- s -> hex string as masked + +-- bv -> binary string of v +-- bm -> binary string mask + +local bv = Hex2Bin(v) +local bm = Hex2Bin(m) + +local i = 0 +local s = "" + + while (string.len(bv) < 32) do + bv = "0000"..bv + end + + while (string.len(bm) < 32) do + bm = "0000"..bm + end + + + for i = 1, 32 do + cv = string.sub(bv, i, i) + cm = string.sub(bm, i, i) + if cv == "1" then + s = s.."1" + elseif cm == "1" then + s = s.."1" + else + s = s.."0" + end + end + + return Bin2Hex(s) + +end + +function BMXOr(v, m) + +-- v -> hex string to be masked +-- m -> hex string mask + +-- s -> hex string as masked + +-- bv -> binary string of v +-- bm -> binary string mask + +local bv = Hex2Bin(v) +local bm = Hex2Bin(m) + +local i = 0 +local s = "" + + while (string.len(bv) < 32) do + bv = "0000"..bv + end + + while (string.len(bm) < 32) do + bm = "0000"..bm + end + + + for i = 1, 32 do + cv = string.sub(bv, i, i) + cm = string.sub(bm, i, i) + if cv == "1" then + if cm == "0" then + s = s.."1" + else + s = s.."0" + end + elseif cm == "1" then + if cv == "0" then + s = s.."1" + else + s = s.."0" + end + else + -- cv and cm == "0" + s = s.."0" + end + end + + return Bin2Hex(s) + +end + + +function BMNot(v, m) + +-- v -> hex string to be masked +-- m -> hex string mask + +-- s -> hex string as masked + +-- bv -> binary string of v +-- bm -> binary string mask + +local bv = Hex2Bin(v) +local bm = Hex2Bin(m) + +local i = 0 +local s = "" + + while (string.len(bv) < 32) do + bv = "0000"..bv + end + + while (string.len(bm) < 32) do + bm = "0000"..bm + end + + + for i = 1, 32 do + cv = string.sub(bv, i, i) + cm = string.sub(bm, i, i) + if cm == "1" then + if cv == "1" then + -- turn off + s = s.."0" + else + -- turn on + s = s.."1" + end + else + -- leave untouched + s = s..cv + + end + end + + return Bin2Hex(s) + +end + + +-- these functions shift right and left, adding zeros to lost or gained bits +-- returned values are 32 bits long + +-- BShRight(v, nb) +-- BShLeft(v, nb) + + +function BShRight(v, nb) + +-- v -> hexstring value to be shifted +-- nb -> number of bits to shift to the right + +-- s -> binary string of v + +local s = Hex2Bin(v) + + while (string.len(s) < 32) do + s = "0000"..s + end + + s = string.sub(s, 1, 32 - nb) + + while (string.len(s) < 32) do + s = "0"..s + end + + return Bin2Hex(s) + +end + +function BShLeft(v, nb) + +-- v -> hexstring value to be shifted +-- nb -> number of bits to shift to the right + +-- s -> binary string of v + +local s = Hex2Bin(v) + + while (string.len(s) < 32) do + s = "0000"..s + end + + s = string.sub(s, nb + 1, 32) + + while (string.len(s) < 32) do + s = s.."0" + end + + return Bin2Hex(s) + +end + + +local binlib = {} +local orFunc +orFunc = function(a, b, ...) + local params = ... + if params == nil then + return BMOr(Dec2Hex(a), Dec2Hex(b)) + else + return orFunc(BMOr(Dec2Hex(a), Dec2Hex(b)), ...) + end +end +binlib.Or = orFunc +local function BMTest(a, b) + return tonumber(BMAnd(a,b)) ~= 0 +end +binlib.Test = function(a, b, ...) + local params = ... + if params == nil then + return BMTest(Dec2Hex(a), Dec2Hex(b)) + else + return BMTest(Dec2Hex(a), orFunc(b, ...)) + end +end + + +return binlib diff --git a/util/ChatSystem.lua b/util/ChatSystem.lua index 2aea4152..ec89ee79 100644 --- a/util/ChatSystem.lua +++ b/util/ChatSystem.lua @@ -11,11 +11,11 @@ function M.SendVersionAnnouncement() local npcBot = GetBot() if (npcBot:GetPlayerID() == id) then npcBot:ActionImmediate_Chat( - "Welcome to Ranked Matchmaking AI, the current version is 1.6f, updated on December 19, 2019. If you have any questions or feedback, please leave message on steam workshop https://steamcommunity.com/sharedfiles/filedetails/?id=855965029 or contact Dota2RMMAI@outlook.com", + "Welcome to Ranked Matchmaking AI. The current version is 1.6f, updated on December 19, 2019. If you have any questions or feedback, please leave message on steam workshop https://steamcommunity.com/sharedfiles/filedetails/?id=855965029 or contact Dota2RMMAI@outlook.com", true ) npcBot:ActionImmediate_Chat( - "Please use hard or unfair mode and do not play Monkey king. 请使用困难或疯狂难度,不要使用齐天大圣。", + "Please use hard or unfair mode and do not play as Monkey king. 请使用困难或疯狂难度,不要使用齐天大圣。", true ) end diff --git a/util/CourierSystem.lua b/util/CourierSystem.lua index fd2c33e4..35a0f984 100644 --- a/util/CourierSystem.lua +++ b/util/CourierSystem.lua @@ -45,6 +45,31 @@ local function IsInvFull(npcHero) end return true end +local function IsOnlyInventoryFull(npcHero) + for i = 0, 5 do + if npcHero:GetItemInSlot(i) == nil then + return false + end + end + return true +end +local function CannotCarryOnBackpack(itemName) + local items = {"item_gem", "item_rapier", "item_immortal"} + for _,v in ipairs(itemName) do + if v == items then + return true + end + end + return false +end +local function HasItemCannotCarryOnBackpack(courier) + for i = 0, 5 do + if CannotCarryOnBackpack(courier:GetItemInSlot(i):GetName()) then + return true + end + end + return false +end local function IsTheClosestToCourier(npcBot, npcCourier) local numPlayer = GetTeamPlayers(GetTeam()) @@ -175,187 +200,224 @@ local define_courier = false; local cr = nil; local tm = GetTeam(); local pIDs = GetTeamPlayers(tm); -function M.CourierUsageThink() -local npcBot = GetBot() -if GetGameMode() == 23 or npcBot:IsInvulnerable() or not npcBot:IsHero() or npcBot:IsIllusion() or npcBot:HasModifier("modifier_arc_warden_tempest_double") or GetNumCouriers() == 0 then - return; -end +local lastTransferredTime = -100 +local lastTransferredTimeCourierItemNumber = 0 +local returnToFountainWhenTransferFailed = false --- if GetTeam() == TEAM_DIRE then - -- print(npcBot:GetUnitName().."----"..tostring(npcBot:GetPlayerID())); - -- for i = 1, #pIDs do - -- print(GetSelectedHeroName(pIDs[i])..":"..pIDs[i]) +function M.CourierUsageThink() + local npcBot = GetBot() + if GetGameMode() == 23 or npcBot:IsInvulnerable() or not npcBot:IsHero() or npcBot:IsIllusion() or npcBot:HasModifier("modifier_arc_warden_tempest_double") or GetNumCouriers() == 0 then + return; + end + + -- if GetTeam() == TEAM_DIRE then + -- print(npcBot:GetUnitName().."----"..tostring(npcBot:GetPlayerID())); + -- for i = 1, #pIDs do + -- print(GetSelectedHeroName(pIDs[i])..":"..pIDs[i]) + -- end -- end --- end --- if npcBot.courierAssigned == false then - -- for i=1, #pIDs do - -- if IsPlayernpcBot(pIDs[i]) == true then - -- local mbr = GetTeamMember(i); - -- if npcBot == mbr then - -- npcBot.courierID = i - 1; - -- npcBot.courierAssigned = true; - -- print(npcBot:GetUnitName().." : Courier Successfully Assigned To Courier "..tostring(npcBot.courierID)); + -- if npcBot.courierAssigned == false then + -- for i=1, #pIDs do + -- if IsPlayernpcBot(pIDs[i]) == true then + -- local mbr = GetTeamMember(i); + -- if npcBot == mbr then + -- npcBot.courierID = i - 1; + -- npcBot.courierAssigned = true; + -- print(npcBot:GetUnitName().." : Courier Successfully Assigned To Courier "..tostring(npcBot.courierID)); + -- end -- end -- end -- end --- end -if courierUtils.pIDInc < #pIDs + 1 and DotaTime() > -60 then - if IsPlayerBot(pIDs[courierUtils.pIDInc]) == true then - local currID = pIDs[courierUtils.pIDInc]; - if npcBot:GetPlayerID() == currID then - if checkCourier == true and DotaTime() > courierUtils.calibrateTime + 5 then - local cst = GetCourierState(cr); - -- print(npcBot:GetUnitName()); - if cst == COURIER_STATE_MOVING then - courierUtils.pIDInc = courierUtils.pIDInc + 1; - print(npcBot:GetUnitName().." : Courier Successfully Assigned ."..tostring(npcBot.courierID)); - checkCourier = false; - npcBot.courierAssigned = true; - courierUtils.calibrateTime = DotaTime(); - npcBot:ActionImmediate_Courier( cr, COURIER_ACTION_RETURN_STASH_ITEMS ); - return; - else - -- print("Failed to Assign Courier."); - npcBot.courierID = npcBot.courierID + 1; - checkCourier = false; - courierUtils.calibrateTime = DotaTime(); + if courierUtils.pIDInc < #pIDs + 1 and DotaTime() > -60 then + if IsPlayerBot(pIDs[courierUtils.pIDInc]) == true then + local currID = pIDs[courierUtils.pIDInc]; + if npcBot:GetPlayerID() == currID then + if checkCourier == true and DotaTime() > courierUtils.calibrateTime + 5 then + local cst = GetCourierState(cr); + -- print(npcBot:GetUnitName()); + if cst == COURIER_STATE_MOVING then + courierUtils.pIDInc = courierUtils.pIDInc + 1; + print(npcBot:GetUnitName().." : Courier Successfully Assigned ."..tostring(npcBot.courierID)); + checkCourier = false; + npcBot.courierAssigned = true; + courierUtils.calibrateTime = DotaTime(); + npcBot:ActionImmediate_Courier( cr, COURIER_ACTION_RETURN_STASH_ITEMS ); + return; + elseif npcBot.courierID ~= nil then + print(npcBot:GetUnitName().. ": Failed to Assign Courier."); + npcBot.courierID = npcBot.courierID + 1; + checkCourier = false; + courierUtils.calibrateTime = DotaTime(); + end + elseif checkCourier == false then + cr = GetBotCourier(npcBot); + npcBot:ActionImmediate_Courier( cr, COURIER_ACTION_SECRET_SHOP ); + checkCourier = true; end - elseif checkCourier == false then - cr = GetBotCourier(npcBot); - npcBot:ActionImmediate_Courier( cr, COURIER_ACTION_SECRET_SHOP ); - checkCourier = true; end - end - else - courierUtils.pIDInc = courierUtils.pIDInc + 1; + else + courierUtils.pIDInc = courierUtils.pIDInc + 1; + end end -end -if npcBot.courierAssigned == true then --- if npcBot:GetCourierValue( ) > 0 then + if npcBot.courierAssigned == true then + -- if npcBot:GetCourierValue( ) > 0 then - -- print(npcBot:GetUnitName()..":"..tostring(npcBot:GetCourierValue( ))); --- end - local npcCourier = GetBotCourier(npcBot); - -- local itm = npcCourier:GetItemInSlot(1); - -- if itm ~= nil then + -- print(npcBot:GetUnitName()..":"..tostring(npcBot:GetCourierValue( ))); + -- end + local npcCourier = GetBotCourier(npcBot); + -- local itm = npcCourier:GetItemInSlot(1); + -- if itm ~= nil then -- print(itm:GetName()); - -- end - local cState = GetCourierState( npcCourier ); + -- end - local courierPHP = npcCourier:GetHealth() / npcCourier:GetMaxHealth(); - - if cState == COURIER_STATE_DEAD then - npcCourier.latestUser = nil; - return - end - - if IsFlyingCourier(npcCourier) then - local burst = npcCourier:GetAbilityByName('courier_shield'); - if IsTargetedByUnit(npcCourier) then - if burst:IsFullyCastable() and apiAvailable == true - then - npcBot:ActionImmediate_Courier( npcCourier, COURIER_ACTION_BURST ); - return - elseif DotaTime() > returnTime + 7.0 - --and not burst:IsFullyCastable() and not npcCourier:HasModifier('modifier_courier_shield') - then - npcBot:ActionImmediate_Courier( npcCourier, COURIER_ACTION_RETURN ); - returnTime = DotaTime(); - return - end + local cState = GetCourierState( npcCourier ); + + if cState == COURIER_STATE_DEAD then + npcCourier.latestUser = nil; + return end - else - if IsTargetedByUnit(npcCourier) then - if DotaTime() - returnTime > 7.0 then - npcBot:ActionImmediate_Courier( npcCourier, COURIER_ACTION_RETURN ); - returnTime = DotaTime(); - return + + -- try to return courier to fountain when the hero's inventory and backpack are full and there are items in the courier and no high-level items can be created; or return courier to fountain and drop gems when the hero's inventory is full and there are gems or rapiers in the courier + --local newDis = GetUnitToUnitDistance(npcBot, npcCourier) + --if newDis <= 250 and cState == COURIER_STATE_DELIVERING_ITEMS then + -- if lastTransferredTime == -100 then + -- lastTransferredTime = DotaTime() + -- lastTransferredTimeCourierItemNumber = 6-GetCourierEmptySlot(npcCourier) + -- end + --else + -- lastTransferredTime = -100 + --end + --if returnToFountainWhenTransferFailed then + -- if not (cState == COURIER_STATE_AT_BASE or cState == COURIER_STATE_DELIVERING_ITEMS) then + -- + -- else + -- returnToFountainWhenTransferFailed = false + -- lastTransferredTime = -100 + -- end + -- return + --end + --if lastTransferredTime ~= -100 and DotaTime() - lastTransferredTime > 2 then + -- if IsInvFull(npcBot) and GetCourierEmptySlot(npcCourier) < 6 then + -- npcBot:ActionImmediate_Courier(npcCourier, COURIER_ACTION_RETURN) + -- returnToFountainWhenTransferFailed = true + -- return + -- end + -- if IsOnlyInventoryFull(npcBot) and HasItemCannotCarryOnBackpack(npcCourier) then + -- npcBot:ActionImmediate_Courier(npcCourier, COURIER_ACTION_RETURN) + -- returnToFountainWhenTransferFailed = true + -- return + -- end + --end + + + local courierPHP = npcCourier:GetHealth() / npcCourier:GetMaxHealth(); + + if IsFlyingCourier(npcCourier) then + local burst = npcCourier:GetAbilityByName('courier_shield'); + if IsTargetedByUnit(npcCourier) then + if burst:IsFullyCastable() and apiAvailable == true + then + npcBot:ActionImmediate_Courier( npcCourier, COURIER_ACTION_BURST ); + return + elseif DotaTime() > returnTime + 7.0 + --and not burst:IsFullyCastable() and not npcCourier:HasModifier('modifier_courier_shield') + then + npcBot:ActionImmediate_Courier( npcCourier, COURIER_ACTION_RETURN ); + returnTime = DotaTime(); + return + end + end + else + if IsTargetedByUnit(npcCourier) then + if DotaTime() - returnTime > 7.0 then + npcBot:ActionImmediate_Courier( npcCourier, COURIER_ACTION_RETURN ); + returnTime = DotaTime(); + return + end end end - end - - if ( IsCourierAvailable() and cState ~= COURIER_STATE_IDLE ) then - npcCourier.latestUser = "temp"; - end - - if npcBot.SShopUser and ( not npcBot:IsAlive() or npcBot:GetActiveMode() == npcBot_MODE_SECRET_SHOP or not npcBot.SecretShop ) then - --npcBot:ActionImmediate_Chat( "Releasing the courier to anticipate secret shop stuck", true ); - npcCourier.latestUser = "temp"; - npcBot.SShopUser = false; - npcBot:ActionImmediate_Courier( npcCourier, COURIER_ACTION_RETURN_STASH_ITEMS ); - return - end - - if cState == COURIER_STATE_AT_BASE or cState == COURIER_STATE_IDLE or cState == COURIER_STATE_RETURNING_TO_BASE then - if courierPHP < 1.0 then - return; + + if ( IsCourierAvailable() and cState ~= COURIER_STATE_IDLE ) then + npcCourier.latestUser = "temp"; end - - --RETURN COURIER TO BASE WHEN IDLE - if cState == COURIER_STATE_IDLE then + + if npcBot.SShopUser and ( not npcBot:IsAlive() or npcBot:GetActiveMode() == npcBot_MODE_SECRET_SHOP or not npcBot.SecretShop ) then + --npcBot:ActionImmediate_Chat( "Releasing the courier to anticipate secret shop stuck", true ); + npcCourier.latestUser = "temp"; + npcBot.SShopUser = false; npcBot:ActionImmediate_Courier( npcCourier, COURIER_ACTION_RETURN_STASH_ITEMS ); return end - - --TAKE ITEM FROM STASH - if cState == COURIER_STATE_AT_BASE then - local nCSlot = GetCourierEmptySlot(npcCourier); - if npcBot:IsAlive() - then - local nMSlot = GetNumStashItem(npcBot); - if nMSlot > 0 and nMSlot <= nCSlot + + if cState == COURIER_STATE_AT_BASE or cState == COURIER_STATE_IDLE or cState == COURIER_STATE_RETURNING_TO_BASE then + if courierPHP < 1.0 then + return; + end + + --RETURN COURIER TO BASE WHEN IDLE + if cState == COURIER_STATE_IDLE then + npcBot:ActionImmediate_Courier( npcCourier, COURIER_ACTION_RETURN_STASH_ITEMS ); + return + end + + --TAKE ITEM FROM STASH + if cState == COURIER_STATE_AT_BASE then + local nCSlot = GetCourierEmptySlot(npcCourier); + if npcBot:IsAlive() then - -- print("Transfer Item"); - npcBot:ActionImmediate_Courier( npcCourier, COURIER_ACTION_TAKE_STASH_ITEMS ); - nCSlot = nCSlot - nMSlot ; - courierTime = DotaTime(); - return; + local nMSlot = GetNumStashItem(npcBot); + if nMSlot > 0 and nMSlot <= nCSlot + then + -- print("Transfer Item"); + npcBot:ActionImmediate_Courier( npcCourier, COURIER_ACTION_TAKE_STASH_ITEMS ); + nCSlot = nCSlot - nMSlot ; + courierTime = DotaTime(); + return; + end end - end - end - - --MAKE COURIER GOES TO SECRET SHOP - if npcBot:IsAlive() and npcBot.SecretShop and npcCourier:DistanceFromFountain() < 7000 and IsInvFull(npcCourier) == false and DotaTime() > courierTime + 1.0 then - --npcBot:ActionImmediate_Chat( "Using Courier for secret shop.", true ); - npcBot:ActionImmediate_Courier( npcCourier, COURIER_ACTION_SECRET_SHOP ) - npcCourier.latestUser = npcBot; - npcBot.SShopUser = true; - UpdateSShopUserStatus(npcBot); - courierTime = DotaTime(); - -- print("Transfer Secret Shop"); - return - end - - --TRANSFER ITEM IN COURIER - if npcBot:IsAlive() and npcBot:GetCourierValue( ) > 0 - then - npcBot:ActionImmediate_Courier( npcCourier, COURIER_ACTION_TRANSFER_ITEMS ) - npcCourier.latestUser = npcBot; - courierTime = DotaTime(); - -- print("Transfer Item 2"); - return - end - - --RETURN STASH ITEM WHEN DEATH - if not npcBot:IsAlive() and cState == COURIER_STATE_DELIVERING_ITEMS - and npcBot:GetCourierValue( ) > 0 and DotaTime() > courierTime + 1.0 - then - npcBot:ActionImmediate_Courier( npcCourier, COURIER_ACTION_RETURN_STASH_ITEMS ); - npcCourier.latestUser = npcBot; - courierTime = DotaTime(); - -- print("Return Item"); - return + end + + --MAKE COURIER GOES TO SECRET SHOP + if npcBot:IsAlive() and npcBot.SecretShop and npcCourier:DistanceFromFountain() < 7000 and IsInvFull(npcCourier) == false and DotaTime() > courierTime + 1.0 then + --npcBot:ActionImmediate_Chat( "Using Courier for secret shop.", true ); + npcBot:ActionImmediate_Courier( npcCourier, COURIER_ACTION_SECRET_SHOP ) + npcCourier.latestUser = npcBot; + npcBot.SShopUser = true; + UpdateSShopUserStatus(npcBot); + courierTime = DotaTime(); + -- print("Transfer Secret Shop"); + return + end + + --TRANSFER ITEM IN COURIER + if npcBot:IsAlive() and npcBot:GetCourierValue( ) > 0 + then + npcBot:ActionImmediate_Courier( npcCourier, COURIER_ACTION_TRANSFER_ITEMS ) + npcCourier.latestUser = npcBot; + courierTime = DotaTime(); + -- print("Transfer Item 2"); + return + end + + --RETURN STASH ITEM WHEN DEATH + if not npcBot:IsAlive() and cState == COURIER_STATE_DELIVERING_ITEMS + and npcBot:GetCourierValue( ) > 0 and DotaTime() > courierTime + 1.0 + then + npcBot:ActionImmediate_Courier( npcCourier, COURIER_ACTION_RETURN_STASH_ITEMS ); + npcCourier.latestUser = npcBot; + courierTime = DotaTime(); + -- print("Return Item"); + return + end + end - - - end -end + end end diff --git a/util/ItemPurchaseSystem.lua b/util/ItemPurchaseSystem.lua index d6e5fab2..0ac1472c 100644 --- a/util/ItemPurchaseSystem.lua +++ b/util/ItemPurchaseSystem.lua @@ -1,5 +1,6 @@ local BotsInit = require("game/botsinit") local M = BotsInit.CreateGeneric() +local utility = require( GetScriptDirectory().."/utility" ) function M.SellExtraItem(ItemsToBuy) local npcBot=GetBot() @@ -19,7 +20,7 @@ function M.SellExtraItem(ItemsToBuy) end if(GameTime()>25*60 or level>=10) then - M.SellSpecifiedItem("item_stout_shield") + --M.SellSpecifiedItem("item_stout_shield") M.SellSpecifiedItem("item_orb_of_venom") M.SellSpecifiedItem("item_enchanted_mango") M.SellSpecifiedItem("item_bracer") @@ -32,7 +33,7 @@ function M.SellExtraItem(ItemsToBuy) M.SellSpecifiedItem("item_branches") M.SellSpecifiedItem("item_bottle") M.SellSpecifiedItem("item_magic_wand") - M.SellSpecifiedItem("item_magic_stick") + M.SellSpecifiedItem("item_flask") M.SellSpecifiedItem("item_ancient_janggo") M.SellSpecifiedItem("item_ring_of_basilius") M.SellSpecifiedItem("item_quelling_blade") @@ -74,11 +75,7 @@ end function isLeaf (Node) local recipe = GetItemComponents(Node) - if next(recipe) == nil then - return true - else - return false - end + return next(recipe) == nil end function nextNodes (Node) @@ -86,6 +83,24 @@ function nextNodes (Node) return recipe[1] end +M.ExpandItemRecipe = function(self, itemTable) + local output = {} + local expandItem + expandItem = function(item) + if isLeaf(item) then + table.insert(output, item) + else + for _, v in pairs(nextNodes(item)) do + expandItem(item) + end + end + end + for _, v in pairs(itemTable) do + expandItem(v) + end + return output +end + function M.Transfer(itemtable) local output = {} for k1, v1 in pairs(itemtable) do @@ -127,14 +142,11 @@ function M.Transfer(itemtable) end function M.ItemPurchase(ItemsToBuy) - + if GetGameState() == DOTA_GAMERULES_STATE_POSTGAME then + return + end local npcBot = GetBot(); - if(M.GetItemIncludeBackpack("item_courier") or DotaTime()<-80) - then - return; - end - -- buy item_tpscroll if(npcBot.secretShopMode~=true or npcBot:GetGold() >= 100) then @@ -147,47 +159,33 @@ function M.ItemPurchase(ItemsToBuy) return; end - local sNextItem = ItemsToBuy[1]; + local sNextItem = ItemsToBuy[1] npcBot:SetNextItemPurchaseValue( GetItemCost( sNextItem ) ) M.SellExtraItem(ItemsToBuy) - if(npcBot:DistanceFromFountain()<=2500 or npcBot:GetHealth()/npcBot:GetMaxHealth()<=0.35) + if npcBot:DistanceFromFountain()<=2500 or npcBot:GetHealth()/npcBot:GetMaxHealth()<=0.35 then - npcBot.secretShopMode = false; - npcBot.sideShopMode = false; + npcBot.secretShopMode = false end - if (IsItemPurchasedFromSideShop( sNextItem )==false and IsItemPurchasedFromSecretShop( sNextItem )==false) + if IsItemPurchasedFromSecretShop( sNextItem )==false then - npcBot.secretShopMode = false; - npcBot.sideShopMode = false; + npcBot.secretShopMode = false end if ( npcBot:GetGold() >= GetItemCost( sNextItem ) ) then - if(npcBot.secretShopMode~=true and npcBot.sideShopMode ~=true) + if npcBot.secretShopMode~=true then - if (IsItemPurchasedFromSideShop( sNextItem ) and npcBot:DistanceFromSideShop() <= 1800) --????????·?????????????·??? - then - npcBot.sideShopMode = true; - npcBot.secretShopMode = false; - end if (IsItemPurchasedFromSecretShop( sNextItem ) and sNextItem ~= "item_bottle") then - npcBot.secretShopMode = true; - npcBot.sideShopMode = false; + npcBot.secretShopMode = true end end local PurchaseResult=-2 --??????????????????? - if(npcBot.sideShopMode == true) - then - if(npcBot:DistanceFromSideShop() <= 250) - then - PurchaseResult=npcBot:ActionImmediate_PurchaseItem( sNextItem ) - end - elseif(npcBot.secretShopMode == true) --??????????????????????????????? + if(npcBot.secretShopMode == true) --??????????????????????????????? then if(npcBot:DistanceFromSecretShop() <= 250) then @@ -213,12 +211,14 @@ function M.ItemPurchase(ItemsToBuy) PurchaseResult=npcBot:ActionImmediate_PurchaseItem( sNextItem ) end - if(PurchaseResult==PURCHASE_ITEM_SUCCESS) --??????????????????????? - then - npcBot.secretShopMode = false; - npcBot.sideShopMode = false; - table.remove( ItemsToBuy, 1 ) - end + if(PurchaseResult==PURCHASE_ITEM_SUCCESS) --??????????????????????? + then + npcBot.secretShopMode = false; + table.remove( ItemsToBuy, 1 ) + elseif PurchaseResult ~= -2 then + print("purchase item failed: "..ItemsToBuy[1]..", fail code: "..PurchaseResult) + end + if(PurchaseResult==PURCHASE_ITEM_OUT_OF_STOCK) --?????????????????????? then M.SellSpecifiedItem("item_dust") @@ -229,27 +229,20 @@ function M.ItemPurchase(ItemsToBuy) end if(PurchaseResult==PURCHASE_ITEM_INVALID_ITEM_NAME or PurchaseResult==PURCHASE_ITEM_DISALLOWED_ITEM) --???????????????????? then + print("invalid item purchase or disallowed purchase: "..ItemsToBuy[1]) table.remove( ItemsToBuy, 1 ) end if(PurchaseResult==PURCHASE_ITEM_INSUFFICIENT_GOLD ) --???????????????????????????????????????ж??????? then npcBot.secretShopMode = false; - npcBot.sideShopMode = false; end if(PurchaseResult==PURCHASE_ITEM_NOT_AT_SECRET_SHOP) --????????????????????? then npcBot.secretShopMode = true - npcBot.sideShopMode = false; - end - if(PurchaseResult==PURCHASE_ITEM_NOT_AT_SIDE_SHOP) --?????·?????????????????????????·???????????????????? - then - npcBot.sideShopMode = true - npcBot.secretShopMode = false; end if(PurchaseResult==PURCHASE_ITEM_NOT_AT_HOME_SHOP) --??????????????????????????????????????У???????????????????? then npcBot.secretShopMode = false; - npcBot.sideShopMode = false; end if(PurchaseResult>=-1) then @@ -257,24 +250,25 @@ function M.ItemPurchase(ItemsToBuy) end else npcBot.secretShopMode = false; - npcBot.sideShopMode = false; end end function M.BuyCourier() - local npcBot=GetBot() - local courier=GetCourier(0) - if(courier==nil) - then - if(npcBot:GetGold()>=GetItemCost("item_courier")) - then - local info=npcBot:ActionImmediate_PurchaseItem("item_courier"); - if info ==PURCHASE_ITEM_SUCCESS then - npcBot:ActionImmediate_Chat('I bought the courier 我买了鸡。',false); - end - end - end + -- no longer need to buy courier + + -- local npcBot=GetBot() + -- local courier=GetCourier(0) + -- if(courier==nil) + -- then + -- if(npcBot:GetGold()>=GetItemCost("item_courier")) + -- then + -- local info=npcBot:ActionImmediate_PurchaseItem("item_courier"); + -- if info ==PURCHASE_ITEM_SUCCESS then + -- npcBot:ActionImmediate_Chat('I bought the courier 我买了鸡。',false); + -- end + -- end + -- end --[[else if DotaTime()>60*3 and npcBot:GetGold()>=GetItemCost("item_flying_courier") and (courier:GetMaxHealth()==75) then local info=npcBot:ActionImmediate_PurchaseItem("item_flying_courier"); @@ -468,25 +462,12 @@ function M.checkItemBuild(ItemsToBuy) end end -local invisibleHeroes = { - --"npc_dota_hero_legion_commander", - "npc_dota_hero_sand_king", - "npc_dota_hero_treant", - "npc_dota_hero_bounty_hunter", - --"npc_dota_hero_broodmother", - "npc_dota_hero_clinkz", - --"npc_dota_hero_drow_ranger", - "npc_dota_hero_mirana", - "npc_dota_hero_nyx_assassin", - "npc_dota_hero_riki", - --"npc_dota_hero_nevermore", - --"npc_dota_hero_slark", - --"npc_dota_hero_sniper", - "npc_dota_hero_templar_assassin", - --"npc_dota_hero_viper", - "npc_dota_hero_invoker", - "npc_dota_hero_weaver", -}; +local RoleUtility = require(GetScriptDirectory().."/util/RoleUtility") +local invisHeroes = RoleUtility.invisHeroes +local invisibleHeroes = {} +for heroName, _ in pairs(invisHeroes) do + table.insert(invisibleHeroes, heroName) +end -- function M.GetItemIncludeBackpack( item_name ) diff --git a/util/ItemUsageSystem.lua b/util/ItemUsageSystem.lua index cffa511b..1b948928 100644 --- a/util/ItemUsageSystem.lua +++ b/util/ItemUsageSystem.lua @@ -1,5 +1,7 @@ local BotsInit = require("game/botsinit") local role = require(GetScriptDirectory() .. "/util/RoleUtility") +local AbilityExtensions = require(GetScriptDirectory().."/util/AbilityAbstraction") + local M = BotsInit.CreateGeneric() @@ -53,7 +55,7 @@ local function GiveToMidLaner() local num_sts = GetItemCount(member, "item_tango_single") local num_ff = GetItemCount(member, "item_faerie_fire") local num_stg = GetItemCharges(member, "item_tango") - if num_sts + num_ff + num_stg <= 3 then + if num_sts + num_ff + num_stg <= 2 then return member end end @@ -677,6 +679,16 @@ function M.UnImplementedItemUsage() end end + local ghost = IsItemAvailable("item_ghost") + if ghost and ghost:IsFullyCastable() then + if npcBot:GetActiveMode() == BOT_MODE_ATTACK or npcBot:GetActiveMode() == BOT_MODE_RETREAT then + if npcBot:WasRecentlyDamagedByAnyHero(2.0) and npcBot:GetHealth()/npcBot:GetMaxHealth() <= 0.6 then -- TODO: get recent physical and magical damage + npcBot:Action_UseAbility(ghost) + return + end + end + end + local glimer = IsItemAvailable("item_glimmer_cape") if glimer ~= nil and glimer:IsFullyCastable() then if @@ -779,7 +791,7 @@ function M.UnImplementedItemUsage() end end - local mgs=IsItemAvailable("item_magic_stick"); + local mgs=IsItemAvailable("item_flask"); if mgs~=nil and mgs:IsFullyCastable() then if npcBot:GetMana()/npcBot:GetMaxMana() - npcBot:GetHealth()/npcBot:GetMaxHealth() <= 1 and mgs:GetCurrentCharges()>=8 then @@ -787,16 +799,16 @@ function M.UnImplementedItemUsage() return; end end]] - local stick = IsItemAvailable("item_magic_stick") + local stick = IsItemAvailable("item_flask") if stick ~= nil and stick:IsFullyCastable() then if DotaTime() > 0 then local tableNearbyEnemyHeroes = npcBot:GetNearbyHeroes(500, true, BOT_MODE_NONE) if ((npcBot:GetHealth() / npcBot:GetMaxHealth() < 0.4 or npcBot:GetMana() / npcBot:GetMaxMana() < 0.2) and #tableNearbyEnemyHeroes >= 1 and - GetItemCharges(npcBot, "item_magic_stick") >= 1) or + GetItemCharges(npcBot, "item_flask") >= 1) or ((npcBot:GetHealth() / npcBot:GetMaxHealth() < 0.7 and npcBot:GetMana() / npcBot:GetMaxMana() < 0.7) and - GetItemCharges(npcBot, "item_magic_stick") >= 7) + GetItemCharges(npcBot, "item_flask") >= 7) then npcBot:Action_UseAbility(stick) return @@ -811,7 +823,7 @@ function M.UnImplementedItemUsage() if ((npcBot:GetHealth() / npcBot:GetMaxHealth() < 0.4 or npcBot:GetMana() / npcBot:GetMaxMana() < 0.2) and #tableNearbyEnemyHeroes >= 1 and - GetItemCharges(npcBot, "item_magic_stick") >= 1) or + GetItemCharges(npcBot, "item_magic_wand") >= 1) or ((npcBot:GetHealth() / npcBot:GetMaxHealth() < 0.7 and npcBot:GetMana() / npcBot:GetMaxMana() < 0.7) and GetItemCharges(npcBot, "item_magic_wand") >= 12) then @@ -821,6 +833,23 @@ function M.UnImplementedItemUsage() end end + local holyLocket = IsItemAvailable("item_holy_locket") + if holyLocket ~= nil and holyLocket:IsFullyCastable() then + if DotaTime() > 0 then + local tableNearbyEnemyHeroes = npcBot:GetNearbyHeroes(500, true, BOT_MODE_NONE) + if + ((npcBot:GetHealth() / npcBot:GetMaxHealth() < 0.4 or npcBot:GetMana() / npcBot:GetMaxMana() < 0.2) and + #tableNearbyEnemyHeroes >= 1 and + GetItemCharges(npcBot, "item_holy_locket") >= 1) or + ((npcBot:GetHealth() / npcBot:GetMaxHealth() < 0.7 and npcBot:GetMana() / npcBot:GetMaxMana() < 0.7) and + GetItemCharges(npcBot, "item_holy_locket") >= 12) + then + npcBot:Action_UseAbility(wand, npcBot) + return + end + end + end + local bottle = IsItemAvailable("item_bottle") if bottle ~= nil and bottle:IsFullyCastable() then local tableNearbyEnemyHeroes = npcBot:GetNearbyHeroes(650, true, BOT_MODE_NONE) @@ -840,9 +869,8 @@ function M.UnImplementedItemUsage() local cyclone = IsItemAvailable("item_cyclone") if cyclone ~= nil and cyclone:IsFullyCastable() then if - npcTarget ~= nil and - (npcTarget:HasModifier("modifier_teleporting") or - npcTarget:HasModifier("modifier_abaddon_borrowed_time")) and + npcTarget ~= nil and npcTarget:IsChanneling() or + (npcTarget:HasModifier("modifier_teleporting") or AbilityExtensions:CannotKillNormally(npcTarget)) and CanCastOnTarget(npcTarget) and GetUnitToUnitDistance(npcBot, npcTarget) < 775 then @@ -851,6 +879,18 @@ function M.UnImplementedItemUsage() end end + local windWaker = IsItemAvailable("item_wind_waker") + if windWaker ~= nil and windWaker:IsFullyCastable() then + if npcTarget and npcTarget:IsChanneling() + or (npcTarget:HasModifier("modifier_teleporting") or AbilityExtensions:CannotKillNormally(npcTarget)) and + CanCastOnTarget(npcTarget) and + GetUnitToUnitDistance(npcBot, npcTarget) < 775 + then + npcBot:Action_UseAbilityOnEntity(windWaker, npcTarget) + return + end + end + local metham = IsItemAvailable("item_meteor_hammer") if metham ~= nil and metham:IsFullyCastable() then local tableNearbyAttackingAlliedHeroes = npcBot:GetNearbyHeroes(1000, false, BOT_MODE_ATTACK) @@ -893,7 +933,7 @@ function M.UnImplementedItemUsage() npcBot:GetActiveMode() == BOT_MODE_ATTACK) then if - npcTarget ~= nil and npcTarget:IsHero() and CanCastOnTarget(npcTarget) and + npcTarget ~= nil and npcTarget:IsHero() and AbilityExtensions:MayNotBeIllusion(npcBot, npcTarget) and CanCastOnTarget(npcTarget) and GetUnitToUnitDistance(npcBot, npcTarget) < 900 and npcTarget:HasModifier("modifier_item_spirit_vessel_damage") == false and npcTarget:GetHealth() / npcTarget:GetMaxHealth() < 0.65 @@ -905,7 +945,7 @@ function M.UnImplementedItemUsage() local Allies = npcBot:GetNearbyHeroes(1150, false, BOT_MODE_NONE) for _, Ally in pairs(Allies) do if - Ally:HasModifier("modifier_item_spirit_vessel_heal") == false and CanCastOnTarget(Ally) and + not Ally:IsIllusion() and Ally:HasModifier("modifier_item_spirit_vessel_heal") == false and CanCastOnTarget(Ally) and Ally:GetHealth() / Ally:GetMaxHealth() < 0.35 and #tableNearbyEnemyHeroes == 0 and Ally:WasRecentlyDamagedByAnyHero(2.5) == false @@ -917,8 +957,8 @@ function M.UnImplementedItemUsage() end end - local null = IsItemAvailable("item_nullifier") - if null ~= nil and null:IsFullyCastable() then + local nullifier = IsItemAvailable("item_nullifier") + if nullifier ~= nil and nullifier:IsFullyCastable() then if (npcBot:GetActiveMode() == BOT_MODE_ROAM or npcBot:GetActiveMode() == BOT_MODE_TEAM_ROAM or npcBot:GetActiveMode() == BOT_MODE_DEFEND_ALLY or @@ -929,7 +969,7 @@ function M.UnImplementedItemUsage() GetUnitToUnitDistance(npcBot, npcTarget) < 800 and npcTarget:HasModifier("modifier_item_nullifier_mute") == false then - npcBot:Action_UseAbilityOnEntity(null, npcTarget) + npcBot:Action_UseAbilityOnEntity(nullifier, npcTarget) return end end diff --git a/util/RoleUtility.lua b/util/RoleUtility.lua index 989965ed..f2dce397 100644 --- a/util/RoleUtility.lua +++ b/util/RoleUtility.lua @@ -1483,13 +1483,14 @@ X['invisHeroes'] = { ['npc_dota_hero_clinkz'] = 1, ['npc_dota_hero_mirana'] = 1, ['npc_dota_hero_riki'] = 1, + ["npc_dota_hero_rubic"] = 1, ['npc_dota_hero_nyx_assassin'] = 1, ['npc_dota_hero_bounty_hunter'] = 1, ['npc_dota_hero_invoker'] = 1, ['npc_dota_hero_sand_king'] = 1, - ['npc_dota_hero_treant'] = 1, - ['npc_dota_hero_broodmother'] = 1, - ['npc_dota_hero_weaver'] = 1 + ['npc_dota_hero_slark'] = 1, + ['npc_dota_hero_weaver'] = 1, + ["npc_dota_hero_wind_runner"] = 1, } function X.IsCarry(hero) @@ -1556,6 +1557,7 @@ X['off'] = { 'npc_dota_hero_beastmaster', 'npc_dota_hero_brewmaster', 'npc_dota_hero_bristleback', + 'npc_dota_hero_broodmother', 'npc_dota_hero_centaur', 'npc_dota_hero_dark_seer', 'npc_dota_hero_doom_bringer', @@ -1575,14 +1577,13 @@ X['off'] = { 'npc_dota_hero_tidehunter', 'npc_dota_hero_tusk', 'npc_dota_hero_venomancer', - 'npc_dota_hero_windrunner' + 'npc_dota_hero_windrunner', } X['mid'] = { 'npc_dota_hero_alchemist', 'npc_dota_hero_arc_warden', 'npc_dota_hero_bloodseeker', - 'npc_dota_hero_broodmother', 'npc_dota_hero_clinkz', 'npc_dota_hero_death_prophet', 'npc_dota_hero_dragon_knight', @@ -1590,7 +1591,6 @@ X['mid'] = { 'npc_dota_hero_huskar', 'npc_dota_hero_invoker', 'npc_dota_hero_kunkka', - 'npc_dota_hero_leshrac', 'npc_dota_hero_lina', 'npc_dota_hero_lone_druid', 'npc_dota_hero_medusa', @@ -1609,7 +1609,7 @@ X['mid'] = { 'npc_dota_hero_tinker', 'npc_dota_hero_tiny', 'npc_dota_hero_viper', - 'npc_dota_hero_zuus' + 'npc_dota_hero_zuus', } X['safe'] = { @@ -1620,6 +1620,7 @@ X['safe'] = { 'npc_dota_hero_gyrocopter', 'npc_dota_hero_juggernaut', 'npc_dota_hero_life_stealer', + 'npc_dota_hero_leshrac', 'npc_dota_hero_luna', 'npc_dota_hero_lycan', 'npc_dota_hero_monkey_king', @@ -1635,7 +1636,7 @@ X['safe'] = { 'npc_dota_hero_terrorblade', 'npc_dota_hero_troll_warlord', 'npc_dota_hero_ursa', - 'npc_dota_hero_weaver' + 'npc_dota_hero_weaver', } X['supp'] = { diff --git a/utility.lua b/utility.lua index 54ce781b..d9f71508 100644 --- a/utility.lua +++ b/utility.lua @@ -25,6 +25,13 @@ function utilityModule.UCanCast( npcEnemy )--magic immune return npcEnemy:CanBeSeen() and not npcEnemy:IsInvulnerable() and not utilityModule.HasImmuneDebuff(npcEnemy) and not npcEnemy:IsIllusion() and not npcEnemy:HasModifier("modifier_item_sphere") and not npcEnemy:HasModifier("modifier_item_sphere_target") end +function utilityModule.CanCastNoTarget() + return true +end +function utilityModule.CanCastPassive() + return true +end + function utilityModule.IsRoshan(npcTarget) return npcTarget ~= nil and npcTarget:IsAlive() and string.find(npcTarget:GetUnitName(), "roshan"); end