about summary refs log tree commit diff
path: root/src/Xanthous/Generators
diff options
context:
space:
mode:
authorGriffin Smith <root@gws.fyi>2020-01-05T17·55-0500
committerGriffin Smith <root@gws.fyi>2020-01-05T17·55-0500
commit0f79a06733c30ddca4bc0746ddc99e1626775fff (patch)
tree7f9bffb1740a531ac11c3130020bb86723bde5a8 /src/Xanthous/Generators
parent6b0bab0e85266ce66836c4584f8cc83b307a3af5 (diff)
Add staircases, and moving between levels
Currently we just pick randomly between the cave and dungeon level
generators. There's a lot of bugs here, but it's *sorta* working, so I'm
leaving it as is.
Diffstat (limited to 'src/Xanthous/Generators')
-rw-r--r--src/Xanthous/Generators/LevelContents.hs8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/Xanthous/Generators/LevelContents.hs b/src/Xanthous/Generators/LevelContents.hs
index 96d64a693774..748afa96da72 100644
--- a/src/Xanthous/Generators/LevelContents.hs
+++ b/src/Xanthous/Generators/LevelContents.hs
@@ -4,6 +4,7 @@ module Xanthous.Generators.LevelContents
   , randomItems
   , randomCreatures
   , randomDoors
+  , placeDownStaircase
   , tutorialMessage
   ) where
 --------------------------------------------------------------------------------
@@ -23,7 +24,7 @@ import           Xanthous.Entities.Item (Item)
 import qualified Xanthous.Entities.Creature as Creature
 import           Xanthous.Entities.Creature (Creature)
 import           Xanthous.Entities.Environment
-                 (GroundMessage(..), Door(..), unlockedDoor)
+                 (GroundMessage(..), Door(..), unlockedDoor, Staircase(..))
 import           Xanthous.Messages (message_)
 import           Xanthous.Util.Graphics (circle)
 --------------------------------------------------------------------------------
@@ -34,6 +35,11 @@ chooseCharacterPosition = randomPosition
 randomItems :: MonadRandom m => Cells -> m (EntityMap Item)
 randomItems = randomEntities Item.newWithType (0.0004, 0.001)
 
+placeDownStaircase :: MonadRandom m => Cells -> m (EntityMap Staircase)
+placeDownStaircase cells = do
+  pos <- randomPosition cells
+  pure $ _EntityMap # [(pos, DownStaircase)]
+
 randomDoors :: MonadRandom m => Cells -> m (EntityMap Door)
 randomDoors cells = do
   doorRatio <- getRandomR subsetRange