module Game.LambdaHack.Content.CaveKind
( pattern DEFAULT_RANDOM
, CaveKind(..), makeData
#ifdef EXPOSE_INTERNAL
, validateSingle, validateAll, mandatoryGroups
#endif
) where
import Prelude ()
import Game.LambdaHack.Core.Prelude
import qualified Data.Text as T
import Game.LambdaHack.Content.ItemKind (ItemKind)
import Game.LambdaHack.Content.PlaceKind (PlaceKind)
import Game.LambdaHack.Content.TileKind (TileKind)
import qualified Game.LambdaHack.Core.Dice as Dice
import Game.LambdaHack.Core.Random
import Game.LambdaHack.Definition.ContentData
import Game.LambdaHack.Definition.Defs
data CaveKind = CaveKind
{ CaveKind -> Char
csymbol :: Char
, CaveKind -> Text
cname :: Text
, CaveKind -> Freqs CaveKind
cfreq :: Freqs CaveKind
, CaveKind -> X
cXminSize :: X
, CaveKind -> X
cYminSize :: Y
, CaveKind -> DiceXY
ccellSize :: Dice.DiceXY
, CaveKind -> DiceXY
cminPlaceSize :: Dice.DiceXY
, CaveKind -> DiceXY
cmaxPlaceSize :: Dice.DiceXY
, CaveKind -> Dice
cdarkOdds :: Dice.Dice
, CaveKind -> Dice
cnightOdds :: Dice.Dice
, CaveKind -> Rational
cauxConnects :: Rational
, CaveKind -> Rational
cmaxVoid :: Rational
, CaveKind -> Rational
cdoorChance :: Chance
, CaveKind -> Rational
copenChance :: Chance
, CaveKind -> X
chidden :: Int
, CaveKind -> X
cactorCoeff :: Int
, CaveKind -> Freqs ItemKind
cactorFreq :: Freqs ItemKind
, CaveKind -> Dice
citemNum :: Dice.Dice
, CaveKind -> Freqs ItemKind
citemFreq :: Freqs ItemKind
, CaveKind -> Freqs PlaceKind
cplaceFreq :: Freqs PlaceKind
, CaveKind -> Bool
cpassable :: Bool
, CaveKind -> Bool
labyrinth :: Bool
, CaveKind -> GroupName TileKind
cdefTile :: GroupName TileKind
, CaveKind -> GroupName TileKind
cdarkCorTile :: GroupName TileKind
, CaveKind -> GroupName TileKind
clitCorTile :: GroupName TileKind
, CaveKind -> GroupName TileKind
cwallTile :: GroupName TileKind
, CaveKind -> GroupName TileKind
ccornerTile :: GroupName TileKind
, CaveKind -> GroupName TileKind
cfenceTileN :: GroupName TileKind
, CaveKind -> GroupName TileKind
cfenceTileE :: GroupName TileKind
, CaveKind -> GroupName TileKind
cfenceTileS :: GroupName TileKind
, CaveKind -> GroupName TileKind
cfenceTileW :: GroupName TileKind
, CaveKind -> Bool
cfenceApart :: Bool
, CaveKind -> GroupName TileKind
clegendDarkTile :: GroupName TileKind
, CaveKind -> GroupName TileKind
clegendLitTile :: GroupName TileKind
, CaveKind -> X
cminStairDist :: Int
, CaveKind -> Dice
cmaxStairsNum :: Dice.Dice
, CaveKind -> Freqs PlaceKind
cescapeFreq :: Freqs PlaceKind
, CaveKind -> Freqs PlaceKind
cstairFreq :: Freqs PlaceKind
, CaveKind -> Freqs PlaceKind
cstairAllowed :: Freqs PlaceKind
, CaveKind -> [X]
cskip :: [Int]
, CaveKind -> Text
cdesc :: Text
}
deriving X -> CaveKind -> ShowS
[CaveKind] -> ShowS
CaveKind -> String
(X -> CaveKind -> ShowS)
-> (CaveKind -> String) -> ([CaveKind] -> ShowS) -> Show CaveKind
forall a.
(X -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CaveKind] -> ShowS
$cshowList :: [CaveKind] -> ShowS
show :: CaveKind -> String
$cshow :: CaveKind -> String
showsPrec :: X -> CaveKind -> ShowS
$cshowsPrec :: X -> CaveKind -> ShowS
Show
validateSingle :: CaveKind -> [Text]
validateSingle :: CaveKind -> [Text]
validateSingle CaveKind{..} =
let (minCellSizeX :: X
minCellSizeX, minCellSizeY :: X
minCellSizeY) = DiceXY -> (X, X)
Dice.infDiceXY DiceXY
ccellSize
(minMinSizeX :: X
minMinSizeX, minMinSizeY :: X
minMinSizeY) = DiceXY -> (X, X)
Dice.infDiceXY DiceXY
cminPlaceSize
(maxMinSizeX :: X
maxMinSizeX, maxMinSizeY :: X
maxMinSizeY) = DiceXY -> (X, X)
Dice.supDiceXY DiceXY
cminPlaceSize
(minMaxSizeX :: X
minMaxSizeX, minMaxSizeY :: X
minMaxSizeY) = DiceXY -> (X, X)
Dice.infDiceXY DiceXY
cmaxPlaceSize
in [ "cname longer than 25" | Text -> X
T.length Text
cname X -> X -> Bool
forall a. Ord a => a -> a -> Bool
> 25 ]
[Text] -> [Text] -> [Text]
forall a. [a] -> [a] -> [a]
++ [ "cXminSize < 20" | X
cXminSize X -> X -> Bool
forall a. Ord a => a -> a -> Bool
< 20 ]
[Text] -> [Text] -> [Text]
forall a. [a] -> [a] -> [a]
++ [ "cYminSize < 20" | X
cYminSize X -> X -> Bool
forall a. Ord a => a -> a -> Bool
< 20 ]
[Text] -> [Text] -> [Text]
forall a. [a] -> [a] -> [a]
++ [ "minCellSizeX < 1" | X
minCellSizeX X -> X -> Bool
forall a. Ord a => a -> a -> Bool
< 1 ]
[Text] -> [Text] -> [Text]
forall a. [a] -> [a] -> [a]
++ [ "minCellSizeY < 1" | X
minCellSizeY X -> X -> Bool
forall a. Ord a => a -> a -> Bool
< 1 ]
[Text] -> [Text] -> [Text]
forall a. [a] -> [a] -> [a]
++ [ "minCellSizeX < 6 && non-trivial stairs"
| X
minCellSizeX X -> X -> Bool
forall a. Ord a => a -> a -> Bool
< 6 Bool -> Bool -> Bool
&& Bool -> Bool
not (Freqs PlaceKind -> X
forall a. [a] -> X
length Freqs PlaceKind
cstairFreq X -> X -> Bool
forall a. Ord a => a -> a -> Bool
<= 1 Bool -> Bool -> Bool
&& Freqs PlaceKind -> Bool
forall a. [a] -> Bool
null Freqs PlaceKind
cescapeFreq) ]
[Text] -> [Text] -> [Text]
forall a. [a] -> [a] -> [a]
++ [ "minCellSizeY < 4 && non-trivial stairs"
| X
minCellSizeY X -> X -> Bool
forall a. Ord a => a -> a -> Bool
< 4 Bool -> Bool -> Bool
&& Bool -> Bool
not (Freqs PlaceKind -> X
forall a. [a] -> X
length Freqs PlaceKind
cstairFreq X -> X -> Bool
forall a. Ord a => a -> a -> Bool
<= 1 Bool -> Bool -> Bool
&& Freqs PlaceKind -> Bool
forall a. [a] -> Bool
null Freqs PlaceKind
cescapeFreq) ]
[Text] -> [Text] -> [Text]
forall a. [a] -> [a] -> [a]
++ [ "minMinSizeX < 5 && non-trivial stairs"
| X
minMinSizeX X -> X -> Bool
forall a. Ord a => a -> a -> Bool
< 5 Bool -> Bool -> Bool
&& Bool -> Bool
not (Freqs PlaceKind -> X
forall a. [a] -> X
length Freqs PlaceKind
cstairFreq X -> X -> Bool
forall a. Ord a => a -> a -> Bool
<= 1 Bool -> Bool -> Bool
&& Freqs PlaceKind -> Bool
forall a. [a] -> Bool
null Freqs PlaceKind
cescapeFreq) ]
[Text] -> [Text] -> [Text]
forall a. [a] -> [a] -> [a]
++ [ "minMinSizeY < 3 && non-trivial stairs"
| X
minMinSizeY X -> X -> Bool
forall a. Ord a => a -> a -> Bool
< 3 Bool -> Bool -> Bool
&& Bool -> Bool
not (Freqs PlaceKind -> X
forall a. [a] -> X
length Freqs PlaceKind
cstairFreq X -> X -> Bool
forall a. Ord a => a -> a -> Bool
<= 1 Bool -> Bool -> Bool
&& Freqs PlaceKind -> Bool
forall a. [a] -> Bool
null Freqs PlaceKind
cescapeFreq) ]
[Text] -> [Text] -> [Text]
forall a. [a] -> [a] -> [a]
++ [ "minMinSizeX < 1" | X
minMinSizeX X -> X -> Bool
forall a. Ord a => a -> a -> Bool
< 1 ]
[Text] -> [Text] -> [Text]
forall a. [a] -> [a] -> [a]
++ [ "minMinSizeY < 1" | X
minMinSizeY X -> X -> Bool
forall a. Ord a => a -> a -> Bool
< 1 ]
[Text] -> [Text] -> [Text]
forall a. [a] -> [a] -> [a]
++ [ "minMaxSizeX < maxMinSizeX" | X
minMaxSizeX X -> X -> Bool
forall a. Ord a => a -> a -> Bool
< X
maxMinSizeX ]
[Text] -> [Text] -> [Text]
forall a. [a] -> [a] -> [a]
++ [ "minMaxSizeY < maxMinSizeY" | X
minMaxSizeY X -> X -> Bool
forall a. Ord a => a -> a -> Bool
< X
maxMinSizeY ]
[Text] -> [Text] -> [Text]
forall a. [a] -> [a] -> [a]
++ [ "chidden < 0" | X
chidden X -> X -> Bool
forall a. Ord a => a -> a -> Bool
< 0 ]
[Text] -> [Text] -> [Text]
forall a. [a] -> [a] -> [a]
++ [ "cactorCoeff < 0" | X
cactorCoeff X -> X -> Bool
forall a. Ord a => a -> a -> Bool
< 0 ]
[Text] -> [Text] -> [Text]
forall a. [a] -> [a] -> [a]
++ [ "citemNum < 0" | Dice -> X
Dice.infDice Dice
citemNum X -> X -> Bool
forall a. Ord a => a -> a -> Bool
< 0 ]
[Text] -> [Text] -> [Text]
forall a. [a] -> [a] -> [a]
++ [ "cmaxStairsNum < 0" | Dice -> X
Dice.infDice Dice
cmaxStairsNum X -> X -> Bool
forall a. Ord a => a -> a -> Bool
< 0 ]
[Text] -> [Text] -> [Text]
forall a. [a] -> [a] -> [a]
++ [ "stairs suggested, but not defined"
| Dice -> X
Dice.supDice Dice
cmaxStairsNum X -> X -> Bool
forall a. Ord a => a -> a -> Bool
> 0 Bool -> Bool -> Bool
&& Freqs PlaceKind -> Bool
forall a. [a] -> Bool
null Freqs PlaceKind
cstairFreq ]
validateAll :: [CaveKind] -> ContentData CaveKind -> [Text]
validateAll :: [CaveKind] -> ContentData CaveKind -> [Text]
validateAll _ _ = []
mandatoryGroups :: [GroupName CaveKind]
mandatoryGroups :: [GroupName CaveKind]
mandatoryGroups =
[GroupName CaveKind
DEFAULT_RANDOM]
pattern DEFAULT_RANDOM :: GroupName CaveKind
pattern $bDEFAULT_RANDOM :: GroupName CaveKind
$mDEFAULT_RANDOM :: forall r. GroupName CaveKind -> (Void# -> r) -> (Void# -> r) -> r
DEFAULT_RANDOM = GroupName "default random"
makeData :: [CaveKind] -> [GroupName CaveKind] -> [GroupName CaveKind]
-> ContentData CaveKind
makeData :: [CaveKind]
-> [GroupName CaveKind]
-> [GroupName CaveKind]
-> ContentData CaveKind
makeData content :: [CaveKind]
content groupNamesSingleton :: [GroupName CaveKind]
groupNamesSingleton groupNames :: [GroupName CaveKind]
groupNames =
String
-> (CaveKind -> Text)
-> (CaveKind -> Freqs CaveKind)
-> (CaveKind -> [Text])
-> ([CaveKind] -> ContentData CaveKind -> [Text])
-> [CaveKind]
-> [GroupName CaveKind]
-> [GroupName CaveKind]
-> ContentData CaveKind
forall c.
Show c =>
String
-> (c -> Text)
-> (c -> Freqs c)
-> (c -> [Text])
-> ([c] -> ContentData c -> [Text])
-> [c]
-> [GroupName c]
-> [GroupName c]
-> ContentData c
makeContentData "CaveKind" CaveKind -> Text
cname CaveKind -> Freqs CaveKind
cfreq CaveKind -> [Text]
validateSingle [CaveKind] -> ContentData CaveKind -> [Text]
validateAll [CaveKind]
content
[GroupName CaveKind]
groupNamesSingleton
([GroupName CaveKind]
mandatoryGroups [GroupName CaveKind]
-> [GroupName CaveKind] -> [GroupName CaveKind]
forall a. [a] -> [a] -> [a]
++ [GroupName CaveKind]
groupNames)