diff options
author | zelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573> | 2007-10-04 05:05:42 +0000 |
---|---|---|
committer | zelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573> | 2007-10-04 05:05:42 +0000 |
commit | 13f47218bbda7251a2521eda0c4a858ea333bbee (patch) | |
tree | fef4d2076355461b7c64dedd1676a90351cbc23d /crawl-ref/source/dat/bazaar.des | |
parent | 92c238f2c7ed33f3ebffc22fe08b1c51f98814b1 (diff) | |
download | crawl-ref-13f47218bbda7251a2521eda0c4a858ea333bbee.tar.gz crawl-ref-13f47218bbda7251a2521eda0c4a858ea333bbee.zip |
Moved all of the bazaar specific logic/code to dat/bazaar (or turned the
code into Lua utility functions which can be reused by things other than
bazaars). Related changes:
* Portal vault entrances now work if they have destinations ("dst" property)
besides "bazaar" (though it still causes an assert if no matchng
maps for the destination can be found).
* The floor and rock colour for a level are generated once and then stored
in the save file, rather than being constantly regenerated (which means
that bazaar floor colours are now truly random, rather than being tied
to the depth of the bazaar entrance).
* The floor and rock colour for a portal vault (or for any level containing
any vault) can be set with ROCKCOL and FLOORCOL (which currently only
accepts a single colour, unlike COLOUR); there are also Lua functions for
querying and setting the colours.
* Each portal vault level_type_name can have an associated Lua callback
which is called when level generation is complete; it can be used for
things like stair fixup.
I also moved the Halls of Zot rock/floor colour special casing to the
dat/zot.des file, since it was easy once ROCKCOL and FLOORCOL had been
implemented.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@2314 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/dat/bazaar.des')
-rw-r--r-- | crawl-ref/source/dat/bazaar.des | 65 |
1 files changed, 52 insertions, 13 deletions
diff --git a/crawl-ref/source/dat/bazaar.des b/crawl-ref/source/dat/bazaar.des index c833208cdf..4f0fa92174 100644 --- a/crawl-ref/source/dat/bazaar.des +++ b/crawl-ref/source/dat/bazaar.des @@ -28,6 +28,32 @@ function bazaar_message(e) e.welcome("You enter an inter-dimensional bazaar!") end +function random_bazaar_colour() + local colours = {"blue", "red", "lightblue", "magenta", "green"} + + crawl.mpr("#colours = " .. #colours) + + local ret = colours[crawl.random2(#colours) + 1] + + crawl.mpr("ret = " .. ret) + + return ret +end + +function fixup_bazaar() + dgn.fixup_stairs("stone_arch", "exit_portal_vault") + dgn.floor_halo("enter_shop", "yellow") + + if (dgn.get_floor_colour() == "black") then + dgn.change_floor_colour(random_bazaar_colour()) + end + + if (dgn.get_rock_colour() == "black") then + dgn.change_rock_colour("yellow") + end +end + +dgn.set_lt_callback("bazaar", "fixup_bazaar") }} default-depth: D:10-27 @@ -169,7 +195,10 @@ ENDMAP # upstair, which will be converted into a stone arch (and on which the player # will be placed when entering the bazaar). If there's no upstair, the player # will arrive on a random square. - +# +# You can force a particular colour for the rock walls or floor using +# ROCKCOL and FLOORCOL directives. +# NAME: bazaar_general_marketplace TAGS: bazaar allow_dup FLAGS: no_rotate @@ -248,10 +277,12 @@ ITEM: any jewellery / good_item any jewellery ITEM: any book / good_item any book, any staff SUBST: d=.d, e=.e, f=.f # special cases for blue/red floor -: if you.bazaar_floor() == "red" then +: local colour = random_bazaar_colour() +: _G.floor_colour(colour) +: if colour == "red" then SUBST: l = w : else -: if you.bazaar_floor() == "blue" then +: if colour == "blue" then SUBST: w = l : end : end @@ -279,10 +310,12 @@ KFEAT: B = distillery shop ITEM: any wand, ring of levitation SHUFFLE: leAB/wdBA # special cases for blue/red floor -: if you.bazaar_floor() == "red" then +: local colour = random_bazaar_colour() +: _G.floor_colour(colour) +: if colour == "red" then SUBST: l = w : else -: if you.bazaar_floor() == "blue" then +: if colour == "blue" then SUBST: w = l : end : end @@ -332,11 +365,13 @@ KFEAT: R = stone_arch KFEAT: S = stone_arch SHUFFLE: lw # special cases for blue/red floor -: if you.bazaar_floor() == "red" then -SUBST: l : wWx +: local colour = random_bazaar_colour() +: _G.floor_colour(colour) +: if colour == "red" then +SUBST: l = w : else -: if you.bazaar_floor() == "blue" then -SUBST: w : Wx +: if colour == "blue" then +SUBST: w = l : end : end # @@ -654,8 +689,10 @@ KFEAT: D = antique weapon shop KFEAT: E = antique armour shop KFEAT: F = scroll shop / distillery shop : bazaar_message(_G) -# special case for floor -: if you.bazaar_floor() == "blue" then +# special cases for blue floor +: local colour = random_bazaar_colour() +: _G.floor_colour(colour) +: if colour == "blue" then SUBST: w = W : end # @@ -778,10 +815,12 @@ SHUFFLE: zZ SUBST: z = ., Z = w SHUFFLE: wl, ABCD # special cases for blue/red floor -: if you.bazaar_floor() == "red" then +: local colour = random_bazaar_colour() +: _G.floor_colour(colour) +: if colour == "red" then SUBST: l = w : else -: if you.bazaar_floor() == "blue" then +: if colour == "blue" then SUBST: w = l : end : end |