Commit 4595011f authored by JoyJ's avatar JoyJ

fixes

parent dbabd5b8
......@@ -256,7 +256,9 @@ function X.ConsiderWE()
local nAlliesNearby = J.GetAllyList( bot, 600 )
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 )
......@@ -371,8 +373,12 @@ function X.ConsiderW()
local nAllies = J.GetAllyList( bot, 1200 )
local nEnemysHerosInView = hEnemyHeroList
local nEnemysHerosInRange = bot:GetNearbyHeroes( nCastRange + 150, true, BOT_MODE_NONE )
local nEnemysHerosInBonus = bot:GetNearbyHeroes( nCastRange + 350, true, BOT_MODE_NONE )
local range=nCastRange + 150
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 aliveEnemyCount = J.GetNumOfAliveHeroes( true )
......@@ -651,7 +657,9 @@ function X.ConsiderR()
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 )
do
local EstDamage = nDamagaPerHealth * ( npcEnemy:GetMaxMana() - npcEnemy:GetMana() )
......
......@@ -17,33 +17,12 @@ local sAbilityList = J.Skill.GetAbilityList( bot )
local sOutfitType = J.Item.GetOutfitType( bot )
local tTalentTreeList = {
['t25'] = {10, 10},
['t20'] = {10, 10},
['t15'] = {10, 10},
['t10'] = {10, 10},
['t25'] = {0, 10},
['t20'] = {10, 0},
['t15'] = {0, 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 = {
{1,2,3,1,1,6,1,3,2,2,6,2,3,3,6},
}
......@@ -162,14 +141,14 @@ function X.SkillsComplement()
X.UpdateEnemyLocations()
if lastWTime<DotaTime()+3 then
if lastWLocation and lastWTime+2.0<DotaTime() then
lastWLocation=nil
lastWTarget=nil
lastWTime=0
WECasted=false
end
if lastETime<DotaTime()+3 then
if lastELocation and lastETime+2.0<DotaTime() then
lastELocation=nil
lastETime=0
end
......@@ -187,7 +166,25 @@ function X.SkillsComplement()
local aether = J.IsItemAvailable( "item_aether_lens" )
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()
if ( castEDesire > 0 )
......@@ -225,24 +222,6 @@ function X.SkillsComplement()
return
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
function X.ConsiderQ()
......@@ -259,10 +238,10 @@ function X.ConsiderQ()
local nInRangeEnemyList = bot:GetNearbyHeroes( nCastRange, 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
if J.IsValidHero( npcEnemy )
and J.WillMagicKillTarget( bot, npcEnemy, nDamage, 5.0 )
......@@ -274,7 +253,8 @@ function X.ConsiderQ()
--团战
if J.IsInTeamFight( bot, 1200 )
then
local enemy = J.GetLeastHpUnit( nInRangeEnemyList )
local valid = J.FilterGroup(nInRangeEnemyList,J.IsValidHero)
local enemy = J.GetLeastHpUnit( valid )
if enemy ~= nil then
return BOT_ACTION_DESIRE_HIGH, enemy, 'Q-团战攻击血量最少单位'
end
......@@ -310,7 +290,7 @@ function X.ConsiderQ()
and #hAllyList <= 2 and #hEnemyList == 0
then
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" )
end)
if #laneCreepList >= 3 then
......@@ -353,27 +333,36 @@ local nEnemyLocationsIndex = 1
function X.UpdateEnemyLocations()
local enemies = GetUnitList( UNIT_LIST_ENEMY_HEROES )
for id,_ in pairs(hEnemyLocations) do
hEnemyLocations[id][nEnemyLocationsIndex]=nil
end
for _,u in pairs(enemies) do
if not hEnemyLocations[u] then
hEnemyLocations[u] = {}
end
if not pcall(function()
if not u:IsAlive() then
nEnemyLocationsIndex[u][nEnemyLocationsIndex]=J.GetEnemyFountain()
local pid="p"..tostring(u:GetPlayerID())
if pid then
if not hEnemyLocations[pid] then
hEnemyLocations[pid] = {}
end
nEnemyLocationsIndex[u][nEnemyLocationsIndex]=u:GetLocation()
end) then
nEnemyLocationsIndex[u][nEnemyLocationsIndex]=nil
pcall(function()
if not u:IsAlive() then
hEnemyLocations[pid][nEnemyLocationsIndex]=J.GetEnemyFountain()
end
hEnemyLocations[pid][nEnemyLocationsIndex]=u:GetLocation()
end)
end
end
nEnemyLocationsIndex = nEnemyLocationsIndex + 1
if nEnemyLocationsIndex > 41 then nEnemyLocationsIndex = 1 end
if nEnemyLocationsIndex > 121 then nEnemyLocationsIndex = 1 end
end
function X.GetWLocation(u)
if u==nil then return nil end
local index = nEnemyLocationsIndex + 1
if index == 42 then index = 1 end
if hEnemyLocations[u] and hEnemyLocations[u][index] then return hEnemyLocations[u][index] end
if index > 121 then index = 1 end
local pid="p"..tostring(u:GetPlayerID())
if hEnemyLocations[pid] and hEnemyLocations[pid][index] then return hEnemyLocations[pid][index] end
return nil
end
......@@ -387,9 +376,12 @@ function X.ConsiderW()
local nManaCost = abilityW:GetManaCost()
local nDamage = abilityW:GetAbilityDamage()
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
......@@ -402,7 +394,7 @@ function X.ConsiderW()
for _, npcEnemy in pairs( nInRangeEnemyList ) do
local newLocation = X.GetWLocation(npcEnemy)
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 )
end
end
......@@ -422,6 +414,18 @@ function X.ConsiderW()
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
end
......@@ -442,7 +446,8 @@ function X.ConsiderE()
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
and nLV>=6 and abilityR:IsFullyCastable()
and bot:GetMana()>abilityE:GetManaCost()+abilityR:GetManaCost()
......@@ -548,18 +553,20 @@ function X.ConsiderR()
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
and #J.GetEnemiesNearLoc(bot, lastWLocation, nRadius)>0 then
return BOT_ACTION_DESIRE_HIGH, lastWLocation, "R连招"
and #J.GetEnemiesNearLoc(lastWLocation, nRadius)>0 then
return BOT_ACTION_DESIRE_HIGH, lastWLocation, "R连招:WER"
end
local ETime = lastETime - DotaTime()
if ETime>-1 and ETime<0.5 and #J.GetEnemiesNearLoc(bot, lastELocation, nRadius)>0 then
return BOT_ACTION_DESIRE_HIGH, lastELocation, "R连招2"
local ETime = 0
if lastETime then ETime = lastETime - DotaTime() end
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
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
......@@ -567,7 +574,7 @@ function X.ConsiderR()
if nAoeLoc ~= nil
then
nTargetLocation = nAoeLoc
return BOT_ACTION_DESIRE_HIGH, nTargetLocation, 'Q团战'
return BOT_ACTION_DESIRE_HIGH, nTargetLocation, 'R团战'
end
end
......
local X = {}
local bDebugMode = true
local bDebugMode = false
local bot = GetBot()
local J = require( GetScriptDirectory()..'/FunLib/jmz_func' )
......
......@@ -149,7 +149,6 @@ function X.SkillsComplement()
return
end
bot:ActionImmediate_Chat( "CheckD", true )
castDDesire = X.ConsiderD()
if ( castDDesire > 0 ) then
bot:ActionQueue_UseAbility( abilityD )
......
......@@ -123,7 +123,7 @@ end
function J.CanNotUseAction( bot )
return not bot:IsAlive()
or bot:NumQueuedActions() > 0
or (bot==GetBot() and bot:NumQueuedActions() > 0)
or bot:IsInvulnerable()
or bot:IsCastingAbility()
or bot:IsUsingAbility()
......@@ -138,7 +138,7 @@ end
function J.CanNotUseAbility( bot )
return not bot:IsAlive()
or bot:NumQueuedActions() > 0
or (bot==GetBot() and bot:NumQueuedActions() > 0)
or bot:IsInvulnerable()
or bot:IsCastingAbility()
or bot:IsUsingAbility()
......@@ -221,7 +221,7 @@ function J.GetAttackEnemysAllyCreepCount( target, nRadius )
local nAttackEnemyCount = 0
for _, creep in pairs( nAllyCreeps )
do
if creep:IsAlive()
if creep:IsAlive() and creep:CanBeSeen()
and creep:GetAttackTarget() == target
then
nAttackEnemyCount = nAttackEnemyCount + 1
......@@ -436,7 +436,7 @@ function J.GetAlliesNearLoc( vLoc, nRadius )
end
function J.GetEnemiesNearLoc(bot, vLoc, nRadius)
function J.GetEnemiesNearLoc(vLoc, nRadius)
local enemies = GetUnitList( UNIT_LIST_ENEMY_HEROES )
return J.FilterGroup(enemies,function(u)
......@@ -3400,7 +3400,7 @@ end
function J.DebugMessage(str,b)
if b then
bot:ActionImmediate_Chat( str, true )
GetBot():ActionImmediate_Chat( str, true )
end
end
......
......@@ -504,7 +504,7 @@ function X.IsCourierTargetedByUnit( courier )
for i = 0, 10
do
local tower = GetTower( GetOpposingTeam(), i )
if tower ~= nil
if tower ~= nil and tower:CanBeSeen()
then
local towerTarget = tower:GetAttackTarget()
......
......@@ -1002,7 +1002,7 @@ function Think()
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 == 1 then sSelectHero = "npc_dota_hero_antimage" end
......
......@@ -548,7 +548,7 @@ end
function X.IsIBecameTheTarget(units)
for _,u in pairs(units)
do
if u:GetAttackTarget() == bot then
if u:CanBeSeen() and u:GetAttackTarget() == bot then
return true
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