forked from PCMRShutnik/Rage-Trigger
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Wardlogic.lua
181 lines (152 loc) · 3.75 KB
/
Wardlogic.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
local X = {}
local RADIANT_T3TOPFALL = Vector(-6633, -3010);
local RADIANT_T3MIDFALL = Vector(-4393, -3854);
local RADIANT_T3BOTFALL = Vector(-3600, -6096);
local RADIANT_T2TOPFALL = Vector(-4381, -1311);
local RADIANT_T2MIDFALL = Vector(-960, -4613);
local RADIANT_T2BOTFALL = Vector(1396, -4686);
local RADIANT_T1TOPFALL = Vector(-5118, 2043);
local RADIANT_T1MIDFALL = Vector(-56, -1085);
local RADIANT_T1BOTFALL = Vector(5142, -3794);
local RADIANT_MANDATE1 = Vector(-2930, 775);
local RADIANT_MANDATE2 = Vector(1798, -2826);
local RADIANT_AGGRESSIVETOP = Vector(-4705, 1125);
local RADIANT_AGGRESSIVEMID1 = Vector(-3310, -1420);
local RADIANT_AGGRESSIVEMID2 = Vector(-865, -4013);
local RADIANT_AGGRESSIVEBOT = Vector(2162, -3869);
local DIRE_T3TOPFALL = Vector(3111, 5832);
local DIRE_T3MIDFALL = Vector(4006, 3481);
local DIRE_T3BOTFALL = Vector(6300, 2627);
local DIRE_T2TOPFALL = Vector(1010, 4619);
local DIRE_T2MIDFALL = Vector(981, 2278);
local DIRE_T2BOTFALL = Vector(5069, -760);
local DIRE_T1TOPFALL = Vector(-2833, 3900);
local DIRE_T1MIDFALL = Vector(787, -465);
local DIRE_T1BOTFALL = Vector(5130, -799);
local DIRE_MANDATE1 = Vector(3333, -1506);
local DIRE_MANDATE2 = Vector(-970, 1329);
local DIRE_AGGRESSIVETOP = Vector(-1999, 4853);
local DIRE_AGGRESSIVEMID1 = Vector(-60, 2310);
local DIRE_AGGRESSIVEMID2 = Vector(3320, -10);
local DIRE_AGGRESSIVEBOT = Vector(5130, -799);
local Towers = {
TOWER_TOP_1,
TOWER_MID_1,
TOWER_BOT_1,
TOWER_TOP_2,
TOWER_MID_2,
TOWER_BOT_2,
TOWER_TOP_3,
TOWER_MID_3,
TOWER_BOT_3
}
local WardSpotTowerFallRadiant = {
RADIANT_T1TOPFALL,
RADIANT_T1MIDFALL,
RADIANT_T1BOTFALL,
RADIANT_T2TOPFALL,
RADIANT_T2MIDFALL,
RADIANT_T2BOTFALL,
RADIANT_T3TOPFALL,
RADIANT_T3MIDFALL,
RADIANT_T3BOTFALL
}
local WardSpotTowerFallDire = {
DIRE_T1TOPFALL,
DIRE_T1MIDFALL,
DIRE_T1BOTFALL,
DIRE_T2TOPFALL,
DIRE_T2MIDFALL,
DIRE_T2BOTFALL,
DIRE_T3TOPFALL,
DIRE_T3MIDFALL,
DIRE_T3BOTFALL
}
function X.GetDistance(s, t)
return math.sqrt((s[1]-t[1])*(s[1]-t[1]) + (s[2]-t[2])*(s[2]-t[2]));
end
function X.GetMandatorySpot()
local MandatorySpotRadiant = {
RADIANT_MANDATE1,
RADIANT_MANDATE2
}
local MandatorySpotDire = {
DIRE_MANDATE1,
DIRE_MANDATE2
}
if GetTeam() == TEAM_RADIANT then
return MandatorySpotRadiant;
else
return MandatorySpotDire
end
end
function X.GetWardSpotWhenTowerFall()
local wardSpot = {};
for i = 1, #Towers
do
local t = GetTower(GetTeam(), Towers[i]);
if t == nil then
if GetTeam() == TEAM_RADIANT then
table.insert(wardSpot, WardSpotTowerFallRadiant[i]);
else
table.insert(wardSpot, WardSpotTowerFallDire[i]);
end
end
end
return wardSpot;
end
function X.GetAggressiveSpot()
local AggressiveRadiant = {
DIRE_AGGRESSIVETOP,
DIRE_AGGRESSIVEMID1,
DIRE_AGGRESSIVEMID2,
DIRE_AGGRESSIVEBOT
}
local AggressiveDire = {
RADIANT_AGGRESSIVETOP,
RADIANT_AGGRESSIVEMID1,
RADIANT_AGGRESSIVEMID2,
RADIANT_AGGRESSIVEBOT
}
if GetTeam() == TEAM_RADIANT then
return AggressiveRadiant;
else
return AggressiveDire
end
end
function X.UpdateWardSpot(WardSpot)
for i = 1, #WardSpot
do
if X.IsWardInCertainPlace(WardSpot[i]) then
print(i.."true")
table.remove(WardSpot, i);
end
end
return WardSpot;
end
function X.HasWardInInventory()
local bot = GetBot();
local slot = bot:FindItemSlot('item_ward_observer');
if slot >= 0 and slot <= 8 then
return slot;
else
return -1;
end
end
function X.GetItemCharges(item)
local npcBot = GetBot();
local charges = item:GetCurrentCharges();
return charges;
end
function X.IsWardInCertainPlace(vPlace)
local WardList = GetUnitList(UNIT_LIST_ALLIED_WARDS);
for _,ward in pairs(WardList)
do
local wardLoc = ward:GetLocation();
if vPlace.x == wardLoc.x then
return true;
end
end
return false;
end
return X