Remove PickOnePlacements
This commit is contained in:
@@ -86,9 +86,7 @@ data Placement
|
||||
, _plMID :: Maybe Int
|
||||
, _plIDCont :: World -> Placement -> Maybe Placement
|
||||
}
|
||||
| PlacementUsingPos Point3 (Point3 -> Placement) -- allows a placement to use a shifted position
|
||||
| RandomPlacement {_unRandomPlacement :: State StdGen Placement}
|
||||
| PickOnePlacement Int Placement
|
||||
|
||||
{- The '_rmPolys' lists which polygons should be cut out to form the indestructible walls of the room.
|
||||
Link pairs contain a position and rotation to attach to another room;
|
||||
|
||||
@@ -86,10 +86,8 @@ ps0PushPSw pst f = Placement 10 (PSNoShiftCont (V2 0 0) 0) pst Nothing $
|
||||
|
||||
addPlmnt :: Placement -> Placement -> Placement
|
||||
addPlmnt pl pl2 = case pl2 of
|
||||
(PlacementUsingPos p f) -> PlacementUsingPos p (fmap (addPlmnt pl) f)
|
||||
(RandomPlacement rp) -> RandomPlacement $ fmap (addPlmnt pl) rp
|
||||
(Placement i ps pt mi f) -> Placement i ps pt mi (fmap (fmap g) f)
|
||||
PickOnePlacement{} -> error "not written how to combine PickOnePlacement with others yet"
|
||||
where
|
||||
g Nothing = Just pl
|
||||
g (Just pl') = Just $ addPlmnt pl pl'
|
||||
|
||||
@@ -11,7 +11,6 @@ import Control.Monad.State
|
||||
import Data.Bifunctor
|
||||
import Data.Foldable
|
||||
import qualified Data.IntSet as IS
|
||||
import Data.Maybe
|
||||
import Dodge.Base.NewID
|
||||
import Dodge.Data.GenWorld
|
||||
import Dodge.Path
|
||||
@@ -34,15 +33,10 @@ placeSpot (w, rm) plmnt = case plmnt of
|
||||
Placement{_plSpot = PSPos extract eff fallback} ->
|
||||
placeSpotUsingLink w rm plmnt extract eff fallback
|
||||
Placement{} -> placePlainPSSpot w rm plmnt shift
|
||||
PlacementUsingPos p subpl -> placeSpot (w, rm) (subpl (shiftPoint3By shift p))
|
||||
RandomPlacement rplmnt -> placeRandomPlacement rplmnt w rm
|
||||
PickOnePlacement i pl -> ((placePickOne i pl rm w, rm), [])
|
||||
where
|
||||
shift = _rmShift rm
|
||||
|
||||
placePickOne :: Int -> Placement -> Room -> GenWorld -> GenWorld
|
||||
placePickOne i pl rm = genPlacements %~ IM.insertWith (++) i [(pl, fromJust (_rmMID rm))]
|
||||
|
||||
placeRandomPlacement ::
|
||||
State StdGen Placement ->
|
||||
GenWorld ->
|
||||
|
||||
@@ -5,7 +5,7 @@ import Dodge.Item
|
||||
import RandomHelp
|
||||
|
||||
{- Probabilites of the type of the first floor weapon. -}
|
||||
randFirstWeapon :: State StdGen Item
|
||||
randFirstWeapon :: RandomGen g => State g Item
|
||||
randFirstWeapon =
|
||||
takeOne $
|
||||
replicate 10 pistol
|
||||
|
||||
@@ -25,9 +25,4 @@ shiftPlacement shift plmnt = case plmnt of
|
||||
Placement{} ->
|
||||
plmnt & plSpot %~ shiftPSBy shift
|
||||
& plIDCont %~ fmap (fmap (fmap $ shiftPlacement shift))
|
||||
PlacementUsingPos p f ->
|
||||
PlacementUsingPos
|
||||
(shiftPoint3By shift p)
|
||||
(fmap (shiftPlacement shift) f)
|
||||
RandomPlacement rpl -> RandomPlacement $ fmap (shiftPlacement shift) rpl
|
||||
PickOnePlacement i pl -> PickOnePlacement i (shiftPlacement shift pl)
|
||||
|
||||
@@ -151,9 +151,9 @@ weaponEmptyRoom = do
|
||||
restrictRMInLinksPD f (roomRect w h 2 2 & rmPmnts .~ plmnts)
|
||||
return $ treePost [corridor, cleatSide $ cleatOnward rm]
|
||||
|
||||
weaponUnderCrits :: RandomGen g => Int -> State g (MetaTree Room String)
|
||||
weaponUnderCrits i = do
|
||||
let addwpat p = rmPmnts .:~ PickOnePlacement i (sPS p 0 $ RandPS $ fmap PutFlIt randFirstWeapon)
|
||||
weaponUnderCrits :: RandomGen g => State g (MetaTree Room String)
|
||||
weaponUnderCrits = do
|
||||
let addwpat p = rmPmnts .:~(sPS p 0 $ RandPS $ fmap PutFlIt randFirstWeapon)
|
||||
continuationRoom =
|
||||
treePost
|
||||
[ addwpat (V2 20 0) corridorN
|
||||
@@ -246,12 +246,12 @@ deadEndRoom =
|
||||
lnks = [(V2 0 30, 0)]
|
||||
|
||||
{- A random Either tree with a weapon and melee monster challenge. -}
|
||||
weaponRoom :: Int -> State StdGen (MetaTree Room String)
|
||||
weaponRoom i =
|
||||
weaponRoom :: State StdGen (MetaTree Room String)
|
||||
weaponRoom =
|
||||
join $
|
||||
takeOne
|
||||
[ weaponEmptyRoom >>= rToOnward "weaponEmptyRoom"
|
||||
, weaponUnderCrits i -- this int is used for PickOnePlacement
|
||||
, weaponUnderCrits
|
||||
, weaponBehindPillar >>= rToOnward "weaponBehindPillar"
|
||||
, weaponBetweenPillars -- >>= rToOnward "weaponBetweenPillars"
|
||||
, weaponLongCorridor >>= rToOnward "weaponLongCorridor"
|
||||
|
||||
@@ -54,7 +54,7 @@ startRoom :: Int -> State StdGen (MetaTree Room String)
|
||||
startRoom i =
|
||||
join $
|
||||
takeOne
|
||||
[ attachOnward "startThenWeaponRoom" <$> preCritStart <*> weaponRoom i
|
||||
[ attachOnward "startThenWeaponRoom" <$> preCritStart <*> weaponRoom
|
||||
, rezBoxesWpCrit >>= rToOnward "rezBoxesWpCrit"
|
||||
, runPastStart i >>= rToOnward ("runPastStart " ++ show i)
|
||||
, attachOnward "startThenCraft" <$> preCritStart <*> (startCrafts >>= roomsContaining [])
|
||||
|
||||
Reference in New Issue
Block a user