Implement first weapon into tree structure
This commit is contained in:
+21
-18
@@ -169,7 +169,7 @@ manyDoors i = treePost (replicate i (Left door)) $ Right door
|
||||
|
||||
glassLesson :: RandomGen g => State g (Tree (Either Room Room))
|
||||
glassLesson = do
|
||||
corridors <- sequence $ replicate 3 $ fmap Left $ randLinks corridor
|
||||
corridors <- sequence $ replicate 3 $ fmap Left $ randomiseOutLinks corridor
|
||||
return $ Node (Left $ botRoom) [deadRoom door,uppers, treePost (Left door : corridors) $ Right door]
|
||||
where uppers = Node (Left door) [deadRoom topRoom]
|
||||
botRoom = set rmPS botplmnts
|
||||
@@ -212,7 +212,7 @@ miniRoom1 = do
|
||||
return $ set rmPS plmnts $ shiftRoomBy ((0,40),0) $ roomRect' wth hgt 2 4
|
||||
|
||||
miniTree2 :: RandomGen g => State g (Tree (Either Room Room))
|
||||
miniTree2 = miniRoom1 >>= randLinks >>= changeLinkTo (\p -> (snd . fst) p < 70)
|
||||
miniTree2 = miniRoom1 >>= randomiseOutLinks >>= changeLinkTo (\p -> (snd . fst) p < 70)
|
||||
>>= return . flip branchWith (replicate 3 $ treePost [door,corridor]
|
||||
critInDeadEnd )
|
||||
|
||||
@@ -245,7 +245,7 @@ miniRoom3 = do
|
||||
,PS cp (pi/8+7*pi/4) b
|
||||
,PS (w/2,h/2) 0 putLamp
|
||||
]
|
||||
fmap connectRoom $ randLinks $ set rmPS plmnts $ roomRectAutoLinks w h
|
||||
fmap connectRoom $ randomiseOutLinks $ set rmPS plmnts $ roomRectAutoLinks w h
|
||||
|
||||
rot90Around :: Point2 -> Point2 -> Point2
|
||||
rot90Around cen p = cen +.+ vNormal (p -.- cen)
|
||||
@@ -258,7 +258,7 @@ roomMiniIntro = fmap (g . expandTreeBy f) $ sequence $ treePost
|
||||
,join $ takeOne [miniTree2,glassLesson]
|
||||
-- ,join $ takeOne [miniRoom1]
|
||||
]
|
||||
$ fmap connectRoom $ randLinks corridor
|
||||
$ fmap connectRoom $ randomiseOutLinks corridor
|
||||
where f (Node (Right x) xs) = Node (Right (Right x)) $ map f xs
|
||||
f (Node (Left x) xs) = Node (Left (Left x)) $ map f xs
|
||||
g (Node (Right x) []) = Node (Right x) []
|
||||
@@ -332,7 +332,7 @@ weaponEmptyRoom = do
|
||||
,PS (w-20,20) (pi/2) $ randC1
|
||||
,PS (w/2,h/2) 0 $ putLamp
|
||||
]
|
||||
(fmap connectRoom . randLinks) =<< (changeLinkTo ((\p -> dist p (w/2,0) < 10) . fst)
|
||||
(fmap connectRoom . randomiseOutLinks) =<< (changeLinkTo ((\p -> dist p (w/2,0) < 10) . fst)
|
||||
$ set rmPS plmnts $ roomRect' w h 2 2)
|
||||
|
||||
|
||||
@@ -377,7 +377,7 @@ weaponBetweenPillars = do
|
||||
,PS crPos1 (d crPos1) $ randC1
|
||||
,PS crPos2 (d crPos2) $ randC1
|
||||
]
|
||||
(fmap connectRoom . randLinks) =<< (filterLinks f $ over rmPS (++plmnts) $ roomPillars)
|
||||
(fmap connectRoom . randomiseOutLinks) =<< (filterLinks f $ over rmPS (++plmnts) $ roomPillars)
|
||||
where f (_,a) = a == 0
|
||||
|
||||
blockedCorridor :: RandomGen g => State g (Tree (Either Room Room))
|
||||
@@ -387,21 +387,24 @@ blockedCorridor = do
|
||||
let plmnts = [PS (20,40) r $ PutBlock [5,5,5] (150/256, 75/256, 0, 250/256)
|
||||
$ reverse $ rectNSWE 10 (-10) (-10) 10
|
||||
]
|
||||
sequence $ treePost (replicate n $ fmap Left $ randLinks corridor)
|
||||
sequence $ treePost (replicate n $ fmap Left $ randomiseOutLinks corridor)
|
||||
$ fmap Right $ return $ set rmPS plmnts corridor
|
||||
|
||||
weaponLongCorridor :: RandomGen g => State g (Tree (Either Room Room))
|
||||
weaponLongCorridor = do
|
||||
root <- takeOne $ [tEast, tWest]
|
||||
connectingRoom <- takeOne [tEast,tWest]
|
||||
connectingRoom <- takeOne
|
||||
[--tEast & rmPS .~ [PS (-40,60) 0 $ putLamp]
|
||||
tWest & rmPS .~ [PS (40,60) 0 $ putLamp]
|
||||
]
|
||||
i1 <- state $ randomR (2,5)
|
||||
i2 <- state $ randomR (2,5)
|
||||
let branch1 = treeTrunk (replicate i1 $ Left corridor) (connectRoom $ putCrs connectingRoom)
|
||||
let branch2 = treeTrunk (replicate i2 $ Left corridor) (deadRoom $ putWp corridorN)
|
||||
let branch1 = treeTrunk (replicate i1 $ Left corridorN) (connectRoom $ putCrs connectingRoom)
|
||||
let branch2 = treeTrunk (replicate i2 $ Left corridorN) (deadRoom $ putWp corridor)
|
||||
return $ Node (Left root) [branch1,branch2]
|
||||
where putCrs = set rmPS [PS (10,40) (-pi/2) $ randC
|
||||
where putCrs = over rmPS (++ [PS (10,40) (-pi/2) $ randC
|
||||
,PS (-10,40) (-pi/2) $ randC
|
||||
]
|
||||
])
|
||||
putWp = set rmPS [PS (20,40) 0 $ RandPS randFirstWeapon
|
||||
,PS (20,60) 0 $ putLamp
|
||||
]
|
||||
@@ -424,11 +427,11 @@ deadEndRoom = Room
|
||||
|
||||
weaponRoom :: RandomGen g => State g (Tree (Either Room Room))
|
||||
weaponRoom = do
|
||||
x <- takeOne [weaponEmptyRoom
|
||||
x <- takeOne --[weaponEmptyRoom
|
||||
--, weaponUnderCrits
|
||||
, weaponBehindPillar
|
||||
, weaponBetweenPillars
|
||||
, weaponLongCorridor
|
||||
--, weaponBehindPillar
|
||||
--, weaponBetweenPillars
|
||||
[ weaponLongCorridor
|
||||
]
|
||||
x
|
||||
|
||||
@@ -445,7 +448,7 @@ branchRectWith t = do
|
||||
x <- state $ randomR (100,200)
|
||||
y <- state $ randomR (100,200)
|
||||
b <- t
|
||||
root <- randLinks $ roomRectAutoLinks x y
|
||||
root <- randomiseOutLinks $ roomRectAutoLinks x y
|
||||
return $ Node (Left root) [Node (Right door) [], fmap rToL $ treeTrunk [Left door] b]
|
||||
where rToL :: Either a a -> Either a a
|
||||
rToL (Right r) = Left r
|
||||
@@ -648,5 +651,5 @@ spawnerRoom = do
|
||||
,PS (x/2, y-10) 0 putLamp
|
||||
]
|
||||
let f ((lx,_),_) = lx < x/2-5
|
||||
roomWithSpawner <- (fmap connectRoom . randLinks) =<< (filterLinks f $ set rmPS plmnts $ roomRect' x y 2 2)
|
||||
roomWithSpawner <- (fmap connectRoom . randomiseOutLinks) =<< (filterLinks f $ set rmPS plmnts $ roomRect' x y 2 2)
|
||||
return $ treeTrunk [Left (airlock 0)] roomWithSpawner
|
||||
|
||||
Reference in New Issue
Block a user