Work on placements

This commit is contained in:
2025-09-25 17:32:02 +01:00
parent 23f61081cf
commit f5a3486f72
13 changed files with 155 additions and 157 deletions
+32 -1
View File
@@ -1,5 +1,6 @@
module Dodge.Room.Tutorial where
import ShortShow
import Dodge.Data.MTRS
import Dodge.Room.Room
import Dodge.Cleat
@@ -33,6 +34,8 @@ import LensHelp
--import Padding
import RandomHelp
import TreeHelp
import qualified Data.IntSet as IS
import qualified Data.IntMap.Strict as IM
--import Data.List (intersperse)
@@ -108,7 +111,10 @@ tutRooms is = do
i <- nextLayoutInt
j <- nextLayoutInt
k <- nextLayoutInt
let a gw = analyserByNthLinkWithPrompt 3 sensorTut (RequireEquipment (AMMOMAG DRUMMAG)) k
let a gw = analyserByNthLinkWithPrompt
3 (makeTermPara $ show is <> show (getRoomsFromInts is gw)
<>(getCrsFromRooms' is gw))
(RequireDeadCreatures $ getCrsFromRooms is gw) k
x <-
shuffleLinks
. analyserByDoorWithPrompt sensorTut (RequireEquipment (AMMOMAG DRUMMAG)) i
@@ -167,6 +173,31 @@ tutRooms is = do
, makeTermLine "---------------------------------------------"
]
getRoomsFromInts :: [Int] -> GenWorld -> IS.IntSet
getRoomsFromInts is gw
= foldMap IS.singleton $ IM.restrictKeys (gw ^. genInts) (IS.fromList is)
getCrsFromRooms' :: [Int] -> GenWorld -> String
getCrsFromRooms' is gw = fmap h $ show $ foldMap f (IM.restrictKeys (gw ^. genRooms) js)
where
h ',' = ' '
h x = x
js = getRoomsFromInts is gw
f rm = shortShow <$> rm ^.. rmPmnts . each . plType
--f rm = foldMap g $ rm ^. rmPmnts
--g x = case x ^. plType of
-- PutCrit _ -> [x ^?! plMID . _Just]
-- _ -> []
getCrsFromRooms :: [Int] -> GenWorld -> [Int]
getCrsFromRooms is gw = foldMap f (IM.restrictKeys (gw ^. genRooms) js)
where
js = foldMap IS.singleton $ IM.restrictKeys (gw ^. genInts) (IS.fromList is)
f rm = foldMap g $ rm ^. rmPmnts
g x = case x ^. plType of
PutCrit _ -> [x ^?! plMID . _Just]
_ -> []
sensorTut :: [TerminalLine]
sensorTut =
[ makeTermLine "--------------------------------------------"