Commit mid big tree composing change

This commit is contained in:
2022-06-09 21:25:22 +01:00
parent 8fb80f9691
commit 3edc7a0a58
20 changed files with 263 additions and 248 deletions
+9 -9
View File
@@ -35,8 +35,8 @@ padSucWithDoors (Node x xs) = Node x (map (padWithAno [SpecificRoom thetree]) xs
thetree = do
thecor <- shuffleLinks corridor
takeOne
[ (return (UseAll door),TreeSubLabelling "door" Nothing)
, (treeFromPost [PassDown door, PassDown thecor] (UseAll door)
[ (return (useAll door),TreeSubLabelling "door" Nothing)
, (treeFromPost [ door, thecor] (useAll door)
,TreeSubLabelling "twoDoors" Nothing)
]
@@ -47,9 +47,9 @@ randomPadCorridors (Node x xs) = do
xs' <- mapM randomPadCorridors xs
return $ treeFromTrunk (replicate n [Corridor]) (Node x xs')
{- | Add a corridor to a random out-link of a room. -}
roomThenCorridor :: RandomGen g => Room -> State g (SubCompTree Room)
roomThenCorridor :: RandomGen g => Room -> State g (Tree Room)
roomThenCorridor theRoom = fmap
(\r -> Node (PassDown theRoom) [(pure . UseAll) r])
(\r -> Node ( theRoom) [(pure . useAll) r])
(shuffleLinks corridor)
{- | Create a random room tree structure from a list of annotations. -}
@@ -72,7 +72,7 @@ anoToRoomTree anos = case anos of
_ -> (,TreeSubLabelling "no label" Nothing) <$> anoToRoomTree' anos
{- | Create a random room tree structure from a list of annotations. -}
anoToRoomTree' :: [Annotation] -> State StdGen (SubCompTree Room)
anoToRoomTree' :: [Annotation] -> State StdGen (Tree Room)
anoToRoomTree' anos = case anos of
[ChainAnos ass] -> do
rms <- mapM anoToRoomTree' ass
@@ -80,12 +80,12 @@ anoToRoomTree' anos = case anos of
[OrAno as] -> do
a <- takeOne as
anoToRoomTree' a
[Corridor] -> pure . UseAll <$> shuffleLinks corridor
[Corridor] -> pure . useAll <$> shuffleLinks corridor
(BossAno cr : _) -> do
br <- bossRoom cr
branchRectWith . pure . fmap PassDown $ treeFromPost [corridor,corridor] br
(TreasureAno crs loot : _) -> branchRectWith . fmap (pure . PassDown) $ lootRoom crs loot
branchRectWith . pure . fmap $ treeFromPost [corridor,corridor] br
(TreasureAno crs loot : _) -> branchRectWith . fmap (pure . ) $ lootRoom crs loot
_ -> do
w <- state $ randomR (100,400)
h <- state $ randomR (200,400)
fmap (pure . UseAll) . shuffleLinks $ roomRectAutoLinks w h
fmap (pure . useAll) . shuffleLinks $ roomRectAutoLinks w h