feat(gs/xanthous): Add a Husk creature, with limited generation

Add a new "husk" creature raw, limited to only being generated on levels
>= 1, including support for actually doing that limiting.

These guys are gonna get daggers next!

Change-Id: Ic4b58dc7ee36b50ced60fec6912cd1b46269d55c
Reviewed-on: https://cl.tvl.fyi/c/depot/+/3868
Reviewed-by: grfn <grfn@gws.fyi>
Tested-by: BuildkiteCI
This commit is contained in:
Griffin Smith 2021-11-13 10:44:05 -05:00 committed by grfn
parent e2f8939a9e
commit 1af67d9ca7
9 changed files with 152 additions and 24 deletions

View file

@ -10,6 +10,7 @@ import qualified Xanthous.Data.MemoSpec
import qualified Xanthous.Data.NestedMapSpec
import qualified Xanthous.DataSpec
import qualified Xanthous.Entities.RawsSpec
import qualified Xanthous.Entities.RawTypesSpec
import qualified Xanthous.Entities.CharacterSpec
import qualified Xanthous.GameSpec
import qualified Xanthous.Game.StateSpec
@ -39,6 +40,7 @@ test = testGroup "Xanthous"
, Xanthous.DataSpec.test
, Xanthous.Entities.RawsSpec.test
, Xanthous.Entities.CharacterSpec.test
, Xanthous.Entities.RawTypesSpec.test
, Xanthous.GameSpec.test
, Xanthous.Game.StateSpec.test
, Xanthous.Game.PromptSpec.test

View file

@ -0,0 +1,28 @@
--------------------------------------------------------------------------------
module Xanthous.Entities.RawTypesSpec (main, test) where
--------------------------------------------------------------------------------
import Test.Prelude
--------------------------------------------------------------------------------
import Xanthous.Entities.RawTypes
--------------------------------------------------------------------------------
main :: IO ()
main = defaultMain test
test :: TestTree
test = testGroup "Xanthous.Entities.RawTypesSpec"
[ testGroup "CreatureGenerateParams"
[ testBatch $ monoid @CreatureGenerateParams mempty
, testGroup "canGenerate"
[ testProperty "no bounds" $ \level ->
let gps = CreatureGenerateParams Nothing Nothing
in canGenerate level gps
, testProperty "min bound" $ \level minB ->
let gps = CreatureGenerateParams (Just minB) Nothing
in canGenerate level gps === (level >= minB)
, testProperty "max bound" $ \level maxB ->
let gps = CreatureGenerateParams Nothing (Just maxB)
in canGenerate level gps === (level <= maxB)
]
]
]