Apply the new ground_level method.
[crawl.git] / crawl-ref / source / test / item_curse.lua
blob64a0514e30ebf9f4597c473993979e51eed7d466
1 -- Test handling of not_cursed in item curse status generation.
3 local niters = 5000
4 local item_type = "short sword not_cursed"
5 local place = dgn.point(20, 20)
6 local curse_count = 0
8 local function test_item (place, item_type)
9 dgn.create_item(place.x, place.y, item_type)
10 local item = dgn.items_at(place.x, place.y)[1]
11 if item.is_cursed then
12 curse_count = curse_count + 1
13 end
14 end
16 local function do_item_tests (niters, item_type, place)
17 debug.goto_place("D:1")
18 dgn.dismiss_monsters()
19 dgn.grid(place.x, place.y, "floor")
21 for i=1, niters do
22 if #dgn.items_at(place.x, place.y) ~= 0 then
23 iter.stack_destroy(place)
24 end
25 test_item(place, item_type)
26 end
28 if curse_count ~= 0 then
29 error("Generated " .. curse_count .. " cursed '" .. item_type .. "' out of " .. niters .. ".")
30 end
31 end
33 do_item_tests (niters, item_type, place)