1 -- Check bouncing of lightning bolts around in a box with ragged
2 -- edges. If there's anything wrong the C/C++ code will assert.
8 local function test_bounce_iter(map
)
10 -- local width, height = dgn.mapsize(map) -- returns (0,0)
11 local function place_map()
12 return dgn
.place_map(map
, true, true, 30, 30)
14 dgn
.with_map_anchors(30, 30, place_map
)
16 if dgn
.grid(31, 31) ~= dgn
.find_feature_number("floor") then
17 assert(false, "Map not placed properly")
20 -- Move player out of the way
23 -- Fire beams to random targets, using a ray as returned by
24 -- find_ray if available.
26 local dx
= crawl
.random2(9)
27 local dy
= crawl
.random2(9)
28 debug
.bouncy_beam(30, 30, 30+dx
, 30+dy
, 1000, true)
32 local function test_bounces()
33 debug
.flush_map_memory()
34 dgn
.load_des_file("test/des/bounce.des")
35 local map
= dgn
.map_by_tag("bounce_test")
36 assert(map
, "Could not find bounce_test map (tag 'bounce_test')")
37 -- The ragedness of the map edge is randomized on placement,
38 -- so place the same map multiple times.