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
bfb02f13
Commit
bfb02f13
authored
Apr 22, 2023
by
JoyJ
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix clinkz
parent
c1060786
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
65 additions
and
222 deletions
+65
-222
BotLib/hero_clinkz.lua
BotLib/hero_clinkz.lua
+65
-221
BotLib/hero_visage.lua
BotLib/hero_visage.lua
+0
-1
No files found.
BotLib/hero_clinkz.lua
View file @
bfb02f13
...
...
@@ -19,13 +19,13 @@ local sOutfitType = J.Item.GetOutfitType( bot )
local
tTalentTreeList
=
{
[
't25'
]
=
{
10
,
0
},
[
't20'
]
=
{
0
,
1
0
},
[
't20'
]
=
{
10
,
0
},
[
't15'
]
=
{
0
,
10
},
[
't10'
]
=
{
0
,
10
},
}
local
tAllAbilityBuildList
=
{
{
2
,
1
,
2
,
3
,
2
,
6
,
2
,
1
,
1
,
1
,
6
,
3
,
3
,
3
,
6
},
{
2
,
1
,
3
,
1
,
2
,
6
,
1
,
1
,
2
,
2
,
6
,
3
,
3
,
3
,
6
},
}
local
nAbilityBuildList
=
J
.
Skill
.
GetRandomBuild
(
tAllAbilityBuildList
)
...
...
@@ -124,12 +124,14 @@ modifier_clinkz_burning_army
local
abilityQ
=
bot
:
GetAbilityByName
(
sAbilityList
[
1
]
)
local
abilityW
=
bot
:
GetAbilityByName
(
sAbilityList
[
2
]
)
local
abilityE
=
bot
:
GetAbilityByName
(
sAbilityList
[
3
]
)
local
abilityD
=
bot
:
GetAbilityByName
(
sAbilityList
[
4
]
)
local
abilityF
=
bot
:
GetAbilityByName
(
sAbilityList
[
5
]
)
local
abilityR
=
bot
:
GetAbilityByName
(
sAbilityList
[
6
]
)
local
talent4
=
bot
:
GetAbilityByName
(
sTalentList
[
4
]
)
local
castQDesire
,
castQTarget
local
castWDesire
,
castWTarget
local
castEDesire
local
castEDesire
,
castWTarget
local
castRDesire
,
castRTarget
local
nKeepMana
,
nMP
,
nHP
,
nLV
,
hEnemyList
,
hAllyList
,
botTarget
,
sMotive
...
...
@@ -163,26 +165,25 @@ function X.SkillsComplement()
return
end
castRDesire
,
castRTarget
,
sMotive
=
X
.
ConsiderR
()
castRDesire
,
sMotive
=
X
.
ConsiderR
()
if
(
castRDesire
>
0
)
then
J
.
SetReportMotive
(
bDebugMode
,
sMotive
)
J
.
SetQueuePtToINT
(
bot
,
true
)
bot
:
ActionQueue_UseAbility
OnEntity
(
abilityR
,
castRTarget
)
bot
:
ActionQueue_UseAbility
(
abilityR
)
return
end
castQDesire
,
castQTarget
,
sMotive
=
X
.
ConsiderQ
()
castQDesire
,
sMotive
=
X
.
ConsiderQ
()
if
(
castQDesire
>
0
)
then
J
.
SetReportMotive
(
bDebugMode
,
sMotive
)
J
.
SetQueuePtToINT
(
bot
,
true
)
bot
:
ActionQueue_UseAbility
OnLocation
(
abilityQ
,
castQTarget
)
bot
:
ActionQueue_UseAbility
(
abilityQ
)
return
end
...
...
@@ -191,23 +192,33 @@ function X.SkillsComplement()
then
J
.
SetReportMotive
(
bDebugMode
,
sMotive
)
bot
:
Action_UseAbilityOnEntity
(
abilityW
,
castWTarget
)
local
mp
=
bot
:
GetMana
()
if
abilityR
:
IsFullyCastable
()
and
mp
>
250
then
bot
:
ActionQueue_UseAbility
(
abilityR
)
end
if
not
abilityD
:
IsHidden
()
and
abilityD
:
IsFullyCastable
()
and
mp
>
400
then
bot
:
ActionQueue_UseAbilityOnLocation
(
abilityD
,
(
bot
:
GetLocation
()
+
castWTarget
:
GetLocation
())
/
3
)
end
bot
:
ActionQueue_UseAbilityOnEntity
(
abilityW
,
castWTarget
)
if
abilityQ
:
IsFullyCastable
()
then
bot
:
ActionQueue_UseAbility
(
abilityQ
)
end
return
end
end
function
X
.
Consider
R
()
function
X
.
Consider
E
()
if
not
ability
R
:
IsFullyCastable
()
then
return
0
end
if
not
ability
E
:
IsFullyCastable
()
then
return
0
end
local
nSkillLV
=
ability
R
:
GetLevel
()
local
nCastRange
=
ability
R
:
GetCastRange
()
+
aetherRange
+
32
local
nCastPoint
=
ability
R
:
GetCastPoint
()
local
nManaCost
=
ability
R
:
GetManaCost
()
local
nDamage
=
ability
R
:
GetAbilityDamage
()
local
nSkillLV
=
ability
E
:
GetLevel
()
local
nCastRange
=
ability
E
:
GetCastRange
()
+
aetherRange
+
32
local
nCastPoint
=
ability
E
:
GetCastPoint
()
local
nManaCost
=
ability
E
:
GetManaCost
()
local
nDamage
=
ability
E
:
GetAbilityDamage
()
local
nDamageType
=
DAMAGE_TYPE_MAGICAL
if
#
hEnemyList
==
0
then
nCastRange
=
1600
end
...
...
@@ -265,220 +276,59 @@ end
local
lastAutoTime
=
0
function
X
.
ConsiderW
()
if
not
abilityW
:
IsFullyCastable
()
or
bot
:
IsDisarmed
()
then
return
BOT_ACTION_DESIRE_NONE
,
0
end
if
not
abilityW
:
IsFullyCastable
()
then
return
BOT_ACTION_DESIRE_NONE
end
local
nCastRange
=
bot
:
GetAttackRange
()
--不考虑combo,必须挨得够近
local
nCastPoint
=
abilityW
:
GetCastPoint
()
local
nSkillLV
=
abilityW
:
GetLevel
()
local
nAttackRange
=
bot
:
GetAttackRange
()
+
50
local
nAttackDamage
=
bot
:
GetAttackDamage
()
local
nTalent4Damage
=
talent4
:
IsTrained
()
and
talent4
:
GetSpecialValueInt
(
"value"
)
or
0
local
nAbilityDamage
=
nAttackDamage
+
abilityW
:
GetSpecialValueInt
(
"damage_bonus"
)
+
nTalent4Damage
local
nDamageType
=
DAMAGE_TYPE_PHYSICAL
local
nCastRange
=
nAttackRange
local
nTowers
=
bot
:
GetNearbyTowers
(
870
,
true
)
local
nEnemysLaneCreepsInRange
=
bot
:
GetNearbyLaneCreeps
(
nAttackRange
+
100
,
true
)
local
nEnemysLaneCreepsInBonus
=
bot
:
GetNearbyLaneCreeps
(
500
,
true
)
local
nEnemysWeakestLaneCreepsInRange
=
J
.
GetVulnerableWeakestUnit
(
bot
,
false
,
true
,
nAttackRange
+
200
)
local
nEnemysHerosInAttackRange
=
bot
:
GetNearbyHeroes
(
nAttackRange
,
true
,
BOT_MODE_NONE
)
local
nEnemysWeakestHero
=
J
.
GetVulnerableWeakestUnit
(
bot
,
true
,
true
,
nAttackRange
+
40
)
local
nAllyLaneCreeps
=
bot
:
GetNearbyLaneCreeps
(
450
,
false
)
local
botMode
=
bot
:
GetActiveMode
()
local
nTargetUint
=
nil
if
nLV
>=
7
then
if
(
hEnemyList
[
1
]
~=
nil
or
(
nSkillLV
>=
4
and
nMP
>
0
.
6
-
0
.
01
*
nLV
)
)
and
not
abilityW
:
GetAutoCastState
()
then
lastAutoTime
=
DotaTime
()
abilityW
:
ToggleAutoCast
()
elseif
hEnemyList
[
1
]
==
nil
and
lastAutoTime
<
DotaTime
()
-
2
.
0
and
abilityW
:
GetAutoCastState
()
then
abilityW
:
ToggleAutoCast
()
end
else
if
abilityW
:
GetAutoCastState
()
then
abilityW
:
ToggleAutoCast
()
end
end
if
nLV
<=
6
and
nHP
>
0
.
55
and
J
.
IsValidHero
(
botTarget
)
and
(
not
J
.
IsRunning
(
bot
)
or
J
.
IsInRange
(
bot
,
botTarget
,
nAttackRange
+
29
)
)
then
if
not
botTarget
:
IsAttackImmune
()
and
GetUnitToUnitDistance
(
bot
,
botTarget
)
<
nAttackRange
+
99
then
nTargetUint
=
botTarget
return
BOT_ACTION_DESIRE_HIGH
,
nTargetUint
,
"W-手动法球"
end
end
if
(
botMode
==
BOT_MODE_LANING
and
#
nTowers
==
0
)
then
local
nEnemysHeroesInCastRange
=
bot
:
GetNearbyHeroes
(
nCastRange
+
99
,
true
,
BOT_MODE_NONE
)
local
nEnemysHeroesInView
=
bot
:
GetNearbyHeroes
(
880
,
true
,
BOT_MODE_NONE
)
if
J
.
IsValid
(
nEnemysWeakestHero
)
then
if
nHP
>=
0
.
62
and
#
nEnemysLaneCreepsInBonus
<=
6
and
#
nAllyLaneCreeps
>=
2
and
not
bot
:
WasRecentlyDamagedByCreep
(
1
.
5
)
and
not
bot
:
WasRecentlyDamagedByAnyHero
(
1
.
5
)
then
return
BOT_ACTION_DESIRE_HIGH
,
nEnemysWeakestHero
,
"W-对线法球1"
--追杀
if
J
.
IsGoingOnSomeone
(
bot
)
then
local
target
=
J
.
GetProperTarget
(
bot
)
if
J
.
IsValidHero
(
target
)
and
J
.
CanCastOnNonMagicImmune
(
target
)
and
J
.
CanCastOnTargetAdvanced
(
target
)
and
J
.
IsInRange
(
target
,
bot
,
nCastRange
)
then
return
BOT_ACTION_DESIRE_HIGH
,
target
end
if
J
.
GetAllyUnitCountAroundEnemyTarget
(
bot
,
nEnemysWeakestHero
,
500
)
>=
3
and
nHP
>=
0
.
6
and
not
bot
:
WasRecentlyDamagedByCreep
(
1
.
5
)
and
not
bot
:
WasRecentlyDamagedByAnyHero
(
1
.
5
)
then
return
BOT_ACTION_DESIRE_HIGH
,
nEnemysWeakestHero
,
"W-对线法球2"
end
end
--补刀
if
J
.
IsWithoutTarget
(
bot
)
and
not
J
.
IsAttacking
(
bot
)
then
local
nLaneCreepList
=
bot
:
GetNearbyLaneCreeps
(
1100
,
true
)
for
_
,
creep
in
pairs
(
nLaneCreepList
)
do
if
J
.
IsValid
(
creep
)
and
not
creep
:
HasModifier
(
"modifier_fountain_glyph"
)
and
creep
:
GetHealth
()
<
nAttackDamage
+
180
and
not
J
.
IsAllysTarget
(
creep
)
then
local
nAttackProDelayTime
=
J
.
GetAttackProDelayTime
(
bot
,
nCreep
)
*
1
.
12
+
0
.
05
local
nAD
=
nAbilityDamage
*
bot
:
GetAttackCombatProficiency
(
creep
)
if
J
.
WillKillTarget
(
creep
,
nAD
,
nDamageType
,
nAttackProDelayTime
)
then
return
BOT_ACTION_DESIRE_HIGH
,
creep
,
nAD
..
'W-补刀:'
..
creep
:
GetHealth
()
end
end
end
end
end
if
J
.
IsValidHero
(
botTarget
)
and
not
J
.
IsInRange
(
bot
,
botTarget
,
nAttackRange
+
200
)
and
J
.
IsValidHero
(
nEnemysHerosInAttackRange
[
1
]
)
and
J
.
CanBeAttacked
(
nEnemysHerosInAttackRange
[
1
]
)
and
botMode
~=
BOT_MODE_RETREAT
then
return
BOT_ACTION_DESIRE_HIGH
,
nEnemysHerosInAttackRange
[
1
]
end
if
botTarget
==
nil
and
botMode
~=
BOT_MODE_RETREAT
and
botMode
~=
BOT_MODE_ATTACK
and
botMode
~=
BOT_MODE_ASSEMBLE
and
botMode
~=
BOT_MODE_TEAM_ROAM
then
if
J
.
IsValid
(
nEnemysWeakestLaneCreepsInRange
)
and
not
J
.
IsAllysTarget
(
nEnemysWeakestLaneCreepsInRange
)
then
local
nCreep
=
nEnemysWeakestLaneCreepsInRange
local
nAttackProDelayTime
=
J
.
GetAttackProDelayTime
(
bot
,
nCreep
)
local
otherAttackRealDamage
=
J
.
GetTotalAttackWillRealDamage
(
nCreep
,
nAttackProDelayTime
)
local
nRealDamage
=
nCreep
:
GetActualIncomingDamage
(
nAbilityDamage
*
bot
:
GetAttackCombatProficiency
(
nCreep
),
nDamageType
)
if
otherAttackRealDamage
+
nRealDamage
>
nCreep
:
GetHealth
()
and
not
J
.
CanKillTarget
(
nCreep
,
nAttackDamage
,
DAMAGE_TYPE_PHYSICAL
)
then
local
nTime
=
nAttackProDelayTime
local
rMessage
=
"时:"
..
J
.
GetTwo
(
DotaTime
()
%
60
)
..
"延:"
..
J
.
GetOne
(
nAttackProDelayTime
)
..
"生:"
..
nCreep
:
GetHealth
()
..
"技:"
..
J
.
GetOne
(
nAbilityDamage
)
..
"额:"
..
J
.
GetOne
(
otherAttackRealDamage
)
..
"总:"
..
(
otherAttackRealDamage
+
nRealDamage
)
return
BOT_ACTION_DESIRE_HIGH
,
nCreep
,
rMessage
end
end
end
if
(
J
.
IsFarming
(
bot
)
or
J
.
IsPushing
(
bot
)
)
and
nSkillLV
>=
3
and
not
abilityW
:
GetAutoCastState
()
then
if
J
.
IsValidBuilding
(
botTarget
)
and
bot
:
GetMana
()
>
nKeepMana
and
not
botTarget
:
HasModifier
(
'modifier_fountain_glyph'
)
and
J
.
IsInRange
(
bot
,
botTarget
,
nCastRange
+
80
)
then
return
BOT_ACTION_DESIRE_HIGH
,
botTarget
,
'W-推塔'
end
if
botTarget
~=
nil
and
botTarget
:
IsAlive
()
and
nMP
>
0
.
4
and
not
botTarget
:
HasModifier
(
'modifier_fountain_glyph'
)
and
botTarget
:
GetHealth
()
>
nAbilityDamage
*
2
.
6
and
J
.
IsInRange
(
bot
,
botTarget
,
nCastRange
+
80
)
then
return
BOT_ACTION_DESIRE_HIGH
,
botTarget
,
'W-打钱'
end
end
if
J
.
IsGoingOnSomeone
(
bot
)
and
not
abilityW
:
GetAutoCastState
()
then
if
J
.
IsValidHero
(
botTarget
)
and
not
botTarget
:
IsAttackImmune
()
and
J
.
CanCastOnMagicImmune
(
botTarget
)
and
J
.
IsInRange
(
botTarget
,
bot
,
nAttackRange
+
80
)
then
return
BOT_ACTION_DESIRE_MODERATE
,
botTarget
end
end
if
(
bot
:
GetActiveMode
()
==
BOT_MODE_ROSHAN
and
not
abilityW
:
GetAutoCastState
()
)
--逃跑
if
J
.
IsRetreating
(
bot
)
then
if
J
.
IsRoshan
(
botTarget
)
and
J
.
IsInRange
(
botTarget
,
bot
,
nAttackRange
)
if
J
.
IsValid
(
nEnemysHeroesInCastRange
[
1
]
)
and
J
.
CanCastOnNonMagicImmune
(
nEnemysHeroesInCastRange
[
1
]
)
and
J
.
CanCastOnTargetAdvanced
(
nEnemysHeroesInCastRange
[
1
]
)
and
not
J
.
IsDisabled
(
nEnemysHeroesInCastRange
[
1
]
)
and
not
nEnemysHeroesInCastRange
[
1
]:
IsDisarmed
()
and
GetUnitToUnitDistance
(
bot
,
nEnemysHeroesInCastRange
[
1
]
)
<=
nCastRange
-
60
then
return
BOT_ACTION_DESIRE_HIGH
,
botTarget
return
BOT_ACTION_DESIRE_HIGH
,
nEnemysHeroesInCastRange
[
1
]
end
end
return
BOT_ACTION_DESIRE_NONE
end
function
X
.
Consider
E
()
function
X
.
Consider
R
()
local
nEnemyTowers
=
bot
:
GetNearbyTowers
(
888
,
true
)
if
not
ability
E
:
IsFullyCastable
()
if
not
ability
R
:
IsFullyCastable
()
or
bot
:
IsInvisible
()
or
#
nEnemyTowers
>=
1
or
bot
:
HasModifier
(
"modifier_item_dustofappearance"
)
or
bot
:
DistanceFromFountain
()
<
800
then
return
0
end
then
return
BOT_ACTION_DESIRE_NONE
end
local
nSkillLV
=
ability
E
:
GetLevel
()
local
nCastRange
=
ability
E
:
GetCastRange
()
local
nCastPoint
=
ability
E
:
GetCastPoint
()
local
nManaCost
=
ability
E
:
GetManaCost
()
local
nDamage
=
ability
E
:
GetAbilityDamage
()
local
nSkillLV
=
ability
R
:
GetLevel
()
local
nCastRange
=
ability
R
:
GetCastRange
()
local
nCastPoint
=
ability
R
:
GetCastPoint
()
local
nManaCost
=
ability
R
:
GetManaCost
()
local
nDamage
=
ability
R
:
GetAbilityDamage
()
local
nDamageType
=
DAMAGE_TYPE_MAGICAL
local
nInRangeEnemyList
=
bot
:
GetNearbyHeroes
(
nCastRange
,
true
,
BOT_MODE_NONE
)
...
...
@@ -486,13 +336,13 @@ function X.ConsiderE()
and
bot
:
GetActiveModeDesire
()
>
BOT_MODE_DESIRE_HIGH
and
#
hEnemyList
>
0
then
return
BOT_ACTION_DESIRE_HIGH
,
'
E
-撤退了'
return
BOT_ACTION_DESIRE_HIGH
,
'
R
-撤退了'
end
if
J
.
GetHP
(
bot
)
<
0
.
166
and
(
#
hEnemyList
>
0
or
bot
:
WasRecentlyDamagedByAnyHero
(
5
.
0
)
)
then
return
BOT_ACTION_DESIRE_HIGH
,
'
E
-隐身保命'
return
BOT_ACTION_DESIRE_HIGH
,
'
R
-隐身保命'
end
if
J
.
IsGoingOnSomeone
(
bot
)
...
...
@@ -506,14 +356,14 @@ function X.ConsiderE()
local
hEnemyCreepList
=
bot
:
GetNearbyLaneCreeps
(
700
,
true
)
if
#
hEnemyCreepList
==
0
and
#
hEnemyList
==
0
then
return
BOT_ACTION_DESIRE_HIGH
,
'
E
-隐身攻击:'
..
J
.
Chat
.
GetNormName
(
botTarget
)
return
BOT_ACTION_DESIRE_HIGH
,
'
R
-隐身攻击:'
..
J
.
Chat
.
GetNormName
(
botTarget
)
end
end
if
J
.
IsChasingTarget
(
bot
,
botTarget
)
and
J
.
IsInRange
(
bot
,
botTarget
,
1000
)
then
return
BOT_ACTION_DESIRE_HIGH
,
'
E
-隐身追击:'
..
J
.
Chat
.
GetNormName
(
botTarget
)
return
BOT_ACTION_DESIRE_HIGH
,
'
R
-隐身追击:'
..
J
.
Chat
.
GetNormName
(
botTarget
)
end
end
...
...
@@ -528,7 +378,7 @@ function X.ConsiderE()
local
nEnemyTowers
=
bot
:
GetNearbyTowers
(
1400
,
true
)
if
#
nEnemies
==
0
and
#
nAllies
<=
2
and
nEnemyTowers
==
0
then
return
BOT_ACTION_DESIRE_HIGH
,
'
E
-敌方地区潜行'
return
BOT_ACTION_DESIRE_HIGH
,
'
R
-敌方地区潜行'
end
end
...
...
@@ -544,30 +394,24 @@ function X.ConsiderQ()
then
return
0
end
local
nSkillLV
=
abilityQ
:
GetLevel
()
local
nCastRange
=
750
local
nCastRange
=
bot
:
GetAttackRange
()
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
)
--攻击敌人
if
J
.
IsGoingOnSomeone
(
bot
)
then
if
J
.
IsValidHero
(
botTarget
)
and
J
.
CanCastOnNonMagicImmune
(
botTarget
)
and
J
.
IsInRange
(
bot
,
botTarget
,
nCastRange
)
and
botTarget
:
IsFacingLocation
(
bot
:
GetLocation
(),
120
)
then
return
BOT_ACTION_DESIRE_HIGH
,
botTarget
:
GetLocation
(),
"Q-攻击敌人
"
return
BOT_ACTION_DESIRE_HIGH
,
"Q-攻击
"
end
end
return
BOT_ACTION_DESIRE_NONE
end
...
...
BotLib/hero_visage.lua
View file @
bfb02f13
...
...
@@ -182,7 +182,6 @@ function X.ConsiderQ()
local
nCastRange
=
abilityQ
:
GetCastRange
()
local
nCastPoint
=
abilityQ
:
GetCastPoint
()
local
nSkillLV
=
abilityQ
:
GetLevel
()
local
nDamage
=
30
+
nSkillLV
*
30
+
120
*
0
.
38
local
nEnemysHeroesInCastRange
=
bot
:
GetNearbyHeroes
(
nCastRange
+
99
,
true
,
BOT_MODE_NONE
)
local
nEnemysHeroesInView
=
bot
:
GetNearbyHeroes
(
880
,
true
,
BOT_MODE_NONE
)
...
...
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