diff --git a/ability_item_usage_abaddon.lua b/ability_item_usage_abaddon.lua index 729fe07..e69b809 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 fun1 = AbilityExtensions +local A = require(GetScriptDirectory().."/util/MiraDota") local debugmode = false local npcBot = GetBot() if npcBot:IsIllusion() then @@ -101,11 +102,7 @@ Consider[1] = function() local Damage = ability:GetAbilityDamage() local SelfDamage = ability:GetSpecialValueInt("self_damage") local allys = npcBot:GetNearbyHeroes(CastRange + 150, false, BOT_MODE_NONE) - for _, hero in pairs(allys) do - if hero == npcBot then - table.remove(allys, _) - end - end + local allys = fun1:GetNearbyNonIllusionHeroes(npcBot, CastRange + 150, false):Filter(A.Hero.IsNotCreepHero) local WeakestAlly, AllyHealth = utility.GetWeakestUnit(allys) local enemys = npcBot:GetNearbyHeroes(CastRange + 150, true, BOT_MODE_NONE) local WeakestEnemy, HeroHealth = utility.GetWeakestUnit(enemys) @@ -223,9 +220,9 @@ Consider[2] = function() return RemapValClamped(rate, 15, 80, BOT_ACTION_DESIRE_MODERATE - 0.1, BOT_ACTION_DESIRE_VERYHIGH), t end end - if npcBot:GetActiveMode() == BOT_MODE_ATTACK or npcBot:GetActiveMode() == BOT_MODE_DEFEND_ALLY then + if fun1:IsAttackingEnemies(npcBot) then if WeakestAlly ~= nil then - if AllyHealth / WeakestAlly:GetMaxHealth() < 0.3 + 0.4 * ManaPercentage then + if AllyHealth / WeakestAlly:GetMaxHealth() < 0.3 then if CanCast[abilityNumber](WeakestAlly) then return BOT_ACTION_DESIRE_MODERATE, WeakestAlly end diff --git a/ability_item_usage_abaddon.mira b/ability_item_usage_abaddon.mira index 0c7d344..0b6235f 100644 --- a/ability_item_usage_abaddon.mira +++ b/ability_item_usage_abaddon.mira @@ -9,6 +9,7 @@ local utility = require( GetScriptDirectory().."/utility" ) require(GetScriptDirectory() .. "/ability_item_usage_generic") local AbilityExtensions = require(GetScriptDirectory().."/util/AbilityAbstraction") local fun1 = AbilityExtensions +local A = require(GetScriptDirectory().."/util/MiraDota") local debugmode=false local npcBot = GetBot() @@ -125,13 +126,9 @@ Consider[1]=function() -- TODO: lv 25 AOE mist coil local allys = npcBot:GetNearbyHeroes( CastRange+150, false, BOT_MODE_NONE ); - for _,hero in pairs (allys) - do - if (hero==npcBot) - then - table.remove(allys,_) - end - end + local allys = fun1:GetNearbyNonIllusionHeroes(npcBot, CastRange+150, false) + :Filter(A.Unit.IsNotCreepHero) + local WeakestAlly,AllyHealth=utility.GetWeakestUnit(allys) local enemys = npcBot:GetNearbyHeroes(CastRange+150,true,BOT_MODE_NONE) local WeakestEnemy,HeroHealth=utility.GetWeakestUnit(enemys) @@ -395,9 +392,11 @@ Consider[2]=function() local CastRange = ability:GetCastRange(); local Damage = ability:GetAbilityDamage(); - local allys = fun1:GetNearbyNonIllusionHeroes(npcBot, CastRange + 200, false):Filter(CanCast[2]):Filter { it -> - it:WasRecentlyDamagedByAnyHero(4) or it:WasRecentlyDamagedByTower(2) - } + local allys = fun1:GetNearbyNonIllusionHeroes(npcBot, CastRange + 200, false) + :Filter(CanCast[2]) + :Filter { it -> + it:WasRecentlyDamagedByAnyHero(4) or it:WasRecentlyDamagedByTower(2) + } local WeakestAlly,AllyHealth=utility.GetWeakestUnit(allys) local enemys = npcBot:GetNearbyHeroes(CastRange+300,true,BOT_MODE_NONE) local WeakestEnemy,HeroHealth=utility.GetWeakestUnit(enemys) @@ -444,12 +443,11 @@ Consider[2]=function() end --teamfightUsing - if(npcBot:GetActiveMode() == BOT_MODE_ATTACK or - npcBot:GetActiveMode() == BOT_MODE_DEFEND_ALLY) + if fun1:IsAttackingEnemies(npcBot) then if (WeakestAlly~=nil) then - if(AllyHealth/WeakestAlly:GetMaxHealth()<0.3+0.4*ManaPercentage) + if(AllyHealth/WeakestAlly:GetMaxHealth()<0.3) then if(CanCast[abilityNumber]( WeakestAlly )) then diff --git a/ability_item_usage_abyssal_underlord.lua b/ability_item_usage_abyssal_underlord.lua index d1c3a64..a18289e 100644 --- a/ability_item_usage_abyssal_underlord.lua +++ b/ability_item_usage_abyssal_underlord.lua @@ -8,6 +8,7 @@ local utility = require( GetScriptDirectory().."/utility" ) require(GetScriptDirectory() .. "/ability_item_usage_generic") local AbilityExtensions = require(GetScriptDirectory().."/util/AbilityAbstraction") +local A = require(GetScriptDirectory().."/util/MiraDota") local debugmode=false local npcBot = GetBot() @@ -28,16 +29,16 @@ local AbilityToLevelUp= Abilities[2], Abilities[1], Abilities[2], - Abilities[5], + Abilities[4], "talent", Abilities[2], - Abilities[5], + Abilities[4], Abilities[3], Abilities[3], "talent", Abilities[3], "nil", - Abilities[5], + Abilities[4], "nil", "talent", "nil", @@ -247,12 +248,9 @@ Consider[2]=function() --Location AOE Example -- 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:GetLocation(); - end + local channelingEnemy = A.Linq.First(enemys, function(t) return A.Hero.IsTeleporting(t) and CanCast[2](t) end) + if channelingEnemy then + return BOT_ACTION_DESIRE_HIGH, npcEnemy:GetLocation() end --try to kill enemy hero @@ -334,9 +332,9 @@ local darkRiftOriginalTarget local trackOriginalTargetPosition local darkRiftChosenTarget -Consider[5]=function() - - local abilityNumber=5 +-- 7.31 rework fiends_gate +Consider[4]=function() + local abilityNumber=4 -------------------------------------- -- Generic Variable Setting -------------------------------------- @@ -380,7 +378,7 @@ Consider[5]=function() local target = FindNearbyTeleportTarget(npcEnemy) if target ~= nil then darkRiftOriginalTarget = npcEnemy - return BOT_ACTION_DESIRE_HIGH, target, "Target" + return BOT_ACTION_DESIRE_HIGH, target:GetLocation(), "Location" end end end @@ -390,8 +388,8 @@ Consider[5]=function() end local darkRiftCancelRange = 1200^2 -Consider[6] = function() - local ability = AbilitiesReal[6] +Consider[5] = function() + local ability = AbilitiesReal[5] if not ability:IsFullyCastable() or ability:IsHidden() then return 0 end @@ -411,6 +409,7 @@ Consider[6] = function() end return 0 end +Consider[5] = A.Dota.EmptyDesireFun AbilityExtensions:AutoModifyConsiderFunction(npcBot, Consider, AbilitiesReal) function AbilityUsageThink() diff --git a/ability_item_usage_bane.lua b/ability_item_usage_bane.lua index 95cb433..efaebbe 100644 --- a/ability_item_usage_bane.lua +++ b/ability_item_usage_bane.lua @@ -318,7 +318,7 @@ Consider[3] = function() do local target = allies:First(function(t1) return fun1:Any(fun1:GetIncomingDodgeWorthProjectiles(t1), function(t) - return GetUnitToLocationDistance(it, t.location) <= 400 and not t.is_attack + return GetUnitToLocationDistance(it, t.location) <= 400 and not t.is_attack and not fun1:DontInterruptAlly(t) end) end) if target then diff --git a/ability_item_usage_bane.mira b/ability_item_usage_bane.mira index 57d20fd..24fc681 100644 --- a/ability_item_usage_bane.mira +++ b/ability_item_usage_bane.mira @@ -397,7 +397,9 @@ Consider[3]=function() return BOT_ACTION_DESIRE_MODERATE, target end if local target = allies:First { t1 -> - fun1:Any(fun1:GetIncomingDodgeWorthProjectiles(t1)) {t -> GetUnitToLocationDistance(it, t.location) <= 400 and not t.is_attack} + fun1:Any(fun1:GetIncomingDodgeWorthProjectiles(t1)) { + t -> GetUnitToLocationDistance(it, t.location) <= 400 and not t.is_attack and not fun1:DontInterruptAlly(t) + } } then return BOT_ACTION_DESIRE_MODERATE, target end diff --git a/ability_item_usage_bounty_hunter.lua b/ability_item_usage_bounty_hunter.lua index 9cefcd7..c3c1d28 100644 --- a/ability_item_usage_bounty_hunter.lua +++ b/ability_item_usage_bounty_hunter.lua @@ -6,6 +6,7 @@ local utility = require(GetScriptDirectory().."/utility") require(GetScriptDirectory().."/ability_item_usage_generic") local fun1 = require(GetScriptDirectory().."/util/AbilityAbstraction") +local A = require(GetScriptDirectory().."/util/MiraDota") local debugmode = false local npcBot = GetBot() if npcBot:IsIllusion() then @@ -153,7 +154,7 @@ Consider[1] = function() if CanCast[abilityNumber](npcEnemy) then if GetUnitToUnitDistance(npcBot, npcEnemy) < CastRange then return BOT_ACTION_DESIRE_HIGH, npcEnemy - elseif creeps[1] ~= nil and npcEnemy:HasModifier("modifier_bounty_hunter_track") then + elseif creeps[1] and GetUnitToUnitDistanceSqr(creeps[1], npcEnemy) <= 810000 and npcEnemy:HasModifier("modifier_bounty_hunter_track") then return BOT_ACTION_DESIRE_HIGH, creeps[1] end end @@ -215,7 +216,7 @@ Consider[4] = function() end local CastRange = Clamp(ability:GetCastRange(), 0, 1599) local realEnemies = fun1:GetNearbyNonIllusionHeroes(npcBot, CastRange):Filter(function(it) - return fun1:SpellCanCast(it) and it:IsHero() and fun1:MayNotBeIllusion(npcBot, it) + return fun1:SpellCanCast(it) and it:IsHero() and fun1:MayNotBeIllusion(npcBot, it) and A.Unit.IsNotCreepHero(it) end):Map(function(it) return { it, @@ -242,7 +243,7 @@ Consider[4] = function() end do local target = fun1:GetTargetIfGood(npcBot) - if target then + if target and target:GetTeam() ~= npcBot:GetTeam() and A.Unit.IsNotCreepHero(target) then return BOT_ACTION_DESIRE_HIGH, target end end diff --git a/ability_item_usage_bounty_hunter.mira b/ability_item_usage_bounty_hunter.mira index b581a76..40b2a23 100644 --- a/ability_item_usage_bounty_hunter.mira +++ b/ability_item_usage_bounty_hunter.mira @@ -8,6 +8,7 @@ local utility = require( GetScriptDirectory().."/utility" ) require(GetScriptDirectory() .. "/ability_item_usage_generic") local fun1 = require(GetScriptDirectory().."/util/AbilityAbstraction") +local A = require(GetScriptDirectory().."/util/MiraDota") local debugmode=false local npcBot = GetBot() @@ -234,7 +235,7 @@ Consider[1]=function() --Target Ability Example then if GetUnitToUnitDistance(npcBot,npcEnemy) - fun1:SpellCanCast(it) and it:IsHero() and fun1:MayNotBeIllusion(npcBot, it) + fun1:SpellCanCast(it) and it:IsHero() and fun1:MayNotBeIllusion(npcBot, it) + and A.Unit.IsNotCreepHero(it) }:Map { it -> { it, it:GetHealth() * HasTrackModifierPenalty(it) } }:SortByMinFirst { it -> it[2] } @@ -337,16 +339,21 @@ Consider[4]=function() local target = t[1] if fun1:IsFarmingOrPushing(npcBot) or npcBot:GetActiveMode() == BOT_MODE_LANING then if ManaPercentage >= 0.7 then + -- realEnemies:ForEach { t -> print("bh 1 "..t[1]:GetUnitName())} return BOT_ACTION_DESIRE_MODERATE, target end if fun1:GetHealthPercent(target) <= 0.5 then + -- realEnemies:ForEach { t -> print("bh 2 "..t[1]:GetUnitName())} return BOT_ACTION_DESIRE_HIGH, target end else return BOT_ACTION_DESIRE_HIGH, target end end - if local target = fun1:GetTargetIfGood(npcBot) then + if local target = fun1:GetTargetIfGood(npcBot); target and target:GetTeam() ~= npcBot:GetTeam() + and A.Unit.IsNotCreepHero(target) + then + -- print("bh 3 "..target:GetUnitName()) return BOT_ACTION_DESIRE_HIGH, target end diff --git a/ability_item_usage_brewmaster.lua b/ability_item_usage_brewmaster.lua index e9dbd87..333ecc7 100644 --- a/ability_item_usage_brewmaster.lua +++ b/ability_item_usage_brewmaster.lua @@ -24,21 +24,21 @@ ability_item_usage_generic.InitAbility(Abilities,AbilitiesReal,Talents) local AbilityToLevelUp= { Abilities[2], - Abilities[3], Abilities[1], Abilities[1], + Abilities[2], Abilities[1], Abilities[4], Abilities[1], Abilities[3], - Abilities[3], - "talent", - Abilities[3], - Abilities[4], - Abilities[2], Abilities[2], "talent", Abilities[2], + Abilities[4], + Abilities[3], + Abilities[3], + "talent", + Abilities[3], "nil", Abilities[4], "nil", diff --git a/ability_item_usage_chen.lua b/ability_item_usage_chen.lua index 8c2c12e..1eb5cfb 100644 --- a/ability_item_usage_chen.lua +++ b/ability_item_usage_chen.lua @@ -16,22 +16,22 @@ local Abilities = {} local AbilitiesReal = {} ability_item_usage_generic.InitAbility(Abilities, AbilitiesReal, Talents) local AbilityToLevelUp = { - Abilities[3], Abilities[1], - Abilities[3], + Abilities[2], + Abilities[2], Abilities[1], - Abilities[3], + Abilities[2], Abilities[4], - Abilities[3], + Abilities[2], Abilities[1], Abilities[1], "talent", - Abilities[2], + Abilities[3], Abilities[4], - Abilities[2], - Abilities[2], + Abilities[3], + Abilities[3], "talent", - Abilities[2], + Abilities[3], "nil", Abilities[4], "nil", @@ -47,13 +47,13 @@ local TalentTree = { return Talents[2] end, function() - return Talents[4] + return Talents[3] end, function() - return Talents[5] + return Talents[6] end, function() - return Talents[8] + return Talents[7] end, } utility.CheckAbilityBuild(AbilityToLevelUp) @@ -156,9 +156,11 @@ Consider[2] = function() local WeakestCreep, CreepHealth = utility.GetWeakestUnit(creeps) local creepsNeutral = npcBot:GetNearbyNeutralCreeps(1600) local StrongestCreep, CreepHealth2 = utility.GetStrongestUnit(creepsNeutral) + local holyPersuasionLevelLimit = AbilitiesReal[2]:GetLevel() + 2 + local canEnchantAncientCreep = npcBot:GetLevel() <= 15 if ManaPercentage >= 0.3 then for k, creep in pairs(creepsNeutral) do - if IsGoodNeutralCreeps(creep) or (creep:IsAncientCreep() and fun1:HasScepter(npcBot)) and CanCast[1](creep) then + if (IsGoodNeutralCreeps(creep) and holyPersuasionLevelLimit >= creep:GetLevel() or (creep:IsAncientCreep() and fun1:HasScepter(npcBot))) and CanCast[2](creep) and not creep:WasRecentlyDamagedByAnyHero(1.5) then return BOT_ACTION_DESIRE_HIGH, creep end end diff --git a/ability_item_usage_chen.mira b/ability_item_usage_chen.mira index ff525f3..9b03052 100644 --- a/ability_item_usage_chen.mira +++ b/ability_item_usage_chen.mira @@ -21,24 +21,24 @@ ability_item_usage_generic.InitAbility(Abilities,AbilitiesReal,Talents) local AbilityToLevelUp= { - Abilities[3], - Abilities[1], - Abilities[3], - Abilities[1], - Abilities[3], - Abilities[4], - Abilities[3], - Abilities[1], - Abilities[1], - "talent", - Abilities[2], - Abilities[4], - Abilities[2], - Abilities[2], - "talent", - Abilities[2], - "nil", - Abilities[4], + Abilities[1], + Abilities[2], + Abilities[2], + Abilities[1], + Abilities[2], + Abilities[4], + Abilities[2], + Abilities[1], + Abilities[1], + "talent", + Abilities[3], + Abilities[4], + Abilities[3], + Abilities[3], + "talent", + Abilities[3], + "nil", + Abilities[4], "nil", "talent", "nil", @@ -53,13 +53,13 @@ local TalentTree={ return Talents[2] end, function() - return Talents[4] + return Talents[3] end, function() - return Talents[5] + return Talents[6] end, function() - return Talents[8] + return Talents[7] end } @@ -312,9 +312,12 @@ Consider[2]=function() -- Mode based usage -------------------------------------- -- Find neural creeps + + local holyPersuasionLevelLimit = AbilitiesReal[2]:GetLevel() + 2 + local canEnchantAncientCreep = npcBot:GetLevel() <= 15 if ManaPercentage>=0.3 then for k,creep in pairs(creepsNeutral) do - if IsGoodNeutralCreeps(creep) or (creep:IsAncientCreep() and fun1:HasScepter(npcBot)) and CanCast[1](creep) + if (IsGoodNeutralCreeps(creep) and holyPersuasionLevelLimit >= creep:GetLevel() or (creep:IsAncientCreep() and fun1:HasScepter(npcBot)) ) and CanCast[2](creep) and not creep:WasRecentlyDamagedByAnyHero(1.5) then return BOT_ACTION_DESIRE_HIGH, creep; end diff --git a/ability_item_usage_clinkz.lua b/ability_item_usage_clinkz.lua index 92a2872..6048173 100644 --- a/ability_item_usage_clinkz.lua +++ b/ability_item_usage_clinkz.lua @@ -163,24 +163,37 @@ Consider[2] = AbilityExtensions:ToggleFunctionToAutoCast(npcBot, AbilitiesReal[2 return false end if target:IsHero() then - if AbilityExtensions:MustBeIllusion(npcBot, target) then + if AbilityExtensions:IsAttackingEnemies(npcBot) and npcBot:WasRecentlyDamagedByAnyHero(1) then + return false + end + if GetUnitToUnitDistanceSqr(npcBot, target) <= 190000 then + return false + elseif AbilityExtensions:MustBeIllusion(npcBot, target) then return AbilityExtensions:GetManaPercent(npcBot) >= 0.8 or AbilityExtensions:GetHealthPercent(target) <= 0.4 else return true end elseif target:IsBuilding() then - return false + return true else return AbilityExtensions:GetManaPercent(npcBot) >= 0.8 end end + local attackRange = npcBot:GetAttackRange() if AbilityExtensions:NotRetreating(npcBot) then + if npcBot:GetActiveMode() == BOT_MODE_LANING then + local creeps = npcBot:GetNearbyLaneCreeps(attackRange + 120, true) + local allyCreeps = npcBot:GetNearbyLaneCreeps(attackRange + 120, false) + if creeps and #creeps > 0 or allyCreeps and #allyCreeps > 0 then + return false + end + end local target = npcBot:GetAttackTarget() or npcBot:GetTarget() if target == nil then if WeakestEnemy ~= nil then local b = UseAt(WeakestEnemy) if b then - return BOT_ACTION_DESIRE_HIGH, WeakestEnemy + return BOT_ACTION_DESIRE_MODERATE, WeakestEnemy else return false end diff --git a/ability_item_usage_clinkz.mira b/ability_item_usage_clinkz.mira index fae29b2..80ca32c 100644 --- a/ability_item_usage_clinkz.mira +++ b/ability_item_usage_clinkz.mira @@ -162,7 +162,6 @@ Consider[1]=function() end end end - -- If my mana is enough, use it at enemy if ( npcBot:GetActiveMode() == BOT_MODE_LANING ) @@ -226,26 +225,39 @@ Consider[2] = AbilityExtensions:ToggleFunctionToAutoCast(npcBot, AbilitiesReal[2 return false end if target:IsHero() then - if AbilityExtensions:MustBeIllusion(npcBot, target) then + if AbilityExtensions:IsAttackingEnemies(npcBot) and npcBot:WasRecentlyDamagedByAnyHero(1) then + return false + end + if GetUnitToUnitDistanceSqr(npcBot, target) <= 190000 then + return false + elseif AbilityExtensions:MustBeIllusion(npcBot, target) then return AbilityExtensions:GetManaPercent(npcBot) >= 0.8 or AbilityExtensions:GetHealthPercent(target) <= 0.4 else return true end elseif target:IsBuilding() then - return false + return true else return AbilityExtensions:GetManaPercent(npcBot) >= 0.8 end end + local attackRange = npcBot:GetAttackRange() if AbilityExtensions:NotRetreating(npcBot) then + if npcBot:GetActiveMode() == BOT_MODE_LANING then + local creeps = npcBot:GetNearbyLaneCreeps(attackRange+120, true) + local allyCreeps = npcBot:GetNearbyLaneCreeps(attackRange+120, false) + if creeps and #creeps > 0 or allyCreeps and #allyCreeps > 0 then + return false + end + end local target = npcBot:GetAttackTarget() or npcBot:GetTarget() if target == nil then if WeakestEnemy ~= nil then local b = UseAt(WeakestEnemy) if b then - return BOT_ACTION_DESIRE_HIGH, WeakestEnemy + return BOT_ACTION_DESIRE_MODERATE, WeakestEnemy else return false end diff --git a/ability_item_usage_crystal_maiden.lua b/ability_item_usage_crystal_maiden.lua index 1653c6b..bf217a2 100644 --- a/ability_item_usage_crystal_maiden.lua +++ b/ability_item_usage_crystal_maiden.lua @@ -75,7 +75,7 @@ end local cast={} cast.Desire={} cast.Target={} cast.Type={} local Consider ={} local CanCast={utility.NCanCast,function(t) - return AbilityExtensions:StunCanCast(t, AbilitiesReal[2], false, false) + return AbilityExtensions:StunCanCast(t, AbilitiesReal[2], false, true) end,utility.NCanCast,utility.UCanCast} local enemyDisabled=utility.enemyDisabled diff --git a/ability_item_usage_doom_bringer.lua b/ability_item_usage_doom_bringer.lua index 38086d3..2b39baf 100644 --- a/ability_item_usage_doom_bringer.lua +++ b/ability_item_usage_doom_bringer.lua @@ -140,6 +140,26 @@ local function GetComboMana() end return mana end +local acquiredAbilityPriority = A.Linq.NewTable("satyr_trickster_purge", "mud_golem_hurl_boulder", "giant_wolf_intimidate", "granite_golem_granite_aura", "centaur_khan_war_stomp", "thunderhide_frenzy") +local devourUnitPriority = A.Linq.NewTable("npc_dota_neutral_satyr_trickster", "npc_dota_neutral_mud_golem", "npc_dota_neutral_giant_wolf", "npc_dota_neutral_granite_golem", "npc_dota_neutral_centaur_khan", "npc_dota_neutral_thunderhide") +local function GetAcquiredAbilityUnitPriority(acquiredAbility) + return (function() + if acquiredAbility == nil or acquiredAbility:IsHidden() then + return -100 + else + return acquiredAbilityPriority:IndexOf(acquiredAbility:GetName()) + end + end)() +end +local function GetUnitPriority(unit) + return devourUnitPriority:IndexOf(unit:GetUnitName()) +end +local function ToggleDevourAutoCast(ability, targetState) + if ability:GetAutoCastState() ~= targetState then + ability:ToggleAutoCast() + return true + end +end Consider[1] = function() local abilityNumber = 1 local ability = AbilitiesReal[abilityNumber] @@ -149,6 +169,15 @@ Consider[1] = function() do local strongstCreep = utility.GetStrongestUnit(A.Dota.GetNearbyCreeps(npcBot, 800, true):Concat(A.Dota.GetNearbyNeutralCreeps(npcBot, 800)):Filter(CanCast[1])) if strongstCreep then + if GetUnitPriority(strongstCreep) > GetAcquiredAbilityUnitPriority(AbilitiesReal[4]) then + if ToggleDevourAutoCast(ability, true) then + return 0 + end + else + if ToggleDevourAutoCast(ability, false) then + return 0 + end + end return BOT_ACTION_DESIRE_MODERATE, strongstCreep end end diff --git a/ability_item_usage_doom_bringer.mira b/ability_item_usage_doom_bringer.mira index 8499ea2..122cce5 100644 --- a/ability_item_usage_doom_bringer.mira +++ b/ability_item_usage_doom_bringer.mira @@ -145,6 +145,36 @@ local function GetComboMana() return mana end +local acquiredAbilityPriority = A.Linq.NewTable( + "satyr_trickster_purge", + "mud_golem_hurl_boulder", + "giant_wolf_intimidate", + "granite_golem_granite_aura", + "centaur_khan_war_stomp", + "thunderhide_frenzy" +) +local devourUnitPriority = A.Linq.NewTable( + "npc_dota_neutral_satyr_trickster", + "npc_dota_neutral_mud_golem", + "npc_dota_neutral_giant_wolf", + "npc_dota_neutral_granite_golem", + "npc_dota_neutral_centaur_khan", + "npc_dota_neutral_thunderhide" +) +local function GetAcquiredAbilityUnitPriority(acquiredAbility) + -> if acquiredAbility == nil or acquiredAbility:IsHidden() { -100 } + else { acquiredAbilityPriority:IndexOf(acquiredAbility:GetName()) } +-- the priority is higher when the unit is stronger +local function GetUnitPriority(unit) + -> devourUnitPriority:IndexOf(unit:GetUnitName()) + +local function ToggleDevourAutoCast(ability, targetState) + if ability:GetAutoCastState() ~= targetState then + ability:ToggleAutoCast() + return true + end +end + Consider[1]=function() local abilityNumber=1 -------------------------------------- @@ -157,6 +187,15 @@ Consider[1]=function() end if local strongstCreep = utility.GetStrongestUnit(A.Dota.GetNearbyCreeps(npcBot, 800, true):Concat(A.Dota.GetNearbyNeutralCreeps(npcBot, 800)):Filter(CanCast[1])) then + if GetUnitPriority(strongstCreep) > GetAcquiredAbilityUnitPriority(AbilitiesReal[4]) then + if ToggleDevourAutoCast(ability, true) then + return 0 + end + else + if ToggleDevourAutoCast(ability, false) then + return 0 + end + end return BOT_ACTION_DESIRE_MODERATE, strongstCreep end diff --git a/ability_item_usage_drow_ranger.lua b/ability_item_usage_drow_ranger.lua index dd102ff..924eb81 100644 --- a/ability_item_usage_drow_ranger.lua +++ b/ability_item_usage_drow_ranger.lua @@ -108,14 +108,17 @@ Consider[1] = function() return false end if target:IsHero() then + if AbilityExtensions:IsAttackingEnemies(npcBot) and npcBot:WasRecentlyDamagedByAnyHero(1) then + return false + end local modifier = target:GetModifierByName("modifier_drow_ranger_frost_arrows_slow") if modifier ~= -1 and target:GetModifierRemainingDuration(modifier) > npcBot:GetAttackSpeed()/100*0.7/1.7 + 0.2 then return AbilityExtensions:GetManaPercent(npcBot) >= 0.65 end if AbilityExtensions:MustBeIllusion(npcBot, target) then - return (AbilityExtensions:GetManaPercent(npcBot) >= 0.8 or AbilityExtensions:GetHealthPercent(target) <= 0.4) and (GetUnitToUnitDistance(npcBot, target) >= 300 or npcBot:GetLevel() < 6) + return (AbilityExtensions:GetManaPercent(npcBot) >= 0.8 or AbilityExtensions:GetHealthPercent(target) <= 0.4) and GetUnitToUnitDistanceSqr(npcBot, target) >= 190000 else - return AbilityExtensions:GetManaPercent(npcBot) >= 0.3 or AbilityExtensions:GetManaPercent(npcBot) >= 0.2 and (GetUnitToUnitDistance(npcBot, target) >= 300 or npcBot:GetLevel() < 6) + return AbilityExtensions:GetManaPercent(npcBot) >= 0.3 or AbilityExtensions:GetManaPercent(npcBot) >= 0.2 and GetUnitToUnitDistanceSqr(npcBot, target) >= 190000 end elseif target:IsBuilding() then return false @@ -125,13 +128,22 @@ Consider[1] = function() return 0 end + local attackRange = npcBot:GetAttackRange() if AbilityExtensions:NotRetreating(npcBot) then + if npcBot:GetActiveMode() == BOT_MODE_LANING then + local creeps = npcBot:GetNearbyLaneCreeps(attackRange+120, true) + local allyCreeps = npcBot:GetNearbyLaneCreeps(attackRange+120, false) + if creeps and #creeps > 0 or allyCreeps and #allyCreeps > 0 then + return false + end + end + local target = npcBot:GetAttackTarget() if target == nil then if WeakestEnemy ~= nil then local b = UseAt(WeakestEnemy) if b then - return BOT_ACTION_DESIRE_HIGH, WeakestEnemy + return BOT_ACTION_DESIRE_MODERATE, WeakestEnemy else return false end diff --git a/ability_item_usage_enchantress.lua b/ability_item_usage_enchantress.lua index 8534111..a0d54f6 100644 --- a/ability_item_usage_enchantress.lua +++ b/ability_item_usage_enchantress.lua @@ -8,6 +8,7 @@ local utility = require( GetScriptDirectory().."/utility" ) require(GetScriptDirectory() .. "/ability_item_usage_generic") local AbilityExtensions = require(GetScriptDirectory().."/util/AbilityAbstraction") +local A = require(GetScriptDirectory().."/util/MiraDota") local debugmode=false @@ -50,7 +51,7 @@ local AbilityToLevelUp= local TalentTree={ function() - return Talents[1] + return Talents[2] end, function() return Talents[3] @@ -59,7 +60,7 @@ local TalentTree={ return Talents[5] end, function() - return Talents[7] + return Talents[8] end } @@ -140,18 +141,27 @@ Consider[2]=function() -- dispell local buffedEnemies = AbilityExtensions:Filter(enemys, function(t) return CanCast[2](t) end) - buffedEnemies = AbilityExtensions:Map(enemys, function(t) return {t, AbilityExtensions:IndexOfBasicDispellablePositiveModifier(t)} end) - buffedEnemies = AbilityExtensions:Filter(buffedEnemies, function(t) return t[2] ~= -1 end) - buffedEnemies = AbilityExtensions:SortByMinFirst(buffedEnemies, function(t) return t[2] end) + :Map(function(t) return {t, AbilityExtensions:IndexOfBasicDispellablePositiveModifier(t)} end) + :Filter(function(t) return t[2] ~= -1 end) + :SortByMinFirst(function(t) return t[2] end) if AbilityExtensions:Any(buffedEnemies) then return BOT_ACTION_DESIRE_MODERATE, buffedEnemies[1][1] end + -- 7.31c level limit on enchanting + local enchantLevelLimit = 6 + local abilityLevel = AbilitiesReal[2]:GetLevel() + if abilityLevel == 1 then + enchantLevelLimit = 4 + elseif abilityLevel == 2 then + enchantLevelLimit = 5 + end + local canEnchantAncientCreep = npcBot:GetLevel() >= 20 -- Find neural creeps if(ManaPercentage>=0.4) then - for k,creep in pairs(creepsNeutral) do - if IsGoodNeutralCreeps(creep) and not creep:WasRecentlyDamagedByAnyHero(1.5) + for _, creep in pairs(creepsNeutral) do + if (IsGoodNeutralCreeps(creep) and creep:GetLevel() <= enchantLevelLimit or creep:IsAncientCreep() and canEnchantAncientCreep) and not creep:WasRecentlyDamagedByAnyHero(1.5) then return BOT_ACTION_DESIRE_MODERATE, creep; end diff --git a/ability_item_usage_generic.lua b/ability_item_usage_generic.lua index b785f20..e17d1d2 100644 --- a/ability_item_usage_generic.lua +++ b/ability_item_usage_generic.lua @@ -393,6 +393,9 @@ function UseAbility(AbilitiesReal, cast) local function CallWithTarget() cast.Type[j] = "Target" + -- if cast.Target[j]:GetTeam() == npcBot:GetTeam() then + -- print(ability:GetName().." used at "..cast.Target[j]:GetUnitName()) + -- end -- if not AbilityExtensions:IsHero(cast.Target[j]) then -- print("target at creep"..ability:GetName()) -- end diff --git a/ability_item_usage_jakiro.lua b/ability_item_usage_jakiro.lua index 2eb9e4c..8965da3 100644 --- a/ability_item_usage_jakiro.lua +++ b/ability_item_usage_jakiro.lua @@ -395,23 +395,23 @@ Consider[3]=function() end end + if npcBot:GetActiveMode() == BOT_MODE_PUSH_TOWER_TOP or + npcBot:GetActiveMode() == BOT_MODE_PUSH_TOWER_MID or + npcBot:GetActiveMode() == BOT_MODE_PUSH_TOWER_BOT then + local tower = towers[1] + if tower then + if A.Building.CanBeAttacked(tower) and tower:GetAttackTarget() and tower:GetAttackTarget() ~= npcBot or GetUnitToUnitDistanceSqr(npcBot, tower) >= 250000 then + return BOT_ACTION_DESIRE_HIGH, tower + 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 - return BOT_ACTION_DESIRE_LOW, WeakestCreep; - end - end - - 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 - local tower = towers[1] - if tower then - if A.Building.CanBeAttacked(tower) then - return BOT_ACTION_DESIRE_VERYHIGH, tower - end + return BOT_ACTION_DESIRE_MODERATE, WeakestCreep end end @@ -530,12 +530,23 @@ Consider[4] = function() end end + if npcBot:GetActiveMode() == BOT_MODE_PUSH_TOWER_TOP or + npcBot:GetActiveMode() == BOT_MODE_PUSH_TOWER_MID or + npcBot:GetActiveMode() == BOT_MODE_PUSH_TOWER_BOT then + local tower = towers[1] + if tower then + if A.Building.CanBeAttacked(tower) and tower:GetAttackTarget() and tower:GetAttackTarget() ~= npcBot or GetUnitToUnitDistanceSqr(npcBot, tower) >= 250000 then + return BOT_ACTION_DESIRE_HIGH, tower + 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 - return BOT_ACTION_DESIRE_LOW, WeakestCreep; + return BOT_ACTION_DESIRE_MODERATE, WeakestCreep end end diff --git a/ability_item_usage_legion_commander.lua b/ability_item_usage_legion_commander.lua index 9c5b9f7..ad97045 100644 --- a/ability_item_usage_legion_commander.lua +++ b/ability_item_usage_legion_commander.lua @@ -378,7 +378,7 @@ Consider[4]=function() then if ( CanCast[abilityNumber]( WeakestEnemy )) then - if(HeroHealth<=WeakestEnemy:GetActualIncomingDamage(GetComboDamage(),DAMAGE_TYPE_ALL) and #allys >=#enemys) and + if(HeroHealth<=WeakestEnemy:GetActualIncomingDamage(GetComboDamage(),DAMAGE_TYPE_ALL) and #allys >=#enemys) then return BOT_ACTION_DESIRE_HIGH,WeakestEnemy; end diff --git a/ability_item_usage_lich.lua b/ability_item_usage_lich.lua index e0182ef..4ba641f 100644 --- a/ability_item_usage_lich.lua +++ b/ability_item_usage_lich.lua @@ -299,51 +299,26 @@ consider[2] = function() end end - -- Attack roshan - --if (npcBot:GetActiveMode() == BOT_MODE_ROSHAN) then - -- local npcTarget - -- for _, creep in pairs(creeps) do - -- if (AbilityHelper.isRoshan(creep)) then - -- npcTarget = creep - -- break - -- end - -- end - -- - -- local roshanTarget = npcTarget:GetAttackTarget() - -- if (isManaEnough and AbilityHelper.isValidTarget(roshanTarget)) then - -- return BOT_ACTION_DESIRE_HIGH, roshanTarget - -- end - --end - - -- If we're farming - if (activeMode == BOT_MODE_FARM) then - if (#creeps >= 2 and CanCast[abilityIndex](weakestCreep)) then - if (isManaEnough) then - return BOT_ACTION_DESIRE_LOW, npcBot - 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) - then - local allyCreeps = npcBot:GetNearbyCreeps(serachDistance, false) - local strongestAllyCreep = AbilityHelper.getStrongestUnit(allyCreeps) - if (isManaEnough and abilities[abilityIndex]:GetLevel() >= 1) then - if (#allyCreeps >= 1) then - if (CanCast[abilityIndex](strongestAllyCreep)) then - if (GetUnitToUnitDistance(npcBot, strongestAllyCreep) < castRange + 75 * #allys) then - return BOT_ACTION_DESIRE_LOW, strongestAllyCreep - end - end - end - end - end + -- if + -- (npcBot:GetActiveMode() == BOT_MODE_PUSH_TOWER_TOP or npcBot:GetActiveMode() == BOT_MODE_PUSH_TOWER_MID or + -- npcBot:GetActiveMode() == BOT_MODE_PUSH_TOWER_BOT or + -- npcBot:GetActiveMode() == BOT_MODE_DEFEND_TOWER_TOP or + -- npcBot:GetActiveMode() == BOT_MODE_DEFEND_TOWER_MID or + -- npcBot:GetActiveMode() == BOT_MODE_DEFEND_TOWER_BOT) + -- then + -- local allyCreeps = npcBot:GetNearbyCreeps(serachDistance, false) + -- local strongestAllyCreep = AbilityHelper.getStrongestUnit(allyCreeps) + -- if (isManaEnough and abilities[abilityIndex]:GetLevel() >= 1) then + -- if (#allyCreeps >= 1) then + -- if (CanCast[abilityIndex](strongestAllyCreep)) then + -- if (GetUnitToUnitDistance(npcBot, strongestAllyCreep) < castRange + 75 * #allys) then + -- return BOT_ACTION_DESIRE_LOW, strongestAllyCreep + -- end + -- end + -- end + -- end + -- end -- If we're going after someone if diff --git a/ability_item_usage_magnataur.lua b/ability_item_usage_magnataur.lua index a568a2a..01b374c 100644 --- a/ability_item_usage_magnataur.lua +++ b/ability_item_usage_magnataur.lua @@ -76,7 +76,7 @@ end local cast={} cast.Desire={} cast.Target={} cast.Type={} local Consider ={} local CanCast={utility.NCanCast,utility.NCanCast,utility.NCanCast,function(t) - return AbilityExtensions:StunCanCast(t, AbilitiesReal[4], false, false) + return AbilityExtensions:StunCanCast(t, AbilitiesReal[4], true, false) end} local enemyDisabled=utility.enemyDisabled diff --git a/ability_item_usage_mirana.lua b/ability_item_usage_mirana.lua index d29e75c..7df8e9d 100644 --- a/ability_item_usage_mirana.lua +++ b/ability_item_usage_mirana.lua @@ -381,7 +381,7 @@ Consider[4]=function() npcBot:GetActiveMode() == BOT_MODE_DEFEND_ALLY or npcBot:GetActiveMode() == BOT_MODE_ATTACK ) then - local npcEnemy = npcBot:GetTarget(); + local npcEnemy = AbilityExtensions:GetTargetIfGood(npcBot) if ( npcEnemy ~= nil ) then diff --git a/ability_item_usage_necrolyte.lua b/ability_item_usage_necrolyte.lua index ab81253..ff6e7b6 100644 --- a/ability_item_usage_necrolyte.lua +++ b/ability_item_usage_necrolyte.lua @@ -6,6 +6,7 @@ local utility = require(GetScriptDirectory().."/utility") require(GetScriptDirectory().."/ability_item_usage_generic") local AbilityExtensions = require(GetScriptDirectory().."/util/AbilityAbstraction") +local A = require(GetScriptDirectory().."/util/MiraDota") local debugmode = false local npcBot = GetBot() if npcBot:IsIllusion() then @@ -257,21 +258,31 @@ Consider[5] = function() local CastRange = ability:GetCastRange() local DamagePercent = ability:GetSpecialValueFloat("damage_per_health") local allys = npcBot:GetNearbyHeroes(1200, false, BOT_MODE_NONE) - local enemys = AbilityExtensions:GetPureHeroes(npcBot, CastRange + 300) + local enemys = AbilityExtensions:GetPureHeroes(npcBot, CastRange + 300):Filter(A.Unit.IsNotCreepHero) local WeakestEnemy, HeroHealth = utility.GetWeakestUnit(enemys) local maxHealth = (AbilityExtensions:GetNearbyHeroes(npcBot):MaxV(function(t) return t:GetHealth() - end) or npcBot:GetHealth()) / 4 + end) or npcBot:GetHealth()) / 3 + local allyNumber = AbilityExtensions:GetEnemyHeroNumber(npcBot, AbilityExtensions:Filter(allys, function(t) + return AbilityExtensions:IsAttackingEnemies(t) or not t:IsBot() + end)) + do + local enemy = enemys:First(A.Hero.IsTeleporting) + if enemy and CanCast[abilityNumber](enemy) then + local k = (1 - enemy:GetMagicResist()) * d * (1 + 0.08 * allyNumber) + local maxHealthPercentToKill = k / (1 + k) + if AbilityExtensions:GetHealthPercent(enemy) <= maxHealthPercentToKill then + return BOT_ACTION_DESIRE_HIGH, enemy + end + end + end if npcBot:GetActiveMode() ~= BOT_MODE_RETREAT then for i, npcEnemy in pairs(enemys) do if (CanCast[abilityNumber](npcEnemy)) and not npcEnemy:IsMagicImmune() then - local Damage = (npcEnemy:GetMaxHealth() - npcEnemy:GetHealth()) * DamagePercent + local Damage = (npcEnemy:GetMaxHealth() - npcEnemy:GetHealth()) * DamagePercent * (1 + allyNumber * 0.06) 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) * (0.85 + #allys * 0.05) and (npcEnemy:GetHealth() >= (ability:GetLevel() * 100 + 300) and npcEnemy:GetHealth() > maxHealth or AbilityExtensions:GetHealthPercent(npcEnemy) <= 0.45 and AbilityExtensions:GetHealthPercent(npcEnemy) >= 0.2) then + if npcEnemy:GetHealth() <= npcEnemy:GetActualIncomingDamage(Damage, DAMAGE_TYPE_MAGICAL) and (npcEnemy:GetHealth() >= (ability:GetLevel() * 100 + 300) and npcEnemy:GetHealth() > maxHealth and AbilityExtensions:GetHealthPercent(npcEnemy) >= 0.25) then return BOT_ACTION_DESIRE_HIGH, npcEnemy end end diff --git a/ability_item_usage_necrolyte.mira b/ability_item_usage_necrolyte.mira index 6a2e2ac..817a38c 100644 --- a/ability_item_usage_necrolyte.mira +++ b/ability_item_usage_necrolyte.mira @@ -8,6 +8,7 @@ local utility = require( GetScriptDirectory().."/utility" ) require(GetScriptDirectory() .. "/ability_item_usage_generic") local AbilityExtensions = require(GetScriptDirectory().."/util/AbilityAbstraction") +local A = require(GetScriptDirectory().."/util/MiraDota") local debugmode=false @@ -87,8 +88,8 @@ end,utility.NCanCast,utility.NCanCast,{ t -> AbilityExtensions:NormalCanCast(t) } },function(t) - return AbilityExtensions:NormalCanCast(t) and not AbilityExtensions:HasAnyModifier(t, AbilityExtensions.CannotKillModifiers) -end} + -> AbilityExtensions:NormalCanCast(t) and not AbilityExtensions:HasAnyModifier(t, AbilityExtensions.CannotKillModifiers) +} local enemyDisabled=utility.enemyDisabled function GetComboDamage() @@ -352,32 +353,40 @@ Consider[5]=function() local allys = npcBot:GetNearbyHeroes( 1200, false, BOT_MODE_NONE ) - local enemys = AbilityExtensions:GetPureHeroes(npcBot, CastRange+300) + local enemys = AbilityExtensions:GetPureHeroes(npcBot, CastRange+300):Filter(A.Unit.IsNotCreepHero) local WeakestEnemy,HeroHealth=utility.GetWeakestUnit(enemys) local maxHealth = (AbilityExtensions:GetNearbyHeroes(npcBot):MaxV { t -> t:GetHealth() - } or npcBot:GetHealth()) / 4 + } or npcBot:GetHealth()) / 3 + local allyNumber = AbilityExtensions:GetEnemyHeroNumber(npcBot, AbilityExtensions:Filter(allys) { t -> + AbilityExtensions:IsAttackingEnemies(t) or not t:IsBot() + }) + -------------------------------------- -- Global high-priorty usage -------------------------------------- --Try to kill enemy hero + if local enemy = enemys:First(A.Hero.IsTeleporting); enemy and CanCast[abilityNumber](enemy) then + local k = (1-enemy:GetMagicResist()) * d * (1 + 0.08 * allyNumber) + local maxHealthPercentToKill = k / (1 + k) + if AbilityExtensions:GetHealthPercent(enemy) <= maxHealthPercentToKill then + return BOT_ACTION_DESIRE_HIGH, enemy + end + end + if(npcBot:GetActiveMode() ~= BOT_MODE_RETREAT ) then for i,npcEnemy in pairs(enemys) do if ( CanCast[abilityNumber]( npcEnemy ) ) and not npcEnemy:IsMagicImmune() then - local Damage=(npcEnemy:GetMaxHealth()-npcEnemy:GetHealth())*DamagePercent + local Damage=(npcEnemy:GetMaxHealth()-npcEnemy:GetHealth())*DamagePercent* (1+allyNumber*0.06) 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) * (0.85+#allys*0.05) - and (npcEnemy:GetHealth() >= (ability:GetLevel()*100+300) and npcEnemy:GetHealth() > maxHealth - or AbilityExtensions:GetHealthPercent(npcEnemy) <= 0.45 and AbilityExtensions:GetHealthPercent(npcEnemy) >= 0.2) + if npcEnemy:GetHealth()<=npcEnemy:GetActualIncomingDamage(Damage,DAMAGE_TYPE_MAGICAL) + and (npcEnemy:GetHealth() >= (ability:GetLevel()*100+300) and npcEnemy:GetHealth() > maxHealth + and AbilityExtensions:GetHealthPercent(npcEnemy) >= 0.25) then return BOT_ACTION_DESIRE_HIGH,npcEnemy end diff --git a/ability_item_usage_pudge.lua b/ability_item_usage_pudge.lua index 120843d..f8f7353 100644 --- a/ability_item_usage_pudge.lua +++ b/ability_item_usage_pudge.lua @@ -87,11 +87,8 @@ Consider[1] = function() local hookSpeed = ability:GetSpecialValueFloat("hook_speed") local allNearbyUnits = AbilityExtensions:GetNearbyAllUnits(npcBot, range):Remove(npcBot) local function NotBlockedByAnyUnit(line, target, distance) - return AbilityExtensions:All(AbilityExtensions:Remove(allNearbyUnits, target), function(t) + return AbilityExtensions:Remove(allNearbyUnits, target):All(function(t) local closeEnough = AbilityExtensions:GetPointToLineDistance(t:GetLocation(), line) <= searchRadius + target:GetBoundingRadius() - if closeEnough then - print("want to hook "..target:GetUnitName()..", blocked by "..t:GetUnitName()) - end local mayHook = closeEnough and distance > GetUnitToUnitDistance(npcBot, t) return not mayHook or t:IsInvulnerable() end) @@ -115,13 +112,13 @@ Consider[1] = function() if #enemies ~= 0 then return BOT_MODE_DESIRE_HIGH, enemies[1]:GetExtrapolatedLocation(GetUnitToUnitDistance(npcBot, enemies[1]) / hookSpeed) end - local allies = AbilityExtensions:GetNearbyNonIllusionHeroes(npcBot, range, false, BOT_MODE_NONE) - allies = AbilityExtensions:Filter(allies, function(t) - return t:IsStunned() or t:IsRooted() - end) - allies = AbilityExtensions:Filter(allies, T) - if #allies ~= 0 then - return BOT_MODE_DESIRE_HIGH, allies[1]:GetExtrapolatedLocation(GetUnitToUnitDistance(npcBot, enemies[1]) / hookSpeed) + do + local ally = AbilityExtensions:GetNearbyNonIllusionHeroes(npcBot, range, false, BOT_MODE_NONE):Filter(allies, function(t) + return t:IsStunned() or t:IsRooted() + end):First(allies, T) + if ally then + return BOT_MODE_DESIRE_HIGH, ally:GetExtrapolatedLocation(GetUnitToUnitDistance(npcBot, enemies[1]) / hookSpeed) + end end end if AbilityExtensions:IsAttackingEnemies(npcBot) then @@ -138,6 +135,7 @@ Consider[1] = function() else ItemUsage.UseItemOnLocation(npcBot, atos, t:GetLocation()) end + return 0 end end end @@ -168,9 +166,11 @@ Consider[2] = function() return 0 end if AbilityExtensions:IsAttackingEnemies(npcBot) or AbilityExtensions:IsRetreating(npcBot) then - local nearbyEnemies = AbilityExtensions:GetNearbyHeroes(npcBot, radius, true) - if nearbyEnemies:Any(CanCast[2]) then - return true + do + local nearbyEnemies = AbilityExtensions:GetNearbyHeroes(npcBot, radius, true) + if nearbyEnemies:Any(CanCast[2]) then + return true + end end end do @@ -215,26 +215,30 @@ Consider[5] = function() local hookedEnemy = AbilityExtensions:First(AbilityExtensions:GetNearbyNonIllusionHeroes(npcBot, range, true, BOT_MODE_NONE), function(t) return t:IsHero() and AbilityExtensions:MayNotBeIllusion(npcBot, t) and t:HasModifier("modifier_pudge_meat_hook") end) - if hookedEnemy ~= nil then + if hookedEnemy then return BOT_MODE_DESIRE_VERYHIGH, hookedEnemy end do local target = AbilityExtensions:GetTargetIfGood(npcBot) - if target ~= nil and CanCast[5](target) and GetUnitToUnitDistance(npcBot, target) <= range then + if target and CanCast[5](target) and GetUnitToUnitDistance(npcBot, target) <= range then return BOT_MODE_DESIRE_HIGH, target end end local nearbyEnemies = AbilityExtensions:GetNearbyNonIllusionHeroes(npcBot, 900, true, BOT_MODE_NONE) if AbilityExtensions:IsAttackingEnemies(npcBot) then - local u = utility.GetWeakestUnit(nearbyEnemies) - if u ~= nil and CanCast[5](u) then - return BOT_MODE_DESIRE_HIGH, u + do + local u = utility.GetWeakestUnit(nearbyEnemies) + if u and CanCast[5](u) then + return BOT_MODE_DESIRE_HIGH, u + end end end if AbilityExtensions:IsRetreating(npcBot) and #nearbyEnemies == 1 then - local loneEnemy = nearbyEnemies[1] - if not AbilityExtensions:HasAbilityRetargetModifier(loneEnemy) and CanCast[5](loneEnemy) then - return BOT_MODE_DESIRE_MODERATE, loneEnemy + do + local loneEnemy = nearbyEnemies[1] + if loneEnemy and not AbilityExtensions:HasAbilityRetargetModifier(loneEnemy) and CanCast[5](loneEnemy) then + return BOT_MODE_DESIRE_MODERATE, loneEnemy + end end end return 0 diff --git a/ability_item_usage_pudge.mira b/ability_item_usage_pudge.mira index ba9fb55..d42dfe4 100644 --- a/ability_item_usage_pudge.mira +++ b/ability_item_usage_pudge.mira @@ -69,11 +69,16 @@ end -------------------------------------- local cast={} cast.Desire={} cast.Target={} cast.Type={} local Consider ={} -local CanCast={function(t) - return AbilityExtensions:NormalCanCast(t, false, DAMAGE_TYPE_PURE, true, false) -end,AbilityExtensions.NormalCanCastFunction,utility.NCanCast,utility.CanCastNoTarget,function(t) - return AbilityExtensions:NormalCanCast(t, false, DAMAGE_TYPE_MAGICAL, true, true) and not AbilityExtensions:HasAbilityRetargetModifier(t) -end} +local CanCast = { { t -> + AbilityExtensions:NormalCanCast(t, false, DAMAGE_TYPE_PURE, true, false) + }, + AbilityExtensions.NormalCanCastFunction, + utility.NCanCast, + utility.CanCastNoTarget, + { t -> + AbilityExtensions:NormalCanCast(t, false, DAMAGE_TYPE_MAGICAL, true, true) and not AbilityExtensions:HasAbilityRetargetModifier(t) + } +} Consider[1] = function() local ability = AbilitiesReal[1] @@ -86,16 +91,15 @@ Consider[1] = function() local hookSpeed = ability:GetSpecialValueFloat("hook_speed") local allNearbyUnits = AbilityExtensions:GetNearbyAllUnits(npcBot, range):Remove(npcBot) - local function NotBlockedByAnyUnit(line, target, distance) - return AbilityExtensions:All(AbilityExtensions:Remove(allNearbyUnits, target), function(t) + local function NotBlockedByAnyUnit(line, target, distance) -> + AbilityExtensions:Remove(allNearbyUnits, target):All { t -> local closeEnough = AbilityExtensions:GetPointToLineDistance(t:GetLocation(), line) <= searchRadius + target:GetBoundingRadius() - if closeEnough then - print("want to hook "..target:GetUnitName()..", blocked by "..t:GetUnitName()) - end + -- if closeEnough then + -- print("want to hook "..target:GetUnitName()..", blocked by "..t:GetUnitName()) + -- end local mayHook = closeEnough and distance > GetUnitToUnitDistance(npcBot, t) return not mayHook or t:IsInvulnerable() - end) - end + } local function T(target) if not CanCast[1](target) then return false end @@ -114,11 +118,10 @@ Consider[1] = function() return BOT_MODE_DESIRE_HIGH, enemies[1]:GetExtrapolatedLocation(GetUnitToUnitDistance(npcBot, enemies[1]) / hookSpeed) end - local allies = AbilityExtensions:GetNearbyNonIllusionHeroes(npcBot, range, false, BOT_MODE_NONE) - allies = AbilityExtensions:Filter(allies, function(t) return t:IsStunned() or t:IsRooted() end) - allies = AbilityExtensions:Filter(allies, T) - if #allies ~= 0 then - return BOT_MODE_DESIRE_HIGH, allies[1]:GetExtrapolatedLocation(GetUnitToUnitDistance(npcBot, enemies[1]) / hookSpeed) + if local ally = AbilityExtensions:GetNearbyNonIllusionHeroes(npcBot, range, false, BOT_MODE_NONE) + :Filter(allies) { t -> t:IsStunned() or t:IsRooted() } + :First(allies, T) then + return BOT_MODE_DESIRE_HIGH, ally:GetExtrapolatedLocation(GetUnitToUnitDistance(npcBot, enemies[1]) / hookSpeed) end end @@ -132,6 +135,7 @@ Consider[1] = function() else ItemUsage.UseItemOnLocation(npcBot, atos, t:GetLocation()) end + return 0 end end @@ -157,21 +161,17 @@ Consider[2] = function() return 0 end if AbilityExtensions:IsAttackingEnemies(npcBot) or AbilityExtensions:IsRetreating(npcBot) then - local nearbyEnemies = AbilityExtensions:GetNearbyHeroes(npcBot, radius, true) - if nearbyEnemies:Any(CanCast[2]) then + if local nearbyEnemies = AbilityExtensions:GetNearbyHeroes(npcBot, radius, true); nearbyEnemies:Any(CanCast[2]) then return true end end - do - local target = npcBot:GetTarget() - if target and GetUnitToUnitDistance(target, npcBot) <= radius and CanCast[2](target) then - if not AbilityExtensions:IsHero(target) or AbilityExtensions:MustBeIllusion(npcBot, target) then - if npcBot:GetHealth() <= 270 or AbilityExtensions:GetHealthPercent(npcBot) <= 0.3 and npcBot:WasRecentlyDamagedByHero(target, 1.5) then - return false - end + if local target = npcBot:GetTarget(); target and GetUnitToUnitDistance(target, npcBot) <= radius and CanCast[2](target) then + if not AbilityExtensions:IsHero(target) or AbilityExtensions:MustBeIllusion(npcBot, target) then + if npcBot:GetHealth() <= 270 or AbilityExtensions:GetHealthPercent(npcBot) <= 0.3 and npcBot:WasRecentlyDamagedByHero(target, 1.5) then + return false end - return true end + return true end return false @@ -204,29 +204,24 @@ Consider[5] = function() return nil end local range = ability:GetCastRange() + 100 - local hookedEnemy = AbilityExtensions:First(AbilityExtensions:GetNearbyNonIllusionHeroes(npcBot, range, true, BOT_MODE_NONE), function(t) - return t:IsHero() and AbilityExtensions:MayNotBeIllusion(npcBot, t) and t:HasModifier("modifier_pudge_meat_hook") - end) - if hookedEnemy ~= nil then + local hookedEnemy = AbilityExtensions:First(AbilityExtensions:GetNearbyNonIllusionHeroes(npcBot, range, true, BOT_MODE_NONE)) { t -> + t:IsHero() and AbilityExtensions:MayNotBeIllusion(npcBot, t) and t:HasModifier("modifier_pudge_meat_hook") + } + if hookedEnemy then return BOT_MODE_DESIRE_VERYHIGH, hookedEnemy end - do - local target = AbilityExtensions:GetTargetIfGood(npcBot) - if target ~= nil and CanCast[5](target) and GetUnitToUnitDistance(npcBot, target) <= range then - return BOT_MODE_DESIRE_HIGH, target - end + if local target = AbilityExtensions:GetTargetIfGood(npcBot); target and CanCast[5](target) and GetUnitToUnitDistance(npcBot, target) <= range then + return BOT_MODE_DESIRE_HIGH, target end local nearbyEnemies = AbilityExtensions:GetNearbyNonIllusionHeroes(npcBot, 900, true, BOT_MODE_NONE) if AbilityExtensions:IsAttackingEnemies(npcBot) then - local u = utility.GetWeakestUnit(nearbyEnemies) - if u ~= nil and CanCast[5](u) then + if local u = utility.GetWeakestUnit(nearbyEnemies); u and CanCast[5](u) then return BOT_MODE_DESIRE_HIGH, u end end if AbilityExtensions:IsRetreating(npcBot) and #nearbyEnemies == 1 then - local loneEnemy = nearbyEnemies[1] - if not AbilityExtensions:HasAbilityRetargetModifier(loneEnemy) and CanCast[5](loneEnemy) then + if local loneEnemy = nearbyEnemies[1]; loneEnemy and not AbilityExtensions:HasAbilityRetargetModifier(loneEnemy) and CanCast[5](loneEnemy) then return BOT_MODE_DESIRE_MODERATE, loneEnemy end end diff --git a/ability_item_usage_queenofpain.lua b/ability_item_usage_queenofpain.lua index 9c3c1c2..264751f 100644 --- a/ability_item_usage_queenofpain.lua +++ b/ability_item_usage_queenofpain.lua @@ -508,7 +508,7 @@ function AbilityUsageThink() local index, target = ability_item_usage_generic.UseAbility(AbilitiesReal,cast) if index == 4 then if sonicWaveTime and sonicWaveTargetLoc == target then - if DotaTime() - sonicWaveTime > 0.8 then + if DotaTime() - sonicWaveTime > 0.45 then npcBot:Action_ClearActions(false) sonicWaveTime = nil end diff --git a/ability_item_usage_riki.lua b/ability_item_usage_riki.lua index a0da56e..43b10a7 100644 --- a/ability_item_usage_riki.lua +++ b/ability_item_usage_riki.lua @@ -18,11 +18,6 @@ local AbilitiesReal ={} ability_item_usage_generic.InitAbility(Abilities,AbilitiesReal,Talents) --- utility.PrintAbilityName(Abilities) -local abilityName = { "riki_smoke_screen", "riki_blink_strike", "riki_tricks_of_the_trade", "riki_poison_dart", "riki_backstab" } -local abilityIndex = utility.ReverseTable(abilityName) - - local AbilityToLevelUp= { Abilities[3], diff --git a/ability_item_usage_silencer.lua b/ability_item_usage_silencer.lua index 98e0f67..19d0db8 100644 --- a/ability_item_usage_silencer.lua +++ b/ability_item_usage_silencer.lua @@ -237,6 +237,9 @@ Consider[2] = function() if not CanCast[abilityNumber](target) then return false end + if AbilityExtensions:IsAttackingEnemies(npcBot) and npcBot:WasRecentlyDamagedByAnyHero(1) then + return false + end if target:IsHero() then if AbilityExtensions:MustBeIllusion(npcBot, target) then return AbilityExtensions:GetManaPercent(npcBot) >= 0.8 or AbilityExtensions:GetHealthPercent(target) <= 0.4 @@ -248,10 +251,18 @@ Consider[2] = function() else return AbilityExtensions:GetManaPercent(npcBot) >= 0.8 end - end + local attackRange = npcBot:GetAttackRange() if AbilityExtensions:NotRetreating(npcBot) then + if npcBot:GetActiveMode() == BOT_MODE_LANING then + local creeps = npcBot:GetNearbyLaneCreeps(attackRange+120, true) + local allyCreeps = npcBot:GetNearbyLaneCreeps(attackRange+120, false) + if creeps and #creeps > 0 or allyCreeps and #allyCreeps > 0 then + return false + end + end + local target = npcBot:GetAttackTarget() or npcBot:GetTarget() if target == nil then if WeakestEnemy ~= nil then diff --git a/ability_item_usage_skywrath_mage.lua b/ability_item_usage_skywrath_mage.lua index bcb14d6..8c4ebbf 100644 --- a/ability_item_usage_skywrath_mage.lua +++ b/ability_item_usage_skywrath_mage.lua @@ -74,9 +74,9 @@ end -------------------------------------- local cast={} cast.Desire={} cast.Target={} cast.Type={} local Consider ={} -local CanCast={utility.NCanCast,utility.NCanCast,function(t) +local CanCast={ AbilityExtensions.NormalCanCastFunction,utility.NCanCast,function(t) return AbilityExtensions:StunCanCast(t, AbilitiesReal[3], false, true, true, false) -end,utility.UCanCast} +end,utility.NCanCast} local enemyDisabled=utility.enemyDisabled function GetComboDamage() diff --git a/ability_item_usage_slardar.lua b/ability_item_usage_slardar.lua index 854a1a5..f260d7f 100644 --- a/ability_item_usage_slardar.lua +++ b/ability_item_usage_slardar.lua @@ -281,8 +281,11 @@ Consider[2]=function() end end - return BOT_ACTION_DESIRE_NONE, 0; - + return BOT_ACTION_DESIRE_NONE, 0 +end + +local function CorrosiveHazeRemainingDurationLessThan(target, time) + return AbilityExtensions:GetMagicImmuneRemainingDuration(target, "modifier_slardar_amplify_damage") <= time end Consider[4]=function() @@ -299,12 +302,12 @@ Consider[4]=function() local CastRange = ability:GetCastRange(); local Damage = ability:GetAbilityDamage(); - 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 -------------------------------------- @@ -315,7 +318,7 @@ Consider[4]=function() then if ( CanCast[abilityNumber]( WeakestEnemy ) ) then - if(HeroHealth<=WeakestEnemy:GetActualIncomingDamage(Damage,DAMAGE_TYPE_PHYSICAL) or (HeroHealth<=WeakestEnemy:GetActualIncomingDamage(GetComboDamage(),DAMAGE_TYPE_PHYSICAL) and npcBot:GetMana()>ComboMana)) + if (HeroHealth<=WeakestEnemy:GetActualIncomingDamage(Damage,DAMAGE_TYPE_PHYSICAL) or (HeroHealth<=WeakestEnemy:GetActualIncomingDamage(GetComboDamage(),DAMAGE_TYPE_PHYSICAL) and npcBot:GetMana()>ComboMana)) and CorrosiveHazeRemainingDurationLessThan(WeakestEnemy, 6) then return BOT_ACTION_DESIRE_HIGH,WeakestEnemy; end @@ -333,7 +336,7 @@ Consider[4]=function() then for _,npcEnemy in pairs(enemys) do - if(CanCast[abilityNumber]( npcEnemy )) + if CanCast[abilityNumber]( npcEnemy ) and CorrosiveHazeRemainingDurationLessThan(npcEnemy, 12) then return BOT_ACTION_DESIRE_LOW, npcEnemy; end @@ -341,21 +344,6 @@ Consider[4]=function() end end - -- If we're farming - if ( npcBot:GetActiveMode() == BOT_MODE_FARM ) - then - if ( #creeps >= 1 ) - then - for _,tempcreep in pairs(creeps) - do - if(tempcreep:GetHealth()>=600 and npcBot:GetMana()>ComboMana and CanCast[abilityNumber]( tempcreep )) - then - return BOT_ACTION_DESIRE_LOW, tempcreep; - end - end - end - end - -- If we're going after someone if ( npcBot:GetActiveMode() == BOT_MODE_ROAM or npcBot:GetActiveMode() == BOT_MODE_TEAM_ROAM or @@ -366,7 +354,7 @@ Consider[4]=function() if ( npcEnemy ~= nil ) then - if ( CanCast[abilityNumber]( npcEnemy ) and GetUnitToUnitDistance(npcBot,npcEnemy)< CastRange + 75*#allys) + if CanCast[abilityNumber]( npcEnemy ) and CorrosiveHazeRemainingDurationLessThan(npcEnemy, 6) then return BOT_ACTION_DESIRE_MODERATE, npcEnemy end diff --git a/ability_item_usage_terrorblade.lua b/ability_item_usage_terrorblade.lua index e3aaba9..0a76043 100644 --- a/ability_item_usage_terrorblade.lua +++ b/ability_item_usage_terrorblade.lua @@ -77,8 +77,11 @@ end local cast={} cast.Desire={} cast.Target={} cast.Type={} local Consider ={} local CanCast={function(t) - return AbilityExtensions:StunCanCast(t, AbilitiesReal[1], false, false, true, false) -end,utility.CanCastNoTarget,utility.CanCastNoTarget,utility.NCanCast,utility.NCanCast,AbilityExtensions.NormalCanCastFunction} + return AbilityExtensions:StunCanCast(t, AbilitiesReal[1], false, false, true, false) + and A.Unit.IsNotCreepHero(t) +end,utility.CanCastNoTarget,utility.CanCastNoTarget,utility.NCanCast,utility.NCanCast, function(t) + return AbilityExtensions:NormalCanCast(t, _, DAMAGE_TYPE_PURE, true) and A.Unit.IsNotCreepHero(t) +end} local enemyDisabled=utility.enemyDisabled function GetComboDamage() diff --git a/ability_item_usage_undying.lua b/ability_item_usage_undying.lua index aafae75..7c6cd73 100644 --- a/ability_item_usage_undying.lua +++ b/ability_item_usage_undying.lua @@ -8,6 +8,7 @@ local utility = require( GetScriptDirectory().."/utility" ) require(GetScriptDirectory() .. "/ability_item_usage_generic") local AbilityExtensions = require(GetScriptDirectory().."/util/AbilityAbstraction") +local A = require(GetScriptDirectory().."/util/MiraDota") local debugmode=false local npcBot = GetBot() @@ -154,24 +155,6 @@ Consider[1]=function() end end end - - -- If we're pushing or defending a lane and can hit 4+ creeps, go for it - if ( npcBot:GetActiveMode() == BOT_MODE_PUSH_TOWER_TOP or - npcBot:GetActiveMode() == BOT_MODE_PUSH_TOWER_MID or - npcBot:GetActiveMode() == BOT_MODE_PUSH_TOWER_BOT or - npcBot:GetActiveMode() == BOT_MODE_DEFEND_TOWER_TOP or - npcBot:GetActiveMode() == BOT_MODE_DEFEND_TOWER_MID or - npcBot:GetActiveMode() == BOT_MODE_DEFEND_TOWER_BOT ) - then - if(ManaPercentage>0.4 or npcBot:GetMana()>ComboMana ) - then - local locationAoE = npcBot:FindAoELocation( true, true, npcBot:GetLocation(), CastRange, Radius, CastPoint, 0 ); - if ( locationAoE.count >=2 and GetUnitToLocationDistance(npcBot,locationAoE.targetloc)<=CastRange) - then - return BOT_ACTION_DESIRE_MODERATE-0.03, locationAoE.targetloc; - end - end - end -- If we're going after someone if ( npcBot:GetActiveMode() == BOT_MODE_ROAM or @@ -181,7 +164,7 @@ Consider[1]=function() then local npcEnemy = npcBot:GetTarget(); - if ( npcEnemy ~= nil ) + if npcEnemy and npcEnemy:IsHero() and AbilityExtensions:MayNotBeIllusion(npcBot, npcEnemy) and A.Unit.IsNotCreepHero(npcEnemy) then if ( CanCast[abilityNumber]( npcEnemy ) and GetUnitToUnitDistance(npcBot,npcEnemy)0.4 or npcBot:GetMana()>ComboMana)) + if ManaPercentage>0.8 and npcBot:GetMana()>ComboMana + 230 then local locationAoE = npcBot:FindAoELocation( true, false, npcBot:GetLocation(), CastRange, Radius, CastPoint, Damage ); @@ -201,11 +184,7 @@ Consider[1]=function() then return BOT_ACTION_DESIRE_LOW, locationAoE.targetloc; end - end - - if((ManaPercentage>0.4 or npcBot:GetMana()>ComboMana)) - then - local locationAoE = npcBot:FindAoELocation( true, true, npcBot:GetLocation(), CastRange, Radius, CastPoint, 0 ); + if ( locationAoE.count >= 2 and GetUnitToLocationDistance(npcBot,locationAoE.targetloc)<=CastRange) then return BOT_ACTION_DESIRE_LOW, locationAoE.targetloc; @@ -215,7 +194,7 @@ Consider[1]=function() -- If we're farming and can kill 3+ creeps if ( npcBot:GetActiveMode() == BOT_MODE_FARM ) then - if(ManaPercentage>0.4 or npcBot:GetMana()>ComboMana ) + if ManaPercentage>0.8 and npcBot:GetMana()>ComboMana + 230 then local locationAoE = npcBot:FindAoELocation( true, false, npcBot:GetLocation(), CastRange, Radius, CastPoint, 0 ); if ( locationAoE.count >= 3 and GetUnitToLocationDistance(npcBot,locationAoE.targetloc)<=CastRange) then diff --git a/ability_item_usage_venomancer.lua b/ability_item_usage_venomancer.lua index 02c9146..0e347d9 100644 --- a/ability_item_usage_venomancer.lua +++ b/ability_item_usage_venomancer.lua @@ -149,7 +149,7 @@ Consider[1]=function() --Target Ability Example then for _,npcEnemy in pairs( enemys ) do - if ( npcBot:WasRecentlyDamagedByHero( npcEnemy, 2.0 ) ) + if ( npcBot:WasRecentlyDamagedByHero( npcEnemy, 2.0 ) ) and CanCast[1](npcEnemy) then return BOT_ACTION_DESIRE_HIGH, npcEnemy:GetLocation(); end @@ -169,7 +169,7 @@ Consider[1]=function() --Target Ability Example if ( npcBot:GetActiveMode() == BOT_MODE_FARM ) then local locationAoE = npcBot:FindAoELocation( true, false, npcBot:GetLocation(), CastRange, Radius, 0, Damage ); - if ( locationAoE.count >= 3 ) then + if ( locationAoE.count >= 3 ) and #allys <= 2 then return BOT_ACTION_DESIRE_LOW, locationAoE.targetloc; end end @@ -184,7 +184,7 @@ Consider[1]=function() --Target Ability Example then local locationAoE = npcBot:FindAoELocation( true, false, npcBot:GetLocation(), CastRange, Radius, 0, 0 ); - if ( locationAoE.count >= 3 ) + if ( locationAoE.count >= 3 ) and #allys <= 2 then return BOT_ACTION_DESIRE_LOW, locationAoE.targetloc; end diff --git a/ability_item_usage_viper.lua b/ability_item_usage_viper.lua index d7e2b4a..435b0e7 100644 --- a/ability_item_usage_viper.lua +++ b/ability_item_usage_viper.lua @@ -20,22 +20,22 @@ ability_item_usage_generic.InitAbility(Abilities,AbilitiesReal,Talents) local AbilityToLevelUp= { + Abilities[2], Abilities[1], + Abilities[2], Abilities[3], + Abilities[2], + Abilities[4], + Abilities[2], Abilities[1], - Abilities[3], Abilities[1], - Abilities[4], + "talent", Abilities[1], + Abilities[4], Abilities[3], Abilities[3], "talent", - Abilities[2], - Abilities[4], - Abilities[2], - Abilities[2], - "talent", - Abilities[2], + Abilities[3], "nil", Abilities[4], "nil", diff --git a/ability_item_usage_warlock.lua b/ability_item_usage_warlock.lua index 0cbe573..a922119 100644 --- a/ability_item_usage_warlock.lua +++ b/ability_item_usage_warlock.lua @@ -419,22 +419,6 @@ Consider[3]=function() -------------------------------------- -- Mode based usage -------------------------------------- - -- If we're pushing or defending a lane and can hit 4+ creeps, go for it - if ( npcBot:GetActiveMode() == BOT_MODE_PUSH_TOWER_TOP or - npcBot:GetActiveMode() == BOT_MODE_PUSH_TOWER_MID or - npcBot:GetActiveMode() == BOT_MODE_PUSH_TOWER_BOT or - npcBot:GetActiveMode() == BOT_MODE_DEFEND_TOWER_TOP or - npcBot:GetActiveMode() == BOT_MODE_DEFEND_TOWER_MID or - npcBot:GetActiveMode() == BOT_MODE_DEFEND_TOWER_BOT ) - then - local locationAoE = npcBot:FindAoELocation( true, true, npcBot:GetLocation(), CastRange, Radius, 0, 0 ); - - if ( locationAoE.count >= 2 ) - then - return BOT_ACTION_DESIRE_LOW, locationAoE.targetloc; - end - end - -- If we're going after someone if ( npcBot:GetActiveMode() == BOT_MODE_ROAM or npcBot:GetActiveMode() == BOT_MODE_TEAM_ROAM or @@ -548,11 +532,10 @@ function AbilityUsageThink() if upheavelTimer == nil then upheavelTimer = DotaTime() else - local enemies = npcBot:GetNearbyHeroes(1500, true, BOT_MODE_NONE) - enemies = AbilityExtensions:Count(enemies, function(t) + local enemies = AbilityExtensions:Count(npcBot:GetNearbyHeroes(1500, true, BOT_MODE_NONE), function(t) return t:HasModifier("modifier_warlock_upheavel") end) - if enemies == 0 then + if #enemies == 0 then if DotaTime() > upheavelTimer + 1.5 then npcBot:Action_ClearActions(true) upheavelTimer = nil diff --git a/ability_item_usage_winter_wyvern.lua b/ability_item_usage_winter_wyvern.lua index 7c55ed8..17bb31f 100644 --- a/ability_item_usage_winter_wyvern.lua +++ b/ability_item_usage_winter_wyvern.lua @@ -93,9 +93,9 @@ local CanCast={utility.NCanCast,utility.NCanCast,function(t) -- GetUnitList(UNIT_LIST_ALL) return AbilityExtensions:Any(allUnits, function(t) return t:HasModifier("modifier_faceless_void_chronosphere_freeze") - end) or AbilityExtensions:Any(t:GetNearbyHeroes(300, true, BOT_MODE_NONE, function(t) + end) or AbilityExtensions:Any(t:GetNearbyHeroes(300, true, BOT_MODE_NONE), function(t) return t:HasModifier("modifier_faceless_void_timelock_freeze") - end)) + end) end return AbilityExtensions:AllyCanCast(t) and (not AbilityExtensions:DontInterruptAlly(t) or t:HasModifier("modifier_medusa_stone_gaze") and t:GetActiveMode() == BOT_MODE_RETREAT) and not t:IsChanneling() end,function(t) diff --git a/item_purchase_beastmaster.lua b/item_purchase_beastmaster.lua index 5c950da..73dc9c7 100644 --- a/item_purchase_beastmaster.lua +++ b/item_purchase_beastmaster.lua @@ -16,7 +16,7 @@ local ItemsToBuy = "item_vladmir", --祭品 "item_black_king_bar", --BKB "item_helm_of_the_overlord", --level 2 helm dominator 7.30 - "item_solar_crest", --大勋章7.20 + "item_assault", "item_ultimate_scepter", "item_ultimate_scepter_2", "item_heart", diff --git a/item_purchase_lich.lua b/item_purchase_lich.lua index 7132256..f332f1d 100644 --- a/item_purchase_lich.lua +++ b/item_purchase_lich.lua @@ -13,7 +13,7 @@ local ItemsToBuy = "item_boots", "item_tranquil_boots", "item_urn_of_shadows", - -- "item_ghost", + "item_ghost", "item_glimmer_cape", --微光 "item_force_staff", "item_lotus_orb", --清莲宝珠 diff --git a/item_purchase_luna.lua b/item_purchase_luna.lua index e547106..551b3d0 100644 --- a/item_purchase_luna.lua +++ b/item_purchase_luna.lua @@ -13,8 +13,7 @@ local ItemsToBuy = "item_power_treads", --假腿7.21 "item_mask_of_madness", --疯狂面具7.06 "item_yasha", --单刀 - "item_ultimate_orb", - "item_recipe_manta", + "item_manta", "item_hurricane_pike", --大推推7.20 "item_black_king_bar", "item_aghanims_shard", diff --git a/item_purchase_necrolyte.lua b/item_purchase_necrolyte.lua index 666abbb..4e7dceb 100644 --- a/item_purchase_necrolyte.lua +++ b/item_purchase_necrolyte.lua @@ -9,7 +9,6 @@ local ItemsToBuy = "item_null_talisman", "item_tango", "item_enchanted_mango", - "item_null_talisman", "item_boots", "item_magic_wand", --大魔棒7.14 "item_veil_of_discord", --纷争7.20 diff --git a/item_purchase_nyx_assassin.lua b/item_purchase_nyx_assassin.lua index cf4795c..7c38ee0 100644 --- a/item_purchase_nyx_assassin.lua +++ b/item_purchase_nyx_assassin.lua @@ -12,15 +12,14 @@ local ItemsToBuy = "item_flask", "item_magic_stick", --大魔棒7.14 "item_boots", - "item_hand_of_midas", --点金 "item_arcane_boots", - "item_blink", - "item_dagon", + "item_magic_wand", + "item_hand_of_midas", --点金 "item_ultimate_scepter", --蓝杖 + "item_dagon", "item_force_staff", --推推 "item_guardian_greaves", "item_dagon_3", - "item_recipe_dagon", "item_overwhelming_blink", "item_ultimate_scepter_2", "item_sheepstick", diff --git a/item_purchase_obsidian_destroyer.lua b/item_purchase_obsidian_destroyer.lua index 3ba5281..df89c2d 100644 --- a/item_purchase_obsidian_destroyer.lua +++ b/item_purchase_obsidian_destroyer.lua @@ -9,6 +9,7 @@ local ItemsToBuy = { "item_tango", "item_null_talisman", --无用挂件 + "item_null_talisman", --无用挂件 "item_power_treads", --假腿7.21 "item_dragon_lance", --魔龙枪 "item_witch_blade", diff --git a/item_purchase_shredder.lua b/item_purchase_shredder.lua index 6904bcc..98c5667 100644 --- a/item_purchase_shredder.lua +++ b/item_purchase_shredder.lua @@ -11,7 +11,9 @@ local ItemsToBuy = "item_flask", "item_magic_wand", "item_arcane_boots", --秘法鞋 + "item_aether_lens", "item_hood_of_defiance", + "item_kaya", "item_octarine_core", "item_ultimate_scepter", --蓝杖 "item_shivas_guard", --希瓦 diff --git a/item_purchase_silencer.lua b/item_purchase_silencer.lua index 239287e..a54ff83 100644 --- a/item_purchase_silencer.lua +++ b/item_purchase_silencer.lua @@ -12,15 +12,16 @@ local ItemsToBuy = "item_magic_stick", "item_power_treads", --假腿7.21 "item_witch_blade", + "item_dragon_lance", "item_hurricane_pike", --大推推7.20 "item_aghanims_shard", "item_orchid", - "item_bloodthorn", "item_sheepstick", --羊刀 "item_gungir", "item_ultimate_scepter", --蓝杖 "item_ultimate_scepter_2", "item_moon_shard", + "item_bloodthorn", } ItemPurchaseSystem:CreateItemInformationTable(GetBot(), ItemsToBuy) diff --git a/mode_item_generic.lua b/mode_item_generic.lua index 2ecc928..90feed8 100644 --- a/mode_item_generic.lua +++ b/mode_item_generic.lua @@ -1,5 +1,5 @@ --------------------------------------------- --- Generated from Mirana Compiler version 1.6.1 +-- Generated from Mirana Compiler version 1.6.2 -- Do not modify -- https://github.com/AaronSong321/Mirana --------------------------------------------- @@ -18,8 +18,6 @@ local function PrintCarriedItems(bot) end function OnStart() bot = GetBot() - PrintCarriedItems(bot) end function OnEnd() - PrintCarriedItems(bot) end diff --git a/mode_item_generic.mira b/mode_item_generic.mira index 21d273e..dd75a72 100644 --- a/mode_item_generic.mira +++ b/mode_item_generic.mira @@ -13,10 +13,10 @@ end function OnStart() bot = GetBot() - PrintCarriedItems(bot) + -- PrintCarriedItems(bot) end function OnEnd() - PrintCarriedItems(bot) + -- PrintCarriedItems(bot) end diff --git a/util/AbilityAbstraction.lua b/util/AbilityAbstraction.lua index b7b87da..831b7ed 100644 --- a/util/AbilityAbstraction.lua +++ b/util/AbilityAbstraction.lua @@ -1040,6 +1040,7 @@ M.positiveForceMovementModifiers = { "modifier_pangolier_swashbuckle_stunned", "modiifer_pangolier_shield_crash_jump", "modifier_pangolier_rollup", + "modifier_lone_druid_true_form_transform", "modifier_snapfire_firesnap_cookie", "modifier_snapfire_gobble_up", "modifier_sand_king_burrowstrike", @@ -1621,7 +1622,7 @@ M.enemyVisibleIllusionModifiers = { "modifier_vengefulspirit_hybrid_special", } M.MustBeIllusion = function(self, npcBot, target) - if npcBot:GetTeam() == target:GetTeam() then + if target.GetTeam and npcBot:GetTeam() == target:GetTeam() then return target:IsIllusion() end if target.markedAsIllusion then @@ -1797,11 +1798,14 @@ M.CanHardlyMove = function(self, npc) return npc:IsStunned() or npc:IsRooted() or npc:GetCurrentMovementSpeed() <= 150 end M.GetModifierRemainingDuration = function(self, npc, modifierName) - local mod = npc:GetModifierByName(modifierName) - if mod ~= -1 then - return npc:GetModifierRemainingDuration(mod) - end - return 0 + return (function() + local mod = npc:GetModifierByName(modifierName) + if mod ~= -1 then + return npc:GetModifierRemainingDuration(mod) + else + return 0 + end + end)() end M.imprisonmentModifier = { "modifier_item_cyclone", @@ -2928,13 +2932,14 @@ function M:GetBattlePower(npc) power = power + 1000 end if npc:GetLevel() >= 30 then - power = power + 1000 + power = power + 600 + end + if name:match("lone_druid") then + power = power * 0.25 end elseif string.match(name, "npc_dota_lone_druid_bear") then local heroLevel = GetHeroLevel(npc:GetPlayerID()) - power = name[#"npc_dota_lone_druid_bear" + 1] * 2000 - 1000 - power = power + heroLevel * 310 - power = power + npc:GetNetWorth() + power = name[#"npc_dota_lone_druid_bear" + 2] * 2000 - 1000 + heroLevel * 310 + npc:GetNetWorth() * 0.75 end if npc:HasModifier "modifier_item_assault_positive" and not npc:HasModifier "modifier_item_assault_positive_aura" then power = power + 1500 diff --git a/util/AbilityAbstraction.mira b/util/AbilityAbstraction.mira index 96eab00..d556d89 100644 --- a/util/AbilityAbstraction.mira +++ b/util/AbilityAbstraction.mira @@ -1130,6 +1130,7 @@ M.positiveForceMovementModifiers = { "modifier_pangolier_swashbuckle_stunned", "modiifer_pangolier_shield_crash_jump", "modifier_pangolier_rollup", + "modifier_lone_druid_true_form_transform", "modifier_snapfire_firesnap_cookie", "modifier_snapfire_gobble_up", "modifier_sand_king_burrowstrike", @@ -1742,7 +1743,7 @@ M.enemyVisibleIllusionModifiers = { -- end M.MustBeIllusion = function(self, npcBot, target) - if npcBot:GetTeam() == target:GetTeam() then + if target.GetTeam and npcBot:GetTeam() == target:GetTeam() then return target:IsIllusion() end -- if self:HasAnyModifier(target, self.enemyVisibleIllusionModifiers) or not self:GetEnemyHeroNames():Contains(target:GetUnitName()) then @@ -1925,13 +1926,11 @@ M.CanHardlyMove = function(self, npc) return npc:IsStunned() or npc:IsRooted() or npc:GetCurrentMovementSpeed() <= 150 end -M.GetModifierRemainingDuration = function(self, npc, modifierName) - local mod = npc:GetModifierByName(modifierName) - if mod ~= -1 then +M.GetModifierRemainingDuration = function(self, npc, modifierName) -> + if local mod = npc:GetModifierByName(modifierName); mod ~= -1 { return npc:GetModifierRemainingDuration(mod) - end - return 0 -end + } + else { 0 } M.imprisonmentModifier = { "modifier_item_cyclone", @@ -3184,16 +3183,19 @@ function M:GetBattlePower(npc) if string.match(name, "npc_dota_hero") then power = npc:GetNetWorth() + npc:GetLevel() * 1000 if npc:GetLevel() >= 25 then - power = power + 1000 + power += 1000 end if npc:GetLevel() >= 30 then - power = power + 1000 + power += 600 + end + if name:match("lone_druid") then + power *= 0.25 end elseif string.match(name, "npc_dota_lone_druid_bear") then local heroLevel = GetHeroLevel(npc:GetPlayerID()) - power = name[#"npc_dota_lone_druid_bear"+1]*2000-1000 - power = power + heroLevel * 310 - power = power + npc:GetNetWorth() + power = name[#"npc_dota_lone_druid_bear"+2]*2000-1000 + + heroLevel * 310 + + npc:GetNetWorth()*0.75 end if npc:HasModifier "modifier_item_assault_positive" and not npc:HasModifier "modifier_item_assault_positive_aura" then power = power + 1500 diff --git a/util/PushUtility2.lua b/util/PushUtility2.lua index a53a86b..aef6948 100644 --- a/util/PushUtility2.lua +++ b/util/PushUtility2.lua @@ -1,5 +1,5 @@ --------------------------------------------- --- Generated from Mirana Compiler version 1.6.1 +-- Generated from Mirana Compiler version 1.6.2 -- Do not modify -- https://github.com/AaronSong321/Mirana ---------------------------------------------