Test of lock and key system
This commit is contained in:
+14
-7
@@ -11,7 +11,8 @@ import Dodge.Annotation.Data
|
||||
import Data.Tree
|
||||
import Control.Monad.State
|
||||
import System.Random
|
||||
import Control.Lens
|
||||
--import Control.Lens
|
||||
import Data.Maybe
|
||||
|
||||
addLock :: RandomGen g => Int -> Tree [Annotation g] -> State g (Tree [Annotation g])
|
||||
addLock i t = do
|
||||
@@ -43,15 +44,21 @@ roomThenCorridor theRoom = fmap (\r -> Node (PassDown theRoom) [(pure . UseAll)
|
||||
anoToRoomTree :: RandomGen g => [Annotation g] -> State g (SubCompTree Room)
|
||||
anoToRoomTree anos = case anos of
|
||||
[AnoApplyInt i f] -> f i
|
||||
[SetLabel i randrm] -> do
|
||||
rm <- randrm
|
||||
return . singleUseAll $ rm & rmLabel ?~ i
|
||||
[UseLabel i randrm] -> do
|
||||
rm <- randrm
|
||||
return $ singleUseAll $ rm & rmTakeFrom ?~ i
|
||||
-- [SetLabel i randrm] -> do
|
||||
-- rm <- randrm
|
||||
-- return . singleUseAll $ rm & rmLabel ?~ i
|
||||
-- [UseLabel i randrm] -> do
|
||||
-- rm <- randrm
|
||||
-- return $ singleUseAll $ rm & rmTakeFrom ?~ i
|
||||
[ChainAnos ass] -> do
|
||||
rms <- mapM anoToRoomTree ass
|
||||
return $ chainUses rms
|
||||
[PassthroughLockKeyLists i ls ks] -> do
|
||||
(functionlockroom,randomitemidentity) <- takeOne ls
|
||||
lr <- functionlockroom i
|
||||
ii <- randomitemidentity
|
||||
keyroom <- fromJust $ lookup ii ks
|
||||
return $ overwriteLabel 0 UseNone lr [keyroom]
|
||||
[OrAno as] -> do
|
||||
a <- takeOne as
|
||||
anoToRoomTree a
|
||||
|
||||
Reference in New Issue
Block a user