Source:NetHack 5.0.0/dat/knox.lua

From NetHackWiki
Jump to navigation Jump to search

Below is the full text to knox.lua from the source code of NetHack 5.0.0. To link to a particular line, write [[Source:NetHack 5.0.0/dat/knox.lua#line12]], for example.

The NetHack General Public License applies to screenshots, source code and other content from NetHack.

This content was modified from the original NetHack source code distribution (by splitting up NetHack content between wiki pages, and possibly further editing). See the page history for a list of who changed it, and on what dates.

1. -- NetHack knox knox.lua	$NHDT-Date: 1652196027 2022/05/10 15:20:27 $  $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.5 $
2. --	Copyright (c) 1989 by Jean-Christophe Collet
3. --	Copyright (c) 1992 by Izchak Miller
4. -- NetHack may be freely redistributed.  See license for details.
5. --
6. --
7. des.level_init({ style = "solidfill", fg = " " });
8. 
9. des.level_flags("mazelevel", "noteleport")
10. -- Fort's entry is via a secret door rather than a drawbridge;
11. -- the moat must be manually circumvented.
12. des.map([[
13. ----------------------------------------------------------------------------
14. | |........|...............................................................|
15. | |........|.................................................------------..|
16. | --S----S--.................................................|..........|..|
17. |   #   |........}}}}}}}....................}}}}}}}..........|..........|..|
18. |   #   |........}-----}....................}-----}..........--+--+--...|..|
19. |   # ---........}|...|}}}}}}}}}}}}}}}}}}}}}}|...|}.................|...|..|
20. |   # |..........}---S------------------------S---}.................|...|..|
21. |   # |..........}}}|...............|..........|}}}.................+...|..|
22. | --S----..........}|...............S..........|}...................|...|..|
23. | |.....|..........}|...............|......\...S}...................|...|..|
24. | |.....+........}}}|...............|..........|}}}.................+...|..|
25. | |.....|........}---S------------------------S---}.................|...|..|
26. | |.....|........}|...|}}}}}}}}}}}}}}}}}}}}}}|...|}.................|...|..|
27. | |..-S----......}-----}....................}-----}..........--+--+--...|..|
28. | |..|....|......}}}}}}}....................}}}}}}}..........|..........|..|
29. | |..|....|..................................................|..........|..|
30. | -----------................................................------------..|
31. |           |..............................................................|
32. ----------------------------------------------------------------------------
33. ]]);
34. -- Non diggable walls
35. des.non_diggable(selection.area(00,00,75,19))
36. -- Portal arrival point
37. des.levregion({ region = {08,16,08,16}, type="branch" });
38. -- accessible via ^V in wizard mode; arrive near the portal
39. des.teleport_region({ region = {06,15,09,16}, dir="up" })
40. des.teleport_region({ region = {06,15,09,16}, dir="down" })
41. --   Throne room, with Croesus on the throne
42. des.region({ x1=37,y1=08,x2=46,y2=11, lit=1, type="throne", filled=1 })
43. --   50% chance each to move throne and/or fort's entry secret door up one row
44. if percent(50) then
45.    des.monster({ id = "Croesus", x=43, y=10, peaceful = 0 })
46. else
47.    des.monster({ id = "Croesus", x=43, y=09, peaceful = 0 })
48.    des.terrain(43,09, "\\")
49.    des.terrain(43,10, ".")
50. end
51. if percent(50) then
52.    des.terrain(47,09, "S")
53.    des.terrain(47,10, "|")
54. end
55. 
56. --   The Vault
57. function treasure_spot(x,y)
58.    des.gold({ x = x, y = y, amount = 600 + math.random(0, 300) });
59.    if (math.random(0,2) == 0) then
60.       if (math.random(0,2) == 0) then
61.          des.trap("spiked pit", x,y);
62.       else
63.          des.trap("land mine", x,y);
64.       end
65.    end
66. end
67. 
68. des.region({ region={21,08,35,11}, lit=1, type="ordinary" })
69. local treasury = selection.area(21,08,35,11);
70. treasury:iterate(treasure_spot);
71. 
72. --   Vault entrance also varies
73. if percent(50) then
74.    des.terrain(36,09, "|")
75.    des.terrain(36,10, "S")
76. end
77. --   Corner towers
78. des.region(selection.area(19,06,21,06),"lit")
79. des.region(selection.area(46,06,48,06),"lit")
80. des.region(selection.area(19,13,21,13),"lit")
81. des.region(selection.area(46,13,48,13),"lit")
82. --   A welcoming committee
83. des.region({ region={03,10,07,13},lit=1,type="zoo",filled=1,irregular=1 })
84. --   arrival chamber; needs to be a real room to control migrating monsters,
85. --   and `unfilled' is a kludge to force an ordinary room to remain a room
86. des.region({ region={06,15,09,16},lit=0,type="ordinary",arrival_room=true })
87. 
88. --   3.6.2:  Entering level carrying a lit candle would show the whole entry
89. --   chamber except for its top right corner even though some of the revealed
90. --   spots are farther away than that is.  This is because the lit treasure zoo
91. --   is forcing the walls around it to be lit too (see light_region(sp_lev.c)),
92. --   and lit walls show up when light reaches the spot next to them.  The unlit
93. --   corner is beyond candle range and isn't flagged as lit so it doesn't show
94. --   up until light reaches it rather than when light gets next to it.
95. --
96. --   Force left and top walls of the arrival chamber to be unlit in order to
97. --   hide this lighting quirk.
98. des.region(selection.area(05,14,05,17),"unlit")
99. des.region(selection.area(05,14,09,14),"unlit")
100. --   (Entering the treasure zoo while blind and then regaining sight might
101. --   expose the new oddity of these walls not appearing when on the lit side
102. --   but that's even less likely to occur than the rare instance of entering
103. --   the level with a candle.  They'll almost always be mapped from the arrival
104. --   side before entering the treasure zoo.
105. --
106. --   A prior workaround lit the top right corner wall and then jumped through
107. --   hoops to suppress the extra light in the 3x3 lit area that produced.
108. --   This is simpler and makes the short range candle light behave more like
109. --   it is expected to work.)
110. 
111. --   Barracks
112. des.region({ region={62,03,71,04},lit=1,type="barracks",filled=1,irregular=1 })
113. -- Doors
114. des.door("closed",06,14)
115. des.door("closed",09,03)
116. des.door("open",63,05)
117. des.door("open",66,05)
118. des.door("open",68,08)
119. des.door("locked",08,11)
120. des.door("open",68,11)
121. des.door("closed",63,14)
122. des.door("closed",66,14)
123. des.door("closed",04,03)
124. des.door("closed",04,09)
125. -- Soldiers guarding the fort
126. des.monster("soldier",12,14)
127. des.monster("soldier",12,13)
128. des.monster("soldier",11,10)
129. des.monster("soldier",13,02)
130. des.monster("soldier",14,03)
131. des.monster("soldier",20,02)
132. des.monster("soldier",30,02)
133. des.monster("soldier",40,02)
134. des.monster("soldier",30,16)
135. des.monster("soldier",32,16)
136. des.monster("soldier",40,16)
137. des.monster("soldier",54,16)
138. des.monster("soldier",54,14)
139. des.monster("soldier",54,13)
140. des.monster("soldier",57,10)
141. des.monster("soldier",57,09)
142. des.monster("lieutenant",15,08)
143. -- Possible source of a boulder
144. des.monster("stone giant",03,01)
145. -- Four dragons guarding each side
146. des.monster("D",18,09)
147. des.monster("D",49,10)
148. des.monster("D",33,05)
149. des.monster("D",33,14)
150. -- Eels in the moat
151. des.monster("giant eel",17,08)
152. des.monster("giant eel",17,11)
153. des.monster("giant eel",48,08)
154. des.monster("giant eel",48,11)
155. -- The corner rooms treasures
156. des.object("diamond",19,06)
157. des.object("diamond",20,06)
158. des.object("diamond",21,06)
159. des.object("emerald",19,13)
160. des.object("emerald",20,13)
161. des.object("emerald",21,13)
162. des.object("ruby",46,06)
163. des.object("ruby",47,06)
164. des.object("ruby",48,06)
165. des.object("amethyst",46,13)
166. des.object("amethyst",47,13)
167. des.object("amethyst",48,13)