Implement first weapon into tree structure
This commit is contained in:
@@ -18,6 +18,8 @@ data Annotation
|
||||
= Lock Int
|
||||
| Key Int
|
||||
| Corridor
|
||||
| FirstWeapon
|
||||
| StartRoom
|
||||
|
||||
addLock :: RandomGen g => Int -> Tree [Annotation] -> State g (Tree [Annotation])
|
||||
addLock i t = do
|
||||
@@ -34,9 +36,20 @@ randomPadCorridors (Node x xs) = do
|
||||
xs' <- mapM randomPadCorridors xs
|
||||
return $ treeTrunk (replicate n [Corridor]) (Node x xs')
|
||||
|
||||
annoToRoomTree :: RandomGen g => [Annotation] -> State g (Tree (Either Room Room))
|
||||
annoToRoomTree [Corridor] = fmap (pure . Right) $ randomiseOutLinks corridor
|
||||
annoToRoomTree [FirstWeapon] = weaponRoom
|
||||
annoToRoomTree _ = do
|
||||
w <- state $ randomR (100,400)
|
||||
h <- state $ randomR (200,400)
|
||||
fmap (pure . Right) $ return (roomRectAutoLinks w h) >>= randomiseOutLinks
|
||||
|
||||
annoToRoom :: RandomGen g => [Annotation] -> State g Room
|
||||
annoToRoom [Corridor] = takeOne [corridor]
|
||||
annoToRoom _ = randLinks $ roomRectAutoLinks 200 200
|
||||
annoToRoom [Corridor] = randomiseOutLinks corridor
|
||||
annoToRoom _ = do
|
||||
w <- state $ randomR (100,400)
|
||||
h <- state $ randomR (200,400)
|
||||
return (roomRectAutoLinks w h) >>= randomiseOutLinks
|
||||
|
||||
annoToRoom' :: [Annotation] -> Room
|
||||
annoToRoom' [Corridor] = corridor
|
||||
|
||||
Reference in New Issue
Block a user