-
Notifications
You must be signed in to change notification settings - Fork 0
/
mode_side_shop_antimage.lua
59 lines (46 loc) · 2.08 KB
/
mode_side_shop_antimage.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
local npcBot = GetBot()
local sideShopLocation = nil
_G.NPCHasReachedSideShop = false
_G.distanceBetweenSideShopAndNPC = 0
----------------------------------------------------------------------------------------------------
function OnStart()
npcBot:ActionImmediate_Chat("Brb, I'm going the side shop.", false)
end
----------------------------------------------------------------------------------------------------
function OnEnd()
-- Do the standard OnEnd
end
----------------------------------------------------------------------------------------------------
function Think()
npcBot:Action_MoveToLocation(sideShopLocation)
if (GetUnitToLocationDistance(npcBot, sideShopLocation) < 300) then
_G.NPCHasReachedSideShop = true
end
end
----------------------------------------------------------------------------------------------------
function GetDesire()
local canBePurchasedFromSideShop = IsItemPurchasedFromSideShop(_G.sNextItem)
local hasEnoughGold = npcBot:GetGold() >= GetItemCost(_G.sNextItem)
-- Détermination de l'échoppe la + proche
local botTeamSideShopLocation = GetShopLocation(npcBot:GetTeam(), SHOP_SIDE)
local botEnemySideShopLocation = GetShopLocation(npcBot:GetTeam(), SHOP_SIDE2)
-- Détermine le shop le + près
if
(GetUnitToLocationDistance(npcBot, botTeamSideShopLocation) >
GetUnitToLocationDistance(npcBot, botEnemySideShopLocation))
then
sideShopLocation = botEnemySideShopLocation
else
sideShopLocation = botTeamSideShopLocation
end
_G.sideShopNearby = GetUnitToLocationDistance(npcBot, sideShopLocation) <= 2750
-- Si le prochain item peut être acheté depuis le side shop et on en est assez prêt alors go
--print("Can be purchased from side shop:", canBePurchasedFromSideShop)
--print("Has enough gold:", hasEnoughGold)
--print("Distance between bot and side shop:", _G.sideShopNearby)
if (canBePurchasedFromSideShop and hasEnoughGold and _G.sideShopNearby) then
return BOT_MODE_DESIRE_MODERATE
else
return BOT_MODE_DESIRE_NONE
end
end