forked from dd2repo/BoL
-
Notifications
You must be signed in to change notification settings - Fork 0
/
d2cassiopeia.lua
254 lines (236 loc) · 8.84 KB
/
d2cassiopeia.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
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
if myHero.charName ~= "Cassiopeia" then
return
end
require 'VPrediction'
require 'HPrediction'
require 'SxOrbWalk'
local version = 1.6
local AUTOUPDATE = true
local SCRIPT_NAME = "d2cassiopeia"
local HWID
local ID
local id
local Edelay, Wdelay, orbwalk, check = true, true, true, true
local VP = nil
local SOURCELIB_URL = "https://raw.github.com/TheRealSource/public/master/common/SourceLib.lua"
local SOURCELIB_PATH = LIB_PATH.."SourceLib.lua"
if FileExist(SOURCELIB_PATH) then
require("SourceLib")
else
DONLOADING_SOURCELIB = true
DownloadFile(SOURCELIB_URL, SOURCELIB_PATH, function() print("Required libraries downloaded successfully, please reload") end)
end
if DOWNLOADING_SOURCELIB then print("Downloading required libraries, please wait...") return end
local RequireI = Require("SourceLib")
RequireI:Check()
if AUTOUPDATE then
SourceUpdater(SCRIPT_NAME, version, "raw.github.com", "/dd2repo/BoL/master/"..SCRIPT_NAME..".lua", SCRIPT_PATH .. GetCurrentEnv().FILE_NAME, "/dd2repo/BoL/master/"..SCRIPT_NAME..".version"):CheckUpdate()
end
function OnLoad()
ts = TargetSelector(TARGET_LESS_CAST_PRIORITY,950)
VP = VPrediction()
HPred = HPrediction()
m = scriptConfig("[D2 Cassiopeia v1.4]", "[d2cassiopeia]")
Ignite = (myHero:GetSpellData(SUMMONER_1).name:find("summonerdot") and SUMMONER_1) or (myHero:GetSpellData(SUMMONER_2).name:find("summonerdot") and SUMMONER_2) or nil
m:addSubMenu("Combo Settings", "combosettings")
m.combosettings:addParam("useq", "Use Q", SCRIPT_PARAM_ONOFF, true)
m.combosettings:addParam("usew", "Use W", SCRIPT_PARAM_ONOFF, true)
m.combosettings:addParam("usee", "Use E", SCRIPT_PARAM_ONOFF, true)
m.combosettings:addParam("useonly", "Use delayed W", SCRIPT_PARAM_ONOFF, true)
m:addSubMenu("Harass Settings", "harasssettings")
m.harasssettings:addParam("usehq", "Use Q", SCRIPT_PARAM_ONOFF, true)
m.harasssettings:addParam("usehw", "Use W", SCRIPT_PARAM_ONOFF, true)
m.harasssettings:addParam("mana", "Stop Harass if Mana under -> %", SCRIPT_PARAM_SLICE, 10, 0, 100, 0)
m:addSubMenu("Legit Settings", "legit")
m.legit:addParam("lmode", "Legit Mode", SCRIPT_PARAM_ONKEYTOGGLE, false, string.byte("N"))
--m.legit:addParam("orbing", "Orbwalking", SCRIPT_PARAM_ONOFF, true)
m.legit:addParam("stutter", "Stutterstep after every E", SCRIPT_PARAM_ONOFF, false)
m.legit:addParam("edelaym", "Delay between E's", SCRIPT_PARAM_SLICE, 1, 0.5, 2, 2)
m:addSubMenu("Item Settings", "items")
m.items:addParam("enableautozhonya", "Auto Zhonya's", SCRIPT_PARAM_ONOFF, false)
m.items:addParam("autozhonya", "Zhonya's if Health under -> %", SCRIPT_PARAM_SLICE, 10, 0, 100, 0)
m:addSubMenu("Drawings", "draws")
m.draws:addParam("drawq", "Draw Q & W range", SCRIPT_PARAM_ONOFF, false)
m.draws:addParam("drawe", "Draw E range", SCRIPT_PARAM_ONOFF, false)
m.draws:addParam("drawr", "Draw R range", SCRIPT_PARAM_ONOFF, false)
m:addSubMenu("Kill Steal", "ks")
m.ks:addParam("ignite", "Use Ignite", SCRIPT_PARAM_ONOFF, true)
m.ks:addParam("kse", "KS with E", SCRIPT_PARAM_ONOFF, false)
m.ks:addParam("ksr", "KS with R", SCRIPT_PARAM_ONOFF, false)
m:addParam("combokey", "Combo", SCRIPT_PARAM_ONKEYDOWN, false, 32)
m:addParam("harass", "Toogle Auto Harass", SCRIPT_PARAM_ONKEYTOGGLE, false, string.byte("C"))
m:addParam("prediction", "Choose Prediction", SCRIPT_PARAM_LIST, 1, {"VPrediction", "HPrediction" })
m:addTS(ts)
m:addSubMenu("Orbwalker", "orbwalk")
SxOrb:LoadToMenu(m.orbwalk)
ts.name = "Legit"
PrintChat ("<font color='#F20000'>[D2 Cassiopeia v1.5] loaded!</font>")
end
function OnTick()
checks()
Combo()
--walk()
autokill()
Harass()
autozhonya()
end
function checks()
ts:update()
Qready = (myHero:CanUseSpell(_Q) == READY)
Wready = (myHero:CanUseSpell(_W) == READY)
Eready = (myHero:CanUseSpell(_E) == READY)
Rready = (myHero:CanUseSpell(_R) == READY)
target = ts.target
end
function PoisN(unit)
return TargetHaveBuff('cassiopeiaqdebuff', unit)
end
function PoisM(unit)
return TargetHaveBuff('cassiopeiawposion', unit)
end
--[[
function CastHQ(unit)
local QPos, QHitChance = HPred:GetPredict("Q", unit, myHero)
if QHitChance >= 2 then
CastSpell(_Q, QPos.x, QPos.z)
end
end
function CastHW(unit)
local WPos, WHitChance = HPred:GetPredict("W", unit, myHero)
if WHitChance >= 2 then
CastSpell(_W, WPos.x, WPos.z)
end
end
]]
function CastPreQ(unit)
local CastPosition, HitChance, Position = VP:GetCircularCastPosition(unit, 0.5, 90, 925, 1800, myHero)
if HitChance >= 2 then
CastSpell(_Q, CastPosition.x, CastPosition.z)
end
end
function CastPreW(unit)
local CastPosition, HitChance, Position = VP:GetCircularAOECastPosition(unit, 0.5, 90, 925, 2500, myHero)
if HitChance >= 2 then
CastSpell(_W, CastPosition.x, CastPosition.z)
end
end
function cassdmg(spell, object)
if spell == "e" then
local dmg = ((30+25*myHero:GetSpellData(_E).level)+myHero.ap*(0.35+myHero:GetSpellData(_E).level*0.05))*(100/(100+(object.magicArmor*myHero.magicPenPercent-myHero.magicPen)))
return dmg
elseif spell == "r" then
local dmg = ((50+100*myHero:GetSpellData(_R).level)+myHero.ap*0.5)*(100/(100+(object.magicArmor*myHero.magicPenPercent-myHero.magicPen)))
return dmg
end
end
function autokill()
for i, enemy in ipairs(GetEnemyHeroes()) do
if enemy and not enemy.dead and enemy.visible then
if Ignite ~= nil and m.ks.ignite and enemy.health < getDmg("IGNITE", enemy, myHero) and ValidTarget(enemy, 600) then CastSpell(Ignite, enemy)
end
local dist = GetDistance(enemy)
local edmg = cassdmg("e", enemy)
local rdmg = cassdmg("r", enemy)
if m.ks.ksr and Rready and Eready and dist < 680 and enemy.health < (edmg+rdmg) and ValidTarget(enemy) then
CastSpell(_E, enemy)
CastSpell(_R, enemy.x, enemy.z)
elseif m.ks.ksr and Rready and dist < 750 and enemy.health < rdmg and ValidTarget(enemy) then
CastSpell(_R, enemy.x, enemy.z)
elseif m.ks.kse and Eready and dist < 690 and enemy.health < edmg and ValidTarget(enemy) then
CastSpell(_E, enemy)
end
end
end
end
function Combo()
--if not target then SxOrb:EnableAttacks() end
--if myHero.mana < GetSpellData(_E).mana then SxOrb:EnableAttacks() end
if m.combokey then
--[[
if myHero:GetSpellData(_E).level >= 1 then
if myHero:GetSpellData(_E).currentCd > 0.6 then SxOrb:EnableAttacks()
else SxOrb:DisableAttacks()
end
else SxOrb:EnableAttacks()
end
]]
if m.prediction == 1 or m.prediction == 2 then
if Qready and m.combosettings.useq and target then
CastPreQ(target)
end
if m.combosettings.useonly and Wdelay and Wready and m.combosettings.usew and target then
Wdelay = false
DelayAction(function() Wdelay = true end, 1)
CastPreW(target)
elseif not m.combosettings.useonly and Wready and m.combosettings.usew and target then
CastPreW(target)
end
else
if Qready and m.combosettings.useq and target then
CastHQ(target)
end
if m.combosettings.useonly and Wdelay and Wready and m.combosettings.usew and target then
Wdelay = false
DelayAction(function() Wdelay = true end, 1)
CastHW(target)
elseif not m.combosettings.useonly and Wready and m.combosettings.usew and target then
CastHW(target)
end
end
if m.legit.lmode then
if m.legit.stutter and Eready and target and GetDistance(target) < 690 and m.combosettings.usee and Edelay and (PoisM(target) or PoisN(target)) then
Edelay = false
SxOrb:DisableMove()
if check then
check = false
DelayAction(function() check = true SxOrb:EnableMove() end, 0.5)
end
DelayAction(function() Edelay = true end, m.legit.edelaym)
CastSpell(_E, target)
end
if not m.legit.stutter and Eready and target and GetDistance(target) < 690 and m.combosettings.usee and Edelay and (PoisM(target) or PoisN(target)) then
Edelay = false
DelayAction(function() Edelay = true end, m.legit.edelaym)
CastSpell(_E, target)
end
elseif not m.legit.lmode and Eready and target and GetDistance(target) < 690 and m.combosettings.usee and (PoisM(target) or PoisN(target)) then
CastSpell(_E, target)
end
end
end
function autozhonya()
if m.items.enableautozhonya then
if myHero.health <= (myHero.maxHealth * m.items.autozhonya / 100) then CastItem(3157)
end
end
end
function Harass()
if not target then return
end
if m.harass and (myHero.maxMana * m.harasssettings.mana / 100) <= myHero.mana then
if Qready and m.harasssettings.usehq and target then
CastPreQ(target)
end
if Wready and m.harasssettings.usehw and target then
CastPreW(target)
end
end
end
--[[
function walk()
if m.combokey and m.legit.orbing and orbwalk and SxOrb:CanMove() then
myHero:MoveTo(mousePos.x, mousePos.z)
end
end
]]
function OnDraw()
if m.draws.drawq then
DrawCircle(myHero.x, myHero.y, myHero.z, 925, ARGB(255, 255, 255, 255))
end
if m.draws.drawe then
DrawCircle(myHero.x, myHero.y, myHero.z, 690, ARGB(255, 255, 255, 255))
end
if m.draws.drawr then
DrawCircle(myHero.x, myHero.y, myHero.z, 850, ARGB(255, 255, 255, 255))
end
end