Redo tree composition
This commit is contained in:
+12
-14
@@ -4,6 +4,7 @@ module Dodge.Annotation
|
||||
( module Dodge.Annotation.Data
|
||||
, module Dodge.Annotation
|
||||
) where
|
||||
import Dodge.UseAll
|
||||
import RandomHelp
|
||||
import Dodge.Tree
|
||||
import Dodge.Room
|
||||
@@ -35,9 +36,10 @@ padSucWithDoors (Node x xs) = Node x (map (padWithAno [SpecificRoom thetree]) xs
|
||||
thetree = do
|
||||
thecor <- shuffleLinks corridor
|
||||
takeOne
|
||||
[ (return (useAll door),TreeSubLabelling "door" Nothing)
|
||||
, (treeFromPost [ door, thecor] (useAll door)
|
||||
,TreeSubLabelling "twoDoors" Nothing)
|
||||
[ (toOnward "door", return (useAll door))
|
||||
, (toOnward "twoDoors"
|
||||
,treeFromPost [ door, thecor] (useAll door)
|
||||
)
|
||||
]
|
||||
|
||||
{- Add one to three corridors between each parent-child link of a tree of annotations. -}
|
||||
@@ -62,29 +64,25 @@ anoToRoomTree anos = case anos of
|
||||
(functionlockroom,randomitemidentity) <- takeOne ls
|
||||
lr' <- functionlockroom i
|
||||
ii <- randomitemidentity
|
||||
let lr = fst lr'
|
||||
let lr = snd lr'
|
||||
keyroom' <- fromJust $ lookup ii ks
|
||||
let keyroom = fst keyroom'
|
||||
return (overwriteLabel 0 UseNone lr [keyroom]
|
||||
,TreeSubLabelling ("PassthroughLockKeyLists-"++show ii)
|
||||
(Just $ treeFromPost [snd lr'] (snd keyroom'))
|
||||
let keyroom = snd keyroom'
|
||||
return (toOnward ("PassthroughLockKeyLists-"++show ii)
|
||||
, overwriteLabel 0 lr [keyroom]
|
||||
)
|
||||
_ -> (,TreeSubLabelling "no label" Nothing) <$> anoToRoomTree' anos
|
||||
_ -> (toOnward "no label" ,) <$> anoToRoomTree' anos
|
||||
|
||||
{- | Create a random room tree structure from a list of annotations. -}
|
||||
anoToRoomTree' :: [Annotation] -> State StdGen (Tree Room)
|
||||
anoToRoomTree' anos = case anos of
|
||||
[ChainAnos ass] -> do
|
||||
rms <- mapM anoToRoomTree' ass
|
||||
return $ chainUses rms
|
||||
[OrAno as] -> do
|
||||
a <- takeOne as
|
||||
anoToRoomTree' a
|
||||
[Corridor] -> pure . useAll <$> shuffleLinks corridor
|
||||
(BossAno cr : _) -> do
|
||||
br <- bossRoom cr
|
||||
branchRectWith . pure . fmap $ treeFromPost [corridor,corridor] br
|
||||
(TreasureAno crs loot : _) -> branchRectWith . fmap (pure . ) $ lootRoom crs loot
|
||||
branchRectWith . pure $ treeFromPost [corridor,corridor] br
|
||||
(TreasureAno crs loot : _) -> branchRectWith . fmap pure $ lootRoom crs loot
|
||||
_ -> do
|
||||
w <- state $ randomR (100,400)
|
||||
h <- state $ randomR (200,400)
|
||||
|
||||
Reference in New Issue
Block a user