Commit 4595011f authored by JoyJ's avatar JoyJ

fixes

parent dbabd5b8
...@@ -256,7 +256,9 @@ function X.ConsiderWE() ...@@ -256,7 +256,9 @@ function X.ConsiderWE()
local nAlliesNearby = J.GetAllyList( bot, 600 ) local nAlliesNearby = J.GetAllyList( bot, 600 )
local nEnemysHerosInView = hEnemyHeroList local nEnemysHerosInView = hEnemyHeroList
local nEnemysHerosInRange = bot:GetNearbyHeroes( nCastRange + 150, true, BOT_MODE_NONE ) local range=nCastRange + 150
if range>1600 then range=1600 end
local nEnemysHerosInRange = bot:GetNearbyHeroes( range, true, BOT_MODE_NONE )
local npcTarget = J.GetProperTarget( bot ) local npcTarget = J.GetProperTarget( bot )
...@@ -371,8 +373,12 @@ function X.ConsiderW() ...@@ -371,8 +373,12 @@ function X.ConsiderW()
local nAllies = J.GetAllyList( bot, 1200 ) local nAllies = J.GetAllyList( bot, 1200 )
local nEnemysHerosInView = hEnemyHeroList local nEnemysHerosInView = hEnemyHeroList
local nEnemysHerosInRange = bot:GetNearbyHeroes( nCastRange + 150, true, BOT_MODE_NONE ) local range=nCastRange + 150
local nEnemysHerosInBonus = bot:GetNearbyHeroes( nCastRange + 350, true, BOT_MODE_NONE ) if range>1600 then range=1600 end
local nEnemysHerosInRange = bot:GetNearbyHeroes( range, true, BOT_MODE_NONE )
range=range+200
if range>1600 then range=1600 end
local nEnemysHerosInBonus = bot:GetNearbyHeroes( range, true, BOT_MODE_NONE )
local nEnemysTowers = bot:GetNearbyTowers( 1300, true ) local nEnemysTowers = bot:GetNearbyTowers( 1300, true )
local aliveEnemyCount = J.GetNumOfAliveHeroes( true ) local aliveEnemyCount = J.GetNumOfAliveHeroes( true )
...@@ -651,7 +657,9 @@ function X.ConsiderR() ...@@ -651,7 +657,9 @@ function X.ConsiderR()
end end
end end
local tableNearbyEnemyHeroes = bot:GetNearbyHeroes( nCastRange + 100, true, BOT_MODE_NONE ) local range=nCastRange + 100
if range>1600 then range=1600 end
local tableNearbyEnemyHeroes = bot:GetNearbyHeroes( range, true, BOT_MODE_NONE )
for _, npcEnemy in pairs( tableNearbyEnemyHeroes ) for _, npcEnemy in pairs( tableNearbyEnemyHeroes )
do do
local EstDamage = nDamagaPerHealth * ( npcEnemy:GetMaxMana() - npcEnemy:GetMana() ) local EstDamage = nDamagaPerHealth * ( npcEnemy:GetMaxMana() - npcEnemy:GetMana() )
......
...@@ -17,33 +17,12 @@ local sAbilityList = J.Skill.GetAbilityList( bot ) ...@@ -17,33 +17,12 @@ local sAbilityList = J.Skill.GetAbilityList( bot )
local sOutfitType = J.Item.GetOutfitType( bot ) local sOutfitType = J.Item.GetOutfitType( bot )
local tTalentTreeList = { local tTalentTreeList = {
['t25'] = {10, 10}, ['t25'] = {0, 10},
['t20'] = {10, 10}, ['t20'] = {10, 0},
['t15'] = {10, 10}, ['t15'] = {0, 10},
['t10'] = {10, 10}, ['t10'] = {10, 0},
} }
if RandomInt( 1, 100 ) <= 50 then
tTalentTreeList['t25'][1] = 0
else
tTalentTreeList['t25'][2] = 0
end
if RandomInt( 1, 100 ) <= 50 then
tTalentTreeList['t20'][1] = 0
else
tTalentTreeList['t20'][2] = 0
end
if RandomInt( 1, 100 ) <= 50 then
tTalentTreeList['t15'][1] = 0
else
tTalentTreeList['t15'][2] = 0
end
if RandomInt( 1, 100 ) <= 50 then
tTalentTreeList['t10'][1] = 0
else
tTalentTreeList['t10'][2] = 0
end
local tAllAbilityBuildList = { local tAllAbilityBuildList = {
{1,2,3,1,1,6,1,3,2,2,6,2,3,3,6}, {1,2,3,1,1,6,1,3,2,2,6,2,3,3,6},
} }
...@@ -162,14 +141,14 @@ function X.SkillsComplement() ...@@ -162,14 +141,14 @@ function X.SkillsComplement()
X.UpdateEnemyLocations() X.UpdateEnemyLocations()
if lastWTime<DotaTime()+3 then if lastWLocation and lastWTime+2.0<DotaTime() then
lastWLocation=nil lastWLocation=nil
lastWTarget=nil lastWTarget=nil
lastWTime=0 lastWTime=0
WECasted=false WECasted=false
end end
if lastETime<DotaTime()+3 then if lastELocation and lastETime+2.0<DotaTime() then
lastELocation=nil lastELocation=nil
lastETime=0 lastETime=0
end end
...@@ -187,7 +166,25 @@ function X.SkillsComplement() ...@@ -187,7 +166,25 @@ function X.SkillsComplement()
local aether = J.IsItemAvailable( "item_aether_lens" ) local aether = J.IsItemAvailable( "item_aether_lens" )
if aether ~= nil then aetherRange = 250 end if aether ~= nil then aetherRange = 250 end
-- if talent4:IsTrained() then aetherRange = aetherRange + talent4:GetSpecialValueInt( "value" ) end
castWDesire, castWTarget, sMotive = X.ConsiderW()
if ( castWDesire > 0 )
then
J.SetReportMotive( bDebugMode, sMotive )
J.SetQueuePtToINT( bot, true )
lastWLocation=X.GetWLocation(castWTarget)
if lastWLocation then
local time=GetUnitToLocationDistance(castWTarget,lastWLocation)/600.0
if time>1.8 then time = 1.8 end
lastWTime=DotaTime()+time
end
lastWTarget=castWTarget
bot:ActionQueue_UseAbilityOnEntity( abilityW, castWTarget )
return
end
castEDesire, castELocation, sMotive = X.ConsiderE() castEDesire, castELocation, sMotive = X.ConsiderE()
if ( castEDesire > 0 ) if ( castEDesire > 0 )
...@@ -225,24 +222,6 @@ function X.SkillsComplement() ...@@ -225,24 +222,6 @@ function X.SkillsComplement()
return return
end end
castWDesire, castWTarget, sMotive = X.ConsiderW()
if ( castWDesire > 0 )
then
J.SetReportMotive( bDebugMode, sMotive )
J.SetQueuePtToINT( bot, true )
lastWLocation=X.GetWLocation(castWTarget)
if lastWLocation then
local time=GetUnitToLocationDistance(castWTarget,lastWLocation)/600.0
if time>1.8 then time = 1.8 end
lastWTime=DotaTime()+time
end
lastWTarget=castWTarget
bot:ActionQueue_UseAbilityOnEntity( abilityW, castWTarget )
return
end
end end
function X.ConsiderQ() function X.ConsiderQ()
...@@ -259,10 +238,10 @@ function X.ConsiderQ() ...@@ -259,10 +238,10 @@ function X.ConsiderQ()
local nInRangeEnemyList = bot:GetNearbyHeroes( nCastRange, true, BOT_MODE_NONE ) local nInRangeEnemyList = bot:GetNearbyHeroes( nCastRange, true, BOT_MODE_NONE )
local nInBonusEnemyList = bot:GetNearbyHeroes( nCastRange + 200, true, BOT_MODE_NONE ) local nInBonusEnemyList = bot:GetNearbyHeroes( nCastRange + 200, true, BOT_MODE_NONE )
nInRangeEnemyList = J.Filter(nInRangeEnemyList,J.CanCastOnNonMagicImmune) nInRangeEnemyList = J.FilterGroup(nInRangeEnemyList,J.CanCastOnNonMagicImmune)
--击杀 --击杀
for _, npcEnemy in pairs( nInBonusEnemyList ) for _, npcEnemy in pairs( nInRangeEnemyList )
do do
if J.IsValidHero( npcEnemy ) if J.IsValidHero( npcEnemy )
and J.WillMagicKillTarget( bot, npcEnemy, nDamage, 5.0 ) and J.WillMagicKillTarget( bot, npcEnemy, nDamage, 5.0 )
...@@ -274,7 +253,8 @@ function X.ConsiderQ() ...@@ -274,7 +253,8 @@ function X.ConsiderQ()
--团战 --团战
if J.IsInTeamFight( bot, 1200 ) if J.IsInTeamFight( bot, 1200 )
then then
local enemy = J.GetLeastHpUnit( nInRangeEnemyList ) local valid = J.FilterGroup(nInRangeEnemyList,J.IsValidHero)
local enemy = J.GetLeastHpUnit( valid )
if enemy ~= nil then if enemy ~= nil then
return BOT_ACTION_DESIRE_HIGH, enemy, 'Q-团战攻击血量最少单位' return BOT_ACTION_DESIRE_HIGH, enemy, 'Q-团战攻击血量最少单位'
end end
...@@ -310,7 +290,7 @@ function X.ConsiderQ() ...@@ -310,7 +290,7 @@ function X.ConsiderQ()
and #hAllyList <= 2 and #hEnemyList == 0 and #hAllyList <= 2 and #hEnemyList == 0
then then
local laneCreepList = bot:GetNearbyLaneCreeps( nCastRange, true ) local laneCreepList = bot:GetNearbyLaneCreeps( nCastRange, true )
laneCreepList = J.Filter(function(u) laneCreepList = J.FilterGroup(laneCreepList, function(u)
return J.IsValid(u) and not u:HasModifier( "modifier_fountain_glyph" ) return J.IsValid(u) and not u:HasModifier( "modifier_fountain_glyph" )
end) end)
if #laneCreepList >= 3 then if #laneCreepList >= 3 then
...@@ -353,27 +333,36 @@ local nEnemyLocationsIndex = 1 ...@@ -353,27 +333,36 @@ local nEnemyLocationsIndex = 1
function X.UpdateEnemyLocations() function X.UpdateEnemyLocations()
local enemies = GetUnitList( UNIT_LIST_ENEMY_HEROES ) local enemies = GetUnitList( UNIT_LIST_ENEMY_HEROES )
for id,_ in pairs(hEnemyLocations) do
hEnemyLocations[id][nEnemyLocationsIndex]=nil
end
for _,u in pairs(enemies) do for _,u in pairs(enemies) do
if not hEnemyLocations[u] then local pid="p"..tostring(u:GetPlayerID())
hEnemyLocations[u] = {} if pid then
end if not hEnemyLocations[pid] then
if not pcall(function() hEnemyLocations[pid] = {}
if not u:IsAlive() then
nEnemyLocationsIndex[u][nEnemyLocationsIndex]=J.GetEnemyFountain()
end end
nEnemyLocationsIndex[u][nEnemyLocationsIndex]=u:GetLocation() pcall(function()
end) then if not u:IsAlive() then
nEnemyLocationsIndex[u][nEnemyLocationsIndex]=nil hEnemyLocations[pid][nEnemyLocationsIndex]=J.GetEnemyFountain()
end
hEnemyLocations[pid][nEnemyLocationsIndex]=u:GetLocation()
end)
end end
end end
nEnemyLocationsIndex = nEnemyLocationsIndex + 1 nEnemyLocationsIndex = nEnemyLocationsIndex + 1
if nEnemyLocationsIndex > 41 then nEnemyLocationsIndex = 1 end if nEnemyLocationsIndex > 121 then nEnemyLocationsIndex = 1 end
end end
function X.GetWLocation(u) function X.GetWLocation(u)
if u==nil then return nil end
local index = nEnemyLocationsIndex + 1 local index = nEnemyLocationsIndex + 1
if index == 42 then index = 1 end if index > 121 then index = 1 end
if hEnemyLocations[u] and hEnemyLocations[u][index] then return hEnemyLocations[u][index] end local pid="p"..tostring(u:GetPlayerID())
if hEnemyLocations[pid] and hEnemyLocations[pid][index] then return hEnemyLocations[pid][index] end
return nil return nil
end end
...@@ -387,9 +376,12 @@ function X.ConsiderW() ...@@ -387,9 +376,12 @@ function X.ConsiderW()
local nManaCost = abilityW:GetManaCost() local nManaCost = abilityW:GetManaCost()
local nDamage = abilityW:GetAbilityDamage() local nDamage = abilityW:GetAbilityDamage()
local nDamageType = DAMAGE_TYPE_MAGICAL local nDamageType = DAMAGE_TYPE_MAGICAL
local nInRangeEnemyList = bot:GetNearbyHeroes( nCastRange, true, BOT_MODE_NONE ) local nInRangeEnemyList = GetUnitList( UNIT_LIST_ENEMY_HEROES )
nInRangeEnemyList = J.Filter(nInRangeEnemyList,J.And(J.IsValidHero,J.CanCastOnNonMagicImmune)) nInRangeEnemyList = J.FilterGroup(nInRangeEnemyList,function(u)
return J.IsValidHero(u) and J.CanCastOnNonMagicImmune(u)
and J.IsInRange(bot,u,nCastRange)
end)
--打断 --打断
for _, npcEnemy in pairs( nInRangeEnemyList ) do for _, npcEnemy in pairs( nInRangeEnemyList ) do
...@@ -402,7 +394,7 @@ function X.ConsiderW() ...@@ -402,7 +394,7 @@ function X.ConsiderW()
for _, npcEnemy in pairs( nInRangeEnemyList ) do for _, npcEnemy in pairs( nInRangeEnemyList ) do
local newLocation = X.GetWLocation(npcEnemy) local newLocation = X.GetWLocation(npcEnemy)
if npcEnemy:HasModifier( "modifier_fountain_glyph" ) or if npcEnemy:HasModifier( "modifier_fountain_glyph" ) or
(newLocation and GetUnitToUnitDistance(bot,newLocation))>2000 then (newLocation and GetUnitToLocationDistance(npcEnemy,newLocation)>2000) then
return BOT_ACTION_DESIRE_HIGH, npcEnemy, 'W-打回泉水:'..J.Chat.GetNormName( npcEnemy ) return BOT_ACTION_DESIRE_HIGH, npcEnemy, 'W-打回泉水:'..J.Chat.GetNormName( npcEnemy )
end end
end end
...@@ -422,6 +414,18 @@ function X.ConsiderW() ...@@ -422,6 +414,18 @@ function X.ConsiderW()
end end
end end
--团战
if (J.IsInTeamFight(bot, 1200) or J.IsGoingOnSomeone(bot)) and abilityE:IsFullyCastable() and abilityR:IsFullyCastable()
and bot:GetMana()>abilityE:GetManaCost()+abilityR:GetManaCost()+abilityW:GetManaCost() then
for _, npcEnemy in pairs( nInRangeEnemyList ) do
local newLocation = X.GetWLocation(npcEnemy)
if newLocation and GetUnitToUnitDistance(bot,npcEnemy) > abilityE:GetCastRange() + aetherRange + 200
and GetUnitToLocationDistance(bot,newLocation) < abilityE:GetCastRange() + aetherRange - 200 then
return BOT_ACTION_DESIRE_HIGH, npcEnemy, 'W-准备连招:'..J.Chat.GetNormName( npcEnemy )
end
end
end
return BOT_ACTION_DESIRE_NONE return BOT_ACTION_DESIRE_NONE
end end
...@@ -442,7 +446,8 @@ function X.ConsiderE() ...@@ -442,7 +446,8 @@ function X.ConsiderE()
local nTargetLocation = nil local nTargetLocation = nil
--连招 --连招
local WTime = lastWTime - DotaTime() local WTime = 0
if lastWTime then WTime = lastWTime - DotaTime() end
if lastWLocation and WTime<1.5 and WTime>0.5 and GetUnitToLocationDistance(bot, lastWLocation)<nCastRange if lastWLocation and WTime<1.5 and WTime>0.5 and GetUnitToLocationDistance(bot, lastWLocation)<nCastRange
and nLV>=6 and abilityR:IsFullyCastable() and nLV>=6 and abilityR:IsFullyCastable()
and bot:GetMana()>abilityE:GetManaCost()+abilityR:GetManaCost() and bot:GetMana()>abilityE:GetManaCost()+abilityR:GetManaCost()
...@@ -548,18 +553,20 @@ function X.ConsiderR() ...@@ -548,18 +553,20 @@ function X.ConsiderR()
local nTargetLocation = nil local nTargetLocation = nil
local WTime = lastWTime - DotaTime() local WTime = 0
if lastWTime then WTime = lastWTime - DotaTime() end
if WECasted and WTime<0.5 and WTime>-0.5 and GetUnitToLocationDistance(bot, lastWLocation)<nCastRange if WECasted and WTime<0.5 and WTime>-0.5 and GetUnitToLocationDistance(bot, lastWLocation)<nCastRange
and #J.GetEnemiesNearLoc(bot, lastWLocation, nRadius)>0 then and #J.GetEnemiesNearLoc(lastWLocation, nRadius)>0 then
return BOT_ACTION_DESIRE_HIGH, lastWLocation, "R连招" return BOT_ACTION_DESIRE_HIGH, lastWLocation, "R连招:WER"
end end
local ETime = lastETime - DotaTime() local ETime = 0
if ETime>-1 and ETime<0.5 and #J.GetEnemiesNearLoc(bot, lastELocation, nRadius)>0 then if lastETime then ETime = lastETime - DotaTime() end
return BOT_ACTION_DESIRE_HIGH, lastELocation, "R连招2" if lastELocation and ETime>-0.3 and ETime<0.3 and #J.GetEnemiesNearLoc(lastELocation, nRadius)>0 then
return BOT_ACTION_DESIRE_HIGH, lastELocation, "R连招:ER"
end end
if abilityE:IsFullyCastable() then return end --有E等E,没E再说 if abilityE:IsFullyCastable() or lastWLocation or lastELocation then return BOT_ACTION_DESIRE_NONE end --有E等E,有连招等连招,没E再说
--团战 --团战
if J.IsInTeamFight( bot, 1200 ) then if J.IsInTeamFight( bot, 1200 ) then
...@@ -567,7 +574,7 @@ function X.ConsiderR() ...@@ -567,7 +574,7 @@ function X.ConsiderR()
if nAoeLoc ~= nil if nAoeLoc ~= nil
then then
nTargetLocation = nAoeLoc nTargetLocation = nAoeLoc
return BOT_ACTION_DESIRE_HIGH, nTargetLocation, 'Q团战' return BOT_ACTION_DESIRE_HIGH, nTargetLocation, 'R团战'
end end
end end
......
local X = {} local X = {}
local bDebugMode = true local bDebugMode = false
local bot = GetBot() local bot = GetBot()
local J = require( GetScriptDirectory()..'/FunLib/jmz_func' ) local J = require( GetScriptDirectory()..'/FunLib/jmz_func' )
......
...@@ -149,7 +149,6 @@ function X.SkillsComplement() ...@@ -149,7 +149,6 @@ function X.SkillsComplement()
return return
end end
bot:ActionImmediate_Chat( "CheckD", true )
castDDesire = X.ConsiderD() castDDesire = X.ConsiderD()
if ( castDDesire > 0 ) then if ( castDDesire > 0 ) then
bot:ActionQueue_UseAbility( abilityD ) bot:ActionQueue_UseAbility( abilityD )
......
...@@ -123,7 +123,7 @@ end ...@@ -123,7 +123,7 @@ end
function J.CanNotUseAction( bot ) function J.CanNotUseAction( bot )
return not bot:IsAlive() return not bot:IsAlive()
or bot:NumQueuedActions() > 0 or (bot==GetBot() and bot:NumQueuedActions() > 0)
or bot:IsInvulnerable() or bot:IsInvulnerable()
or bot:IsCastingAbility() or bot:IsCastingAbility()
or bot:IsUsingAbility() or bot:IsUsingAbility()
...@@ -138,7 +138,7 @@ end ...@@ -138,7 +138,7 @@ end
function J.CanNotUseAbility( bot ) function J.CanNotUseAbility( bot )
return not bot:IsAlive() return not bot:IsAlive()
or bot:NumQueuedActions() > 0 or (bot==GetBot() and bot:NumQueuedActions() > 0)
or bot:IsInvulnerable() or bot:IsInvulnerable()
or bot:IsCastingAbility() or bot:IsCastingAbility()
or bot:IsUsingAbility() or bot:IsUsingAbility()
...@@ -221,7 +221,7 @@ function J.GetAttackEnemysAllyCreepCount( target, nRadius ) ...@@ -221,7 +221,7 @@ function J.GetAttackEnemysAllyCreepCount( target, nRadius )
local nAttackEnemyCount = 0 local nAttackEnemyCount = 0
for _, creep in pairs( nAllyCreeps ) for _, creep in pairs( nAllyCreeps )
do do
if creep:IsAlive() if creep:IsAlive() and creep:CanBeSeen()
and creep:GetAttackTarget() == target and creep:GetAttackTarget() == target
then then
nAttackEnemyCount = nAttackEnemyCount + 1 nAttackEnemyCount = nAttackEnemyCount + 1
...@@ -436,7 +436,7 @@ function J.GetAlliesNearLoc( vLoc, nRadius ) ...@@ -436,7 +436,7 @@ function J.GetAlliesNearLoc( vLoc, nRadius )
end end
function J.GetEnemiesNearLoc(bot, vLoc, nRadius) function J.GetEnemiesNearLoc(vLoc, nRadius)
local enemies = GetUnitList( UNIT_LIST_ENEMY_HEROES ) local enemies = GetUnitList( UNIT_LIST_ENEMY_HEROES )
return J.FilterGroup(enemies,function(u) return J.FilterGroup(enemies,function(u)
...@@ -3400,7 +3400,7 @@ end ...@@ -3400,7 +3400,7 @@ end
function J.DebugMessage(str,b) function J.DebugMessage(str,b)
if b then if b then
bot:ActionImmediate_Chat( str, true ) GetBot():ActionImmediate_Chat( str, true )
end end
end end
......
...@@ -504,7 +504,7 @@ function X.IsCourierTargetedByUnit( courier ) ...@@ -504,7 +504,7 @@ function X.IsCourierTargetedByUnit( courier )
for i = 0, 10 for i = 0, 10
do do
local tower = GetTower( GetOpposingTeam(), i ) local tower = GetTower( GetOpposingTeam(), i )
if tower ~= nil if tower ~= nil and tower:CanBeSeen()
then then
local towerTarget = tower:GetAttackTarget() local towerTarget = tower:GetAttackTarget()
......
...@@ -1002,7 +1002,7 @@ function Think() ...@@ -1002,7 +1002,7 @@ function Think()
end end
--if GetTeam() ~= TEAM_DIRE and i == 1 then sSelectHero = "npc_dota_hero_alchemist" end --if GetTeam() ~= TEAM_DIRE and i == 1 then sSelectHero = "npc_dota_hero_alchemist" end
if GetTeam() ~= TEAM_DIRE and i == 3 then sSelectHero = "npc_dota_hero_muerta" end --if GetTeam() ~= TEAM_DIRE and i == 3 then sSelectHero = "npc_dota_hero_disruptor" end
-------******************************----------------------------------------------- -------******************************-----------------------------------------------
-- if GetTeam() ~= TEAM_DIRE and i == 2 then sSelectHero = "npc_dota_hero_lina" end -- if GetTeam() ~= TEAM_DIRE and i == 2 then sSelectHero = "npc_dota_hero_lina" end
-- if GetTeam() ~= TEAM_DIRE and i == 1 then sSelectHero = "npc_dota_hero_antimage" end -- if GetTeam() ~= TEAM_DIRE and i == 1 then sSelectHero = "npc_dota_hero_antimage" end
......
...@@ -548,7 +548,7 @@ end ...@@ -548,7 +548,7 @@ end
function X.IsIBecameTheTarget(units) function X.IsIBecameTheTarget(units)
for _,u in pairs(units) for _,u in pairs(units)
do do
if u:GetAttackTarget() == bot then if u:CanBeSeen() and u:GetAttackTarget() == bot then
return true return true
end end
end end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment