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
f9b36aa1
Commit
f9b36aa1
authored
Apr 23, 2023
by
JoyJ
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
7.33 stuffs
parent
bfb02f13
Changes
19
Hide whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
455 additions
and
627 deletions
+455
-627
BotLib/hero_bounty_hunter.lua
BotLib/hero_bounty_hunter.lua
+7
-3
BotLib/hero_dazzle.lua
BotLib/hero_dazzle.lua
+20
-69
BotLib/hero_kunkka.lua
BotLib/hero_kunkka.lua
+10
-11
BotLib/hero_legion_commander.lua
BotLib/hero_legion_commander.lua
+9
-13
BotLib/hero_medusa.lua
BotLib/hero_medusa.lua
+2
-10
BotLib/hero_necrolyte.lua
BotLib/hero_necrolyte.lua
+1
-36
BotLib/hero_ogre_magi.lua
BotLib/hero_ogre_magi.lua
+6
-46
BotLib/hero_riki.lua
BotLib/hero_riki.lua
+1
-14
FunLib/aba_item.lua
FunLib/aba_item.lua
+4
-133
FunLib/aba_role.lua
FunLib/aba_role.lua
+8
-50
FunLib/aba_site.lua
FunLib/aba_site.lua
+1
-1
ability_item_usage_generic.lua
ability_item_usage_generic.lua
+82
-25
hero_selection.lua
hero_selection.lua
+3
-1
item_purchase_generic.lua
item_purchase_generic.lua
+3
-0
mode_farm_generic.lua
mode_farm_generic.lua
+11
-10
mode_rune_generic.lua
mode_rune_generic.lua
+16
-2
mode_side_shop_generic.lua
mode_side_shop_generic.lua
+0
-171
mode_team_roam_generic.lua
mode_team_roam_generic.lua
+0
-32
rewrite_functions.lua
rewrite_functions.lua
+271
-0
No files found.
BotLib/hero_bounty_hunter.lua
View file @
f9b36aa1
...
...
@@ -40,7 +40,7 @@ tOutFitList['outfit_carry'] = {
'item_melee_carry_outfit'
,
-- 'item_medallion_of_courage',
'item_vanguard'
,
--
"item_aghanims_shard",
"item_aghanims_shard"
,
"item_solar_crest"
,
"item_black_king_bar"
,
"item_ultimate_scepter"
,
...
...
@@ -172,8 +172,8 @@ function X.SkillsComplement()
hEnemyList
=
bot
:
GetNearbyHeroes
(
1600
,
true
,
BOT_MODE_NONE
)
hAllyList
=
J
.
GetAlliesNearLoc
(
bot
:
GetLocation
(),
1600
)
aetherRange
=
J
.
GetBonusCastRange
(
bot
)
if
talent3
:
IsTrained
()
then
talent3Damage
=
talent3
:
GetSpecialValueInt
(
"value"
)
end
...
...
@@ -185,7 +185,11 @@ function X.SkillsComplement()
J
.
SetQueuePtToINT
(
bot
,
false
)
bot
:
ActionQueue_UseAbility
(
abilityE
)
if
bit
.
band
(
abilityE
:
GetBehavior
(),
ABILITY_BEHAVIOR_NO_TARGET
)
>
0
then
bot
:
ActionQueue_UseAbility
(
abilityE
)
else
bot
:
ActionQueue_UseAbilityOnEntity
(
abilityE
,
bot
)
end
return
end
...
...
BotLib/hero_dazzle.lua
View file @
f9b36aa1
...
...
@@ -39,14 +39,14 @@ tOutFitList['outfit_carry'] = {
"item_crystal_maiden_outfit"
,
"item_force_staff"
,
"item_hand_of_midas"
,
"item_ultimate_scepter"
,
--
"item_ultimate_scepter",
"item_aghanims_shard"
,
"item_orchid"
,
"item_black_king_bar"
,
"item_hurricane_pike"
,
"item_bloodthorn"
,
"item_mystic_staff"
,
"item_ultimate_scepter_2"
,
--
"item_ultimate_scepter_2",
"item_sheepstick"
,
}
...
...
@@ -61,6 +61,7 @@ tOutFitList['outfit_priest'] = {
"item_glimmer_cape"
,
"item_aghanims_shard"
,
"item_guardian_greaves"
,
"item_octarine_core"
,
"item_spirit_vessel"
,
--"item_holy_locket",
-- "item_ultimate_scepter",
...
...
@@ -81,6 +82,7 @@ tOutFitList['outfit_mage'] = {
"item_aghanims_shard"
,
--"item_holy_locket",
"item_veil_of_discord"
,
"item_octarine_core"
,
-- "item_ultimate_scepter",
"item_mystic_staff"
,
-- "item_ultimate_scepter_2",
...
...
@@ -179,10 +181,7 @@ function X.SkillsComplement()
hEnemyList
=
bot
:
GetNearbyHeroes
(
1600
,
true
,
BOT_MODE_NONE
)
hAllyList
=
J
.
GetAlliesNearLoc
(
bot
:
GetLocation
(),
1600
)
if
aether
~=
nil
then
aetherRange
=
225
end
aetherRange
=
J
.
GetBonusCastRange
(
bot
)
castWDesire
,
castWTarget
,
sMotive
=
X
.
ConsiderW
()
if
(
castWDesire
>
0
)
...
...
@@ -219,82 +218,35 @@ function X.SkillsComplement()
return
end
castRDesire
,
castRTarget
,
sMotive
=
X
.
ConsiderR
()
if
(
castRDesire
>
0
)
then
castRDesire
,
castRTarget
,
sMotive
=
X
.
ConsiderR
()
if
(
castRDesire
>
0
)
then
J
.
SetReportMotive
(
bDebugMode
,
sMotive
)
J
.
SetQueuePtToINT
(
bot
,
true
)
bot
:
ActionQueue_UseAbility
(
abilityR
)
return
end
castFDesire
,
castFTarget
,
sMotive
=
X
.
ConsiderF
()
if
(
castFDesire
>
0
)
then
J
.
SetReportMotive
(
bDebugMode
,
sMotive
)
J
.
SetQueuePtToINT
(
bot
,
true
)
bot
:
ActionQueue_UseAbilityOnEntity
(
abilityF
,
castFTarget
)
return
end
end
function
X
.
ConsiderF
()
if
not
abilityF
:
IsFullyCastable
()
or
not
bot
:
HasScepter
()
then
return
0
end
if
not
abilityQ
:
IsFullyCastable
()
and
not
abilityW
:
IsFullyCastable
()
and
not
abilityE
:
IsFullyCastable
()
and
not
abilityR
:
IsFullyCastable
()
then
local
allyList
=
bot
:
GetNearbyHeroes
(
400
,
false
,
BOT_MODE_NONE
)
local
targetAlly
=
bot
local
targetAllyNetWorth
=
0
for
_
,
npcAlly
in
pairs
(
allyList
)
do
if
npcAlly
:
IsAlive
()
and
not
npcAlly
:
IsIllusion
()
and
not
npcAlly
:
HasModifier
(
'modifier_arc_warden_tempest_double'
)
then
if
npcAlly
:
GetNetWorth
()
>
targetAllyNetWorth
then
targetAlly
=
npcAlly
targetAllyNetWorth
=
npcAlly
:
GetNetWorth
()
end
end
end
if
targetAlly
~=
nil
then
return
BOT_ACTION_DESIRE_HIGH
,
targetAlly
,
"F-刷新物品"
end
end
end
return
BOT_ACTION_DESIRE_NONE
end
function
X
.
ConsiderR
()
local
nSkillLV
=
abilityQ
:
GetLevel
()
local
cost
=
nSkillLV
*
25
+
50
if
bot
:
HasModifier
(
'modifier_dazzle_bad_juju_manacost'
)
then
cost
=
math.pow
(
cost
,
bot
:
GetModifierStackCount
(
bot
:
GetModifierByName
(
'modifier_dazzle_bad_juju_manacost'
)))
end
if
not
abilityR
:
IsFullyCastable
()
then
return
0
end
if
not
abilityQ
:
IsFullyCastable
()
and
not
abilityW
:
IsFullyCastable
()
and
not
abilityE
:
IsFullyCastable
()
then
and
(
abilityW
:
GetCooldownTimeRemaining
()
<
abilityR
:
GetVal
(
'cooldown_reduction'
)
or
J
.
GetModifierTime
(
bot
,
'modifier_dazzle_shallow_grave'
)
>
abilityR
:
GetCooldown
()
or
cost
*
2
<
bot
:
GetHealth
())
then
local
enemyList
=
bot
:
GetNearbyHeroes
(
900
,
true
,
BOT_MODE_NONE
)
if
#
enemyList
>=
1
then
...
...
@@ -302,7 +254,6 @@ function X.ConsiderR()
end
end
return
BOT_ACTION_DESIRE_NONE
end
...
...
@@ -492,11 +443,8 @@ function X.ConsiderQ()
end
end
return
BOT_ACTION_DESIRE_NONE
end
...
...
@@ -517,6 +465,9 @@ function X.ConsiderW()
local
hCastTarget
=
nil
local
sCastMotive
=
nil
if
nHP
<
0
.
05
then
return
BOT_ACTION_DESIRE_HIGH
,
bot
,
"W-保护自己"
end
for
_
,
npcAlly
in
pairs
(
hAllyList
)
do
...
...
BotLib/hero_kunkka.lua
View file @
f9b36aa1
...
...
@@ -164,7 +164,7 @@ local castWDesire, castWTarget
local
castEDesire
,
castETarget
local
castASDesire
,
castASTarget
local
castE2Desire
local
castDDesire
local
castDDesire
,
castDLocation
local
castRDesire
,
castRLocation
local
Combo1Desire
,
C1Target
,
C1Location
local
Combo2Desire
,
C2Target
,
C2Location
...
...
@@ -302,11 +302,12 @@ function X.SkillsComplement()
--浪
castDDesire
,
castDLocation
=
X
.
ConsiderD
()
if
not
castDLocation
then
castDLocation
=
bot
:
GetLocation
()
end
if
castDDesire
>
0
then
J
.
SetQueuePtToINT
(
bot
,
true
)
bot
:
ActionQueue_UseAbility
(
abilityD
)
bot
:
ActionQueue_UseAbility
OnLocation
(
abilityD
,
castDLocation
)
return
end
...
...
@@ -465,6 +466,9 @@ function X.ConsiderCombo3()
end
function
X
.
ConsiderD
()
local
nCastRange
=
abilityD
:
GetCastRange
()
local
nRadius
=
abilityD
:
GetVal
(
'torrent_max_distance'
)
local
nCastPoint
=
abilityQ
:
GetCastPoint
()
if
not
abilityD
:
IsFullyCastable
()
or
not
bot
:
HasScepter
()
...
...
@@ -476,22 +480,17 @@ function X.ConsiderD()
then
local
npcTarget
=
J
.
GetProperTarget
(
bot
)
if
J
.
IsValidHero
(
npcTarget
)
and
J
.
IsInRange
(
bot
,
npcTarget
,
9
00
)
and
J
.
IsInRange
(
bot
,
npcTarget
,
3
00
)
and
J
.
CanCastOnNonMagicImmune
(
npcTarget
)
then
return
BOT_ACTION_DESIRE_HIGH
end
end
if
J
.
IsRetreating
(
bot
)
or
J
.
IsInTeamFight
(
bot
,
1
2
00
)
if
J
.
IsRetreating
(
bot
)
or
J
.
IsInTeamFight
(
bot
,
1
6
00
)
then
local
nEnemyHeroList
=
J
.
GetEnemyList
(
bot
,
1100
)
if
#
nEnemyHeroList
>=
3
or
(
#
nEnemyHeroList
>=
2
and
nHP
<=
0
.
5
)
or
(
#
nEnemyHeroList
>=
1
and
nHP
<=
0
.
4
and
bot
:
WasRecentlyDamagedByHero
(
3
.
0
)
)
then
return
BOT_ACTION_DESIRE_HIGH
end
local
locationAoE
=
bot
:
FindAoELocation
(
true
,
true
,
bot
:
GetLocation
(),
nCastRange
,
nRadius
,
nCastPoint
,
3
)
if
locationAoE
then
return
BOT_ACTION_DESIRE_HIGH
,
locationAoE
end
end
return
BOT_ACTION_DESIRE_NONE
...
...
BotLib/hero_legion_commander.lua
View file @
f9b36aa1
...
...
@@ -170,11 +170,7 @@ function X.SkillsComplement()
hEnemyList
=
bot
:
GetNearbyHeroes
(
1600
,
true
,
BOT_MODE_NONE
)
hAllyList
=
J
.
GetAlliesNearLoc
(
bot
:
GetLocation
(),
1600
)
--计算天赋可能带来的通用变化
aetherRange
=
J
.
GetBonusCastRange
(
bot
)
castRDesire
,
castRTarget
,
sMotive
=
X
.
ConsiderR
()
if
castRDesire
>
0
...
...
@@ -217,7 +213,7 @@ function X.SkillsComplement()
J
.
SetQueuePtToINT
(
bot
,
true
)
bot
:
ActionQueue_UseAbility
OnLocation
(
abilityQ
,
castQTarget
)
bot
:
ActionQueue_UseAbility
(
abilityQ
)
return
end
...
...
@@ -249,8 +245,8 @@ function X.ConsiderQ()
if
not
abilityQ
:
IsFullyCastable
()
then
return
0
end
local
nSkillLV
=
abilityQ
:
GetLevel
()
local
nCastRange
=
abilityQ
:
GetCastRange
()
local
nRadius
=
abilityQ
:
GetSpecialValueInt
(
'radius'
)
local
nCastRange
=
600
local
nRadius
=
600
local
nCastPoint
=
abilityQ
:
GetCastPoint
()
local
nManaCost
=
abilityQ
:
GetManaCost
()
local
nDamage
=
abilityQ
:
GetSpecialValueInt
(
'damage'
)
*
2
...
...
@@ -273,7 +269,7 @@ function X.ConsiderQ()
end
--消耗
local
nCanHurtEnemyAoE
=
bot
:
FindAoELocation
(
true
,
true
,
bot
:
GetLocation
(),
nCastRange
,
nRadius
+
5
0
,
0
,
0
)
local
nCanHurtEnemyAoE
=
bot
:
FindAoELocation
(
true
,
true
,
bot
:
GetLocation
(),
10
,
59
0
,
0
,
0
)
if
nCanHurtEnemyAoE
.
count
>=
3
then
hCastTarget
=
nCanHurtEnemyAoE
.
targetloc
...
...
@@ -285,7 +281,7 @@ function X.ConsiderQ()
if
J
.
IsLaning
(
bot
)
then
--对线消耗
local
nAoeLoc
=
J
.
GetAoeEnemyHeroLocation
(
bot
,
nCastRange
-
80
,
nRadius
-
8
0
,
2
)
local
nAoeLoc
=
J
.
GetAoeEnemyHeroLocation
(
bot
,
50
,
45
0
,
2
)
if
nAoeLoc
~=
nil
and
nMP
>
0
.
38
then
hCastTarget
=
nAoeLoc
...
...
@@ -297,7 +293,7 @@ function X.ConsiderQ()
--团战
if
J
.
IsInTeamFight
(
bot
,
1200
)
then
local
nAoeLoc
=
J
.
GetAoeEnemyHeroLocation
(
bot
,
nCastRange
,
nRadius
-
100
,
2
)
local
nAoeLoc
=
J
.
GetAoeEnemyHeroLocation
(
bot
,
49
,
499
,
2
)
if
nAoeLoc
~=
nil
then
hCastTarget
=
nAoeLoc
...
...
@@ -315,7 +311,7 @@ function X.ConsiderQ()
then
if
nSkillLV
>=
2
or
nMP
>
0
.
68
or
J
.
GetHP
(
botTarget
)
<
0
.
38
then
hCastTarget
=
J
.
GetCastLocation
(
bot
,
botTarget
,
nCastRange
,
nRadius
-
8
0
)
hCastTarget
=
J
.
GetCastLocation
(
bot
,
botTarget
,
10
,
49
0
)
if
hCastTarget
~=
nil
then
return
BOT_ACTION_DESIRE_HIGH
,
hCastTarget
,
'Q-攻击'
..
J
.
Chat
.
GetNormName
(
botTarget
)
...
...
@@ -354,7 +350,7 @@ function X.ConsiderQ()
and
(
botTarget
:
GetMagicResist
()
<
0
.
4
or
nMP
>
0
.
9
)
then
local
nShouldHurtCount
=
nMP
>
0
.
55
and
3
or
4
local
locationAoE
=
bot
:
FindAoELocation
(
true
,
false
,
bot
:
GetLocation
(),
nCastRange
-
400
,
nRadius
-
5
0
,
0
,
0
)
local
locationAoE
=
bot
:
FindAoELocation
(
true
,
false
,
bot
:
GetLocation
(),
40
,
40
0
,
0
,
0
)
if
(
locationAoE
.
count
>=
nShouldHurtCount
)
then
hCastTarget
=
locationAoE
.
targetloc
...
...
@@ -376,7 +372,7 @@ function X.ConsiderQ()
and
not
laneCreepList
[
1
]:
HasModifier
(
"modifier_fountain_glyph"
)
then
local
locationAoEHurt
=
bot
:
FindAoELocation
(
true
,
false
,
bot
:
GetLocation
(),
nCastRange
-
300
,
nRadius
-
5
0
,
0
,
0
)
local
locationAoEHurt
=
bot
:
FindAoELocation
(
true
,
false
,
bot
:
GetLocation
(),
30
,
40
0
,
0
,
0
)
if
locationAoEHurt
.
count
>=
4
then
hCastTarget
=
locationAoEHurt
.
targetloc
...
...
BotLib/hero_medusa.lua
View file @
f9b36aa1
...
...
@@ -24,7 +24,7 @@ local tTalentTreeList = {
}
local
tAllAbilityBuildList
=
{
{
3
,
2
,
2
,
3
,
2
,
6
,
2
,
1
,
1
,
1
,
1
,
6
,
3
,
3
,
6
},
{
2
,
1
,
3
,
2
,
2
,
6
,
2
,
1
,
1
,
1
,
3
,
6
,
3
,
3
,
6
},
}
local
nAbilityBuildList
=
J
.
Skill
.
GetRandomBuild
(
tAllAbilityBuildList
)
...
...
@@ -174,14 +174,6 @@ function X.SkillsComplement()
nHP
=
bot
:
GetHealth
()
/
bot
:
GetMaxHealth
()
hEnemyHeroList
=
bot
:
GetNearbyHeroes
(
1600
,
true
,
BOT_MODE_NONE
)
castEDesire
=
X
.
ConsiderE
()
if
castEDesire
>
0
then
bot
:
Action_UseAbility
(
abilityE
)
return
end
castWDesire
,
castWTarget
=
X
.
ConsiderW
()
if
castWDesire
>
0
...
...
@@ -228,7 +220,7 @@ function X.ConsiderQ()
local
botTarget
=
J
.
GetProperTarget
(
bot
)
--关闭分裂的情况
if
J
.
IsLaning
(
bot
)
if
J
.
IsLaning
(
bot
)
or
(
#
nInRangeEnemyHeroList
==
1
)
or
(
J
.
IsGoingOnSomeone
(
bot
)
and
J
.
IsValidHero
(
botTarget
)
and
nSkillLv
<=
2
and
#
nInRangeEnemyHeroList
==
2
)
or
(
#
nInRangeEnemyHeroList
==
0
and
#
nInRangeEnemyCreepList
<=
1
)
...
...
BotLib/hero_necrolyte.lua
View file @
f9b36aa1
...
...
@@ -433,7 +433,6 @@ function X.ConsiderR()
if
J
.
CanKillTarget
(
npcTarget
,
EstDamage
,
DAMAGE_TYPE_MAGICAL
)
or
(
npcTarget
:
IsChanneling
()
and
npcTarget
:
HasModifier
(
"modifier_teleporting"
)
)
then
X
.
ReportDetails
(
bot
,
npcTarget
,
EstDamage
,
nDamagePerHealth
)
return
BOT_ACTION_DESIRE_HIGH
,
npcTarget
end
end
...
...
@@ -455,7 +454,6 @@ function X.ConsiderR()
local
EstDamage
=
X
.
GetEstDamage
(
bot
,
npcEnemy
,
nDamagePerHealth
)
if
J
.
CanKillTarget
(
npcEnemy
,
EstDamage
,
DAMAGE_TYPE_MAGICAL
)
then
X
.
ReportDetails
(
bot
,
npcEnemy
,
EstDamage
,
nDamagePerHealth
)
npcToKill
=
npcEnemy
break
end
...
...
@@ -479,7 +477,6 @@ function X.ConsiderR()
local
EstDamage
=
X
.
GetEstDamage
(
bot
,
npcEnemy
,
nDamagePerHealth
)
if
J
.
CanCastOnNonMagicImmune
(
npcEnemy
)
and
J
.
CanKillTarget
(
npcEnemy
,
EstDamage
,
DAMAGE_TYPE_MAGICAL
)
then
X
.
ReportDetails
(
bot
,
npcEnemy
,
EstDamage
,
nDamagePerHealth
)
return
BOT_ACTION_DESIRE_HIGH
,
npcEnemy
end
end
...
...
@@ -544,38 +541,6 @@ function X.GetEstDamage( bot, npcTarget, nDamagePerHealth )
end
local
ReportTime
=
99999
function
X
.
ReportDetails
(
bot
,
npcTarget
,
EstDamage
,
nDamagePerHealth
)
if
DotaTime
()
>
ReportTime
+
5
.
0
then
local
nMessage
local
nNumber
local
MagicResist
=
1
-
npcTarget
:
GetMagicResist
()
ReportTime
=
DotaTime
()
nMessage
=
"基础伤害值:"
nNumber
=
nDamagePerHealth
*
(
npcTarget
:
GetMaxHealth
()
-
npcTarget
:
GetHealth
()
)
nNumber
=
nNumber
*
MagicResist
bot
:
ActionImmediate_Chat
(
nMessage
..
string.gsub
(
tostring
(
nNumber
),
"npc_dota_"
,
""
),
true
)
nMessage
=
"计算伤害值:"
nNumber
=
EstDamage
*
MagicResist
bot
:
ActionImmediate_Chat
(
nMessage
..
string.gsub
(
tostring
(
nNumber
),
"npc_dota_"
,
""
),
true
)
-- nMessage = "目标魔法增强率:"
-- nNumber = npcTarget:GetSpellAmp()
-- bot:ActionImmediate_Chat( nMessage..string.gsub( tostring( nNumber ), "npc_dota_", "" ), true )
nMessage
=
npcTarget
:
GetUnitName
()
nNumber
=
npcTarget
:
GetHealth
()
bot
:
ActionImmediate_Chat
(
string.gsub
(
tostring
(
nMessage
),
"npc_dota_"
,
""
)
..
'当前生命值:'
..
tostring
(
nNumber
),
true
)
end
end
function
X
.
ConsiderAS
()
...
...
@@ -592,7 +557,7 @@ function X.ConsiderAS()
local
tableNearbyEnemyHeroes
=
bot
:
GetNearbyHeroes
(
1600
,
true
,
BOT_MODE_NONE
)
if
J
.
IsRetreating
(
bot
)
then
local
enemyHeroList
=
bot
:
GetNearbyHeroes
(
500
,
true
,
BOT_MODE_NONE
)
...
...
BotLib/hero_ogre_magi.lua
View file @
f9b36aa1
...
...
@@ -35,9 +35,7 @@ local tOutFitList = {}
tOutFitList
[
'outfit_carry'
]
=
{
"item_quelling_blade"
,
"item_crystal_maiden_outfit"
,
"item_blade_mail"
,
"item_bristleback_outfit"
,
"item_hand_of_midas"
,
"item_aghanims_shard"
,
"item_ultimate_scepter"
,
...
...
@@ -55,49 +53,13 @@ tOutFitList['outfit_carry'] = {
tOutFitList
[
'outfit_mid'
]
=
tOutFitList
[
'outfit_carry'
]
tOutFitList
[
'outfit_priest'
]
=
{
tOutFitList
[
'outfit_priest'
]
=
tOutFitList
[
'outfit_carry'
]
"item_quelling_blade"
,
"item_priest_outfit"
,
"item_urn_of_shadows"
,
"item_hand_of_midas"
,
"item_mekansm"
,
"item_glimmer_cape"
,
"item_aghanims_shard"
,
"item_guardian_greaves"
,
"item_spirit_vessel"
,
"item_ultimate_scepter"
,
"item_octarine_core"
,
"item_shivas_guard"
,
"item_moon_shard"
,
"item_ultimate_scepter_2"
,
"item_sheepstick"
,
}
tOutFitList
[
'outfit_mage'
]
=
{
"item_quelling_blade"
,
"item_mage_outfit"
,
"item_hand_of_midas"
,
"item_boots_of_bearing"
,
"item_glimmer_cape"
,
"item_aghanims_shard"
,
"item_pipe"
,
"item_ultimate_scepter"
,
"item_travel_boots"
,
"item_veil_of_discord"
,
"item_moon_shard"
,
"item_travel_boots_2"
,
"item_ultimate_scepter_2"
,
"item_shivas_guard"
,
}
tOutFitList
[
'outfit_mage'
]
=
tOutFitList
[
'outfit_carry'
]
tOutFitList
[
'outfit_tank'
]
=
{
"item_
ogre_magi
_outfit"
,
"item_
tank
_outfit"
,
"item_crimson_guard"
,
"item_aghanims_shard"
,
"item_ultimate_scepter"
,
...
...
@@ -113,6 +75,7 @@ tOutFitList['outfit_tank'] = {
}
X
[
'sBuyList'
]
=
tOutFitList
[
sOutfitType
]
X
[
'sSellList'
]
=
{
...
...
@@ -120,8 +83,6 @@ X['sSellList'] = {
"item_power_treads"
,
"item_quelling_blade"
,
"item_arcane_boots"
,
"item_quelling_blade"
,
"item_assault"
,
"item_magic_wand"
,
...
...
@@ -219,9 +180,8 @@ function X.SkillsComplement()
hEnemyList
=
bot
:
GetNearbyHeroes
(
1600
,
true
,
BOT_MODE_NONE
)
hAllyList
=
J
.
GetAlliesNearLoc
(
bot
:
GetLocation
(),
1600
)
aetherRange
=
J
.
GetBonusCastRange
(
bot
)
-- if talent2:IsTrained() then aetherRange = aetherRange + talent2:GetSpecialValueInt( "value" ) end
if
talent8
:
IsTrained
()
then
talent8Damage
=
talent8Damage
+
talent8
:
GetSpecialValueInt
(
"value"
)
end
...
...
BotLib/hero_riki.lua
View file @
f9b36aa1
...
...
@@ -43,7 +43,7 @@ X['sBuyList'] = {
"item_travel_boots"
,
"item_abyssal_blade"
,
"item_ultimate_scepter"
,
"item_moon_shar
d
"
,
"item_moon_shar
e
"
,
"item_travel_boots_2"
,
"item_eagle"
,
"item_ultimate_scepter_2"
,
...
...
@@ -142,8 +142,6 @@ function X.SkillsComplement()
hAllyList
=
J
.
GetAlliesNearLoc
(
bot
:
GetLocation
(),
1600
)
nAttackPoint
=
bot
:
GetSecondsPerAttack
()
aetherRange
=
J
.
GetBonusCastRange
(
bot
)
castQDesire
,
castQTarget
,
sMotive
=
X
.
ConsiderQ
()
...
...
@@ -179,18 +177,7 @@ function X.SkillsComplement()
return
end
castASDesire
,
castASTarget
,
sMotive
=
X
.
ConsiderAS
()
if
(
castASDesire
>
0
)
then
J
.
SetReportMotive
(
bDebugMode
,
sMotive
)
J
.
SetQueuePtToINT
(
bot
,
true
)
bot
:
ActionQueue_UseAbilityOnEntity
(
abilityAS
,
castASTarget
)
return
end
end
...
...
FunLib/aba_item.lua
View file @
f9b36aa1
...
...
@@ -387,7 +387,6 @@ local sConsumableList = {
'item_refresher_shard'
,
'item_aegis'
,
'item_ultimate_scepter_roshan'
,
'item_aghanims_shard_roshan'
,
}
local
tConsumableItemList
=
{}
...
...
@@ -441,94 +440,6 @@ do
tNotSellItemList
[
sItem
]
=
true
end
--由于默认的机制问题, 已停用
local
tNeutralItemLevelList
=
{
[
'item_arcane_ring'
]
=
35
,
[
'item_broom_handle'
]
=
33
,
-- ['item_faded_broach'] = 31,
-- ['item_keen_optic'] = 29, -- 基恩镜片
-- ['item_ocean_heart'] = 43,
[
'item_royal_jelly'
]
=
96
,
[
'item_trusty_shovel'
]
=
32
,
[
'item_ironwood_tree'
]
=
44
,
[
'item_mysterious_hat'
]
=
35
,
-- ['item_chipped_vest'] = 34,
[
'item_possessed_mask'
]
=
33
,
[
'item_pogo_stick'
]
=
30
,
[
'item_unstable_wand'
]
=
30
,
[
'item_seeds_of_serenity'
]
=
30
,
[
'item_lance_of_pursuit'
]
=
30
,
[
'item_occult_bracelet'
]
=
30
,
[
'item_dragon_scale'
]
=
38
,
-- 炎龙之鳞
-- ['item_essence_ring'] = 55.5, -- 精华指环
[
'item_grove_bow'
]
=
40
,
-- 林野长弓
-- ['item_imp_claw'] = 51.5, -- 魔童之爪
[
'item_nether_shawl'
]
=
28
,
-- 幽冥披巾
[
'item_philosophers_stone'
]
=
47
.
5
,
-- 贤者石
[
'item_pupils_gift'
]
=
41
,
[
'item_ring_of_aquila'
]
=
46
,
[
'item_vambrace'
]
=
52
,
-- ['item_quicksilver_amulet'] = 45,
[
'item_bullwhip'
]
=
48
,
[
'item_misericorde'
]
=
40
,
[
'item_eye_of_the_vizier'
]
=
40
,
[
'item_specialists_array'
]
=
40
,
[
'item_dagger_of_ristul'
]
=
40
,
[
'item_enchanted_quiver'
]
=
44
,
-- 魔力箭袋
[
'item_mind_breaker'
]
=
55
,
-- ['item_orb_of_destruction'] = 53, -- 毁灭灵球
[
'item_paladin_sword'
]
=
40
,
-- 骑士剑
[
'item_quickening_charm'
]
=
50
,
[
'item_titan_sliver'
]
=
54
,
-- 巨神残铁
-- ['item_spider_legs'] = 60,
[
'item_ceremonial_robe'
]
=
46
,
[
'item_cloak_of_flames'
]
=
49
,
[
'item_elven_tunic'
]
=
47
,
[
'item_psychic_headband'
]
=
50
,
[
'item_black_powder_bag'
]
=
50
,
[
'item_ogre_seal_totem'
]
=
50
,
[
'item_spy_gadget'
]
=
36
,
-- 望远镜
[
'item_flicker'
]
=
49
,
-- 闪灵
-- ['item_illusionsts_cape'] = 64,
-- ['item_minotaur_horn'] = 65, -- 恶牛角
[
'item_ninja_gear'
]
=
58
,
-- 忍者用具
[
'item_spell_prism'
]
=
69
,
-- 法术棱镜
-- ['item_the_leveller'] = 61, -- 平世剑
[
'item_timeless_relic'
]
=
59
,
-- 永恒遗物
[
'item_trickster_cloak'
]
=
62
,
[
'item_stormcrafter'
]
=
68
,
[
'item_penta_edged_sword'
]
=
57
,
[
'item_heavy_blade'
]
=
55
,
[
'item_ascetic_cap'
]
=
55
,
[
'item_havoc_hammer'
]
=
55
,
[
'item_apex'
]
=
72
,
-- 极品
[
'item_ballista'
]
=
76
.
5
,
-- 弩炮
[
'item_demonicon'
]
=
73
,
[
'item_desolator_2'
]
=
75
,
[
'item_ex_machina'
]
=
71
,
[
'item_fallen_sky'
]
=
80
,
[
'item_force_boots'
]
=
66
,
[
'item_mirror_shield'
]
=
77
,
[
'item_pirate_hat'
]
=
74
,
[
'item_seer_stone'
]
=
40
,
[
'item_book_of_shadows'
]
=
49
,
[
'item_giants_ring'
]
=
70
,
[
'item_force_field'
]
=
70
,
}
local
tSmallItemList
=
{
[
'item_tpscroll'
]
=
1
,
...
...
@@ -575,7 +486,7 @@ Item['item_ancient_janggo'] = GetItemComponents( 'item_ancient_janggo' )[1]
Item
[
'item_aeon_disk'
]
=
GetItemComponents
(
'item_aeon_disk'
)[
1
]
Item
[
'item_bfury'
]
=
{
'item_quelling_blade'
,
'item_claymore'
,
'item_pers'
,
'item_broadsword'
}
Item
[
'item_bfury'
]
=
GetItemComponents
(
'item_bfury'
)[
1
]
Item
[
'item_black_king_bar'
]
=
GetItemComponents
(
'item_black_king_bar'
)[
1
]
...
...
@@ -595,7 +506,7 @@ Item['item_basher'] = GetItemComponents( 'item_basher' )[1]
Item
[
'item_crimson_guard'
]
=
GetItemComponents
(
'item_crimson_guard'
)[
1
]
Item
[
'item_cyclone'
]
=
{
'item_void_stone'
,
'item_staff_of_wizardry'
,
'item_recipe_cyclone'
,
'item_wind_lace'
}
Item
[
'item_cyclone'
]
=
GetItemComponents
(
'item_cyclone'
)[
1
]
Item
[
'item_dagon'
]
=
GetItemComponents
(
'item_dagon'
)[
1
]
...
...
@@ -621,7 +532,7 @@ Item['item_force_staff'] = GetItemComponents( 'item_force_staff' )[1]
Item
[
'item_glimmer_cape'
]
=
GetItemComponents
(
'item_glimmer_cape'
)[
1
]
Item
[
'item_guardian_greaves'
]
=
{
'item_arcane_boots'
,
'item_mekansm'
,
'item_recipe_guardian_greaves'
,
'item_buckler'
}
Item
[
'item_guardian_greaves'
]
=
GetItemComponents
(
'item_guardian_greaves'
)[
1
]
Item
[
'item_greater_crit'
]
=
GetItemComponents
(
'item_greater_crit'
)[
1
]
...
...
@@ -671,7 +582,7 @@ Item['item_moon_shard'] = GetItemComponents( 'item_moon_shard' )[1]
Item
[
'item_meteor_hammer'
]
=
GetItemComponents
(
'item_meteor_hammer'
)[
1
]
Item
[
'item_necronomicon'
]
=
{
'item_sobi_mask'
,
'item_belt_of_strength'
,
'item_recipe_necronomicon'
,
'item_sobi_mask'
}
Item
[
'item_necronomicon'
]
=
GetItemComponents
(
'item_necronomicon'
)[
1
]
Item
[
'item_necronomicon_2'
]
=
GetItemComponents
(
'item_necronomicon_2'
)[
1
]
...
...
@@ -1213,46 +1124,6 @@ function Item.GetBasicItems( sItemList )
end
--获取物品的基础构造
function
Item
.
GetItemBasicBuild
(
sItemName
)
local
tItem
=
sItemName
if
type
(
tItem
)
==
"string"
then
tItem
=
{
tItem
}
end
local
sBasicItem
=
{}
for
i
,
v
in
pairs
(
tItem
)
do
local
tComponents
=
GetItemComponents
(
v
)
if
#
tComponents
==
0
then
sBasicItem
[
#
sBasicItem
+
1
]
=
v
elseif
#
tComponents
>
0
then
for
_
,
w
in
pairs
(
Item
.
GetItemBasicBuild
(
tComponents
[
1
]
)
)
do
sBasicItem
[
#
sBasicItem
+
1
]
=
w
end
end
end
return
sBasicItem
end
--根据购物列表获取完整的不重复基础物品名单
function
Item
.
GetBasicItemToBuyList
(
sItemList
)
local
sBasicItemToBuyList
=
{}
return
sBasicItemToBuyList
end
function
Item
.
GetMainInvLessValItemSlot
(
bot
)
local
minPrice
=
10000
...
...
FunLib/aba_role.lua
View file @
f9b36aa1
...
...
@@ -9,9 +9,9 @@
local
X
=
{}
--
local sBotVersion = "New"
local
sBotVersion
=
"Mid"
local
sVersionDate
=
" 7.3
2, 2022/09/01
"
local
sBotVersion
=
"New"
--
local sBotVersion = "Mid"
local
sVersionDate
=
" 7.3
3, 2023/04/22
"
function
X
.
GetBotVersion
()
return
sBotVersion
,
sVersionDate
...
...
@@ -1493,35 +1493,10 @@ X["hero_roles"] = {
[
'support'
]
=
3
,
[
'pusher'
]
=
0
},
[
"npc_dota_hero_primal_beast"
]
=
{
[
'carry'
]
=
0
,
[
'disabler'
]
=
2
,
[
'durable'
]
=
1
,
[
'escape'
]
=
1
,
[
'initiator'
]
=
3
,
[
'jungler'
]
=
0
,
[
'nuker'
]
=
0
,
[
'support'
]
=
1
,
[
'pusher'
]
=
0
},
[
"npc_dota_hero_muerta"
]
=
{
[
'carry'
]
=
2
,
[
'disabler'
]
=
2
,
[
'durable'
]
=
0
,
[
'escape'
]
=
1
,
[
'initiator'
]
=
0
,
[
'jungler'
]
=
2
,
[
'nuker'
]
=
3
,
[
'support'
]
=
2
,
[
'pusher'
]
=
2
},
}
X
[
"bottle"
]
=
{
[
"npc_dota_hero_grimstroke"
]
=
1
,
[
"npc_dota_hero_tinker"
]
=
1
,
[
"npc_dota_hero_storm_spirit"
]
=
1
,
[
"npc_dota_hero_pudge"
]
=
1
,
...
...
@@ -1545,7 +1520,6 @@ X["bottle"] = {
X
[
"phase_boots"
]
=
{
[
"npc_dota_hero_abaddon"
]
=
1
,
[
"npc_dota_hero_night_stalker"
]
=
1
,
[
"npc_dota_hero_alchemist"
]
=
1
,
[
"npc_dota_hero_gyrocopter"
]
=
1
,
[
"npc_dota_hero_medusa"
]
=
1
,
...
...
@@ -1648,7 +1622,6 @@ end
X
[
'off'
]
=
{
'npc_dota_hero_abaddon'
,
'npc_dota_hero_night_stalker'
,
'npc_dota_hero_abyssal_underlord'
,
'npc_dota_hero_axe'
,
'npc_dota_hero_batrider'
,
...
...
@@ -1674,12 +1647,9 @@ X['off'] = {
'npc_dota_hero_tusk'
,
'npc_dota_hero_venomancer'
,
'npc_dota_hero_windrunner'
,
'npc_dota_hero_primal_beast'
,
'npc_dota_hero_obsidian_destroyer'
,
}
X
[
'mid'
]
=
{
'npc_dota_hero_grimstroke'
,
'npc_dota_hero_alchemist'
,
'npc_dota_hero_arc_warden'
,
'npc_dota_hero_bloodseeker'
,
...
...
@@ -1717,7 +1687,6 @@ X['mid'] = {
X
[
'safe'
]
=
{
'npc_dota_hero_antimage'
,
'npc_dota_hero_night_stalker'
,
'npc_dota_hero_chaos_knight'
,
"npc_dota_hero_mars"
,
'npc_dota_hero_drow_ranger'
,
...
...
@@ -1747,7 +1716,6 @@ X['safe'] = {
'npc_dota_hero_ogre_magi'
,
'npc_dota_hero_omniknight'
,
'npc_dota_hero_marci'
,
'npc_dota_hero_muerta'
,
}
...
...
@@ -1795,6 +1763,7 @@ X['supp'] = {
'npc_dota_hero_death_prophet'
,
'npc_dota_hero_windrunner'
,
'npc_dota_hero_venomancer'
,
}
...
...
@@ -2157,9 +2126,6 @@ function X.IsABAHero()
local
sABAHeroIndex
=
{
[
"npc_dota_hero_antimage"
]
=
true
,
[
"npc_dota_hero_night_stalker"
]
=
true
,
[
"npc_dota_hero_obsidian_destroyer"
]
=
true
,
[
"npc_dota_hero_grimstroke"
]
=
true
,
[
"npc_dota_hero_arc_warden"
]
=
true
,
[
"npc_dota_hero_bane"
]
=
true
,
[
"npc_dota_hero_bloodseeker"
]
=
true
,
...
...
@@ -2205,7 +2171,6 @@ function X.IsABAHero()
[
"npc_dota_hero_axe"
]
=
true
,
[
"npc_dota_hero_slardar"
]
=
true
,
[
"npc_dota_hero_legion_commander"
]
=
true
,
[
"npc_dota_hero_terrorblade"
]
=
true
,
[
"npc_dota_hero_tidehunter"
]
=
true
,
[
"npc_dota_hero_omniknight"
]
=
true
,
[
"npc_dota_hero_naga_siren"
]
=
true
,
...
...
@@ -2411,25 +2376,18 @@ function X.IsUserSetSup( bot )
end
X
[
"bPvNMode"
]
=
false
function
X
.
IsPvNMode
()
if
X
[
"bPvNMode"
]
or
DotaTime
()
>
60
then
return
X
[
"bPvNMode"
]
end
local
oppositePlayerCount
=
#
GetTeamPlayers
(
GetOpposingTeam
()
)
if
oppositePlayerCount
<=
3
then
X
[
"bPvNMode"
]
=
true
end
function
X
.
IsPvNMode
()
return
X
[
"bPvNMode"
]
return
X
.
IsAllShadow
()
end
local
nShadowNumber
=
RandomInt
(
1
,
66666
)
function
X
.
IsAllShadow
()
return
nShadowNumber
<=
3
return
false
end
...
...
FunLib/aba_site.lua
View file @
f9b36aa1
...
...
@@ -668,7 +668,7 @@ function Site.RefreshCamp( bot )
end
function
Site
.
GetClosestNeutralSp
wa
n
(
bot
,
availableCampList
)
function
Site
.
GetClosestNeutralSp
aw
n
(
bot
,
availableCampList
)
local
minDist
=
15000
local
pCamp
=
nil
...
...
ability_item_usage_generic.lua
View file @
f9b36aa1
...
...
@@ -5863,50 +5863,107 @@ local function UseGlyph()
TOWER_TOP_1
,
TOWER_MID_1
,
TOWER_BOT_1
,
}
local
T2
=
{
TOWER_TOP_2
,
TOWER_MID_2
,
TOWER_BOT_2
,
}
local
T3
=
{
TOWER_TOP_3
,
TOWER_MID_3
,
TOWER_BOT_3
,
TOWER_BASE_1
,
TOWER_BASE_2
}
for
_
,
t
in
pairs
(
T1
)
do
local
tower
=
GetTower
(
GetTeam
(),
t
)
if
tower
~=
nil
and
tower
:
GetHealth
()
>
0
and
tower
:
GetHealth
()
/
tower
:
GetMaxHealth
()
<
0
.
36
and
tower
:
GetAttackTarget
()
~=
nil
then
bot
:
ActionImmediate_Glyph
(
)
return
end
end
local
MeleeBarrack
=
{
BARRACKS_TOP_MELEE
,
BARRACKS_MID_MELEE
,
BARRACKS_BOT_MELEE
}
local
num
=
0
for
_
,
t
in
pairs
(
T1
)
do
local
tower
=
GetTower
(
GetTeam
(),
t
)
if
tower
and
tower
:
GetHealth
()
>
0
then
num
=
num
+
1
end
end
if
num
==
#
T1
then
for
_
,
t
in
pairs
(
T1
)
do
local
tower
=
GetTower
(
GetTeam
(),
t
)
if
tower
and
(
X
.
IsTargetedByEnemy
(
tower
)
or
#
tower
:
GetNearbyCreeps
(
1200
,
true
)
>
3
or
tower
:
GetHealthPercent
()
<
0
.
1
)
and
not
tower
:
HasModifier
(
'modifier_backdoor_protection'
)
and
tower
:
GetHealthPercent
()
<
0
.
3
then
bot
:
ActionImmediate_Glyph
()
return
end
end
end
num
=
0
for
_
,
t
in
pairs
(
T2
)
do
local
tower
=
GetTower
(
GetTeam
(),
t
)
if
tower
and
tower
:
GetHealth
()
>
0
then
num
=
num
+
1
end
end
if
num
==
#
T2
then
for
_
,
t
in
pairs
(
T2
)
do
local
tower
=
GetTower
(
GetTeam
(),
t
)
if
tower
and
(
X
.
IsTargetedByEnemy
(
tower
)
or
#
tower
:
GetNearbyCreeps
(
1200
,
true
)
>
3
or
tower
:
GetHealthPercent
()
<
0
.
1
)
and
not
tower
:
HasModifier
(
'modifier_backdoor_protection'
)
and
tower
:
GetHealthPercent
()
<
0
.
5
then
bot
:
ActionImmediate_Glyph
()
return
end
end
end
for
_
,
t
in
pairs
(
T3
)
do
local
tower
=
GetTower
(
GetTeam
(),
t
)
if
tower
and
(
X
.
IsTargetedByEnemy
(
tower
)
or
#
tower
:
GetNearbyCreeps
(
1200
,
true
)
>
3
or
tower
:
GetHealthPercent
()
<
0
.
1
)
and
not
tower
:
HasModifier
(
'modifier_backdoor_protection'
)
and
tower
:
GetHealthPercent
()
<
0
.
5
then
bot
:
ActionImmediate_Glyph
()
return
end
end
for
_
,
b
in
pairs
(
MeleeBarrack
)
do
local
barrack
=
GetBarracks
(
GetTeam
(),
b
)
if
barrack
~=
nil
and
barrack
:
GetHealth
()
>
0
and
barrack
:
GetHealth
()
/
barrack
:
GetMaxHealth
()
<
0
.
5
and
X
.
IsTargetedByEnemy
(
barrack
)
then
bot
:
ActionImmediate_Glyph
(
)
if
barrack
and
(
X
.
IsTargetedByEnemy
(
barrack
)
or
#
barrack
:
GetNearbyCreeps
(
1200
,
true
)
>
3
or
barrack
:
GetHealthPercent
()
<
0
.
1
)
and
not
barrack
:
HasModifier
(
'modifier_backdoor_protection'
)
and
barrack
:
GetHealthPercent
()
<
0
.
5
then
bot
:
ActionImmediate_Glyph
()
return
end
end
local
Ancient
=
GetAncient
(
GetTeam
()
)
if
Ancient
~=
nil
and
Ancient
:
GetHealth
()
>
0
and
Ancient
:
GetHealth
()
/
Ancient
:
GetMaxHealth
()
<
0
.
5
and
X
.
IsTargetedByEnemy
(
Ancient
)
then
bot
:
ActionImmediate_Glyph
(
)
if
Ancient
and
(
X
.
IsTargetedByEnemy
(
Ancient
)
or
#
Ancient
:
GetNearbyCreeps
(
1200
,
true
)
>
3
or
Ancient
:
GetHealthPercent
()
<
0
.
1
)
and
not
Ancient
:
HasModifier
(
'modifier_backdoor_protection'
)
and
Ancient
:
GetHealthPercent
()
<
0
.
5
then
bot
:
ActionImmediate_Glyph
()
return
end
...
...
hero_selection.lua
View file @
f9b36aa1
...
...
@@ -27,14 +27,16 @@ local bLineupActive = false
local
bLineupReserve
=
false
local
bLineupNotRepeated
=
false
--[[
--夜魇有玩家时AI也走中路补丁
local nDireFirstLaneType = 1 --夜魇默认一楼1中路, 2是下路, 3是上路
if pcall( require, 'game/bot_dire_first_lane_type' )
then
nDireFirstLaneType = require( 'game/bot_dire_first_lane_type' )
end
]]
--
require
(
GetScriptDirectory
()
..
"/rewrite_functions"
)
local
Role
=
require
(
GetScriptDirectory
()
..
'/FunLib/aba_role'
)
local
Chat
=
require
(
GetScriptDirectory
()
..
'/FunLib/aba_chat'
)
...
...
item_purchase_generic.lua
View file @
f9b36aa1
...
...
@@ -82,6 +82,8 @@ local function GeneralPurchase()
or
bot
.
currentComponentToBuy
==
"item_tome_of_knowledge"
or
bot
.
currentComponentToBuy
==
"item_ward_observer"
or
bot
.
currentComponentToBuy
==
"item_ward_sentry"
or
bot
.
currentComponentToBuy
==
"item_tango"
or
bot
.
currentComponentToBuy
==
"item_flask"
then
if
GetItemStockCount
(
bot
.
currentComponentToBuy
)
<=
0
then
...
...
@@ -246,6 +248,7 @@ local function TurboModeGeneralPurchase()
or
bot
.
currentComponentToBuy
==
"item_tome_of_knowledge"
or
bot
.
currentComponentToBuy
==
"item_ward_observer"
or
bot
.
currentComponentToBuy
==
"item_ward_sentry"
or
bot
.
currentComponentToBuy
==
"item_tango"
then
if
GetItemStockCount
(
bot
.
currentComponentToBuy
)
<=
0
then
...
...
mode_farm_generic.lua
View file @
f9b36aa1
...
...
@@ -72,13 +72,13 @@ end
local
sNoticeList
=
{
[
1
]
=
"创建本地主机房间设置AI即可与好友一起游戏"
,
[
2
]
=
"
赞助冠名或发送建议,请联系:dota2jmz@163.匚om
"
,
[
2
]
=
"
暂停功能会导致客户端BUG引发机器人重复出装的问题.
"
,
[
3
]
=
"寻找AI玩家一起游戏, 千人交流群等着你过来."
,
[
4
]
=
"跟车队5人一起玩AI, 等你加群体验游戏."
,
[
5
]
=
"可以和我们公屏聊天互动,武斗文斗同时进行."
,
[
6
]
=
"
感谢各位玩家朋友的支持,AI因你而持续更新.
"
,
[
7
]
=
"
暂停功能会导致客户端BUG引发机器人重复出装的问题.
"
,
[
8
]
=
"
我们正处于各种困境之中, 请帮我们出谋划策.
"
,
[
6
]
=
"
赞助冠名或发送建议,请联系:dota2jmz@163.匚om
"
,
[
7
]
=
"
赞助冠名或发送建议,请联系:dota2jmz@163.匚om
"
,
[
8
]
=
"
赞助冠名或发送建议,请联系:dota2jmz@163.匚om
"
,
[
9
]
=
"赞助冠名或发送建议,请联系:dota2jmz@163.匚om"
,
[
10
]
=
"赞助冠名或发送建议,请联系:dota2jmz@163.匚om"
,
...
...
@@ -288,7 +288,7 @@ function GetDesire()
if
bot
:
IsAlive
()
and
bot
:
HasModifier
(
'modifier_arc_warden_tempest_double'
)
and
GetRoshanDesire
()
>
0
.
85
then
if
preferedCamp
==
nil
then
preferedCamp
=
J
.
Site
.
GetClosestNeutralSp
wa
n
(
bot
,
availableCamp
)
end
;
if
preferedCamp
==
nil
then
preferedCamp
=
J
.
Site
.
GetClosestNeutralSp
aw
n
(
bot
,
availableCamp
)
end
;
return
0
.
99
;
end
...
...
@@ -386,7 +386,7 @@ function GetDesire()
if
madas
~=
nil
and
madas
:
IsFullyCastable
()
and
J
.
IsInAllyArea
(
bot
)
then
hLaneCreepList
=
bot
:
GetNearbyLaneCreeps
(
1600
,
true
);
if
preferedCamp
==
nil
then
preferedCamp
=
J
.
Site
.
GetClosestNeutralSp
wa
n
(
bot
,
availableCamp
)
end
;
if
preferedCamp
==
nil
then
preferedCamp
=
J
.
Site
.
GetClosestNeutralSp
aw
n
(
bot
,
availableCamp
)
end
;
return
BOT_MODE_DESIRE_HIGH
;
end
...
...
@@ -411,7 +411,7 @@ function GetDesire()
then
return
BOT_MODE_DESIRE_HIGH
;
else
if
preferedCamp
==
nil
then
preferedCamp
=
J
.
Site
.
GetClosestNeutralSp
wa
n
(
bot
,
availableCamp
);
end
if
preferedCamp
==
nil
then
preferedCamp
=
J
.
Site
.
GetClosestNeutralSp
aw
n
(
bot
,
availableCamp
);
end
if
preferedCamp
~=
nil
then
if
not
J
.
Site
.
IsModeSuitableToFarm
(
bot
)
...
...
@@ -432,7 +432,7 @@ function GetDesire()
then
if
pushTime
>
DotaTime
()
-
8
.
0
then
if
preferedCamp
==
nil
then
preferedCamp
=
J
.
Site
.
GetClosestNeutralSp
wa
n
(
bot
,
availableCamp
);
end
if
preferedCamp
==
nil
then
preferedCamp
=
J
.
Site
.
GetClosestNeutralSp
aw
n
(
bot
,
availableCamp
);
end
return
BOT_MODE_DESIRE_MODERATE
;
end
...
...
@@ -625,7 +625,7 @@ function Think()
end
if
preferedCamp
==
nil
then
preferedCamp
=
J
.
Site
.
GetClosestNeutralSp
wa
n
(
bot
,
availableCamp
);
end
if
preferedCamp
==
nil
then
preferedCamp
=
J
.
Site
.
GetClosestNeutralSp
aw
n
(
bot
,
availableCamp
);
end
if
preferedCamp
~=
nil
then
local
targetFarmLoc
=
preferedCamp
.
cattr
.
location
;
local
cDist
=
GetUnitToLocationDistance
(
bot
,
targetFarmLoc
);
...
...
@@ -742,7 +742,7 @@ function Think()
farmState
=
0
;
J
.
Role
[
'availableCampTable'
],
preferedCamp
=
J
.
Site
.
UpdateAvailableCamp
(
bot
,
preferedCamp
,
J
.
Role
[
'availableCampTable'
]);
availableCamp
=
J
.
Role
[
'availableCampTable'
];
preferedCamp
=
J
.
Site
.
GetClosestNeutralSp
wa
n
(
bot
,
availableCamp
);
preferedCamp
=
J
.
Site
.
GetClosestNeutralSp
aw
n
(
bot
,
availableCamp
);
local
farmTarget
=
J
.
Site
.
FindFarmNeutralTarget
(
neutralCreeps
)
...
...
@@ -1016,6 +1016,7 @@ function X.ShouldRun(bot)
if
botLevel
<=
9
and
nEnemyTowers
[
1
]
~=
nil
and
nEnemyTowers
[
1
]:
GetAttackTarget
()
==
bot
and
nEnemyTowers
[
1
]:
CanBeSeen
()
and
#
hAllyHeroList
<=
1
then
return
1
;
...
...
mode_rune_generic.lua
View file @
f9b36aa1
...
...
@@ -58,8 +58,13 @@ local vWaitRuneLocList = {
function
GetDesire
()
-- if 7.29 then return 0 end
if
bot
:
IsInvulnerable
()
and
bot
:
GetHealth
()
/
bot
:
GetMaxHealth
()
>
0
.
96
and
bot
:
DistanceFromFountain
()
<
100
then
return
1
.
0
end
if
GetGameMode
()
==
GAMEMODE_1V1MID
or
(
GetGameMode
()
==
GAMEMODE_MO
and
DotaTime
()
<=
0
)
or
(
bot
:
HasModifier
(
"modifier_arc_warden_tempest_double"
)
)
...
...
@@ -190,6 +195,15 @@ end
function
Think
()
if
bot
:
IsInvulnerable
()
and
bot
:
GetHealth
()
/
bot
:
GetMaxHealth
()
>
0
.
96
and
bot
:
DistanceFromFountain
()
<
100
then
bot
:
Action_MoveToLocation
(
bot
:
GetLocation
()
+
RandomVector
(
500
)
)
return
end
if
bot
:
IsChanneling
()
or
bot
:
NumQueuedActions
()
>
0
or
bot
:
IsCastingAbility
()
...
...
mode_side_shop_generic.lua
View file @
f9b36aa1
...
...
@@ -8,85 +8,13 @@ if GetBot():IsInvulnerable() or not GetBot():IsHero() or not string.find(GetBot(
return
;
end
local
bot
=
GetBot
()
local
X
=
{}
local
targetWatchTower
=
nil
local
activeWatchTowerCD
=
30
.
0
local
lastActiveWatchTowerTime
=
0
local
nWatchTower_1
=
nil
local
nWatchTower_2
=
nil
local
ignoreDistance
=
0
local
bEnemyTower2Destroyed
=
false
function
GetDesire
()
if
7
.
30
then
return
BOT_MODE_DESIRE_NONE
end
local
currentTime
=
DotaTime
()
if
bot
:
HasModifier
(
"modifier_arc_warden_tempest_double"
)
or
bot
:
GetCurrentActionType
()
==
BOT_ACTION_TYPE_IDLE
or
not
X
.
HasEnemyTower2Destroyed
()
or
X
.
GetAliveEnemyHeroCount
()
>=
4
then
return
BOT_MODE_DESIRE_NONE
end
if
targetWatchTower
~=
nil
and
GetUnitToUnitDistance
(
bot
,
targetWatchTower
)
<=
3800
-
ignoreDistance
and
targetWatchTower
:
GetTeam
()
~=
bot
:
GetTeam
()
and
X
.
IsSuitableToActiveWatchTower
()
and
lastActiveWatchTowerTime
+
activeWatchTowerCD
<
currentTime
then
local
nBonusDesire
=
-
0
.
05
if
GetUnitToUnitDistance
(
bot
,
targetWatchTower
)
<=
600
then
nBonusDesire
=
nBonusDesire
+
0
.
02
end
if
bot
:
IsChanneling
()
and
bot
:
GetActiveMode
()
==
BOT_MODE_SIDE_SHOP
then
nBonusDesire
=
nBonusDesire
+
0
.
1
local
nEnemies
=
bot
:
GetNearbyHeroes
(
1600
,
true
,
BOT_MODE_NONE
)
if
#
nEnemies
==
0
then
nBonusDesire
=
nBonusDesire
+
0
.
1
end
end
return
BOT_MODE_DESIRE_HIGH
+
nBonusDesire
end
if
currentTime
%
60
>
0
and
currentTime
%
60
<
45
then
ignoreDistance
=
1000
else
ignoreDistance
=
0
end
targetWatchTower
=
X
.
GetNearestWatchTower
(
bot
)
if
targetWatchTower
~=
nil
and
targetWatchTower
:
GetTeam
()
==
bot
:
GetTeam
()
then
lastActiveWatchTowerTime
=
DotaTime
()
end
return
BOT_MODE_DESIRE_NONE
end
function
Think
()
if
bot
:
IsChanneling
()
or
bot
:
NumQueuedActions
()
>
0
or
bot
:
IsCastingAbility
()
or
bot
:
IsUsingAbility
()
then
return
end
if
GetUnitToUnitDistance
(
bot
,
targetWatchTower
)
>
300
then
bot
:
Action_MoveToLocation
(
targetWatchTower
:
GetLocation
()
+
RandomVector
(
30
))
else
bot
:
Action_AttackUnit
(
targetWatchTower
,
false
)
end
end
...
...
@@ -97,106 +25,7 @@ end
function
OnEnd
()
targetWatchTower
=
nil
end
function
X
.
GetNearestWatchTower
(
bot
)
if
nWatchTower_1
==
nil
then
local
allUnitList
=
GetUnitList
(
UNIT_LIST_ALL
)
for
_
,
v
in
pairs
(
allUnitList
)
do
if
v
:
GetUnitName
()
==
'#DOTA_OutpostName_North'
or
v
:
GetUnitName
()
==
'#DOTA_OutpostName_South'
then
if
nWatchTower_1
==
nil
then
nWatchTower_1
=
v
else
nWatchTower_2
=
v
end
end
end
end
if
nWatchTower_1
~=
nil
and
nWatchTower_2
~=
nil
and
GetUnitToUnitDistance
(
bot
,
nWatchTower_1
)
<
GetUnitToUnitDistance
(
bot
,
nWatchTower_2
)
then
return
nWatchTower_1
else
return
nWatchTower_2
end
end
function
X
.
IsSuitableToActiveWatchTower
()
local
mode
=
bot
:
GetActiveMode
()
local
nEnemies
=
bot
:
GetNearbyHeroes
(
1400
,
true
,
BOT_MODE_NONE
)
local
nAttackAllies
=
bot
:
GetNearbyHeroes
(
1200
,
false
,
BOT_MODE_ATTACK
)
local
nRetreatAllies
=
bot
:
GetNearbyHeroes
(
1200
,
false
,
BOT_MODE_RETREAT
)
local
nWatchtTowerAllies
=
bot
:
GetNearbyHeroes
(
1600
,
false
,
BOT_MODE_SIDE_SHOP
)
if
(
mode
==
BOT_MODE_RETREAT
and
bot
:
GetActiveModeDesire
()
>
BOT_MODE_DESIRE_HIGH
)
or
(
mode
==
BOT_MODE_RETREAT
and
bot
:
WasRecentlyDamagedByAnyHero
(
2
.
0
)
)
or
(
#
nAttackAllies
>=
1
)
or
(
#
nEnemies
>=
1
and
(
X
.
IsEnemyTargetBot
(
nEnemies
)
or
#
nEnemies
>=
2
)
)
or
(
#
nRetreatAllies
>=
2
and
nRetreatAllies
[
2
]:
GetActiveModeDesire
()
>
BOT_MODE_DESIRE_HIGH
)
or
(
#
nWatchtTowerAllies
>=
2
and
mode
~=
BOT_MODE_SIDE_SHOP
)
then
return
false
end
return
true
end
function
X
.
IsEnemyTargetBot
(
nEnemies
)
for
_
,
u
in
pairs
(
nEnemies
)
do
if
u
:
GetAttackTarget
()
==
bot
or
u
:
IsFacingLocation
(
bot
:
GetLocation
(),
10
)
or
(
targetWatchTower
~=
nil
and
GetUnitToUnitDistance
(
u
,
targetWatchTower
)
<
500
)
then
return
true
end
end
return
false
end
function
X
.
HasEnemyTower2Destroyed
()
if
bEnemyTower2Destroyed
then
return
true
end
for
i
=
1
,
7
,
3
do
local
tower
=
GetTower
(
GetOpposingTeam
(),
i
)
if
tower
==
nil
then
bEnemyTower2Destroyed
=
true
return
true
end
end
return
false
end
function
X
.
GetAliveEnemyHeroCount
()
local
aliveEnemyHeroCount
=
0
for
_
,
id
in
pairs
(
GetTeamPlayers
(
GetOpposingTeam
()
)
)
do
if
IsHeroAlive
(
id
)
then
aliveEnemyHeroCount
=
aliveEnemyHeroCount
+
1
end
end
return
aliveEnemyHeroCount
end
...
...
mode_team_roam_generic.lua
View file @
f9b36aa1
...
...
@@ -1193,20 +1193,6 @@ function X.GetNearbyLastHitCreep(ignorAlly, bEnemy, nDamage, nRadius, bot)
end
end
if
bEnemy
and
botName
==
"npc_dota_hero_clinkz"
then
local
cAbility
=
bot
:
GetAbilityByName
(
"clinkz_searing_arrows"
);
if
cAbility
:
IsTrained
()
and
cAbility
:
GetAutoCastState
()
then
local
bonusDamage
=
cAbility
:
GetSpecialValueInt
(
'damage_bonus'
);
local
bonusTalent
=
bot
:
GetAbilityByName
(
"special_bonus_unique_clinkz_1"
)
local
talentDamage
=
bonusTalent
:
IsTrained
()
and
bonusTalent
:
GetSpecialValueInt
(
'value'
)
or
0
nDamage
=
nDamage
+
bonusDamage
+
talentDamage
end
end
for
_
,
nCreep
in
pairs
(
nNearbyCreeps
)
do
if
X
.
CanBeAttacked
(
nCreep
)
and
nCreep
:
GetHealth
()
<
(
nDamage
+
256
)
...
...
@@ -1226,24 +1212,6 @@ function X.GetNearbyLastHitCreep(ignorAlly, bEnemy, nDamage, nRadius, bot)
end
end
if
bEnemy
and
botName
==
"npc_dota_hero_phantom_lancer"
and
not
J
.
IsInRange
(
bot
,
nCreep
,
251
)
then
local
cAbility
=
bot
:
GetAbilityByName
(
"phantom_lancer_phantom_edge"
);
if
cAbility
:
IsFullyCastable
()
then
local
bonusDamage
=
cAbility
:
GetSpecialValueInt
(
'bonus_agility'
);
nDamage
=
nDamage
+
bonusDamage
;
end
if
bot
:
HasModifier
(
'modifier_phantom_lancer_phantom_edge_agility'
)
and
J
.
GetModifierTime
(
bot
,
"modifier_phantom_lancer_phantom_edge_agility"
)
<
nAttackProDelayTime
*
1
.
18
then
local
bonusDamage
=
cAbility
:
GetSpecialValueInt
(
'bonus_agility'
);
nDamage
=
nDamage
-
bonusDamage
;
end
end
local
nRealDamage
=
nDamage
*
bot
:
GetAttackCombatProficiency
(
nCreep
)
if
J
.
WillKillTarget
(
nCreep
,
nRealDamage
,
nDamageType
,
nAttackProDelayTime
)
...
...
rewrite_functions.lua
0 → 100644
View file @
f9b36aa1
---------------------------------------------------------------------------
--- The Creation Come From: A Beginner AI
--- Author: 决明子 Email: dota2jmz@163.com 微博@Dota2_决明子
--- Link:http://steamcommunity.com/sharedfiles/filedetails/?id=1573671599
--- Link:http://steamcommunity.com/sharedfiles/filedetails/?id=1627071163
---------------------------------------------------------------------------
-- 有多少人工, 才有多么智能
-- How much artificial, how many intelligence.
------------------------------------------------------2017.08.20
--if _G.Rewrite then return end
--_G.Rewrite = true
--------------------------------
--new functions
--------------------------------
function
print_r
(
t
,
page
)
local
print_r_cache
=
{}
local
function
sub_print_r
(
t
,
indent
)
if
(
print_r_cache
[
tostring
(
t
)])
then
print
(
indent
..
"*"
..
tostring
(
t
))
else
print_r_cache
[
tostring
(
t
)]
=
true
if
(
type
(
t
)
==
"table"
)
then
for
pos
,
val
in
pairs
(
t
)
do
if
(
type
(
val
)
==
"table"
)
then
print
(
indent
..
"["
..
pos
..
"] => "
..
tostring
(
t
)
..
" {"
)
sub_print_r
(
val
,
indent
..
string.rep
(
" "
,
string.len
(
pos
)
+
8
))
print
(
indent
..
string.rep
(
" "
,
string.len
(
pos
)
+
6
)
..
"}"
)
elseif
(
type
(
val
)
==
"string"
)
then
print
(
indent
..
"["
..
pos
..
'] => "'
..
val
..
'"'
)
else
print
(
indent
..
"["
..
pos
..
"] => "
..
tostring
(
val
))
end
end
else
print
(
indent
..
tostring
(
t
))
end
end
end
if
(
type
(
t
)
==
"table"
)
then
print
(
tostring
(
t
)
..
" {"
)
sub_print_r
(
t
,
" "
)
print
(
"}"
)
else
sub_print_r
(
t
,
" "
)
end
end
_G
.
FilterTable
=
function
(
t
,
filter
)
local
newGroup
=
{}
for
_
,
obj
in
pairs
(
t
)
do
if
filter
(
obj
)
then
table.insert
(
newGroup
,
obj
)
end
end
return
newGroup
end
function
CDOTA_Bot_Script
.
IsAlly
(
unit
)
return
GetBot
():
GetTeam
()
==
unit
:
GetTeam
()
end
function
CDOTA_Bot_Script
.
GetHealthPercent
(
unit
)
return
unit
:
GetHealth
()
/
unit
:
GetMaxHealth
()
end
function
CDOTA_Bot_Script
.
GetManaPercent
(
unit
)
return
unit
:
GetMana
()
/
unit
:
GetMaxMana
()
end
function
CDOTA_Bot_Script
.
IsEnemy
(
unit
)
return
GetBot
():
GetTeam
()
~=
unit
:
GetTeam
()
end
function
CDOTA_Bot_Script
.
GetDistanceToUnit
(
unit
,
unit2
)
if
not
unit2
then
return
99999
end
local
loc1
=
unit
:
GetLocation
()
local
loc2
=
unit2
:
GetLocation
()
return
math.sqrt
((
loc1
.
x
-
loc2
.
x
)
*
(
loc1
.
x
-
loc2
.
x
)
+
(
loc1
.
y
-
loc2
.
y
)
*
(
loc1
.
y
-
loc2
.
y
))
end
function
CDOTA_Bot_Script
.
GetDistanceToLocation
(
unit
,
loc
)
if
not
loc
then
return
99999
end
local
loc1
=
unit
:
GetLocation
()
return
math.sqrt
((
loc1
.
x
-
loc
.
x
)
*
(
loc1
.
x
-
loc
.
x
)
+
(
loc1
.
y
-
loc
.
y
)
*
(
loc1
.
y
-
loc
.
y
))
end
function
CDOTA_Bot_Script
.
WasRecentlyDamagedByAnyUnit
(
unit
,
time
)
return
unit
:
WasRecentlyDamagedByAnyHero
(
time
)
or
unit
:
WasRecentlyDamagedByCreep
(
time
)
end
function
CDOTABaseAbility_BotScript
.
GetVal
(
ability
,
name
)
local
f
=
ability
:
GetSpecialValueFloat
(
name
)
if
math.abs
(
f
)
<
0
.
0001
then
f
=
ability
:
GetSpecialValueInt
(
name
)
end
return
f
end
--------------------------------
--rewrite functions CDOTA_Bot_Script
--------------------------------
CDOTA_Bot_Script
.
GetAttackCombatProficiency
=
function
(
u
)
return
1
.
0
end
local
gar
=
CDOTA_Bot_Script
.
GetAttackRange
local
gar_data
=
{}
CDOTA_Bot_Script
.
GetAttackRange
=
function
(
u
)
if
u
:
CanBeSeen
()
then
gar_data
[
u
]
=
gar
(
u
)
return
gar
(
u
)
end
return
gar_data
[
u
]
or
0
end
local
ic
=
CDOTA_Bot_Script
.
IsChanneling
CDOTA_Bot_Script
.
IsChanneling
=
function
(
u
)
if
u
:
CanBeSeen
()
then
return
ic
(
u
)
end
return
false
end
local
hm
=
CDOTA_Bot_Script
.
HasModifier
CDOTA_Bot_Script
.
HasModifier
=
function
(
u
,
pszModifierName
)
if
u
:
CanBeSeen
()
then
return
hm
(
u
,
pszModifierName
)
end
return
false
end
local
gedtt
=
CDOTA_Bot_Script
.
GetEstimatedDamageToTarget
CDOTA_Bot_Script
.
GetEstimatedDamageToTarget
=
function
(
u
,
bCurrentlyAvailable
,
hTarget
,
fDuration
,
nDamageTypes
)
if
u
:
CanBeSeen
()
then
return
gedtt
(
u
,
bCurrentlyAvailable
,
hTarget
,
fDuration
,
nDamageTypes
)
end
local
result
=
DotaTime
()
*
0
.
5
+
50
if
DotaTime
()
>
5
*
60
then
result
=
200
+
(
DotaTime
()
-
300
)
*
0
.
4
end
if
DotaTime
()
>
10
*
60
then
result
=
320
+
(
DotaTime
()
-
600
)
*
0
.
2
end
if
DotaTime
()
>
20
*
60
then
result
=
440
+
(
DotaTime
()
-
600
)
*
0
.
1
end
if
DotaTime
()
>
30
*
60
then
result
=
500
end
return
math.floor
(
result
*
fDuration
)
end
local
iua
=
CDOTA_Bot_Script
.
IsUsingAbility
CDOTA_Bot_Script
.
IsUsingAbility
=
function
(
u
)
if
u
:
CanBeSeen
()
then
return
iua
(
u
)
end
return
false
end
local
gat
=
CDOTA_Bot_Script
.
GetAttackTarget
CDOTA_Bot_Script
.
GetAttackTarget
=
function
(
u
)
if
u
:
CanBeSeen
()
then
return
gat
(
u
)
end
return
nil
end
local
gt
=
CDOTA_Bot_Script
.
GetTarget
CDOTA_Bot_Script
.
GetTarget
=
function
(
u
)
if
u
:
IsAlly
()
then
return
gt
(
u
)
end
return
nil
end
local
ii
=
CDOTA_Bot_Script
.
IsInvulnerable
CDOTA_Bot_Script
.
IsInvulnerable
=
function
(
u
)
if
u
:
CanBeSeen
()
then
return
ii
(
u
)
end
return
false
end
local
iai
=
CDOTA_Bot_Script
.
IsAttackImmune
CDOTA_Bot_Script
.
IsAttackImmune
=
function
(
u
)
if
u
:
CanBeSeen
()
then
return
iai
(
u
)
end
return
false
end
local
gaid
=
CDOTA_Bot_Script
.
GetActualIncomingDamage
CDOTA_Bot_Script
.
GetActualIncomingDamage
=
function
(
u
,
nDamage
,
nType
)
if
u
:
CanBeSeen
()
then
return
gaid
(
u
,
nDamage
,
nType
)
end
return
0
end
local
gh
=
CDOTA_Bot_Script
.
GetHealth
CDOTA_Bot_Script
.
GetHealth
=
function
(
u
)
if
u
:
CanBeSeen
()
then
return
gh
(
u
)
end
return
GetBot
():
GetMaxHealth
()
-
gh
(
GetBot
())
--自己血越少,认为看不见的敌人血越多
end
local
gmh
=
CDOTA_Bot_Script
.
GetMaxHealth
CDOTA_Bot_Script
.
GetMaxHealth
=
function
(
u
)
if
u
:
CanBeSeen
()
then
return
gmh
(
u
)
end
return
gmh
(
GetBot
())
end
local
ghr
=
CDOTA_Bot_Script
.
GetHealthRegen
CDOTA_Bot_Script
.
GetHealthRegen
=
function
(
u
)
if
u
:
CanBeSeen
()
then
return
ghr
(
u
)
end
return
ghr
(
GetBot
())
end
local
gm
=
CDOTA_Bot_Script
.
GetMana
CDOTA_Bot_Script
.
GetMana
=
function
(
u
)
if
u
:
CanBeSeen
()
then
return
gm
(
u
)
end
return
gm
(
GetBot
())
end
local
gmm
=
CDOTA_Bot_Script
.
GetMaxMana
CDOTA_Bot_Script
.
GetMaxMana
=
function
(
u
)
if
u
:
CanBeSeen
()
then
return
gmm
(
u
)
end
return
gmm
(
GetBot
())
end
local
gnh
=
CDOTA_Bot_Script
.
GetNearbyHeroes
CDOTA_Bot_Script
.
GetNearbyHeroes
=
function
(
u
,
nRadius
,
bEnemies
,
eBotMode
)
if
not
u
:
CanBeSeen
()
then
return
{}
end
if
nRadius
<=
1600
and
u
:
IsBot
()
then
return
gnh
(
u
,
nRadius
,
bEnemies
,
eBotMode
)
end
local
list
if
bEnemies
then
list
=
GetUnitList
(
UNIT_LIST_ENEMY_HEROES
)
else
list
=
GetUnitList
(
UNIT_LIST_ALLIED_HEROES
)
end
list
=
FilterTable
(
list
,
function
(
unit
)
return
u
:
GetDistanceToUnit
(
unit
)
<=
nRadius
and
(
bEnemies
or
eBotMode
==
BOT_MODE_NONE
or
not
unit
:
IsBot
()
or
eBotMode
==
unit
:
GetActiveMode
())
end
)
return
list
end
local
gnc
=
CDOTA_Bot_Script
.
GetNearbyCreeps
CDOTA_Bot_Script
.
GetNearbyCreeps
=
function
(
u
,
nRadius
,
bEnemies
)
if
not
u
:
CanBeSeen
()
then
return
{}
end
if
nRadius
<=
1600
and
u
:
IsBot
()
then
return
gnc
(
u
,
nRadius
,
bEnemies
)
end
local
list
if
bEnemies
then
list
=
GetUnitList
(
UNIT_LIST_ENEMY_CREEPS
)
or
{}
else
list
=
GetUnitList
(
UNIT_LIST_ALLIED_CREEPS
)
or
{}
end
list
=
FilterTable
(
list
,
function
(
unit
)
return
u
:
GetDistanceToUnit
(
unit
)
<=
nRadius
end
)
return
list
end
--------------------------------
--rewrite functions CDOTABaseAbility_BotScript
--------------------------------
\ No newline at end of file
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