--{-# OPTIONS_GHC -Wno-unused-imports #-}
{- | The tree of rooms that make up a level. -}
module Dodge.Floor
    ( initialRoomTree
    ) where
--import Geometry.Data
--import Dodge.Data
import Dodge.LockAndKey
--import Dodge.Creature.State.Data
import Dodge.Room
--import Dodge.Placement.Instance.Button
import Dodge.Tree
import Dodge.Annotation
--import Dodge.Creature
--import Dodge.LevelGen.Data
--import Dodge.LevelGen.Switch
--import Dodge.Item.Weapon.Launcher
--import Dodge.PlacementSpot
--import Dodge.RoomPos
--import Dodge.Room.RunPast
--import MonadHelp
import Data.Tree
--import Color
--import Dodge.Wire

--import Control.Lens
import Control.Monad.State
--import Control.Monad.Loops
import System.Random
--import Data.Sequence hiding (zipWith)
--import Data.Maybe
--import qualified Data.IntMap.Strict as IM

initialAnoTree :: RandomGen g => Tree [Annotation g]
initialAnoTree = padSucWithCorridors $ treeFromTrunk 
    [[AnoApplyInt 0 startRoom]
    , [PassthroughLockKeyLists 2 lockRoomKeyItems itemRooms]
    , [AnoApplyInt 1 lasSensorTurretTest]
--    ,[ChainAnos 
--        [[SetLabel 0 $ return $ roomRectAutoLinks 200 200 
--            & rmExtPmnt ?~ triggerSwitchSPicLight (drawSwitchWire red red)
--                (anyLnkInPS 5 & psLnkRoomEff .~ (putWireStart 0 . extractRoomPos) )
--            & rmLinkEff .~ [putWireEnd 0]
--         ]
--        ,[UseLabel 0 $ return switchDoorRoom]
--        ]
--     ]
--    ,[SpecificRoom $ return $ connectRoom lasTunnel ]
--    ,[SpecificRoom $ fmap singleUseAll slowDoorRoom ]
--    ,[Corridor]
--    ,[Corridor]
--    ,[SpecificRoom $ fmap singleUseAll roomCCrits]
--    ,[AirlockAno]
--    ,[Corridor]
------    ,[SpecificRoom roomCCrits]
------    ,[Corridor]
------    ,[SpecificRoom . pure . pure . UseAll $ roomGlassOctogon 400 
------        & rmPS %~ ([sPS (V2 0 50) 0 $ PutCrit armourChaseCrit 
------                    ,sPS (V2 50 25) 0 $ PutCrit armourChaseCrit 
------                    ,sPS (V2 50 0) 0 $ PutCrit armourChaseCrit 
------                    ]++)
------     ]
------    --,[SpecificRoom . pure . pure . UseAll $ roomGlassOctogon 400 
------    --    & rmPS %~ ([swarmPS 0 (x,y) 0 swarmCrit | x <- [-20,-19.5.. 20] , y <- [200,202] ]++)
------    -- ]
------    ,[SpecificRoom . pure . pure . UseAll $ roomGlassOctogon 400 
------        & rmPS %~ ([sPS (V2 0 50) 0 $ PutCrit pistolCrit ]++)
------     ]
------    ,[Corridor]
----    --,[SpecificRoom $ pure . UseAll <$> twinSlowDoorChasers]
-----    ,[SpecificRoom $ pure $ (pure . UseAll) (twinSlowDoorRoom 80 200 40)]
-----    ,[DoorAno]
-----    ,[SpecificRoom $ pure . UseAll <$> centerVaultExplosiveExit]
-----    ,[SpecificRoom blockedCorridor]
-----    ,[OrAno [[DoorAno]
-----            ,[Corridor]
-----            ,[DoorNumAno 0,AirlockAno]] 
-----            ]
-----    ,[FirstWeapon]
-----    ,[CorridorDebug]
-----    ,[SpecificRoom $ fmap (pure . UseAll) randomFourCornerRoom]
--    ,[OrAno 
--        [[SpecificRoom $ branchRectWith $ fmap (fmap PassDown) armouredChasers]
--        ,[BossAno $ addArmour launcherCrit & crHP +~ 800
--            & crState . crDropsOnDeath .~ DropSpecific [0] ]
--        ]
--     ]
----    ,[SpecificRoom $ fmap (pure . UseAll) armouredCorridor]
--    ,[Corridor]
--    ,[TreasureAno [addArmour autoCrit,addArmour autoCrit] [launcher]]
    ] 
    $ treeFromPost [[Corridor,SpecificRoom $ fmap (pure . UseAll) randomFourCornerRoom]] 
                                [EndRoom]

{- | A test level tree. -}
initialRoomTree :: RandomGen g => State g (Tree Room)
initialRoomTree = do
    expandTree <$> mapM anoToRoomTree initialAnoTree


