Add support for group placements

This commit is contained in:
2021-05-14 19:46:52 +02:00
parent 0b26761be5
commit 2b09bf2072
18 changed files with 307 additions and 266 deletions
+13 -18
View File
@@ -1,4 +1,4 @@
{-
{- |
Rooms that contain valuable items, typically protected in some manner.
Typically dead ends.
-}
@@ -13,13 +13,10 @@ import Dodge.LevelGen.Data
import Data.List
import Control.Monad.State
import Control.Lens
import System.Random
{-
A triangular room with loot at the top (with 'PutID' 2),
import System.Random
{- | A triangular room with loot at the top (with 'PutID' 2),
creatures in the bottom two corners (with 'PutID' 0),
and (single) entrance bottom middle.
-}
and (single) entrance bottom middle. -}
triLootRoom
:: Float -- Width
-> Float -- Height
@@ -31,13 +28,13 @@ triLootRoom w h = pure $ Room
, _rmLinks = [((0,-80),pi)]
, _rmPath = doublePair ((0,-80),(0,h/2))
, _rmPS =
[PS (15-w,15) 0 $ PutID 0
,PS (w-15,15) pi $ PutID 0
,PS (0,h-35) 0 $ PutID 2
,PS (-5,h-10) 0 putLamp
,PS (5,h-10) 0 putLamp
,PS (0,h-15) 0 putLamp
,PS (0,-60) 0 putLamp
[sPS (15-w, 15) 0 $ PutID 0
,sPS (w-15, 15) pi $ PutID 0
,sPS ( 0,h-35) 0 $ PutID 2
,sPS ( -5,h-10) 0 putLamp
,sPS ( 5,h-10) 0 putLamp
,sPS ( 0,h-15) 0 putLamp
,sPS ( 0, -60) 0 putLamp
]
, _rmBound = [tri , base]
}
@@ -50,10 +47,8 @@ triLootRoom w h = pure $ Room
, ( 20, h)
, (-20, h)
]
base = rectNSWE 20 (-80) (-20) 20
{- Create a random room with one entrance containing given creatures and items.
-}
base = rectNSWE 20 (-80) (-20) 20
{- | Create a random room with one entrance containing given creatures and items. -}
lootRoom :: RandomGen g => [Creature] -> [Item] -> State g Room
lootRoom crs itms = do
let w = 300