Simplify item placement during generation

This commit is contained in:
2021-04-25 13:21:24 +02:00
parent 30736997c3
commit 17986651c5
13 changed files with 95 additions and 95 deletions
+36
View File
@@ -1,6 +1,42 @@
{-
Rooms that contain valuable items, typically protected in some manner.
Typically dead ends.
-}
module Dodge.Room.Treasure
where
import Geometry
import Dodge.Room.Data
import Dodge.LevelGen.Data
import Control.Monad.State
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.
-}
triLootRoom
:: Float -- Width
-> Float -- Height
-> State g Room
triLootRoom w h = pure $ Room
{ _rmPolys = [poly]
, _rmLinks = [((0,10),pi)]
, _rmPath = doublePair ((0,10),(0,h/2))
, _rmPS =
[PS (15-w,15) 0 $ PutID 0
,PS (w-15,15) 0 $ PutID 0
,PS (0,h-15) 0 $ PutID 2
]
, _rmBound = poly
}
where
poly =
[ ( -w,30)
, ( -w, 0)
, ( w, 0)
, ( w,30)
, ( 20, h)
, (-20, h)
]