Implement basic attention and awareness
This commit is contained in:
+71
-82
@@ -197,26 +197,27 @@ rot90Around cen p = cen +.+ vNormal (p -.- cen)
|
||||
-- inside an inner tree
|
||||
roomMiniIntro :: RandomGen g => State g (Tree (Either Room Room))
|
||||
roomMiniIntro = fmap (g . expandTreeBy f) $ sequence $ treeFromPost
|
||||
[return $ connectRoom door
|
||||
,join $ takeOne [miniTree2,glassLesson]
|
||||
-- ,join $ takeOne [miniRoom1]
|
||||
]
|
||||
$ 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) []
|
||||
g (Node (Right x) xs) = Node (Left x) $ map g xs
|
||||
g (Node y ys) = Node y $ map g ys
|
||||
|
||||
[return $ connectRoom door
|
||||
,join $ takeOne [miniTree2,glassLesson]
|
||||
]
|
||||
$ 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) []
|
||||
g (Node (Right x) xs) = Node (Left x) $ map g xs
|
||||
g (Node y ys) = Node y $ map g ys
|
||||
|
||||
roomCenterPillar :: RandomGen g => State g Room
|
||||
roomCenterPillar = changeLinkTo ((\p -> dist p (120,0) < 10) . fst)
|
||||
$ set rmPS plmnts $ roomRect 240 240 2 2
|
||||
where plmnts = [ blockLine (115,115) (115,125)
|
||||
, blockLine (125,115) (125,125)
|
||||
, PS (40,120) 0 putLamp
|
||||
, PS (200,120) 0 putLamp
|
||||
]
|
||||
$ set rmPS plmnts $ roomRect 240 240 2 2
|
||||
where
|
||||
plmnts =
|
||||
[ blockLine (115,115) (115,125)
|
||||
, blockLine (125,115) (125,125)
|
||||
, PS (40,120) 0 putLamp
|
||||
, PS (200,120) 0 putLamp
|
||||
]
|
||||
|
||||
roomOctogon :: Room
|
||||
roomOctogon = Room
|
||||
@@ -227,15 +228,18 @@ roomOctogon = Room
|
||||
, _rmPS = []
|
||||
, _rmBound = [[(-20,30),(20,30),(60,70),(60,110),(20,150),(-20,150),(-60,110),(-60,70)] ]
|
||||
}
|
||||
where lnks = [((0,140),0)
|
||||
,((35,125),0-pi/4)
|
||||
,((-35,125),pi/4)
|
||||
,( (50,90),0-pi/2)
|
||||
,( (-50,90),pi/2)
|
||||
,((35,55),0-3*pi/4)
|
||||
,((-35,55),3*pi/4)
|
||||
,( (0,40),pi)
|
||||
]
|
||||
where
|
||||
lnks =
|
||||
[((0,140),0)
|
||||
,((35,125),0-pi/4)
|
||||
,((-35,125),pi/4)
|
||||
,( (50,90),0-pi/2)
|
||||
,( (-50,90),pi/2)
|
||||
,((35,55),0-3*pi/4)
|
||||
,((-35,55),3*pi/4)
|
||||
,( (0,40),pi)
|
||||
]
|
||||
|
||||
allPairs :: Eq a => [a] -> [(a,a)]
|
||||
allPairs xs = [(x,y) | x <- xs, y <- xs, x /= y]
|
||||
|
||||
@@ -243,10 +247,7 @@ randomCorridorFrom :: RandomGen g => [a] -> State g (Tree (Either a a))
|
||||
randomCorridorFrom xs = do
|
||||
rooms <- sequence $ replicate 5 $ takeOne xs
|
||||
return $ treeFromTrunk (map Left $ init rooms) (Node (Right (last rooms)) [])
|
||||
|
||||
{-
|
||||
Probabilites of the type of the first floor weapon.
|
||||
-}
|
||||
{- Probabilites of the type of the first floor weapon. -}
|
||||
randFirstWeapon :: State StdGen PSType
|
||||
randFirstWeapon = do
|
||||
takeOne $ map PutFlIt $
|
||||
@@ -256,15 +257,9 @@ randFirstWeapon = do
|
||||
++ replicate 5 multGun
|
||||
++ replicate 2 autoGun
|
||||
++ [launcher]
|
||||
-- ++ [lasGun]
|
||||
-- ++ [flamer]
|
||||
|
||||
--randC1 :: State StdGen PSType
|
||||
|
||||
randC = randC1
|
||||
|
||||
-- randSwarmCrit = RandPS $ takeOne $ map PutCrit $ (armouredSwarmCrit : replicate 100 swarmCrit)
|
||||
|
||||
weaponEmptyRoom :: RandomGen g => State g (Tree (Either Room Room))
|
||||
weaponEmptyRoom = do
|
||||
w <- state $ randomR (220,300)
|
||||
@@ -277,25 +272,24 @@ weaponEmptyRoom = do
|
||||
(fmap connectRoom . randomiseOutLinks) =<< (changeLinkTo ((\p -> dist p (w/2,0) < 10) . fst)
|
||||
$ set rmPS plmnts $ roomRect w h 2 2)
|
||||
|
||||
|
||||
weaponUnderCrits :: RandomGen g => State g (Tree (Either Room Room))
|
||||
weaponUnderCrits = do
|
||||
let plmnts = [PS (20,0) 0 $ RandPS randFirstWeapon
|
||||
,PS (20,0) (0-pi/2) $ randC1
|
||||
,PS (20,20) (0-pi/2) $ randC1
|
||||
]
|
||||
let continuationRoom = treeFromTrunk [Left corridorN,Left corridorN]
|
||||
(connectRoom (set rmPS plmnts $ corridorN))
|
||||
rcp' <- roomCenterPillar
|
||||
let rcp = over rmPS ( PS (120,80) 0 putLamp : ) rcp'
|
||||
deadEndRoom <- takeOne [roomPillars,rcp]
|
||||
junctionRoom <- takeOne [Left tEast,Left tWest]
|
||||
return $ treeFromTrunk [Left corridorN,Left corridorN]
|
||||
$ Node junctionRoom
|
||||
[continuationRoom
|
||||
,deadRoom deadEndRoom
|
||||
]
|
||||
|
||||
let plmnts =
|
||||
[PS (20,0) 0 $ RandPS randFirstWeapon
|
||||
,PS (20,0) (0-pi/2) $ randC1
|
||||
,PS (20,20) (0-pi/2) $ randC1
|
||||
]
|
||||
let continuationRoom = treeFromTrunk [Left corridorN,Left corridorN]
|
||||
(connectRoom (set rmPS plmnts $ corridorN))
|
||||
rcp' <- roomCenterPillar
|
||||
let rcp = over rmPS ( PS (120,80) 0 putLamp : ) rcp'
|
||||
deadEndRoom <- takeOne [roomPillars,rcp]
|
||||
junctionRoom <- takeOne [Left tEast,Left tWest]
|
||||
return $ treeFromTrunk [Left corridorN,Left corridorN]
|
||||
$ Node junctionRoom
|
||||
[continuationRoom
|
||||
,deadRoom deadEndRoom
|
||||
]
|
||||
|
||||
weaponBehindPillar :: RandomGen g => State g (Tree (Either Room Room))
|
||||
weaponBehindPillar = do
|
||||
@@ -312,17 +306,19 @@ weaponBehindPillar = do
|
||||
|
||||
weaponBetweenPillars :: RandomGen g => State g (Tree (Either Room Room))
|
||||
weaponBetweenPillars = do
|
||||
wpPos <- takeOne [(x,y) | x <- [20,120,220], y <- [20,120,220]]
|
||||
(ps,_) <- takeNMore 2 ([], [(x,y) | x <- [20,220], y <- [20,120,220]])
|
||||
let crPos1 = ps !! 0
|
||||
let crPos2 = ps !! 1
|
||||
let d p = argV $ (120,120) -.- p
|
||||
let plmnts = [PS wpPos 0 $ RandPS randFirstWeapon
|
||||
,PS crPos1 (d crPos1) $ randC1
|
||||
,PS crPos2 (d crPos2) $ randC1
|
||||
]
|
||||
(fmap connectRoom . randomiseOutLinks) =<< (filterLinks f $ over rmPS (++plmnts) $ roomPillars)
|
||||
where f (_,a) = a == 0
|
||||
wpPos <- takeOne [(x,y) | x <- [20,120,220], y <- [20,120,220]]
|
||||
(ps,_) <- takeNMore 2 ([], [(x,y) | x <- [20,220], y <- [20,120,220]])
|
||||
let crPos1 = ps !! 0
|
||||
crPos2 = ps !! 1
|
||||
d p = argV $ (120,120) -.- p
|
||||
plmnts =
|
||||
[PS wpPos 0 $ RandPS randFirstWeapon
|
||||
,PS crPos1 (d crPos1) $ randC1
|
||||
,PS crPos2 (d crPos2) $ randC1
|
||||
]
|
||||
(fmap connectRoom . randomiseOutLinks) =<< (filterLinks f $ over rmPS (++plmnts) $ roomPillars)
|
||||
where
|
||||
f (_,a) = a == 0
|
||||
|
||||
weaponLongCorridor :: RandomGen g => State g (Tree (Either Room Room))
|
||||
weaponLongCorridor = do
|
||||
@@ -355,21 +351,17 @@ deadEndRoom = Room
|
||||
, _rmPS = [PS (0,-10) 0 putLamp]
|
||||
, _rmBound = [rectNSWE 20 (-20) (-30) 30]
|
||||
}
|
||||
where lnks = [((0,30) ,0)
|
||||
]
|
||||
|
||||
{-
|
||||
A random Either tree with a weapon and melee monster challenge.
|
||||
-}
|
||||
where
|
||||
lnks = [((0,30) ,0) ]
|
||||
{- A random Either tree with a weapon and melee monster challenge. -}
|
||||
weaponRoom :: RandomGen g => State g (Tree (Either Room Room))
|
||||
weaponRoom = do
|
||||
x <- takeOne [ weaponEmptyRoom
|
||||
, weaponUnderCrits
|
||||
, weaponBehindPillar
|
||||
, weaponBetweenPillars
|
||||
, weaponLongCorridor
|
||||
]
|
||||
x
|
||||
weaponRoom = join $ takeOne
|
||||
[ weaponEmptyRoom
|
||||
, weaponUnderCrits
|
||||
, weaponBehindPillar
|
||||
, weaponBetweenPillars
|
||||
, weaponLongCorridor
|
||||
]
|
||||
|
||||
roomCCrits :: RandomGen g => State g (Tree (Either Room Room))
|
||||
roomCCrits = do
|
||||
@@ -397,10 +389,7 @@ longRoom = do
|
||||
]
|
||||
brls <- fmap (map (\p -> PS (p +.+ (10,200)) 0 $ PutCrit explosiveBarrel) )
|
||||
$ sequence $ replicate 5 $ randInRect (w-20) 900
|
||||
let rm = roomRect w (h+70) 1 1 & rmPolys %~ ( (++)
|
||||
[rectNSWE h (h-165) (-45) (w+45)
|
||||
]
|
||||
)
|
||||
let rm = roomRect w (h+70) 1 1 & rmPolys %~ ([rectNSWE h (h-165) (-45) (w+45)] ++)
|
||||
changeLinkTo cond $ set rmPS (ws ++ brls ++ wsDefense ++
|
||||
[PS ( 12.5,h-25) 0 $ PutCrit longCrit
|
||||
,PS ( 37.5,h-25) 0 $ PutCrit longCrit
|
||||
|
||||
Reference in New Issue
Block a user