Make item display universal
This commit is contained in:
@@ -31,8 +31,7 @@ import Dodge.Room.Containing
|
||||
firstBreather :: State StdGen (MetaTree Room String)
|
||||
firstBreather = do
|
||||
itms <- takeOne
|
||||
[[]
|
||||
,[itemFromBase $ CRAFT TUBE]
|
||||
[[itemFromBase $ CRAFT TUBE]
|
||||
,[itemFromBase $ CRAFT PIPE]
|
||||
,[itemFromBase $ CRAFT HARDWARE]
|
||||
,[itemFromBase $ CRAFT CAN]
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
--{-# LANGUAGE TupleSections #-}
|
||||
module Dodge.Room.Containing where
|
||||
import Dodge.Data
|
||||
import Dodge.Item.Display
|
||||
import Dodge.Tree
|
||||
import Dodge.LevelGen.Data
|
||||
import Dodge.PlacementSpot
|
||||
@@ -16,7 +17,9 @@ import Geometry
|
||||
--import Dodge.Item.Equipment
|
||||
|
||||
roomsContaining :: RandomGen g => [Creature] -> [Item] -> State g (MetaTree Room String)
|
||||
roomsContaining crs its = tToBTree "roomsContaining" <$> roomsContaining' crs its
|
||||
roomsContaining crs its = tToBTree str <$> roomsContaining' crs its
|
||||
where
|
||||
str = "roomsContaining "++ concatMap _crName crs ++ concatMap (head . itemDisplay) its
|
||||
|
||||
roomsContaining' :: RandomGen g => [Creature] -> [Item] -> State g (Tree Room)
|
||||
roomsContaining' crs its = do
|
||||
@@ -24,6 +27,7 @@ roomsContaining' crs its = do
|
||||
[ roomPillarsSquare <&> rmPmnts .++~ crsItmsUnused crs its
|
||||
, randomFourCornerRoomCrsIts crs its
|
||||
, tanksRoom crs its
|
||||
, tanksPipesRoom <&> rmPmnts ++.~ crsItmsUnused crs its
|
||||
, roomPillarsContaining crs its
|
||||
, roomPillarsPassage <&> rmPmnts .++~ crsItmsUnused crs its
|
||||
]
|
||||
|
||||
+14
-12
@@ -10,6 +10,7 @@ module Dodge.Room.Room
|
||||
, corDoor
|
||||
) where
|
||||
import Dodge.Cleat
|
||||
import Dodge.Item.Display
|
||||
import Dodge.Data
|
||||
import Dodge.PlacementSpot
|
||||
import Dodge.RoomLink
|
||||
@@ -135,8 +136,8 @@ roomCenterPillar = do
|
||||
]
|
||||
|
||||
{- Probabilites of the type of the first floor weapon. -}
|
||||
randFirstWeapon :: State StdGen PSType
|
||||
randFirstWeapon = takeOne $ map PutFlIt $
|
||||
randFirstWeapon :: State StdGen Item
|
||||
randFirstWeapon = takeOne $
|
||||
replicate 10 pistol
|
||||
++ replicate 5 (bangStick 4)
|
||||
++ replicate 5 (bangCaneX 3)
|
||||
@@ -148,7 +149,7 @@ weaponEmptyRoom = do
|
||||
w <- state $ randomR (220,300)
|
||||
h <- state $ randomR (220,300)
|
||||
let plmnts =
|
||||
[sPS (V2 (w/2) (h-40)) 0 $ RandPS randFirstWeapon
|
||||
[sPS (V2 (w/2) (h-40)) 0 $ RandPS $ fmap PutFlIt randFirstWeapon
|
||||
,sPS (V2 20 20) (pi/2) randC1
|
||||
,sPS (V2 (w-20) 20) (pi/2) randC1
|
||||
,mntLightLnkCond useUnusedLnk
|
||||
@@ -160,7 +161,7 @@ weaponEmptyRoom = do
|
||||
|
||||
weaponUnderCrits :: RandomGen g => Int -> State g (MetaTree Room String)
|
||||
weaponUnderCrits i = do
|
||||
let addwpat p = rmPmnts .:~ PickOnePlacement i (sPS p 0 $ RandPS randFirstWeapon)
|
||||
let addwpat p = rmPmnts .:~ PickOnePlacement i (sPS p 0 $ RandPS $ fmap PutFlIt randFirstWeapon)
|
||||
continuationRoom = treePost
|
||||
[ addwpat (V2 20 0) corridorN
|
||||
, addwpat (V2 20 0) corridorN
|
||||
@@ -185,13 +186,13 @@ weaponBehindPillar = do
|
||||
return $ treePost
|
||||
[ corridor
|
||||
, rcp & rmPmnts ++.~
|
||||
[sPS wpos wpa $ RandPS randFirstWeapon
|
||||
[sPS wpos wpa $ RandPS $ fmap PutFlIt randFirstWeapon
|
||||
,sPS cpos (argV $ V2 120 80 -.- cpos) randC1
|
||||
]
|
||||
, cleatOnward $ set rmPmnts [sPS (V2 20 60) (negate $ pi/2) randC1] corridorN
|
||||
]
|
||||
|
||||
weaponBetweenPillars :: RandomGen g => State g (Tree Room)
|
||||
weaponBetweenPillars :: State StdGen (MetaTree Room String)
|
||||
weaponBetweenPillars = do
|
||||
(w,wn) <- takeOne [(240,2),(340,3)]
|
||||
(h,hn) <- takeOne [(240,2),(340,3)]
|
||||
@@ -202,13 +203,14 @@ weaponBetweenPillars = do
|
||||
, any ((<100) . dist (_rpPos rp)) (usedRoomInLinkPoss r)
|
||||
]
|
||||
ncrits <- state $ randomR (1,3)
|
||||
wp <- randFirstWeapon
|
||||
critPlacementSpots <- replicateM ncrits $ randDirPS $ rprBool $ \rp r ->
|
||||
rpIsOnPath rp
|
||||
&& _rpPlacementUse rp == 0
|
||||
&& all ((>100) . dist (_rpPos rp)) (usedRoomLinkPoss r)
|
||||
fmap pure $ roomPillars 30 w h wn hn
|
||||
<&> rmPmnts .++~ sps wpPos (RandPS randFirstWeapon) : map (`sps` randC1) critPlacementSpots
|
||||
<&> cleatOnward
|
||||
(fmap pure $ roomPillars 30 w h wn hn
|
||||
<&> rmPmnts .++~ map (`sps` randC1) critPlacementSpots ++ [ sps wpPos (PutFlIt wp) ]
|
||||
<&> cleatOnward) >>= rToOnward ("weaponBetweenPillars_"++itemString wp)
|
||||
|
||||
weaponLongCorridor :: RandomGen g => State g (Tree Room)
|
||||
weaponLongCorridor = do
|
||||
@@ -222,7 +224,7 @@ weaponLongCorridor = do
|
||||
return $ Node rt [branch1,branch2]
|
||||
where
|
||||
putCrs = rmPmnts .++~ [sPS (V2 10 40) (-pi/2) randC1 ,sPS (V2 (-10) 40) (-pi/2) randC1 ]
|
||||
putWp = rmPmnts .~ [sPS (V2 20 60) 0 $ RandPS randFirstWeapon ,spanLightI (V2 0 40) (V2 40 40)]
|
||||
putWp = rmPmnts .~ [sPS (V2 20 60) 0 $ RandPS $ fmap PutFlIt randFirstWeapon ,spanLightI (V2 0 40) (V2 40 40)]
|
||||
|
||||
critInDeadEnd :: Room
|
||||
critInDeadEnd = deadEndRoom & rmPmnts .~ [sPS (V2 0 0) 0 randC1]
|
||||
@@ -239,12 +241,12 @@ deadEndRoom = defaultRoom
|
||||
where
|
||||
lnks = [(V2 0 30 ,0) ]
|
||||
{- A random Either tree with a weapon and melee monster challenge. -}
|
||||
weaponRoom :: RandomGen g => Int -> State g (MetaTree Room String)
|
||||
weaponRoom :: Int -> State StdGen (MetaTree Room String)
|
||||
weaponRoom i = join $ takeOne
|
||||
[ weaponEmptyRoom >>= rToOnward "weaponEmptyRoom"
|
||||
, weaponUnderCrits i -- this int is used for PickOnePlacement
|
||||
, weaponBehindPillar >>= rToOnward "weaponBehindPillar"
|
||||
, weaponBetweenPillars >>= rToOnward "weaponBetweenPillars"
|
||||
, weaponBetweenPillars-- >>= rToOnward "weaponBetweenPillars"
|
||||
, weaponLongCorridor >>= rToOnward "weaponLongCorridor"
|
||||
]
|
||||
|
||||
|
||||
@@ -56,7 +56,7 @@ powerFakeout = do
|
||||
,cleatOnward door]
|
||||
|
||||
-- the i is used either for a PickOnePlacement or a room id, this is not great
|
||||
startRoom :: RandomGen g => Int -> State g (MetaTree Room String)
|
||||
startRoom :: Int -> State StdGen (MetaTree Room String)
|
||||
startRoom i = join $ takeOne
|
||||
[ attachOnward "startThenWeaponRoom" <$> preCritStart <*> weaponRoom i
|
||||
, rezBoxesWpCrit >>= rToOnward "rezBoxesWpCrit"
|
||||
|
||||
Reference in New Issue
Block a user