1-- The earth school
2
3--[[
4STONESKIN = add_spell
5{
6	["name"] = 	"Stone Skin",
7        ["school"] = 	SCHOOL_EARTH,
8        ["level"] = 	1,
9        ["mana"] = 	1,
10        ["mana_max"] = 	100,
11        ["fail"] = 	10,
12        ["spell"] = 	function()
13        		local type
14        		if get_level(Ind, STONESKIN, 50) >= 25 then
15                        	type = SHIELD_COUNTER
16                        else
17                        	type = 0
18                        end
19               		set_shield(Ind, randint(10) + 10 + get_level(Ind, STONESKIN, 100), 5 + get_level(Ind, STONESKIN, 30), type, 2 + get_level(Ind, STONESKIN, 5), 3 + get_level(Ind, STONESKIN, 5))
20	end,
21	["info"] = 	function()
22        		if get_level(Ind, STONESKIN, 50) >= 25 then
23                                return "dam "..(2 + get_level(Ind, STONESKIN, 5)).."d"..(3 + get_level(Ind, STONESKIN, 5)).." dur "..(10 + get_level(Ind, STONESKIN, 100)).."+d10 AC "..(5 + get_level(Ind, STONESKIN, 30))
24                        else
25                                return "dur "..(10 + get_level(Ind, STONESKIN, 100)).."+d10 AC "..(5 + get_level(Ind, STONESKIN, 30))
26                        end
27	end,
28        ["desc"] =	{
29        		"Creates a shield of earth around you to protect you",
30                        "At level 25 it starts dealing damage to attackers"
31		}
32}
33]]
34DIG = add_spell
35{
36	["name"] = 	"Dig",
37        ["school"] = 	SCHOOL_EARTH,
38        ["level"] = 	12,
39        ["mana"] = 	14,
40        ["mana_max"] = 	14,
41        ["fail"] = 	10,
42        ["direction"] = TRUE,
43        ["spell"] = 	function(args)
44			wall_to_mud(Ind, args.dir)
45	end,
46	["info"] = 	function()
47        		return ""
48	end,
49        ["desc"] =	{
50        		"Digs a hole in a wall much faster than any shovels",
51		}
52}
53
54function get_acidbolt_dam()
55        return 6 + get_level(Ind, ACIDBOLT, 25), 8 + get_level(Ind, ACIDBOLT, 25) + 1
56end
57ACIDBOLT = add_spell
58{
59        ["name"] =      "Acid Bolt",
60        ["school"] =    SCHOOL_EARTH,
61        ["level"] =     12,
62        ["mana"] =      3,
63        ["mana_max"] =  13,
64        ["fail"] =      -10,
65        ["direction"] = TRUE,
66        ["ftk"] = 1,
67        ["spell"] =     function(args)
68                        fire_bolt(Ind, GF_ACID, args.dir, damroll(get_acidbolt_dam()), " casts a acid bolt for")
69        end,
70        ["info"] =      function()
71                        local x, y
72
73                        x, y = get_acidbolt_dam()
74                        return "dam "..x.."d"..y
75        end,
76        ["desc"] =      {
77                        "Conjures up corroding acid into a powerful bolt",
78                }
79}
80
81STONEPRISON = add_spell
82{
83	["name"] = 	"Stone Prison",
84        ["school"] = 	SCHOOL_EARTH,
85        ["level"] = 	25,
86        ["mana"] = 	40,
87        ["mana_max"] = 	70,
88        ["fail"] = 	10,
89        ["spell"] = 	function()
90			local ret, x, y
91--        		if get_level(Ind, STONEPRISON, 50) >= 10 then
92--                        	ret, x, y = tgt_pt()
93--                        else
94--                        	y = py
95--                                x = px
96--                        end
97-- DGDGD we need client side tgt_pt			wall_stone(y, x)
98                        fire_ball(Ind, GF_STONE_WALL, 0, 1, 1, "")
99	end,
100	["info"] = 	function()
101        		return ""
102	end,
103        ["desc"] =	{
104        		"Creates a prison of walls around you"
105--                        ,"At level 10 it allows you to target a monster"
106		}
107}
108
109STRIKE = add_spell
110{
111	["name"] = 	"Strike",
112	["school"] = 	{SCHOOL_EARTH},
113	["level"] = 	25,
114	["mana"] = 	30,
115	["mana_max"] = 	50,
116	["fail"] = 	30,
117	["direction"] = TRUE,
118	["spell"] = 	function(args)
119			if get_level(Ind, STRIKE, 50) >= 12 then
120				fire_ball(Ind, GF_FORCE, args.dir, 50 + get_level(Ind, STRIKE, 50), 1, " casts a force ball of")
121			else
122				fire_ball(Ind, GF_FORCE, args.dir, 50 + get_level(Ind, STRIKE, 50), 0, " casts a force bolt of")
123			end
124	end,
125	["info"] = 	function()
126			if get_level(Ind, STRIKE, 50) >= 12 then
127				return "dam "..(50 + get_level(Ind, STRIKE, 50)).." rad 1"
128			else
129				return "dam "..(50 + get_level(Ind, STRIKE, 50))
130			end
131	end,
132	["desc"] =	{
133			"Creates a force bolt that may stun enemies.",
134			"At level 12 it turns into a ball of radius 1"
135	}
136}
137
138SHAKE = add_spell
139{
140	["name"] = 	"Shake",
141        ["school"] = 	{SCHOOL_EARTH},
142        ["level"] = 	27,
143        ["mana"] = 	25,
144        ["mana_max"] = 	30,
145        ["fail"] = 	30,
146        ["spell"] = 	function()
147--                        if get_level(Ind, SHAKE, 50) >= 10 then
148--	                       	ret, x, y = tgt_pt()
149--                                if ret == FALSE then return end
150--                        else
151--                        	x = player.px
152--                                y = player.py
153--                        end
154			earthquake(player.wpos, player.py, player.px, 2 + get_level(Ind, SHAKE, 50));
155	end,
156	["info"] = 	function()
157			return "rad "..(2 + get_level(Ind, SHAKE, 50))
158	end,
159        ["desc"] =	{
160        		"Creates a localized earthquake"
161--                        ,"At level 10 it can be targeted at any location"
162        }
163}
164