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
MAGESKILLS = {
	[0] = {
		name = ""
	},
	
	[1] = {
		name = "Flame",
		class = "Mage",
		level = 1,
		mana = 10,
		damage = 5,
		size = 32,
		require = "a staff or a wand",
		desc = "Launches a searing fireball",
		action = "Cast",
		func = {function(id,skillslot,skillid,use)
			if PLAYERS[id].SMAGE[skillid] == 0 then message(id,"You don't have this skill","255000000") return end
			if PLAYERS[id].Mana >= round(MAGESKILLS[PLAYERS[id].SK[skillslot]].mana * (0.5 + PLAYERS[id].SMAGE[1]/2)) then
				reqcld(id,2)
				PLAYERS[id].tmp.useskill = 1
				PLAYERS[id].Mana = PLAYERS[id].Mana - round(MAGESKILLS[PLAYERS[id].SK[skillslot]].mana * (0.5 + PLAYERS[id].SMAGE[1]/2))
				updateMP(id)
			else
				message(id,"You don't have enough mana",'255255255')
			end
		end},
	},
}
addhook("clientdata","EXPpointer")
function EXPpointer(id,mode,curx,cury)
	if mode == 2 and PLAYERS[id].tmp.useskill == 1 and free_line(player(id,"x"),player(id,"y"),curx,cury) then
		local magicdmg = PLAYERS[id].tmp.mag/4
		local skilldmg = MAGESKILLS[1].damage
		local percentdmg = (skilldmg + magicdmg) * PLAYERS[id].SMAGE[1]/100*20
		local totaldmg = round(skilldmg + magicdmg + percentdmg)
		pointerexplosion(curx, cury, MAGESKILLS[1].size, totaldmg, id)
		print("Total dmg"..totaldmg)
		print("Magic dmg"..magicdmg)
		print("Skill dmg"..skilldmg)
		print("Percent dmg"..percentdmg)
		PLAYERS[id].tmp.useskill = 0
	end
end
function pointerexplosion(curx, cury, size, damage, id)
	for _, m in ipairs(MONSTERS) do
		if math.sqrt((m.x-curx)^2+(m.y-cury)^2) <= size then
			m:damage(id, math.floor(damage*math.random(60,140)/100), 251)
		end
	end
	parse("explosion " .. curx .. " " .. cury .. " " .. size .. " " .. damage .. " " .. id)
end
function free_line(x1,y1,x2,y2)
for i=1,distance(x1,y1,x2,y2) do
if tile(math.floor((x1+i*math.cos(math.atan2(y2-y1,x2-x1)))/32),math.floor((y1+i*math.sin(math.atan2(y2-y1,x2-x1)))/32),"walkable")==false then
return false
end
end
return true
end
function distance(x1,y1,x2,y2)
return math.floor(math.sqrt(math.pow(x1-x2,2)+math.pow(y1-y2,2)))
end