Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
D
dota2-ai
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
JoyJ
dota2-ai
Commits
bacd194c
Commit
bacd194c
authored
Mar 22, 2023
by
JoyJ
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add disruptor
parent
688807e9
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
642 additions
and
10 deletions
+642
-10
BotLib/hero_abyssal_underlord.lua
BotLib/hero_abyssal_underlord.lua
+8
-2
BotLib/hero_alchemist.lua
BotLib/hero_alchemist.lua
+5
-3
BotLib/hero_disruptor.lua
BotLib/hero_disruptor.lua
+579
-0
FunLib/jmz_func.lua
FunLib/jmz_func.lua
+46
-0
hero_selection.lua
hero_selection.lua
+4
-5
No files found.
BotLib/hero_abyssal_underlord.lua
View file @
bacd194c
...
@@ -169,6 +169,10 @@ function X.SkillsComplement()
...
@@ -169,6 +169,10 @@ function X.SkillsComplement()
if
itemGungir
and
itemGungir
:
IsFullyCastable
()
then
if
itemGungir
and
itemGungir
:
IsFullyCastable
()
then
bot
:
ActionQueue_UseAbilityOnLocation
(
itemGungir
,
lastWLocation
)
bot
:
ActionQueue_UseAbilityOnLocation
(
itemGungir
,
lastWLocation
)
end
end
local
itemAtos
=
J
.
IsItemAvailable
(
"item_rod_of_atos"
)
if
itemAtos
and
itemAtos
:
IsFullyCastable
()
and
GetUnitToLocationDistance
(
bot
:
GetTarget
(),
lastWLocation
)
<
400
then
bot
:
ActionQueue_UseAbilityOnEntity
(
itemAtos
,
bot
:
GetTarget
()
)
end
lastWTime
=
0
lastWTime
=
0
lastWLocation
=
nil
lastWLocation
=
nil
end
end
...
@@ -211,12 +215,14 @@ function X.ConsiderQ()
...
@@ -211,12 +215,14 @@ function X.ConsiderQ()
end
end
end
end
--消耗,保持一定魔量
--消耗,保持一定魔量
;仅在兵线相持时消耗
local
nCanHurtEnemyAoE
=
bot
:
FindAoELocation
(
true
,
true
,
bot
:
GetLocation
(),
nCastRange
,
nRadius
+
20
,
0
,
0
)
local
nCanHurtEnemyAoE
=
bot
:
FindAoELocation
(
true
,
true
,
bot
:
GetLocation
(),
nCastRange
,
nRadius
+
20
,
0
,
0
)
if
nSkillLV
>
1
and
J
.
IsAllowedToSpam
(
bot
,
nManaCost
)
and
nCanHurtEnemyAoE
.
count
>=
2
then
if
nSkillLV
>
1
and
J
.
IsAllowedToSpam
(
bot
,
nManaCost
)
and
nCanHurtEnemyAoE
.
count
>=
2
then
nTargetLocation
=
nCanHurtEnemyAoE
.
targetloc
nTargetLocation
=
nCanHurtEnemyAoE
.
targetloc
if
J
.
GetAllyCreepNearLoc
(
bot
,
nTargetLocation
,
400
)
>
1
then
return
BOT_ACTION_DESIRE_HIGH
,
nTargetLocation
,
'Q消耗'
return
BOT_ACTION_DESIRE_HIGH
,
nTargetLocation
,
'Q消耗'
end
end
end
--团战
--团战
if
J
.
IsInTeamFight
(
bot
,
1200
)
then
if
J
.
IsInTeamFight
(
bot
,
1200
)
then
...
...
BotLib/hero_alchemist.lua
View file @
bacd194c
...
@@ -300,12 +300,14 @@ function X.ConsiderQ()
...
@@ -300,12 +300,14 @@ function X.ConsiderQ()
local
nTargetLocation
=
nil
local
nTargetLocation
=
nil
--消耗,保持一定魔量
--消耗,保持一定魔量
;仅在兵线相持时消耗
local
nCanHurtEnemyAoE
=
bot
:
FindAoELocation
(
true
,
false
,
bot
:
GetLocation
(),
nCastRange
,
nRadius
+
20
,
0
,
0
)
local
nCanHurtEnemyAoE
=
bot
:
FindAoELocation
(
true
,
false
,
bot
:
GetLocation
(),
nCastRange
,
nRadius
+
20
,
0
,
0
)
if
J
.
IsAllowedToSpam
(
bot
,
nManaCost
)
and
nCanHurtEnemyAoE
.
count
>=
3
then
if
J
.
IsAllowedToSpam
(
bot
,
nManaCost
)
and
nCanHurtEnemyAoE
.
count
>=
3
then
nTargetLocation
=
nCanHurtEnemyAoE
.
targetloc
nTargetLocation
=
nCanHurtEnemyAoE
.
targetloc
if
J
.
GetAllyCreepNearLoc
(
bot
,
nTargetLocation
,
400
)
>
1
then
return
BOT_ACTION_DESIRE_HIGH
,
nTargetLocation
,
'Q消耗'
return
BOT_ACTION_DESIRE_HIGH
,
nTargetLocation
,
'Q消耗'
end
end
end
--团战
--团战
if
J
.
IsInTeamFight
(
bot
,
1200
)
then
if
J
.
IsInTeamFight
(
bot
,
1200
)
then
...
@@ -323,7 +325,7 @@ function X.ConsiderQ()
...
@@ -323,7 +325,7 @@ function X.ConsiderQ()
if
J
.
IsValidHero
(
botTarget
)
if
J
.
IsValidHero
(
botTarget
)
and
J
.
CanCastOnNonMagicImmune
(
botTarget
)
and
J
.
CanCastOnNonMagicImmune
(
botTarget
)
and
J
.
IsInRange
(
botTarget
,
bot
,
nCastRange
-
30
)
and
J
.
IsInRange
(
botTarget
,
bot
,
nCastRange
-
30
)
and
(
botTarget
:
GetCurrentMovementSpeed
()
<
240
or
botTarget
:
IsStunned
())
and
(
botTarget
:
GetCurrentMovementSpeed
()
<
240
or
botTarget
:
IsStunned
()
or
botTarget
:
IsRooted
()
)
then
then
nTargetLocation
=
J
.
GetDelayCastLocation
(
bot
,
botTarget
,
nCastRange
,
nRadius
,
nCastPoint
)
nTargetLocation
=
J
.
GetDelayCastLocation
(
bot
,
botTarget
,
nCastRange
,
nRadius
,
nCastPoint
)
if
nTargetLocation
~=
nil
if
nTargetLocation
~=
nil
...
...
BotLib/hero_disruptor.lua
0 → 100644
View file @
bacd194c
----------------------------------------------------------------------------------------------------
--- The Creation Come From: BOT EXPERIMENT Credit:FURIOUSPUPPY
--- BOT EXPERIMENT Author: Arizona Fauzie 2018.11.21
--- Link:http://steamcommunity.com/sharedfiles/filedetails/?id=837040016
--- Refactor: 决明子 Email: dota2jmz@163.com 微博@Dota2_决明子
--- Link:http://steamcommunity.com/sharedfiles/filedetails/?id=1573671599
--- Link:http://steamcommunity.com/sharedfiles/filedetails/?id=1627071163
----------------------------------------------------------------------------------------------------
local
X
=
{}
local
bDebugMode
=
(
1
==
10
)
local
bot
=
GetBot
()
local
J
=
require
(
GetScriptDirectory
()
..
'/FunLib/jmz_func'
)
local
Minion
=
dofile
(
GetScriptDirectory
()
..
'/FunLib/aba_minion'
)
local
sTalentList
=
J
.
Skill
.
GetTalentList
(
bot
)
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
},
}
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
},
}
local
nAbilityBuildList
=
J
.
Skill
.
GetRandomBuild
(
tAllAbilityBuildList
)
local
nTalentBuildList
=
J
.
Skill
.
GetTalentBuild
(
tTalentTreeList
)
local
tOutFitList
=
{}
tOutFitList
[
'outfit_carry'
]
=
{
"item_crystal_maiden_outfit"
,
"item_force_staff"
,
"item_glimmer_cape"
,
"item_aghanims_shard"
,
"item_rod_of_atos"
,
"item_ultimate_scepter"
,
"item_sheepstick"
,
"item_moon_shard"
,
"item_octarine_core"
,
"item_ultimate_scepter_2"
,
}
tOutFitList
[
'outfit_mid'
]
=
tOutFitList
[
'outfit_carry'
]
tOutFitList
[
'outfit_priest'
]
=
tOutFitList
[
'outfit_carry'
]
tOutFitList
[
'outfit_mage'
]
=
tOutFitList
[
'outfit_carry'
]
tOutFitList
[
'outfit_tank'
]
=
tOutFitList
[
'outfit_carry'
]
X
[
'sBuyList'
]
=
tOutFitList
[
sOutfitType
]
X
[
'sSellList'
]
=
{
"item_vladmir"
,
"item_magic_wand"
,
"item_cyclone"
,
"item_magic_wand"
,
}
if
J
.
Role
.
IsPvNMode
()
or
J
.
Role
.
IsAllShadow
()
then
X
[
'sBuyList'
],
X
[
'sSellList'
]
=
{
'PvN_mage'
},
{}
end
nAbilityBuildList
,
nTalentBuildList
,
X
[
'sBuyList'
],
X
[
'sSellList'
]
=
J
.
SetUserHeroInit
(
nAbilityBuildList
,
nTalentBuildList
,
X
[
'sBuyList'
],
X
[
'sSellList'
]
)
X
[
'sSkillList'
]
=
J
.
Skill
.
GetSkillList
(
sAbilityList
,
nAbilityBuildList
,
sTalentList
,
nTalentBuildList
)
X
[
'bDeafaultAbility'
]
=
false
X
[
'bDeafaultItem'
]
=
true
function
X
.
MinionThink
(
hMinionUnit
)
if
Minion
.
IsValidUnit
(
hMinionUnit
)
then
Minion
.
IllusionThink
(
hMinionUnit
)
end
end
--[[
npc_dota_hero_lion
"Ability1" "lion_impale"
"Ability2" "lion_voodoo"
"Ability3" "lion_mana_drain"
"Ability4" "generic_hidden"
"Ability5" "generic_hidden"
"Ability6" "lion_finger_of_death"
"Ability10" "special_bonus_cast_range_100"
"Ability11" "special_bonus_attack_damage_90"
"Ability12" "special_bonus_unique_lion_3"
"Ability13" "special_bonus_gold_income_25"
"Ability14" "special_bonus_hp_500"
"Ability15" "special_bonus_unique_lion"
"Ability16" "special_bonus_unique_lion_2"
"Ability17" "special_bonus_unique_lion_4"
modifier_lion_impale
modifier_lion_voodoo
modifier_lion_mana_drain
modifier_lion_finger_of_death_kill_counter
modifier_lion_finger_of_death
modifier_lion_finger_of_death_delay
modifier_lion_arcana_kill_effect
--]]
local
abilityQ
=
bot
:
GetAbilityByName
(
sAbilityList
[
1
]
)
local
abilityW
=
bot
:
GetAbilityByName
(
sAbilityList
[
2
]
)
local
abilityE
=
bot
:
GetAbilityByName
(
sAbilityList
[
3
]
)
local
abilityR
=
bot
:
GetAbilityByName
(
sAbilityList
[
6
]
)
local
castQDesire
,
castQTarget
local
castWDesire
,
castWTarget
local
castEDesire
,
castELocation
local
castRDesire
,
castRLocation
local
nKeepMana
,
nMP
,
nHP
,
nLV
,
hEnemyList
,
hAllyList
,
botTarget
,
sMotive
local
aetherRange
=
0
local
lastCastQTime
=
-
99
local
lastWLocation
=
nil
local
lastWTarget
=
nil
local
lastWTime
=
0
local
WECasted
=
false
local
lastELocation
=
nil
local
lastETime
=
0
function
X
.
SkillsComplement
()
X
.
UpdateEnemyLocations
()
if
lastWTime
<
DotaTime
()
+
3
then
lastWLocation
=
nil
lastWTarget
=
nil
lastWTime
=
0
WECasted
=
false
end
if
lastETime
<
DotaTime
()
+
3
then
lastELocation
=
nil
lastETime
=
0
end
if
J
.
CanNotUseAbility
(
bot
)
or
bot
:
IsInvisible
()
then
return
end
nKeepMana
=
400
aetherRange
=
0
nLV
=
bot
:
GetLevel
()
nMP
=
bot
:
GetMana
()
/
bot
:
GetMaxMana
()
nHP
=
bot
:
GetHealth
()
/
bot
:
GetMaxHealth
()
botTarget
=
J
.
GetProperTarget
(
bot
)
hEnemyList
=
bot
:
GetNearbyHeroes
(
1600
,
true
,
BOT_MODE_NONE
)
hAllyList
=
J
.
GetAlliesNearLoc
(
bot
:
GetLocation
(),
1600
)
local
aether
=
J
.
IsItemAvailable
(
"item_aether_lens"
)
if
aether
~=
nil
then
aetherRange
=
250
end
-- if talent4:IsTrained() then aetherRange = aetherRange + talent4:GetSpecialValueInt( "value" ) end
castEDesire
,
castELocation
,
sMotive
=
X
.
ConsiderE
()
if
(
castEDesire
>
0
)
then
J
.
SetReportMotive
(
bDebugMode
,
sMotive
)
J
.
SetQueuePtToINT
(
bot
,
true
)
lastELocation
=
castELocation
lastETime
=
DotaTime
()
+
1
.
0
bot
:
ActionQueue_UseAbilityOnLocation
(
abilityE
,
castELocation
)
return
end
castRDesire
,
castRLocation
,
sMotive
=
X
.
ConsiderR
()
if
(
castRDesire
>
0
)
then
J
.
SetReportMotive
(
bDebugMode
,
sMotive
)
J
.
SetQueuePtToINT
(
bot
,
true
)
bot
:
ActionQueue_UseAbilityOnLocation
(
abilityR
,
castRLocation
)
return
end
castQDesire
,
castQTarget
,
sMotive
=
X
.
ConsiderQ
()
if
(
castQDesire
>
0
)
then
J
.
SetReportMotive
(
bDebugMode
,
sMotive
)
J
.
SetQueuePtToINT
(
bot
,
true
)
bot
:
ActionQueue_UseAbilityOnEntity
(
abilityQ
,
castQTarget
)
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
()
if
not
abilityQ
:
IsFullyCastable
()
then
return
0
end
local
nSkillLV
=
abilityQ
:
GetLevel
()
local
nCastRange
=
abilityQ
:
GetCastRange
()
+
aetherRange
+
20
local
nRadius
=
abilityQ
:
GetSpecialValueInt
(
"width"
)
local
nCastPoint
=
abilityQ
:
GetCastPoint
()
local
nManaCost
=
abilityQ
:
GetManaCost
()
local
nDamage
=
abilityQ
:
GetAbilityDamage
()
local
nDamageType
=
DAMAGE_TYPE_MAGICAL
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
)
--击杀
for
_
,
npcEnemy
in
pairs
(
nInBonusEnemyList
)
do
if
J
.
IsValidHero
(
npcEnemy
)
and
J
.
WillMagicKillTarget
(
bot
,
npcEnemy
,
nDamage
,
5
.
0
)
then
return
BOT_ACTION_DESIRE_HIGH
,
npcEnemy
,
'Q-击杀'
..
J
.
Chat
.
GetNormName
(
npcEnemy
)
end
end
--团战
if
J
.
IsInTeamFight
(
bot
,
1200
)
then
local
enemy
=
J
.
GetLeastHpUnit
(
nInRangeEnemyList
)
if
enemy
~=
nil
then
return
BOT_ACTION_DESIRE_HIGH
,
enemy
,
'Q-团战攻击血量最少单位'
end
end
--攻击
if
J
.
IsGoingOnSomeone
(
bot
)
then
if
J
.
IsValidHero
(
botTarget
)
and
J
.
IsInRange
(
botTarget
,
bot
,
nCastRange
+
300
)
then
if
nSkillLV
>=
2
or
nMP
>
0
.
68
or
J
.
GetHP
(
botTarget
)
<
0
.
5
then
return
BOT_ACTION_DESIRE_HIGH
,
botTarget
,
'Q-攻击:'
..
J
.
Chat
.
GetNormName
(
botTarget
)
end
end
end
--Farm
if
J
.
IsFarming
(
bot
)
and
nSkillLV
>=
3
and
J
.
IsAllowedToSpam
(
bot
,
nManaCost
)
and
J
.
IsValid
(
botTarget
)
and
botTarget
:
GetTeam
()
==
TEAM_NEUTRAL
and
J
.
IsInRange
(
bot
,
botTarget
,
1000
)
and
bot
:
IsFacingLocation
(
botTarget
:
GetLocation
(),
45
)
and
(
botTarget
:
GetMagicResist
()
<
0
.
4
or
nMP
>
0
.
9
)
then
return
BOT_ACTION_DESIRE_HIGH
,
botTarget
,
"Q-打钱"
end
--Push
if
(
J
.
IsPushing
(
bot
)
or
J
.
IsDefending
(
bot
)
or
J
.
IsFarming
(
bot
)
or
(
J
.
IsLaning
(
bot
)
and
bot
:
GetAssignedLane
()
==
LANE_MID
))
and
J
.
IsAllowedToSpam
(
bot
,
nManaCost
)
and
nSkillLV
>=
2
or
DotaTime
()
>
9
*
60
and
#
hAllyList
<=
2
and
#
hEnemyList
==
0
then
local
laneCreepList
=
bot
:
GetNearbyLaneCreeps
(
nCastRange
,
true
)
laneCreepList
=
J
.
Filter
(
function
(
u
)
return
J
.
IsValid
(
u
)
and
not
u
:
HasModifier
(
"modifier_fountain_glyph"
)
end
)
if
#
laneCreepList
>=
3
then
return
BOT_ACTION_DESIRE_HIGH
,
laneCreepList
[
1
],
"Q-推线"
end
end
--Roshan
if
bot
:
GetActiveMode
()
==
BOT_MODE_ROSHAN
and
bot
:
GetMana
()
>=
900
then
if
J
.
IsRoshan
(
botTarget
)
and
J
.
IsInRange
(
botTarget
,
bot
,
nCastRange
)
then
return
BOT_ACTION_DESIRE_HIGH
,
botTarget
,
"Q-Roshan"
end
end
--常规
if
(
#
hEnemyList
>
0
or
bot
:
WasRecentlyDamagedByAnyHero
(
3
.
0
)
)
and
(
bot
:
GetActiveMode
()
~=
BOT_MODE_RETREAT
or
#
hAllyList
>=
2
)
and
#
nInRangeEnemyList
>=
1
and
nLV
>=
15
then
for
_
,
npcEnemy
in
pairs
(
nInRangeEnemyList
)
do
if
J
.
IsValid
(
npcEnemy
)
and
J
.
CanCastOnNonMagicImmune
(
npcEnemy
)
and
J
.
IsInRange
(
bot
,
npcEnemy
,
nCastRange
)
then
return
BOT_ACTION_DESIRE_HIGH
,
npcEnemy
,
'Q-常规'
end
end
end
return
BOT_ACTION_DESIRE_NONE
end
local
hEnemyLocations
=
{}
local
nEnemyLocationsIndex
=
1
function
X
.
UpdateEnemyLocations
()
local
enemies
=
bot
:
GetNearbyHeroes
(
99999
,
true
,
BOT_MODE_NONE
)
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
()
end
nEnemyLocationsIndex
[
u
][
nEnemyLocationsIndex
]
=
u
:
GetLocation
()
end
)
then
nEnemyLocationsIndex
[
u
][
nEnemyLocationsIndex
]
=
nil
end
end
nEnemyLocationsIndex
=
nEnemyLocationsIndex
+
1
if
nEnemyLocationsIndex
>
41
then
nEnemyLocationsIndex
=
1
end
end
function
X
.
GetWLocation
(
u
)
local
index
=
nEnemyLocationsIndex
+
1
if
index
==
42
then
index
=
1
end
if
hEnemyLocations
[
u
]
and
hEnemyLocations
[
u
][
index
]
then
return
hEnemyLocations
[
u
][
index
]
end
return
nil
end
function
X
.
ConsiderW
()
if
not
abilityW
:
IsFullyCastable
()
then
return
0
end
local
nSkillLV
=
abilityW
:
GetLevel
()
local
nCastRange
=
abilityW
:
GetCastRange
()
+
aetherRange
local
nCastPoint
=
abilityW
:
GetCastPoint
()
local
nManaCost
=
abilityW
:
GetManaCost
()
local
nDamage
=
abilityW
:
GetAbilityDamage
()
local
nDamageType
=
DAMAGE_TYPE_MAGICAL
local
nInRangeEnemyList
=
bot
:
GetNearbyHeroes
(
nCastRange
,
true
,
BOT_MODE_NONE
)
nInRangeEnemyList
=
J
.
Filter
(
nInRangeEnemyList
,
J
.
And
(
J
.
IsValidHero
,
J
.
CanCastOnNonMagicImmune
))
--打断
for
_
,
npcEnemy
in
pairs
(
nInRangeEnemyList
)
do
if
npcEnemy
:
IsChanneling
()
then
return
BOT_ACTION_DESIRE_HIGH
,
npcEnemy
,
'W-打断吟唱:'
..
J
.
Chat
.
GetNormName
(
npcEnemy
)
end
end
--打回泉水或TP点
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
return
BOT_ACTION_DESIRE_HIGH
,
npcEnemy
,
'W-打回泉水:'
..
J
.
Chat
.
GetNormName
(
npcEnemy
)
end
end
--撤退
if
J
.
IsRetreating
(
bot
)
then
for
_
,
npcEnemy
in
pairs
(
nInRangeEnemyList
)
do
local
newLocation
=
X
.
GetWLocation
(
npcEnemy
)
if
newLocation
and
GetUnitToLocationDistance
(
bot
,
newLocation
)
>
GetUnitToUnitDistance
(
bot
,
npcEnemy
)
+
400
and
not
J
.
IsDisabled
(
npcEnemy
)
and
not
J
.
IsTaunted
(
npcEnemy
)
and
not
npcEnemy
:
IsDisarmed
()
then
return
BOT_ACTION_DESIRE_HIGH
,
npcEnemy
,
"W-撤退:"
..
J
.
Chat
.
GetNormName
(
npcEnemy
)
end
end
end
return
BOT_ACTION_DESIRE_NONE
end
function
X
.
ConsiderE
()
if
not
abilityE
:
IsFullyCastable
()
then
return
0
end
local
nSkillLV
=
abilityE
:
GetLevel
()
local
nCastRange
=
abilityE
:
GetCastRange
()
+
aetherRange
local
nCastPoint
=
abilityE
:
GetCastPoint
()
+
1
.
0
local
nManaCost
=
abilityE
:
GetManaCost
()
local
nDamageType
=
DAMAGE_TYPE_MAGICAL
local
nRadius
=
350
local
nInRangeEnemyList
=
bot
:
GetNearbyHeroes
(
nCastRange
+
nRadius
*
0
.
5
,
true
,
BOT_MODE_NONE
)
local
nTargetLocation
=
nil
--连招
local
WTime
=
lastWTime
-
DotaTime
()
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
()
and
not
lastWTarget
:
IsMagicImmune
()
then
WECasted
=
true
return
BOT_ACTION_DESIRE_HIGH
,
lastWLocation
,
'E连招'
end
--团战
if
J
.
IsInTeamFight
(
bot
,
1200
)
then
local
nAoeLoc
=
J
.
GetAoeEnemyHeroLocation
(
bot
,
nCastRange
,
nRadius
,
2
)
if
nAoeLoc
~=
nil
then
return
BOT_ACTION_DESIRE_HIGH
,
nAoeLoc
,
'E团战'
end
end
--团战2
if
J
.
IsInTeamFight
(
bot
,
1200
)
then
local
nAoeLoc
=
J
.
GetAoeEnemyHeroLocation
(
bot
,
nCastRange
,
nRadius
,
2
)
if
nAoeLoc
~=
nil
then
return
BOT_ACTION_DESIRE_HIGH
,
nAoeLoc
,
'E团战'
end
end
--追杀
if
J
.
IsGoingOnSomeone
(
bot
)
then
if
J
.
IsValidHero
(
botTarget
)
and
J
.
CanCastOnNonMagicImmune
(
botTarget
)
and
J
.
IsInRange
(
botTarget
,
bot
,
nCastRange
-
30
)
then
nTargetLocation
=
J
.
GetDelayCastLocation
(
bot
,
botTarget
,
nCastRange
,
nRadius
,
nCastPoint
)
if
nTargetLocation
~=
nil
then
return
BOT_ACTION_DESIRE_HIGH
,
nTargetLocation
,
"E追杀"
..
J
.
Chat
.
GetNormName
(
botTarget
)
end
end
end
--撤退
if
J
.
IsRetreating
(
bot
)
then
local
nAoeLoc
=
J
.
GetAoeEnemyHeroLocation
(
bot
,
nCastRange
-
100
,
nRadius
-
20
,
2
)
if
nAoeLoc
~=
nil
then
nTargetLocation
=
nAoeLoc
return
BOT_ACTION_DESIRE_HIGH
,
nTargetLocation
,
'E撤退-阻止多人'
end
for
_
,
npcEnemy
in
pairs
(
nInRangeEnemyList
)
do
if
J
.
IsValid
(
npcEnemy
)
and
J
.
CanCastOnNonMagicImmune
(
npcEnemy
)
and
(
bot
:
WasRecentlyDamagedByHero
(
npcEnemy
,
4
.
0
)
or
bot
:
GetActiveModeDesire
()
>
BOT_ACTION_DESIRE_VERYHIGH
)
then
nTargetLocation
=
J
.
GetDelayCastLocation
(
bot
,
npcEnemy
,
nCastRange
,
nRadius
,
nCastPoint
)
if
nTargetLocation
~=
nil
then
return
BOT_ACTION_DESIRE_HIGH
,
nTargetLocation
,
"E撤退-阻止单个敌人"
..
J
.
Chat
.
GetNormName
(
npcEnemy
)
end
end
end
end
--自保
if
bot
:
WasRecentlyDamagedByAnyHero
(
3
.
0
)
and
nLV
>=
10
and
bot
:
GetActiveMode
()
~=
BOT_MODE_RETREAT
and
#
nInRangeEnemyList
>=
1
then
for
_
,
npcEnemy
in
pairs
(
nInRangeEnemyList
)
do
if
J
.
IsValid
(
npcEnemy
)
and
J
.
CanCastOnNonMagicImmune
(
npcEnemy
)
and
bot
:
IsFacingLocation
(
npcEnemy
:
GetLocation
(),
45
)
then
nTargetLocation
=
J
.
GetDelayCastLocation
(
bot
,
npcEnemy
,
nCastRange
,
nRadius
-
30
,
nCastPoint
)
if
nTargetLocation
~=
nil
then
return
BOT_ACTION_DESIRE_HIGH
,
nTargetLocation
,
"W自保"
..
J
.
Chat
.
GetNormName
(
npcEnemy
)
end
end
end
end
return
BOT_ACTION_DESIRE_NONE
end
function
X
.
ConsiderR
()
if
not
abilityR
:
IsFullyCastable
()
then
return
0
end
local
nSkillLV
=
abilityR
:
GetLevel
()
local
nCastRange
=
abilityR
:
GetCastRange
()
+
aetherRange
local
nCastPoint
=
abilityR
:
GetCastPoint
()
+
0
.
5
local
nManaCost
=
abilityR
:
GetManaCost
()
local
nDamageType
=
DAMAGE_TYPE_MAGICAL
local
nRadius
=
abilityR
:
GetAOERadius
()
local
nInRangeEnemyList
=
bot
:
GetNearbyHeroes
(
nCastRange
+
nRadius
*
0
.
5
,
true
,
BOT_MODE_NONE
)
local
nTargetLocation
=
nil
local
WTime
=
lastWTime
-
DotaTime
()
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连招"
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"
end
if
abilityE
:
IsFullyCastable
()
then
return
end
--有E等E,没E再说
--团战
if
J
.
IsInTeamFight
(
bot
,
1200
)
then
local
nAoeLoc
=
J
.
GetAoeEnemyHeroLocation
(
bot
,
nCastRange
,
nRadius
,
3
)
if
nAoeLoc
~=
nil
then
nTargetLocation
=
nAoeLoc
return
BOT_ACTION_DESIRE_HIGH
,
nTargetLocation
,
'Q团战'
end
end
return
BOT_ACTION_DESIRE_NONE
end
return
X
-- dota2jmz@163.com QQ:2462331592..
FunLib/jmz_func.lua
View file @
bacd194c
...
@@ -436,6 +436,13 @@ function J.GetAlliesNearLoc( vLoc, nRadius )
...
@@ -436,6 +436,13 @@ function J.GetAlliesNearLoc( vLoc, nRadius )
end
end
function
J
.
GetEnemiesNearLoc
(
bot
,
vLoc
,
nRadius
)
local
enemies
=
bot
:
GetNearbyHeroes
(
99999
,
true
,
BOT_MODE_NONE
)
return
J
.
FilterGroup
(
enemies
,
function
(
u
)
return
u
:
IsAlive
()
and
GetUnitToLocationDistance
(
u
,
vLoc
)
<=
nRadius
end
)
end
function
J
.
IsAllyHeroBetweenAllyAndEnemy
(
hAlly
,
hEnemy
,
vLoc
,
nRadius
)
function
J
.
IsAllyHeroBetweenAllyAndEnemy
(
hAlly
,
hEnemy
,
vLoc
,
nRadius
)
...
@@ -3211,6 +3218,45 @@ function J.GetMagicToPhysicalDamage( bot, nUnit, nMagicDamage )
...
@@ -3211,6 +3218,45 @@ function J.GetMagicToPhysicalDamage( bot, nUnit, nMagicDamage )
end
end
function
J
.
FilterGroup
(
nList
,
func
)
local
newGroup
=
{}
for
_
,
npc
in
pairs
(
nList
)
do
if
func
(
npc
)
then
table.insert
(
newGroup
,
npc
)
end
end
return
newGroup
end
function
J
.
Not
(
f
)
return
function
(
...
)
return
not
f
(
...
)
end
end
function
J
.
And
(
...
)
local
funcList
=
table.unpack
(
...
)
return
function
(
...
)
for
_
,
func
in
pairs
(
funcList
)
do
if
not
func
(
...
)
then
return
false
end
end
return
true
end
end
function
J
.
Or
(
...
)
local
funcList
=
table.unpack
(
...
)
return
function
(
...
)
for
_
,
func
in
pairs
(
funcList
)
do
if
func
(
...
)
then
return
true
end
end
return
false
end
end
return
J
return
J
...
...
hero_selection.lua
View file @
bacd194c
...
@@ -67,7 +67,7 @@ local sUserKeyDir = Chat.GetUserKeyDir()
...
@@ -67,7 +67,7 @@ local sUserKeyDir = Chat.GetUserKeyDir()
'npc_dota_hero_dark_seer',
'npc_dota_hero_dark_seer',
'npc_dota_hero_dark_willow',
'npc_dota_hero_dark_willow',
--'npc_dota_hero_dazzle',
--'npc_dota_hero_dazzle',
'npc_dota_hero_disruptor',
--
'npc_dota_hero_disruptor',
--'npc_dota_hero_death_prophet',
--'npc_dota_hero_death_prophet',
'npc_dota_hero_doom_bringer',
'npc_dota_hero_doom_bringer',
--'npc_dota_hero_dragon_knight',
--'npc_dota_hero_dragon_knight',
...
@@ -176,6 +176,7 @@ local sHasDevelopmentHeroList = {
...
@@ -176,6 +176,7 @@ local sHasDevelopmentHeroList = {
"npc_dota_hero_abyssal_underlord"
,
"npc_dota_hero_abyssal_underlord"
,
"npc_dota_hero_alchemist"
,
"npc_dota_hero_alchemist"
,
"npc_dota_hero_life_stealer"
,
"npc_dota_hero_life_stealer"
,
"npc_dota_hero_disruptor"
,
"npc_dota_hero_silencer"
,
"npc_dota_hero_silencer"
,
"npc_dota_hero_warlock"
,
"npc_dota_hero_warlock"
,
"npc_dota_hero_necrolyte"
,
"npc_dota_hero_necrolyte"
,
...
@@ -230,9 +231,6 @@ local sHasDevelopmentHeroList = {
...
@@ -230,9 +231,6 @@ local sHasDevelopmentHeroList = {
"npc_dota_hero_razor"
,
"npc_dota_hero_razor"
,
"npc_dota_hero_mirana"
,
"npc_dota_hero_mirana"
,
}
}
...
@@ -344,7 +342,7 @@ local sPriestList = {
...
@@ -344,7 +342,7 @@ local sPriestList = {
"npc_dota_hero_bane"
,
"npc_dota_hero_bane"
,
-- "npc_dota_hero_windrunner",
-- "npc_dota_hero_windrunner",
"npc_dota_hero_queenofpain"
,
"npc_dota_hero_queenofpain"
,
"npc_dota_hero_disruptor"
,
}
}
local
sMageList
=
{
local
sMageList
=
{
...
@@ -369,6 +367,7 @@ local sMageList = {
...
@@ -369,6 +367,7 @@ local sMageList = {
"npc_dota_hero_bane"
,
"npc_dota_hero_bane"
,
-- "npc_dota_hero_windrunner",
-- "npc_dota_hero_windrunner",
"npc_dota_hero_queenofpain"
,
"npc_dota_hero_queenofpain"
,
"npc_dota_hero_disruptor"
,
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment