Skip to content

Commit

Permalink
Update for 7.31c (#69)
Browse files Browse the repository at this point in the history
Fix legion_commander;
Fix abaddon cast certain abilities on creep heroes;
Fix drow_ranger, clinkz, silencer auto-cast abilities cast whenever possible;
Prevent crystal_maiden from casting frostbite on antimage_counterspell;
Add doom_bringer auto-cast devour when devouring better creeps;
Fix jakiro doesn't cast liquid_fire, liquid_frost on buildings;
Decrease desire of lich casting frost_armour on creeps;
Fix abyssal_underlord casting pit_of_malice on non-teleporting enemeis;
Fix mirana casting moon_shadow on creep heroes;
Add necrolyte casting reapers_scythe on teleporting enemies;
Prevent slardar from casting corrosive_haze on affected units;
Decrease desire of undying casting decay on creeps;
Change brewmaster, viper ability level-up up to 7.31c;
Prevent nyx_assassin casting impale on magic immune targets;
Prevent venomancer casting venomous_gale on magic immune targets;
Decrease desire of warlock casting upheavel on creeps;
Fix typos in winter_wyvern source;
Change item build lists of some heroes;
Fix errors in slardar;
Prevent undying from casting decay on creep heroes;
Fix bounty_hunter uses track at ally lone_druid_bear;
Fix chen ability level up to 7.31c;
Fix enchantress_enchant neutral creep level limit to 7.31c;
Fix terrorblade uses reflection or sunder at creep heroes;
Forbid bane casting nightmare on transforming lone_druid;
Fix abyssal errors;
  • Loading branch information
AaronSong321 authored May 13, 2022
1 parent ca13ddd commit 0287c0d
Show file tree
Hide file tree
Showing 51 changed files with 467 additions and 370 deletions.
11 changes: 4 additions & 7 deletions ability_item_usage_abaddon.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down
24 changes: 11 additions & 13 deletions ability_item_usage_abaddon.mira
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down
29 changes: 14 additions & 15 deletions ability_item_usage_abyssal_underlord.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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",
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
--------------------------------------
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -411,6 +409,7 @@ Consider[6] = function()
end
return 0
end
Consider[5] = A.Dota.EmptyDesireFun

AbilityExtensions:AutoModifyConsiderFunction(npcBot, Consider, AbilitiesReal)
function AbilityUsageThink()
Expand Down
2 changes: 1 addition & 1 deletion ability_item_usage_bane.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion ability_item_usage_bane.mira
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 4 additions & 3 deletions ability_item_usage_bounty_hunter.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand All @@ -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
Expand Down
13 changes: 10 additions & 3 deletions ability_item_usage_bounty_hunter.mira
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -234,7 +235,7 @@ Consider[1]=function() --Target Ability Example
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
Expand Down Expand Up @@ -329,24 +330,30 @@ Consider[4]=function()

local CastRange = Clamp(ability:GetCastRange(), 0, 1599)
local realEnemies = fun1:GetNearbyNonIllusionHeroes(npcBot, CastRange):Filter { it ->
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] }
if local t = realEnemies:First() then
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

Expand Down
12 changes: 6 additions & 6 deletions ability_item_usage_brewmaster.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
26 changes: 14 additions & 12 deletions ability_item_usage_chen.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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)
Expand Down Expand Up @@ -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
Expand Down
Loading

0 comments on commit 0287c0d

Please sign in to comment.