1;;----------------------------------------------------------------------------
2;; Terrains
3;;----------------------------------------------------------------------------
4
5(define (terrain-effect-burn obj)
6  (kern-obj-apply-damage obj "burning" 10))
7
8(define (terrain-effect-poison obj)
9  (if (and (> (kern-dice-roll "1d20") 10)
10           (kern-obj-is-being? obj)
11           (kern-obj-add-effect obj ef_poison nil))
12      (kern-log-msg "Noxious fumes!")))
13
14;; swamp logic:
15;; 1) swamp only effects you on your turn (ie the 'slow progress' doesnt mean you get whacked 3 times before your next turn)
16;;			this is calculated by whether your character speed is enough to bring your ap positive in your next turn
17;; 2) swamp is weaker in the worldmap, where you are assumed to have some lattitude to go around the noxious bits
18;; 3) swamp gives 'noxious fumes' feedback if someone in your party gets poisoned, or you see an individual critter get poisoned
19;;       you dont get feedback when a npc party moves over swamp
20(define (terrain-effect-swamp obj)
21  (if (and (kern-obj-is-being? obj)
22			(if (kern-place-is-wilderness? (loc-place (kern-obj-get-location obj)))
23				(> (kern-obj-get-ap (kern-char-get-party obj)) (- 0 (kern-char-get-speed obj)))
24				(> (kern-obj-get-ap obj) (- 0 (kern-char-get-speed obj)))
25				))
26	(let* (
27			(difficulty
28				(cond ((< (kern-obj-get-movecost obj pclass-canfly) cant) 1)
29					((kern-place-is-wilderness? (loc-place (kern-obj-get-location obj))) 4)
30					(else 6)
31				))
32			(avoid (* 2 (occ-ability-dexdefend obj)))
33			(avoidroll (- (kern-dice-roll (mkdice 1 (+ avoid difficulty))) avoid ))
34			(strength (kern-char-get-strength obj))
35			(resistroll (- (kern-dice-roll (mkdice 1 (+ strength 10))) strength ))
36			)
37		(if (> avoidroll 0)
38			(if (> resistroll 0)
39				(begin
40					(kern-obj-add-effect obj ef_poison nil)
41					(if (kern-place-is-wilderness? (loc-place (kern-obj-get-location obj)))
42						(if (is-player-party-member? obj)
43							(kern-log-msg "Noxious fumes!"))
44						(msg-log-visible (kern-obj-get-location obj) "Noxious fumes!")
45					)
46				)
47			))
48	)))
49
50(define (terrain-effect-lava obj)
51  (if (eqv? (kern-obj-get-movecost obj pclass-canfly) cant)
52	(if (and (kern-obj-is-being? obj)
53			(kern-place-is-wilderness? (loc-place (kern-obj-get-location obj))))
54		(let* ((avoid (* 2 (occ-ability-dexdefend obj)))
55				(avoidroll (- (kern-dice-roll (mkdice 1 (+ avoid 5))) avoid)))
56			(if (> avoidroll 0)
57				(generic-burn obj (mkdice avoidroll 4)))
58		)
59		(burn obj))))
60
61(define (terrain-effect-torch obj)
62	(generic-burn obj "1d4"))
63
64;; opacity constants:
65(define opq 12) ;; opaque
66(define hvy 5)  ;; heavy
67(define dns 3)  ;; dense
68(define lgt 2)  ;; light (density)
69(define trn 0)  ;; transparent
70
71(define terrains
72  (list
73   ;;    tag                name            pclass           sprite               t light step-on
74   ;;    =================  ==============  =============    ==============       = ===== =======
75   (list 't_stars           "stars"         pclass-space     s_stars             trn 0 'chasm-fall)
76   (list 't_deep            "deep water"    pclass-deep      s_deep              trn 0 nil)
77   (list 't_sunlit_deep     "deep water"    pclass-deep      s_deep              trn 64 nil)
78   (list 't_shallow         "water"          pclass-deep      s_shallow          trn 0 nil)
79   (list 't_blendable_shoals "shallow water" pclass-shoals    s_shoals           trn 0 nil)
80   (list 't_shoals          "shallow water" pclass-shoals    s_shoals            trn 0 nil)
81   (list 't_sludge          "oily sludge"   pclass-sludge    s_sludge            trn 0 nil)
82   (list 't_shallow_sludge  "oily sludge"   pclass-shallows  s_shallow_sludge    trn 0 nil)
83   (list 't_grass           "grass"         pclass-grass     s_grass             trn 0 nil)
84   (list 't_sunlit_grass    "grass"         pclass-grass     s_grass             trn 64 nil)
85   (list 't_dirt            "dirt"          pclass-grass     s_dirt              trn 0 nil)
86   (list 't_gravel          "gravel"        pclass-grass     s_gravel            trn 0 nil)
87   (list 't_trees_v         "trees"         pclass-trees     s_trees             trn 0 nil)
88   (list 't_trees           "trees"         pclass-trees     s_trees             lgt 0 nil)
89   (list 't_trees_d         "trees"         pclass-trees     s_trees             dns 0 nil)
90
91   (list 't_forest_v        "forest"        pclass-forest    s_forest            trn 0 nil)
92   (list 't_forest          "forest"        pclass-forest    s_forest            hvy 0 nil)
93   (list 't_forest_d        "forest"        pclass-forest    s_forest            7   0 nil)
94   (list 't_forest_l        "forest"        pclass-forest    s_forest            dns 0 nil)
95   (list 't_forest_b        "forest"        pclass-forest    s_forest            opq 0 nil)
96
97   (list 't_hills           "hills"         pclass-hills     s_hills             dns 0 nil)
98   (list 't_mountains_v     "mountains"     pclass-vmountains s_mountains         trn 0 nil)
99   (list 't_mountains_b     "mountains (below)"     pclass-space s_mountains         trn 0 nil)
100   (list 't_mountains       "mountains"     pclass-mountains s_mountains         opq 0 nil)
101   (list 't_fake_mountains  "mountains"     pclass-grass     s_mountains         opq 0 nil)
102   (list 't_bog             "bog"           pclass-hills    s_bog               trn 0 'terrain-effect-swamp)
103   (list 't_lava            "lava"          pclass-hills     s_lava              trn  128 'terrain-effect-lava)
104   (list 't_fake_lava       "lava"          pclass-grass     s_lava              trn  128 nil)
105   (list 't_deep_lava       "deep lava"     pclass-deep      s_deep_lava         trn   16 'great-burn)
106   (list 't_fire_terrain    "fire"          pclass-grass     s_field_fire        trn  512 'burn)
107   (list 't_fireplace       "fireplace"     pclass-grass     s_fireplace         trn 2048 'burn)
108
109   (list 't_cobblestone     "cobblestone"   pclass-grass     s_cobblestone       trn 0 nil)
110   (list 't_gold_cobble     "cobblestone"   pclass-grass     s_gold_cobble       trn 0 nil)
111   (list 't_cyan_cobble     "cobblestone"   pclass-grass     s_cyan_cobble       trn 0 nil)
112   (list 't_gray_cobble     "cobblestone"   pclass-grass     s_gray_cobble       trn 0 nil)
113   (list 't_blue_cobble     "cobblestone"   pclass-grass     s_blue_cobble       trn 0 nil)
114   (list 't_olive_cobble     "cobblestone"   pclass-grass     s_olive_cobble       trn 0 nil)
115   (list 't_white_cobble     "cobblestone"   pclass-grass     s_white_cobble       trn 0 nil)
116   (list 't_black_tile     "floor tile"   pclass-grass     s_black_tile       trn 0 nil)
117   (list 't_gold_spiral_tile     "floor tile"   pclass-grass     s_gold_spiral_tile       trn 0 nil)
118   (list 't_blue_spiral_tile     "floor tile"   pclass-grass     s_blue_spiral_tile       trn 0 nil)
119   (list 't_tombstone       "tombstone"     pclass-boulder s_tombstone trn 0 nil)
120   (list 't_tombstone2       "tombstone"     pclass-boulder s_tombstone2 trn 0 nil)
121
122   (list 't_impassable_cobblestone    "cobblestone"   pclass-wall     s_cobblestone       trn 0 nil)
123   (list 't_flagstones      "flagstones"    pclass-grass     s_flagstone         trn 0 nil)
124   (list 't_inv_wall        "flagstones"    pclass-repel     s_flagstone         trn 0 'burn)
125   (list 't_doorway         "doorway"       pclass-grass     s_stone_arch        trn 0 nil) ;;dont use this if poss
126   (list 't_leftwing        "castle wall"   pclass-wall      s_leftwing          trn 0 nil)
127   (list 't_rightwing       "castle wall"   pclass-wall      s_rightwing         trn 0 nil)
128   (list 't_ship_hull       "ship's bulwark"   pclass-wall      s_wall           trn 0 nil)
129   (list 't_ship_hull2      "ship's hull"   pclass-wall      s_wall              opq 0 nil)
130   (list 't_sh_hull_NE      "ship's hull"   pclass-wall      s_wall_b            trn 0 nil)
131   (list 't_sh_hull_NW      "ship's hull"   pclass-wall      s_wall_a            trn 0 nil)
132   (list 't_sh_hull_SE      "ship's hull"   pclass-wall      s_wall_c            trn 0 nil)
133   (list 't_sh_hull_SW      "ship's hull"   pclass-wall      s_wall_d            trn 0 nil)
134   (list 't_mast            "mast"          pclass-wall      s_mast              trn 0 nil)
135   (list 't_ships_wheel     "ship's wheel"  pclass-wall      s_ships_wheel       trn 0 nil)
136   (list 't_deck            "deck"          pclass-grass     s_deck              trn 0 nil)
137   (list 't_boulder         "boulder"       pclass-boulder   s_boulder           lgt 0 nil)
138   (list 't_wall_rock_v     "rock wall"     pclass-wall      s_wall_rock         trn 0 nil)
139   (list 't_wall_rock       "rock wall"     pclass-wall      s_wall_rock         opq 0 nil)
140   (list 't_fake_wall_rock  "rock wall"     pclass-forest    s_secret_rock       opq 0 nil)
141   (list 't_wall_v          "wall"          pclass-wall      s_wall_stone        trn 0 nil)
142   (list 't_wall            "wall"          pclass-wall      s_wall_stone        opq 0 nil)
143   (list 't_fake_wall       "wall"          pclass-forest    s_wall_stone        opq 0 nil)
144   (list 't_wall_torch      "wall torch"    pclass-wall      s_wall_torch        opq 1024 'terrain-effect-torch)
145   (list 't_arrow_slit      "arrow slit"    pclass-bars      s_arrow_slit        trn 0 nil)
146   (list 't_window_in_stone "window"        pclass-bars      s_window_in_stone   trn 0 nil)
147   (list 't_window_in_rock  "window"        pclass-bars      s_window_in_rock    trn 0 nil)
148   (list 't_secret_door     "secret door"   pclass-grass     s_secret_door       opq 0 nil)
149   (list 't_sea_wall_v      "sea wall"      pclass-wall      s_wall              trn 0 nil)
150   (list 't_sea_wall        "sea wall"      pclass-wall      s_wall              opq 0 nil)
151   (list 't_sea_wall_NE     "sea wall"      pclass-wall      s_wall_b            opq 0 nil)
152   (list 't_sea_wall_NW     "sea wall"      pclass-wall      s_wall_a            opq 0 nil)
153   (list 't_sea_wall_SE     "sea wall"      pclass-wall      s_wall_c            opq 0 nil)
154   (list 't_sea_wall_SW     "sea wall"      pclass-wall      s_wall_d            opq 0 nil)
155   (list 't_ankh            "ankh"          pclass-wall      s_ankh              trn 0 nil)
156   (list 't_statue          "statue"        pclass-wall      s_statue            trn 0 nil)
157   (list 't_altar           "altar"         pclass-boulder      s_altar             trn 0 nil)
158   (list 't_rune_altar      "rune altar"    pclass-boulder      s_altar             trn 64 nil)
159   (list 't_active_altar    "activated rune altar" pclass-boulder s_active_altar    trn 512 nil)
160   (list 't_pillar          "pillar"        pclass-wall      s_pillar            trn 0 nil)
161   (list 't_false_pillar    "pillar"        pclass-grass     s_pillar            trn 0 nil)
162   (list 't_counter_2x1_w   "counter"       pclass-boulder   s_counter_2x1_w     trn 0 nil)
163   (list 't_counter_2x1_c   "counter"       pclass-boulder   s_counter_2x1_c     trn 0 nil)
164   (list 't_counter_2x1_e   "counter"       pclass-boulder   s_counter_2x1_e     trn 0 nil)
165   (list 't_counter_1x1     "counter"       pclass-boulder   s_counter_1x1       trn 0 nil)
166   (list 't_bridge_WE       "bridge"        pclass-bridge    s_ew_bridge         trn 0 nil)
167   (list 't_bridge_NS       "bridge"        pclass-bridge    s_ns_bridge         trn 0 nil)
168   (list 't_lava_bridge_NS  "bridge"        pclass-bridge    s_ns_bridge         trn 0 nil)
169   (list 't_chasm           "chasm"         pclass-space     s_null              trn 0 nil)
170   (list 't_void            "empty space"   pclass-space     s_null       trn 0 nil)
171   (list 't_trail_0         "trail"         pclass-grass     s_trail_0           trn 0 nil)
172   (list 't_trail_1         "trail"         pclass-grass     s_trail_1           trn 0 nil)
173   (list 't_trail_2         "trail"         pclass-grass     s_trail_2           trn 0 nil)
174   (list 't_trail_3         "trail"         pclass-grass     s_trail_3           trn 0 nil)
175   (list 't_trail_4         "trail"         pclass-grass     s_trail_4           trn 0 nil)
176   (list 't_trail_5         "trail"         pclass-grass     s_trail_5           trn 0 nil)
177   (list 't_trail_6         "trail"         pclass-grass     s_trail_6           trn 0 nil)
178   (list 't_trail_7         "trail"         pclass-grass     s_trail_7           trn 0 nil)
179   (list 't_trail_8         "trail"         pclass-grass     s_trail_8           trn 0 nil)
180   (list 't_trail_9         "trail"         pclass-grass     s_trail_9           trn 0 nil)
181   (list 't_trail_a         "trail"         pclass-grass     s_trail_a           trn 0 nil)
182   (list 't_trail_b         "trail"         pclass-grass     s_trail_b           trn 0 nil)
183   (list 't_trail_c         "trail"         pclass-grass     s_trail_c           trn 0 nil)
184   (list 't_trail_d         "trail"         pclass-grass     s_trail_d           trn 0 nil)
185   (list 't_trail_e         "trail"         pclass-grass     s_trail_e           trn 0 nil)
186   (list 't_trail_f         "trail"         pclass-grass     s_trail_f           trn 0 nil)
187   (list 't_A               "an A"          pclass-wall      s_A                 trn 0 nil)
188   (list 't_B               "a B"           pclass-wall      s_B                 trn 0 nil)
189   (list 't_fake_B          "a B"           pclass-forest    s_B                 trn 0 nil)
190   (list 't_C               "a C"           pclass-wall      s_C                 trn 0 nil)
191   (list 't_D               "a D"           pclass-wall      s_D                 trn 0 nil)
192   (list 't_E               "an E"          pclass-wall      s_E                 trn 0 nil)
193   (list 't_F               "an F"          pclass-wall      s_F                 trn 0 nil)
194   (list 't_G               "a G"           pclass-wall      s_G                 trn 0 nil)
195   (list 't_H               "an H"          pclass-wall      s_H                 trn 0 nil)
196   (list 't_I               "an I"          pclass-wall      s_I                 trn 0 nil)
197   (list 't_J               "a J"           pclass-wall      s_J                 trn 0 nil)
198   (list 't_K               "a K"           pclass-wall      s_K                 trn 0 nil)
199   (list 't_L               "an L"          pclass-wall      s_L                 trn 0 nil)
200   (list 't_M               "an M"          pclass-wall      s_M                 trn 0 nil)
201   (list 't_N               "an N"          pclass-wall      s_N                 trn 0 nil)
202   (list 't_O               "an O"          pclass-wall      s_O                 trn 0 nil)
203   (list 't_fake_O          "an O"          pclass-forest    s_O                 trn 0 nil)
204   (list 't_P               "a P"           pclass-wall      s_P                 trn 0 nil)
205   (list 't_Q               "a Q"           pclass-wall      s_Q                 trn 0 nil)
206   (list 't_R               "an R"          pclass-wall      s_R                 trn 0 nil)
207   (list 't_S               "an S"          pclass-wall      s_S                 trn 0 nil)
208   (list 't_T               "a T"           pclass-wall      s_T                 trn 0 nil)
209   (list 't_U               "a U"           pclass-wall      s_U                 trn 0 nil)
210   (list 't_V               "a V"           pclass-wall      s_V                 trn 0 nil)
211   (list 't_W               "a W"           pclass-wall      s_W                 trn 0 nil)
212   (list 't_X               "an X"          pclass-wall      s_X                 trn 0 nil)
213   (list 't_Y               "a Y"           pclass-wall      s_Y                 trn 0 nil)
214   (list 't_Z               "a Z"           pclass-wall      s_Z                 trn 0 nil)
215   (list 't_rune_A          "a runic A"        pclass-wall      s_rune_A      trn 0 nil)
216   (list 't_rune_B          "a runic B"        pclass-wall      s_rune_B      trn 0 nil)
217   (list 't_rune_C          "a runic C"        pclass-wall      s_rune_C      trn 0 nil)
218   (list 't_rune_D          "a runic D"        pclass-wall      s_rune_D      trn 0 nil)
219   (list 't_rune_E          "a runic E"        pclass-wall      s_rune_E      trn 0 nil)
220   (list 't_rune_F          "a runic F"        pclass-wall      s_rune_F      trn 0 nil)
221   (list 't_rune_G          "a runic G"        pclass-wall      s_rune_G      trn 0 nil)
222   (list 't_rune_H          "a runic H"        pclass-wall      s_rune_H      trn 0 nil)
223   (list 't_rune_I          "a runic I"        pclass-wall      s_rune_I      trn 0 nil)
224   (list 't_rune_J          "a runic J"        pclass-wall      s_rune_J      trn 0 nil)
225   (list 't_rune_K          "a runic K"        pclass-wall      s_rune_K      trn 0 nil)
226   (list 't_rune_L          "a runic L"        pclass-wall      s_rune_L      trn 0 nil)
227   (list 't_rune_M          "a runic M"        pclass-wall      s_rune_M      trn 0 nil)
228   (list 't_rune_N          "a runic N"        pclass-wall      s_rune_N      trn 0 nil)
229   (list 't_rune_O          "a runic O"        pclass-wall      s_rune_O      trn 0 nil)
230   (list 't_rune_P          "a runic P"        pclass-wall      s_rune_P      trn 0 nil)
231   (list 't_rune_Q          "a runic Q"        pclass-wall      s_rune_Q      trn 0 nil)
232   (list 't_rune_R          "a runic R"        pclass-wall      s_rune_R      trn 0 nil)
233   (list 't_rune_S          "a runic S"        pclass-wall      s_rune_S      trn 0 nil)
234   (list 't_rune_T          "a runic T"        pclass-wall      s_rune_T      trn 0 nil)
235   (list 't_rune_U          "a runic U"        pclass-wall      s_rune_U      trn 0 nil)
236   (list 't_rune_V          "a runic V"        pclass-wall      s_rune_V      trn 0 nil)
237   (list 't_rune_W          "a runic W"        pclass-wall      s_rune_W      trn 0 nil)
238   (list 't_rune_X          "a runic X"        pclass-wall      s_rune_X      trn 0 nil)
239   (list 't_rune_Y          "a runic Y"        pclass-wall      s_rune_Y      trn 0 nil)
240   (list 't_rune_Z          "a runic Z"        pclass-wall      s_rune_Z      trn 0 nil)
241   (list 't_rune_TH         "a runic TH"        pclass-wall      s_rune_TH     trn 0 nil)
242   (list 't_rune_EE         "a runic EE"        pclass-wall      s_rune_EE     trn 0 nil)
243   (list 't_rune_NG         "a runic NG"        pclass-wall      s_rune_NG     trn 0 nil)
244   (list 't_rune_EA         "a runic EA"        pclass-wall      s_rune_EA     trn 0 nil)
245   (list 't_rune_ST         "a runic ST"        pclass-wall      s_rune_ST     trn 0 nil)
246   (list 't_rune_DOT        "a runic ."        pclass-wall      s_rune_DOTSEP trn 0 nil)
247   (list 't_equip_sign    "an equipment shop sign" pclass-wall s_torch_sign      opq 0 nil)
248   (list 't_weapon_sign   "an arms shop sign" pclass-wall s_shield_sign          opq 0 nil)
249   (list 't_healer_sign   "a hospital sign" pclass-wall s_ankh_sign              opq 0 nil)
250   (list 't_tavern_sign   "a tavern sign" pclass-wall s_beer_sign                opq 0 nil)
251   (list 't_inn_sign      "an inn sign" pclass-wall s_bed_sign                   opq 0 nil)
252   (list 't_alchemy_sign      "an alchemy sign" pclass-wall s_potion_sign        opq 0 nil)
253   (list 't_magic_sign      "a reagent shop sign" pclass-wall s_mushroom_sign    opq 0 nil)
254   (list 't_str_sign      "a sign of strength" pclass-wall s_axe_sign            trn 1024 nil)
255   (list 't_dex_sign      "a sign of dexterity" pclass-wall s_key_sign           trn 1024 nil)
256   (list 't_wis_sign      "a sign of wisdom" pclass-wall s_book_sign             trn 1024 nil)
257   (list 't_nat_rock      "natural stone wall" pclass-wall s_nat_rock            opq 0 nil)
258   (list 't_fake_wall_nrock  "natural stone wall" pclass-forest  s_secret_nrock   opq 0 nil)
259   ))
260
261(map (lambda (terrain) (apply kern-mk-terrain terrain)) terrains)
262
263;;----------------------------------------------------------------------------
264;; Make some blended shore terrain types
265
266(define (mk-shore-terrain tag . sprites)
267  (kern-mk-terrain tag "shallow water" pclass-shoals
268                   (mk-composite-sprite (cons s_shoals sprites))
269                   trn 0 nil))
270
271(mk-shore-terrain 't_shore_n  s_grass_n )
272(mk-shore-terrain 't_shore_w  s_grass_w )
273(mk-shore-terrain 't_shore_nw s_grass_nw)
274(mk-shore-terrain 't_shore_e  s_grass_e )
275(mk-shore-terrain 't_shore_ne s_grass_ne)
276(mk-shore-terrain 't_shore_we s_grass_e s_grass_w)
277(mk-shore-terrain 't_shore_nwe s_grass_ne s_grass_nw)
278(mk-shore-terrain 't_shore_s  s_grass_s )
279(mk-shore-terrain 't_shore_ns s_grass_s s_grass_n)
280(mk-shore-terrain 't_shore_ws s_grass_sw)
281(mk-shore-terrain 't_shore_nws s_grass_sw s_grass_nw)
282(mk-shore-terrain 't_shore_es s_grass_se)
283(mk-shore-terrain 't_shore_nes s_grass_se s_grass_ne)
284(mk-shore-terrain 't_shore_wes s_grass_se s_grass_sw)
285(mk-shore-terrain 't_shore_c s_grass_se s_grass_sw s_grass_ne s_grass_nw)
286
287(define tset_shore
288(list
289   t_shoals    ;; 0: none
290   t_shore_n   ;; 1: north
291   t_shore_w   ;; 2: west
292   t_shore_nw  ;; 3: north west
293   t_shore_e   ;; 4: east
294   t_shore_ne  ;; 5: east north
295   t_shore_we  ;; 6: east west
296   t_shore_nwe ;; 7: east west north
297   t_shore_s   ;; 8: south
298   t_shore_ns  ;; 9: south north
299   t_shore_ws  ;; 10: south west
300   t_shore_nws ;; 11: south west north
301   t_shore_es  ;; 12: south east
302   t_shore_nes ;; 13: south east north
303   t_shore_wes ;; 14: south east west
304   t_shore_c ;; 15: south east west north
305   ))
306
307(define tset_water
308(append tset_shore
309          (list t_shoals
310                t_shallow
311                t_deep
312                t_sunlit_deep
313                t_bridge_WE
314                t_bridge_NS)))
315
316;;----------------------------------------------------------------------------
317;; bits of ship
318
319;; regular terrains
320
321(map
322	(lambda (terrainentry)
323		(apply
324			(lambda (tag name pclass opacity sprite)
325				(kern-mk-terrain tag name pclass sprite
326					opacity 0 nil)
327			)
328			terrainentry
329		)
330	)
331	(list
332
333(list 't_bulwark_x_ns "bulwark" pclass-wall opq s_bulwark_ns)
334(list 't_bulwark_x_ew "bulwark" pclass-wall opq s_bulwark_ew)
335
336(list 't_bulwark_v_ne "bulwark" pclass-boulder trn s_bulwark_sw)
337(list 't_bulwark_v_nw "bulwark" pclass-boulder trn s_bulwark_se)
338(list 't_bulwark_v_se "bulwark" pclass-boulder trn s_bulwark_nw)
339(list 't_bulwark_v_sw "bulwark" pclass-boulder trn s_bulwark_ne)
340
341(list 't_bulwark_x_ne "bulwark" pclass-wall opq s_bulwark_sw)
342(list 't_bulwark_x_nw "bulwark" pclass-wall opq s_bulwark_se)
343(list 't_bulwark_x_se "bulwark" pclass-wall opq s_bulwark_nw)
344(list 't_bulwark_x_sw "bulwark" pclass-wall opq s_bulwark_ne)
345
346(list 't_stair_un "stairs" pclass-grass trn s_stair_n)
347(list 't_stair_uw "stairs" pclass-grass trn s_stair_w)
348(list 't_stair_ue "stairs" pclass-grass trn s_stair_e)
349(list 't_stair_us "stairs" pclass-grass trn s_stair_s)
350
351(list 't_tank_l "metal tank" pclass-mountains opq s_tank_l)
352(list 't_tank_d "metal tank" pclass-mountains opq s_tank_d)
353(list 't_tank_nw "metal tank" pclass-mountains opq s_tank_nw)
354(list 't_tank_ne "metal tank" pclass-mountains opq s_tank_ne)
355(list 't_tank_sw "metal tank" pclass-mountains opq s_tank_sw)
356(list 't_tank_se "metal tank" pclass-mountains opq s_tank_se)
357
358	)
359)
360
361
362;; composite terrains
363(map
364	(lambda (terrainentry)
365		(apply
366			(lambda (tag name pclass opacity sprites)
367				(kern-mk-terrain tag name pclass (mk-composite-sprite sprites)
368					opacity 0 nil)
369				)
370			terrainentry
371		)
372	)
373	(list
374
375(list 't_rail_ew "railing" pclass-boulder trn (list s_deck s_bulwark_ew))
376(list 't_rail_ns "railing" pclass-boulder trn (list s_deck s_bulwark_ns))
377
378(list 't_bulwark_n "bulwark" pclass-boulder trn (list s_shallow s_deck_s s_bulwark_ew))
379(list 't_bulwark_w "bulwark" pclass-boulder trn (list s_shallow s_deck_e s_bulwark_ns))
380(list 't_bulwark_e "bulwark" pclass-boulder trn (list s_shallow s_deck_w s_bulwark_ns))
381(list 't_bulwark_s "bulwark" pclass-boulder trn (list s_shallow s_deck_n s_bulwark_ew))
382
383(list 't_bulwark_v_n "bulwark" pclass-boulder trn (list s_deck_s s_bulwark_ew))
384(list 't_bulwark_v_w "bulwark" pclass-boulder trn (list s_deck_e s_bulwark_ns))
385(list 't_bulwark_v_e "bulwark" pclass-boulder trn (list s_deck_w s_bulwark_ns))
386(list 't_bulwark_v_s "bulwark" pclass-boulder trn (list s_deck_n s_bulwark_ew))
387
388(list 't_bulwark_w_ne "bulwark" pclass-boulder trn (list s_shallow s_bulwark_sw))
389(list 't_bulwark_w_nw "bulwark" pclass-boulder trn (list s_shallow s_bulwark_se))
390(list 't_bulwark_w_se "bulwark" pclass-boulder trn (list s_shallow s_bulwark_nw))
391(list 't_bulwark_w_sw "bulwark" pclass-boulder trn (list s_shallow s_bulwark_ne))
392
393(list 't_bulwark_d_ne "bulwark" pclass-boulder trn (list s_deck s_bulwark_ne))
394(list 't_bulwark_d_nw "bulwark" pclass-boulder trn (list s_deck s_bulwark_nw))
395(list 't_bulwark_d_se "bulwark" pclass-boulder trn (list s_deck s_bulwark_se))
396(list 't_bulwark_d_sw "bulwark" pclass-boulder trn (list s_deck s_bulwark_sw))
397
398(list 't_tank_d_nw "metal tank" pclass-mountains opq (list s_deck s_tank_nw))
399(list 't_tank_d_ne "metal tank" pclass-mountains opq (list s_deck s_tank_ne))
400(list 't_tank_d_sw "metal tank" pclass-mountains opq (list s_deck s_tank_sw))
401(list 't_tank_d_se "metal tank" pclass-mountains opq (list s_deck s_tank_se))
402
403	)
404)
405
406;;----------------------------------------------------------------------------
407
408(define bad-terrain-list
409  (list t_bog
410        t_lava
411        t_deep_lava
412        t_fire_terrain
413        t_fireplace
414        t_inv_wall
415        t_wall_torch
416        ))
417
418(define inflammable-terrain-list
419  (list t_bog
420        t_deep
421        t_shallow
422        t_shoals
423        t_sunlit_deep
424        t_stars
425		t_void
426		t_chasm
427        ))
428
429(load "blendterrains.scm")
430
431(define (is-bad-terrain? kter)
432  (in-list? kter bad-terrain-list))
433
434(define (is-inflammable-terrain? kter)
435  (in-list? kter inflammable-terrain-list))
436
437(define (is-deck? kter)
438	(in-list? kter
439		(list
440			t_deck
441			t_ship_hull
442			t_ship_hull2
443			t_mast
444			t_ships_wheel
445
446			t_bulwark_v_ne
447			t_bulwark_v_nw
448			t_bulwark_v_se
449			t_bulwark_v_sw
450
451			t_bulwark_n
452			t_bulwark_w
453			t_bulwark_e
454			t_bulwark_s
455
456			t_bulwark_w_ne
457			t_bulwark_w_nw
458			t_bulwark_w_se
459			t_bulwark_w_sw
460
461			t_bulwark_d_ne
462			t_bulwark_d_nw
463			t_bulwark_d_se
464			t_bulwark_d_sw
465
466			t_bulwark_v_n
467			t_bulwark_v_w
468			t_bulwark_v_e
469			t_bulwark_v_s
470	)))
471