Add or annotations
This commit is contained in:
+1
-1
@@ -33,7 +33,7 @@ roomTreex = do
|
|||||||
struct' <- aTreeStrut
|
struct' <- aTreeStrut
|
||||||
let struct = Node [EndRoom] []
|
let struct = Node [EndRoom] []
|
||||||
let t' = padCorridors struct
|
let t' = padCorridors struct
|
||||||
t = treeTrunk [[StartRoom],[Corridor],[FirstWeapon],[Corridor]] t'
|
t = treeTrunk [[StartRoom],[OrAno [[DoorAno],[Corridor]] ],[FirstWeapon],[Corridor]] t'
|
||||||
fmap (shiftExpandTree . expandTreeBy id) $ mapM annoToRoomTree t
|
fmap (shiftExpandTree . expandTreeBy id) $ mapM annoToRoomTree t
|
||||||
|
|
||||||
levx :: RandomGen g => State g [Room]
|
levx :: RandomGen g => State g [Room]
|
||||||
|
|||||||
@@ -21,9 +21,11 @@ data Annotation
|
|||||||
= Lock Int
|
= Lock Int
|
||||||
| Key Int
|
| Key Int
|
||||||
| Corridor
|
| Corridor
|
||||||
|
| DoorAno
|
||||||
| FirstWeapon
|
| FirstWeapon
|
||||||
| StartRoom
|
| StartRoom
|
||||||
| EndRoom
|
| EndRoom
|
||||||
|
| OrAno [[Annotation]]
|
||||||
|
|
||||||
addLock :: RandomGen g => Int -> Tree [Annotation] -> State g (Tree [Annotation])
|
addLock :: RandomGen g => Int -> Tree [Annotation] -> State g (Tree [Annotation])
|
||||||
addLock i t = do
|
addLock i t = do
|
||||||
@@ -41,7 +43,11 @@ randomPadCorridors (Node x xs) = do
|
|||||||
return $ treeTrunk (replicate n [Corridor]) (Node x xs')
|
return $ treeTrunk (replicate n [Corridor]) (Node x xs')
|
||||||
|
|
||||||
annoToRoomTree :: RandomGen g => [Annotation] -> State g (Tree (Either Room Room))
|
annoToRoomTree :: RandomGen g => [Annotation] -> State g (Tree (Either Room Room))
|
||||||
|
annoToRoomTree [OrAno as] = do
|
||||||
|
a <- takeOne as
|
||||||
|
annoToRoomTree a
|
||||||
annoToRoomTree [Corridor] = fmap (pure . Right) $ randomiseOutLinks corridor
|
annoToRoomTree [Corridor] = fmap (pure . Right) $ randomiseOutLinks corridor
|
||||||
|
annoToRoomTree [DoorAno] = fmap (\r -> Node (Left door) [(pure . Right) r]) (randomiseOutLinks corridor)
|
||||||
annoToRoomTree [FirstWeapon] = do
|
annoToRoomTree [FirstWeapon] = do
|
||||||
branchWP <- branchRectWith weaponRoom
|
branchWP <- branchRectWith weaponRoom
|
||||||
blockedC <- blockedCorridor
|
blockedC <- blockedCorridor
|
||||||
|
|||||||
Reference in New Issue
Block a user