Apply the new ground_level method.
[crawl.git] / crawl-ref / source / test / monplace.lua
blob40c2f886bcad65437b06cbed1490d03cf309f08f
1 -- Monster placement tests.
3 local place = dgn.point(20, 20)
5 local function place_monster_on(x, y, monster, feature)
6 dgn.grid(place.x, place.y, feature)
7 return dgn.create_monster(x, y, monster)
8 end
10 local function assert_place_monster_on(monster, feature)
11 feature = feature or 'floor'
12 dgn.dismiss_monsters()
13 crawl.message("Placing " .. monster .. " on " .. feature)
14 assert(place_monster_on(place.x, place.y, monster, feature),
15 "Could not place monster " .. monster .. " on " .. feature)
17 if monster ~= 'mimic' then
18 local realname = dgn.mons_at(place.x, place.y).name
19 assert(realname == monster,
20 "Monster placed is '" .. realname ..
21 "', expected '" .. monster .. "'")
22 end
23 end
25 assert_place_monster_on("quokka", "floor")
26 assert_place_monster_on("necrophage", "altar_zin")
27 assert_place_monster_on("rat", "shallow water")
29 -- [ds] One wonders why due has this morbid fetish involving flying
30 -- skulls and lava...
31 assert_place_monster_on("flying skull", "lava")
32 assert_place_monster_on("rock worm", "rock_wall")
33 assert_place_monster_on("cyan ugly thing")
34 assert_place_monster_on("purple very ugly thing")
36 for i = 1, 100 do
37 assert_place_monster_on("mimic")
38 end