-
Notifications
You must be signed in to change notification settings - Fork 52
/
Copy pathability_item_usage_lycan.lua
183 lines (148 loc) · 4.4 KB
/
ability_item_usage_lycan.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
if GetBot():IsInvulnerable() or not GetBot():IsHero() or not string.find(GetBot():GetUnitName(), "hero") or GetBot():IsIllusion() then
return;
end
local ability_item_usage_generic = dofile( GetScriptDirectory().."/ability_item_usage_generic" )
local utils = require(GetScriptDirectory() .. "/util")
local mutils = require(GetScriptDirectory() .. "/MyUtility")
local abUtils = require(GetScriptDirectory() .. "/AbilityItemUsageUtility")
function AbilityLevelUpThink()
ability_item_usage_generic.AbilityLevelUpThink();
end
function BuybackUsageThink()
ability_item_usage_generic.BuybackUsageThink();
end
function CourierUsageThink()
ability_item_usage_generic.CourierUsageThink();
end
function ItemUsageThink()
ability_item_usage_generic.ItemUsageThink();
end
local bot = GetBot();
local abilities = {};
local castQDesire = 0;
local castWDesire = 0;
local castEDesire = 0;
local castRDesire = 0;
function AbilityUsageThink()
if #abilities == 0 then abilities = mutils.InitiateAbilities(bot, {0,1,3,5}) end
if mutils.CantUseAbility(bot) then return end
castQDesire, targetQ = ConsiderQ();
castWDesire, targetW = ConsiderW();
castEDesire, targetE = ConsiderE();
castRDesire, targetR = ConsiderR();
if castRDesire > 0 then
bot:Action_UseAbility(abilities[4]);
return
end
if castQDesire > 0 then
bot:Action_UseAbility(abilities[1]);
return
end
if castWDesire > 0 then
bot:Action_UseAbility(abilities[2]);
return
end
if castEDesire > 0 then
bot:Action_UseAbilityOnEntity(abilities[3], targetE);
return
end
end
function ConsiderQ()
if not mutils.CanBeCast(abilities[1]) then
return BOT_ACTION_DESIRE_NONE, nil;
end
local manaCost = abilities[1]:GetManaCost();
if mutils.IsRetreating(bot) and bot:WasRecentlyDamagedByAnyHero(2.0)
then
local enemies = bot:GetNearbyHeroes(1300, true, BOT_MODE_NONE);
if #enemies > 0 then
return BOT_ACTION_DESIRE_HIGH, nil;
end
end
if ( mutils.IsPushing(bot) or mutils.IsDefending(bot) ) and mutils.CanSpamSpell(bot, manaCost)
then
local creeps = bot:GetNearbyCreeps(600, true);
if #creeps > 0 then
return BOT_ACTION_DESIRE_HIGH, nil;
end
end
if mutils.IsGoingOnSomeone(bot)
then
local target = bot:GetTarget();
if mutils.IsValidTarget(target) and mutils.CanCastOnMagicImmune(target) and mutils.IsInRange(target, bot, 600)
then
return BOT_ACTION_DESIRE_HIGH, nil;
end
end
return BOT_ACTION_DESIRE_NONE, nil;
end
function ConsiderW()
if not mutils.CanBeCast(abilities[2]) then
return BOT_ACTION_DESIRE_NONE, nil;
end
local manaCost = abilities[1]:GetManaCost();
if mutils.IsRetreating(bot) and bot:WasRecentlyDamagedByAnyHero(2.0)
then
local enemies = bot:GetNearbyHeroes(1300, true, BOT_MODE_NONE);
if #enemies > 0 then
return BOT_ACTION_DESIRE_HIGH, nil;
end
end
if mutils.IsGoingOnSomeone(bot)
then
local target = bot:GetTarget();
if mutils.IsValidTarget(target) and mutils.CanCastOnMagicImmune(target) and mutils.IsInRange(target, bot, 350)
then
local enemies = bot:GetNearbyHeroes(1600, true, BOT_MODE_NONE)
if #enemies >= 2 then
return BOT_ACTION_DESIRE_HIGH, nil;
end
end
end
return BOT_ACTION_DESIRE_NONE, nil;
end
function ConsiderE()
if not mutils.CanBeCast(abilities[3]) or bot:HasScepter() == false
then
return BOT_ACTION_DESIRE_NONE, nil;
end
local nCastRange = 300 + 200;
if mutils.IsInTeamFight(bot, 1300) then
local enemies = bot:GetNearbyHeroes(1300, true, BOT_MODE_NONE);
if #enemies > 0 then
local allies = bot:GetNearbyHeroes(nCastRange, false, BOT_MODE_ATTACK);
for i=1, #allies do
if allies[i] ~= bot
and mutils.IsValidTarget(allies[i])
and mutils.CanCastOnNonMagicImmune(allies[i])
then
return BOT_ACTION_DESIRE_HIGH, allies[i];
end
end
end
end
return BOT_ACTION_DESIRE_NONE, 0;
end
function ConsiderR()
if not mutils.CanBeCast(abilities[4]) then
return BOT_ACTION_DESIRE_NONE, nil;
end
if mutils.IsRetreating(bot) and bot:WasRecentlyDamagedByAnyHero(2.0)
then
local enemies = bot:GetNearbyHeroes(1300, true, BOT_MODE_NONE)
if #enemies > 0 then
return BOT_ACTION_DESIRE_HIGH, nil;
end
end
if mutils.IsGoingOnSomeone(bot)
then
local target = bot:GetTarget();
if mutils.IsValidTarget(target)
and mutils.CanCastOnMagicImmune(target)
and mutils.IsInRange(target, bot, 750)
then
return BOT_ACTION_DESIRE_HIGH, nil;
end
end
return BOT_ACTION_DESIRE_NONE, nil;
end