[go: up one dir, main page]

File: dungeon.lua

package info (click to toggle)
tome 2.3.11-ah-2
  • links: PTS, VCS
  • area: non-free
  • in suites: jessie, jessie-kfreebsd
  • size: 18,976 kB
  • ctags: 12,278
  • sloc: ansic: 145,042; sh: 212; makefile: 70
file content (55 lines) | stat: -rw-r--r-- 1,127 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
-- Internal lua file in charge of dungeon stuff

function place_dungeon(y, x, d_idx)
	if d_idx then
		wild_map(y, x).entrance = 1000 + d_idx
       	else
		wild_map(y, x).entrance = 0
	end
end

function dungeon(d_idx)
	return d_info[1 + d_idx]
end

function wild_feat(wild)
	return wf_info[1 + wild.feat]
end

function explode_dir(dir)
	return ddy[dir + 1], ddx[dir + 1]
end

function rotate_dir(dir, mov)
	if mov > 0 then
		if dir == 7 then dir = 8
		elseif dir == 8 then dir = 9
		elseif dir == 9 then dir = 6
		elseif dir == 6 then dir = 3
		elseif dir == 3 then dir = 2
		elseif dir == 2 then dir = 1
		elseif dir == 1 then dir = 4
		elseif dir == 4 then dir = 7
		end
	elseif mov < 0 then
		if dir == 7 then dir = 4
		elseif dir == 4 then dir = 1
		elseif dir == 1 then dir = 2
		elseif dir == 2 then dir = 3
		elseif dir == 3 then dir = 6
		elseif dir == 6 then dir = 9
		elseif dir == 9 then dir = 8
		elseif dir == 8 then dir = 7
		end
	end

	return dir
end

-- Place a trap for a specific level
function place_trap(y, x, level)
	local old_dun = dun_level
	dun_level = level
	%place_trap(y, x)
	dun_level = old_dun
end