-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathability_item_usage_keeper_of_the_light.lua
80 lines (65 loc) · 2.48 KB
/
ability_item_usage_keeper_of_the_light.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
-- Include this before require to fix Mac
local dir = GetScriptDirectory();
local function GetScriptDirectory()
if string.sub(dir, 1, 6) == "/Users" then
return string.match(dir, '.*/(.+)');
end
return dir;
end
-----------------------------------------
local Helper = require(GetScriptDirectory() .. "/helper");
require(GetScriptDirectory().."/ability_item_usage_generic");
local Abilities = {
"keeper_of_the_light_illuminate",
"keeper_of_the_light_mana_leak",
"keeper_of_the_light_chakra_magic",
"keeper_of_the_light_recall",
"keeper_of_the_light_blinding_light",
"keeper_of_the_light_spirit_form",
"keeper_of_the_light_illuminate_end",
"keeper_of_the_light_spirit_form_illuminate",
"keeper_of_the_light_spirit_form_illuminate_end",
};
function AbilityUsageThink()
local npcBot = GetBot();
local wave = npcBot:GetAbilityInSlot(0);
local leak = npcBot:GetAbilityByName(Abilities[2]);
local mana = npcBot:GetAbilityByName(Abilities[3]);
local ult = npcBot:GetAbilityByName(Abilities[6]);
local creeps = npcBot:GetNearbyLaneCreeps(1500, true);
local enemyHeroes = npcBot:GetNearbyHeroes(600, true, BOT_MODE_NONE);
local function considerManaLeak()
if leak:IsFullyCastable() and npcBot:GetMana() - leak:GetManaCost() > mana:GetManaCost() then
local enemyHero = Helper.GetHeroWith(npcBot, 'min', 'GetHealth', leak:GetCastRange(), true);
if enemyHero ~= nil then
return npcBot:ActionPush_UseAbilityOnEntity(leak, enemyHero);
end
end
end
if npcBot:IsChanneling() or (npcBot:IsUsingAbility() and (not wave:IsInAbilityPhase())) then
return;
end
if mana:IsFullyCastable() then
local target = Helper.GetHeroWith(npcBot, 'min', 'GetMana', mana:GetCastRange(), false);
return npcBot:ActionPush_UseAbilityOnEntity(mana, target);
end
if #enemyHeroes >= 2 or npcBot:GetActiveMode() == BOT_MODE_RETREAT then
return considerManaLeak();
end
if wave:IsFullyCastable() and
npcBot:GetMana() - wave:GetManaCost() > mana:GetManaCost() and
npcBot:GetActiveMode() ~= BOT_MODE_RETREAT and
#creeps >= 3 then
return npcBot:ActionPush_UseAbilityOnLocation(wave, creeps[1]:GetLocation());
end
considerManaLeak();
-- if ult:IsFullyCastable() and npcBot:GetMana() - ult:GetManaCost() > waveAndManaCombo then
-- npcBot:ActionPush_UseAbility(ult);
-- end
end
function ItemUsageThink()
ability_item_usage_generic.ItemUsageThink();
end
function BuybackUsageThink()
ability_item_usage_generic.BuybackUsageThink();
end