1-- handle the udun school
2
3function get_disebolt_dam()
4        return 40, 15 + get_level(Ind, DISEBOLT, 50)
5end
6
7--[[
8DRAIN = add_spell
9{
10	["name"] = 	"Drain",
11        ["school"] = 	{SCHOOL_UDUN},
12        ["level"] = 	1,
13        ["mana"] = 	0,
14        ["mana_max"] = 	0,
15        ["fail"] = 	20,
16        ["spell"] = 	function()
17        		local ret, item, obj, o_name, add
18
19                        -- Ask for an item
20                        ret, item = get_item("What item to drain?", "You have nothing you can drain", USE_INVEN,
21                        	function (obj)
22					if (obj.tval == TV_WAND) or (obj.tval == TV_ROD_MAIN) or (obj.tval == TV_STAFF) then
23				        	return TRUE
24				        end
25			        	return FALSE
26				end
27			)
28
29                        if ret == TRUE then
30                        	-- get the item
31                                obj = get_object(item)
32
33				add = 0
34                                if (obj.tval == TV_STAFF) or (obj.tval == TV_WAND) then
35                                        local kind = get_kind(obj)
36
37                                        add = kind.level * obj.pval * obj.number
38
39                                        -- Destroy it!
40                                        inven_item_increase(item, -99)
41                                        inven_item_describe(item)
42                                        inven_item_optimize(item)
43                                end
44                                if obj.tval == TV_ROD_MAIN then
45                                        add = obj.timeout
46                                        obj.timeout = 0;
47
48					--Combine / Reorder the pack (later)
49					player.notice = bor(player.notice, PN_COMBINE, PN_REORDER)
50					player.window = bor(player.window, PW_INVEN, PW_EQUIP, PW_PLAYER)
51                                end
52                                increase_mana(add)
53                        end
54	end,
55	["info"] = 	function()
56	                return ""
57	end,
58        ["desc"] =	{
59                        "Drains the mana contained in wands, staves and rods to increase yours",
60        }
61}
62]]
63GENOCIDE = add_spell
64{
65	["name"] = 	"Genocide",
66        ["school"] = 	{SCHOOL_UDUN},
67        ["level"] = 	25,
68        ["mana"] = 	50,
69        ["mana_max"] = 	50,
70        ["fail"] = 	20,
71        ["stat"] =      A_WIS,
72        ["extra"] =     function () if get_check2("Genocide all monsters near you (Y=all in radius, n=race on whole map)?", TRUE) == TRUE then return TRUE else return FALSE end end,
73        ["spell"] = 	function(args)
74                        local type
75
76                        type = 0
77                        if get_level(Ind, GENOCIDE) >= 15 then type = 1 end
78                        if type == 0 then
79                                genocide(Ind)
80                        else
81                                if args.aux == TRUE then
82                                        obliteration(Ind)
83                                else
84                                	genocide(Ind)
85                                end
86                        end
87	end,
88	["info"] = 	function()
89	                return ""
90	end,
91        ["desc"] =	{
92                        "Casts 'Genocide' on all monsters of particular race on the level",
93                        "At level 15 it can be used as an 'Obliteration' spell instead,",
94                        "eradicating all monsters in your vincinity",
95        }
96}
97
98WRAITHFORM = add_spell
99{
100	["name"] = 	"Wraithform",
101        ["school"] = 	{SCHOOL_UDUN},
102        ["level"] = 	35,
103        ["mana"] = 	20,
104        ["mana_max"] = 	40,
105        ["fail"] = 	20,
106        ["spell"] = 	function()
107                        local dur = randint(30) + 20 + get_level(Ind, WRAITHFORM, 40)
108                       	set_tim_wraith(Ind, dur)
109                        if player.spell_project > 0 then
110                                fire_ball(Ind, GF_WRAITH_PLAYER, 0, dur, player.spell_project, "")
111                        end
112	end,
113	["info"] = 	function()
114	                return "dur "..(20 + get_level(Ind, WRAITHFORM, 40)).."+d30"
115	end,
116        ["desc"] =	{
117                        "Turns you into an immaterial being",
118                        "***Affected by the Meta spell: Project Spell***",
119        }
120}
121--[[
122FLAMEOFUDUN = add_spell
123{
124	["name"] = 	"Flame of Udun",
125        ["school"] = 	{SCHOOL_UDUN},
126        ["level"] = 	35,
127        ["mana"] = 	70,
128        ["mana_max"] = 	100,
129        ["fail"] = 	20,
130        ["spell"] = 	function()
131                       	set_mimic(randint(15) + 5 + get_level(FLAMEOFUDUN, 30), MIMIC_BALROG)
132	end,
133	["info"] = 	function()
134	                return "dur "..(5 + get_level(FLAMEOFUDUN, 30)).."+d15"
135	end,
136        ["desc"] =	{
137                        "Turns you into a powerful balrog",
138        }
139}
140]]
141
142DISEBOLT = add_spell
143{
144	["name"] =      "Disenchantment Bolt",
145	["school"] =    {SCHOOL_UDUN},
146	["level"] =     40,
147	["mana"] =      30,
148	["mana_max"] =  140,
149        ["fail"] =      -40,
150	["direction"] = TRUE,
151	["ftk"] = 1,
152	["spell"] =     function(args)
153		fire_bolt(Ind, GF_DISENCHANT, args.dir, damroll(get_disebolt_dam()), " casts a disenchantment bolt for")
154	end,
155	["info"] =      function()
156		local x, y
157
158		x, y = get_disebolt_dam()
159		return "dam "..x.."d"..y
160	end,
161	["desc"] =      {
162		"Conjures a powerful disenchantment bolt",
163		"The damage is nearly irresistible and will increase with level"
164	}
165}
166
167HELLFIRE = add_spell
168{
169        ["name"] =      "Hellfire",
170        ["school"] =    {SCHOOL_UDUN},
171        ["level"] =     20,
172        ["mana"] =      15,
173        ["mana_max"] =  40,
174        ["fail"] =      30,
175        ["direction"] = TRUE,
176        ["ftk"] = 2,
177	["spell"] =     function(args)
178			local type
179	                type = GF_HELL_FIRE
180	                fire_ball(Ind, type, args.dir, 20 + get_level(Ind, HELLFIRE, 500), 2 + get_level(Ind, HELLFIRE, 2), " casts a ball of hellfire for")
181	        end,
182        ["info"] =      function()
183	                return "dam "..(20 + get_level(Ind, HELLFIRE, 500)).." rad "..(2 + get_level(Ind, HELLFIRE, 2))
184	        end,
185        ["desc"] =      {
186	                "Conjures a ball of hellfire to burn your foes to ashes",
187		        }
188}
189
190STOPWRAITH = add_spell
191{
192	["name"] = 	"Stop Wraithform",
193	["school"] = 	{SCHOOL_UDUN},
194	["level"] = 	20,
195	["mana"] = 	0,
196	["mana_max"] = 	0,
197	["fail"] = 	-99,
198	["spell"] = 	function()
199			set_tim_wraith(Ind, 0)
200			if player.spell_project > 0 then
201				fire_ball(Ind, GF_WRAITH_PLAYER, 0, 0, player.spell_project, "")
202			end
203	end,
204	["info"] = 	function()
205			return ""
206	end,
207	["desc"] = 	{
208			"Immediately returns you into a material being",
209			"***Affected by the Meta spell: Project Spell***",
210	}
211}
212