Move towards better annotations when generating layouts
This commit is contained in:
+12
-3
@@ -1,3 +1,4 @@
|
||||
{-# LANGUAGE TupleSections #-}
|
||||
{- | Annotating tree structures with desired properties for rooms. -}
|
||||
module Dodge.Annotation
|
||||
( module Dodge.Annotation.Data
|
||||
@@ -7,6 +8,7 @@ import Dodge.RandomHelp
|
||||
import Dodge.Tree
|
||||
import Dodge.Room
|
||||
import Dodge.Annotation.Data
|
||||
import LensHelp
|
||||
|
||||
import Data.Tree
|
||||
import Control.Monad.State
|
||||
@@ -52,11 +54,18 @@ roomThenCorridor theRoom = fmap
|
||||
(shuffleLinks corridor)
|
||||
|
||||
{- | Create a random room tree structure from a list of annotations. -}
|
||||
anoToRoomTree :: [Annotation] -> State StdGen (SubCompTree Room)
|
||||
anoToRoomTree :: [Annotation] -> State StdGen (SubCompTree Room,String)
|
||||
anoToRoomTree anos = case anos of
|
||||
[AnoApplyInt i f] -> f i
|
||||
[AnoApplyInt' i f str] -> f i <&> (,str)
|
||||
_ -> fmap (,"") $ anoToRoomTree' anos
|
||||
|
||||
{- | Create a random room tree structure from a list of annotations. -}
|
||||
anoToRoomTree' :: [Annotation] -> State StdGen (SubCompTree Room)
|
||||
anoToRoomTree' anos = case anos of
|
||||
-- [AnoApplyInt i f] -> f i
|
||||
[ChainAnos ass] -> do
|
||||
rms <- mapM anoToRoomTree ass
|
||||
rms <- mapM anoToRoomTree' ass
|
||||
return $ chainUses rms
|
||||
[PassthroughLockKeyLists i ls ks] -> do
|
||||
(functionlockroom,randomitemidentity) <- takeOne ls
|
||||
@@ -66,7 +75,7 @@ anoToRoomTree anos = case anos of
|
||||
return $ overwriteLabel 0 UseNone lr [keyroom]
|
||||
[OrAno as] -> do
|
||||
a <- takeOne as
|
||||
anoToRoomTree a
|
||||
anoToRoomTree' a
|
||||
[Corridor] -> pure . UseAll <$> shuffleLinks corridor
|
||||
(SpecificRoom rt:_) -> rt
|
||||
(BossAno cr : _) -> do
|
||||
|
||||
Reference in New Issue
Block a user