{-# LANGUAGE DeriveGeneric #-}
module Game.LambdaHack.Content.ItemKind
( ItemKind(..), makeData
, Aspect(..), Effect(..), DetectKind(..), TimerDice, ThrowMod(..)
, boostItemKindList, forApplyEffect
, strengthOnSmash, getDropOrgans, getMandatoryHideAsFromKind, isEffEscape
, isEffEscapeOrAscend, timeoutAspect, onSmashEffect, damageUsefulness
, verbMsgNoLonger, verbMsgLess, toVelocity, toLinger
, timerNone, isTimerNone, foldTimer, toOrganBad, toOrganGood, toOrganNoTimer
#ifdef EXPOSE_INTERNAL
, boostItemKind, validateSingle, validateAll, validateDups, validateDamage
, hardwiredItemGroups
#endif
) where
import Prelude ()
import Game.LambdaHack.Core.Prelude
import Data.Binary
import Data.Hashable (Hashable)
import qualified Data.Text as T
import GHC.Generics (Generic)
import qualified System.Random as R
import qualified Game.LambdaHack.Core.Dice as Dice
import qualified Game.LambdaHack.Definition.Ability as Ability
import Game.LambdaHack.Definition.ContentData
import Game.LambdaHack.Definition.Defs
import Game.LambdaHack.Definition.Flavour
data ItemKind = ItemKind
{ ItemKind -> Char
isymbol :: Char
, ItemKind -> Text
iname :: Text
, ItemKind -> Freqs ItemKind
ifreq :: Freqs ItemKind
, ItemKind -> [Flavour]
iflavour :: [Flavour]
, ItemKind -> Dice
icount :: Dice.Dice
, ItemKind -> Rarity
irarity :: Rarity
, ItemKind -> Text
iverbHit :: Text
, ItemKind -> Int
iweight :: Int
, ItemKind -> Dice
idamage :: Dice.Dice
, ItemKind -> [Aspect]
iaspects :: [Aspect]
, ItemKind -> [Effect]
ieffects :: [Effect]
, ItemKind -> [(GroupName ItemKind, CStore)]
ikit :: [(GroupName ItemKind, CStore)]
, ItemKind -> Text
idesc :: Text
}
deriving (Int -> ItemKind -> ShowS
[ItemKind] -> ShowS
ItemKind -> String
(Int -> ItemKind -> ShowS)
-> (ItemKind -> String) -> ([ItemKind] -> ShowS) -> Show ItemKind
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ItemKind] -> ShowS
$cshowList :: [ItemKind] -> ShowS
show :: ItemKind -> String
$cshow :: ItemKind -> String
showsPrec :: Int -> ItemKind -> ShowS
$cshowsPrec :: Int -> ItemKind -> ShowS
Show, (forall x. ItemKind -> Rep ItemKind x)
-> (forall x. Rep ItemKind x -> ItemKind) -> Generic ItemKind
forall x. Rep ItemKind x -> ItemKind
forall x. ItemKind -> Rep ItemKind x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ItemKind x -> ItemKind
$cfrom :: forall x. ItemKind -> Rep ItemKind x
Generic)
data Aspect =
Timeout Dice.Dice
| AddSkill Ability.Skill Dice.Dice
| SetFlag Ability.Flag
| ELabel Text
| ToThrow ThrowMod
| HideAs (GroupName ItemKind)
| EqpSlot Ability.EqpSlot
| Odds Dice.Dice [Aspect] [Aspect]
deriving (Int -> Aspect -> ShowS
[Aspect] -> ShowS
Aspect -> String
(Int -> Aspect -> ShowS)
-> (Aspect -> String) -> ([Aspect] -> ShowS) -> Show Aspect
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Aspect] -> ShowS
$cshowList :: [Aspect] -> ShowS
show :: Aspect -> String
$cshow :: Aspect -> String
showsPrec :: Int -> Aspect -> ShowS
$cshowsPrec :: Int -> Aspect -> ShowS
Show, Aspect -> Aspect -> Bool
(Aspect -> Aspect -> Bool)
-> (Aspect -> Aspect -> Bool) -> Eq Aspect
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Aspect -> Aspect -> Bool
$c/= :: Aspect -> Aspect -> Bool
== :: Aspect -> Aspect -> Bool
$c== :: Aspect -> Aspect -> Bool
Eq, (forall x. Aspect -> Rep Aspect x)
-> (forall x. Rep Aspect x -> Aspect) -> Generic Aspect
forall x. Rep Aspect x -> Aspect
forall x. Aspect -> Rep Aspect x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Aspect x -> Aspect
$cfrom :: forall x. Aspect -> Rep Aspect x
Generic)
data Effect =
Burn Dice.Dice
| Explode (GroupName ItemKind)
| RefillHP Int
| RefillCalm Int
| Dominate
| Impress
| PutToSleep
| Yell
| Summon (GroupName ItemKind) Dice.Dice
| Ascend Bool
| Escape
| Paralyze Dice.Dice
| ParalyzeInWater Dice.Dice
| InsertMove Dice.Dice
| Teleport Dice.Dice
| CreateItem CStore (GroupName ItemKind) TimerDice
| DropItem Int Int CStore (GroupName ItemKind)
| PolyItem
| RerollItem
| DupItem
| Identify
| Detect DetectKind Int
| SendFlying ThrowMod
| PushActor ThrowMod
| PullActor ThrowMod
| DropBestWeapon
| ActivateInv Char
| ApplyPerfume
| OneOf [Effect]
| OnSmash Effect
| Composite [Effect]
| VerbNoLonger Text
| VerbMsg Text
deriving (Int -> Effect -> ShowS
[Effect] -> ShowS
Effect -> String
(Int -> Effect -> ShowS)
-> (Effect -> String) -> ([Effect] -> ShowS) -> Show Effect
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Effect] -> ShowS
$cshowList :: [Effect] -> ShowS
show :: Effect -> String
$cshow :: Effect -> String
showsPrec :: Int -> Effect -> ShowS
$cshowsPrec :: Int -> Effect -> ShowS
Show, Effect -> Effect -> Bool
(Effect -> Effect -> Bool)
-> (Effect -> Effect -> Bool) -> Eq Effect
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Effect -> Effect -> Bool
$c/= :: Effect -> Effect -> Bool
== :: Effect -> Effect -> Bool
$c== :: Effect -> Effect -> Bool
Eq, (forall x. Effect -> Rep Effect x)
-> (forall x. Rep Effect x -> Effect) -> Generic Effect
forall x. Rep Effect x -> Effect
forall x. Effect -> Rep Effect x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Effect x -> Effect
$cfrom :: forall x. Effect -> Rep Effect x
Generic)
data DetectKind =
DetectAll
| DetectActor
| DetectLoot
| DetectExit
| DetectHidden
| DetectEmbed
deriving (Int -> DetectKind -> ShowS
[DetectKind] -> ShowS
DetectKind -> String
(Int -> DetectKind -> ShowS)
-> (DetectKind -> String)
-> ([DetectKind] -> ShowS)
-> Show DetectKind
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DetectKind] -> ShowS
$cshowList :: [DetectKind] -> ShowS
show :: DetectKind -> String
$cshow :: DetectKind -> String
showsPrec :: Int -> DetectKind -> ShowS
$cshowsPrec :: Int -> DetectKind -> ShowS
Show, DetectKind -> DetectKind -> Bool
(DetectKind -> DetectKind -> Bool)
-> (DetectKind -> DetectKind -> Bool) -> Eq DetectKind
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DetectKind -> DetectKind -> Bool
$c/= :: DetectKind -> DetectKind -> Bool
== :: DetectKind -> DetectKind -> Bool
$c== :: DetectKind -> DetectKind -> Bool
Eq, (forall x. DetectKind -> Rep DetectKind x)
-> (forall x. Rep DetectKind x -> DetectKind) -> Generic DetectKind
forall x. Rep DetectKind x -> DetectKind
forall x. DetectKind -> Rep DetectKind x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DetectKind x -> DetectKind
$cfrom :: forall x. DetectKind -> Rep DetectKind x
Generic)
data TimerDice =
TimerNone
| TimerGameTurn Dice.Dice
| TimerActorTurn Dice.Dice
deriving (TimerDice -> TimerDice -> Bool
(TimerDice -> TimerDice -> Bool)
-> (TimerDice -> TimerDice -> Bool) -> Eq TimerDice
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TimerDice -> TimerDice -> Bool
$c/= :: TimerDice -> TimerDice -> Bool
== :: TimerDice -> TimerDice -> Bool
$c== :: TimerDice -> TimerDice -> Bool
Eq, (forall x. TimerDice -> Rep TimerDice x)
-> (forall x. Rep TimerDice x -> TimerDice) -> Generic TimerDice
forall x. Rep TimerDice x -> TimerDice
forall x. TimerDice -> Rep TimerDice x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep TimerDice x -> TimerDice
$cfrom :: forall x. TimerDice -> Rep TimerDice x
Generic)
instance Show TimerDice where
show :: TimerDice -> String
show TimerNone = "0"
show (TimerGameTurn nDm :: Dice
nDm) =
Dice -> String
forall a. Show a => a -> String
show Dice
nDm String -> ShowS
forall a. [a] -> [a] -> [a]
++ " " String -> ShowS
forall a. [a] -> [a] -> [a]
++ if Dice
nDm Dice -> Dice -> Bool
forall a. Eq a => a -> a -> Bool
== 1 then "turn" else "turns"
show (TimerActorTurn nDm :: Dice
nDm) =
Dice -> String
forall a. Show a => a -> String
show Dice
nDm String -> ShowS
forall a. [a] -> [a] -> [a]
++ " " String -> ShowS
forall a. [a] -> [a] -> [a]
++ if Dice
nDm Dice -> Dice -> Bool
forall a. Eq a => a -> a -> Bool
== 1 then "move" else "moves"
data ThrowMod = ThrowMod
{ ThrowMod -> Int
throwVelocity :: Int
, ThrowMod -> Int
throwLinger :: Int
, ThrowMod -> Int
throwHP :: Int
}
deriving (Int -> ThrowMod -> ShowS
[ThrowMod] -> ShowS
ThrowMod -> String
(Int -> ThrowMod -> ShowS)
-> (ThrowMod -> String) -> ([ThrowMod] -> ShowS) -> Show ThrowMod
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ThrowMod] -> ShowS
$cshowList :: [ThrowMod] -> ShowS
show :: ThrowMod -> String
$cshow :: ThrowMod -> String
showsPrec :: Int -> ThrowMod -> ShowS
$cshowsPrec :: Int -> ThrowMod -> ShowS
Show, ThrowMod -> ThrowMod -> Bool
(ThrowMod -> ThrowMod -> Bool)
-> (ThrowMod -> ThrowMod -> Bool) -> Eq ThrowMod
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ThrowMod -> ThrowMod -> Bool
$c/= :: ThrowMod -> ThrowMod -> Bool
== :: ThrowMod -> ThrowMod -> Bool
$c== :: ThrowMod -> ThrowMod -> Bool
Eq, Eq ThrowMod
Eq ThrowMod =>
(ThrowMod -> ThrowMod -> Ordering)
-> (ThrowMod -> ThrowMod -> Bool)
-> (ThrowMod -> ThrowMod -> Bool)
-> (ThrowMod -> ThrowMod -> Bool)
-> (ThrowMod -> ThrowMod -> Bool)
-> (ThrowMod -> ThrowMod -> ThrowMod)
-> (ThrowMod -> ThrowMod -> ThrowMod)
-> Ord ThrowMod
ThrowMod -> ThrowMod -> Bool
ThrowMod -> ThrowMod -> Ordering
ThrowMod -> ThrowMod -> ThrowMod
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: ThrowMod -> ThrowMod -> ThrowMod
$cmin :: ThrowMod -> ThrowMod -> ThrowMod
max :: ThrowMod -> ThrowMod -> ThrowMod
$cmax :: ThrowMod -> ThrowMod -> ThrowMod
>= :: ThrowMod -> ThrowMod -> Bool
$c>= :: ThrowMod -> ThrowMod -> Bool
> :: ThrowMod -> ThrowMod -> Bool
$c> :: ThrowMod -> ThrowMod -> Bool
<= :: ThrowMod -> ThrowMod -> Bool
$c<= :: ThrowMod -> ThrowMod -> Bool
< :: ThrowMod -> ThrowMod -> Bool
$c< :: ThrowMod -> ThrowMod -> Bool
compare :: ThrowMod -> ThrowMod -> Ordering
$ccompare :: ThrowMod -> ThrowMod -> Ordering
$cp1Ord :: Eq ThrowMod
Ord, (forall x. ThrowMod -> Rep ThrowMod x)
-> (forall x. Rep ThrowMod x -> ThrowMod) -> Generic ThrowMod
forall x. Rep ThrowMod x -> ThrowMod
forall x. ThrowMod -> Rep ThrowMod x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ThrowMod x -> ThrowMod
$cfrom :: forall x. ThrowMod -> Rep ThrowMod x
Generic)
instance Binary Effect
instance Binary DetectKind
instance Binary TimerDice
instance Binary ThrowMod
instance Hashable ThrowMod
boostItemKindList :: R.StdGen -> [ItemKind] -> [ItemKind]
boostItemKindList :: StdGen -> [ItemKind] -> [ItemKind]
boostItemKindList _ [] = []
boostItemKindList initialGen :: StdGen
initialGen l :: [ItemKind]
l =
let (r :: Int
r, _) = (Int, Int) -> StdGen -> (Int, StdGen)
forall a g. (Random a, RandomGen g) => (a, a) -> g -> (a, g)
R.randomR (0, [ItemKind] -> Int
forall a. [a] -> Int
length [ItemKind]
l Int -> Int -> Int
forall a. Num a => a -> a -> a
- 1) StdGen
initialGen
in case Int -> [ItemKind] -> ([ItemKind], [ItemKind])
forall a. Int -> [a] -> ([a], [a])
splitAt Int
r [ItemKind]
l of
(pre :: [ItemKind]
pre, i :: ItemKind
i : post :: [ItemKind]
post) -> [ItemKind]
pre [ItemKind] -> [ItemKind] -> [ItemKind]
forall a. [a] -> [a] -> [a]
++ ItemKind -> ItemKind
boostItemKind ItemKind
i ItemKind -> [ItemKind] -> [ItemKind]
forall a. a -> [a] -> [a]
: [ItemKind]
post
_ -> String -> [ItemKind]
forall a. HasCallStack => String -> a
error (String -> [ItemKind]) -> String -> [ItemKind]
forall a b. (a -> b) -> a -> b
$ "" String -> [ItemKind] -> String
forall v. Show v => String -> v -> String
`showFailure` [ItemKind]
l
boostItemKind :: ItemKind -> ItemKind
boostItemKind :: ItemKind -> ItemKind
boostItemKind i :: ItemKind
i =
let mainlineLabel :: (a, b) -> Bool
mainlineLabel (label :: a
label, _) =
a
label a -> [a] -> Bool
forall (t :: * -> *) a. (Foldable t, Eq a) => a -> t a -> Bool
`elem` ["common item", "curious item", "treasure"]
in if ((GroupName ItemKind, Int) -> Bool) -> Freqs ItemKind -> Bool
forall (t :: * -> *) a. Foldable t => (a -> Bool) -> t a -> Bool
any (GroupName ItemKind, Int) -> Bool
forall a b. (Eq a, IsString a) => (a, b) -> Bool
mainlineLabel (ItemKind -> Freqs ItemKind
ifreq ItemKind
i)
then ItemKind
i { ifreq :: Freqs ItemKind
ifreq = ("common item", 10000) (GroupName ItemKind, Int) -> Freqs ItemKind -> Freqs ItemKind
forall a. a -> [a] -> [a]
: ((GroupName ItemKind, Int) -> Bool)
-> Freqs ItemKind -> Freqs ItemKind
forall a. (a -> Bool) -> [a] -> [a]
filter (Bool -> Bool
not (Bool -> Bool)
-> ((GroupName ItemKind, Int) -> Bool)
-> (GroupName ItemKind, Int)
-> Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (GroupName ItemKind, Int) -> Bool
forall a b. (Eq a, IsString a) => (a, b) -> Bool
mainlineLabel) (ItemKind -> Freqs ItemKind
ifreq ItemKind
i)
, iaspects :: [Aspect]
iaspects = Aspect -> [Aspect] -> [Aspect]
forall a. Eq a => a -> [a] -> [a]
delete (Flag -> Aspect
SetFlag Flag
Ability.Unique) ([Aspect] -> [Aspect]) -> [Aspect] -> [Aspect]
forall a b. (a -> b) -> a -> b
$ ItemKind -> [Aspect]
iaspects ItemKind
i
}
else ItemKind
i
forApplyEffect :: Effect -> Bool
forApplyEffect :: Effect -> Bool
forApplyEffect eff :: Effect
eff = case Effect
eff of
OnSmash{} -> Bool
False
Composite effs :: [Effect]
effs -> (Effect -> Bool) -> [Effect] -> Bool
forall (t :: * -> *) a. Foldable t => (a -> Bool) -> t a -> Bool
any Effect -> Bool
forApplyEffect [Effect]
effs
VerbNoLonger{} -> Bool
False
VerbMsg{} -> Bool
False
ParalyzeInWater{} -> Bool
False
_ -> Bool
True
isEffEscape :: Effect -> Bool
isEffEscape :: Effect -> Bool
isEffEscape Escape{} = Bool
True
isEffEscape (OneOf l :: [Effect]
l) = (Effect -> Bool) -> [Effect] -> Bool
forall (t :: * -> *) a. Foldable t => (a -> Bool) -> t a -> Bool
any Effect -> Bool
isEffEscape [Effect]
l
isEffEscape (Composite l :: [Effect]
l) = (Effect -> Bool) -> [Effect] -> Bool
forall (t :: * -> *) a. Foldable t => (a -> Bool) -> t a -> Bool
any Effect -> Bool
isEffEscape [Effect]
l
isEffEscape _ = Bool
False
isEffEscapeOrAscend :: Effect -> Bool
isEffEscapeOrAscend :: Effect -> Bool
isEffEscapeOrAscend Ascend{} = Bool
True
isEffEscapeOrAscend Escape{} = Bool
True
isEffEscapeOrAscend (OneOf l :: [Effect]
l) = (Effect -> Bool) -> [Effect] -> Bool
forall (t :: * -> *) a. Foldable t => (a -> Bool) -> t a -> Bool
any Effect -> Bool
isEffEscapeOrAscend [Effect]
l
isEffEscapeOrAscend (Composite l :: [Effect]
l) = (Effect -> Bool) -> [Effect] -> Bool
forall (t :: * -> *) a. Foldable t => (a -> Bool) -> t a -> Bool
any Effect -> Bool
isEffEscapeOrAscend [Effect]
l
isEffEscapeOrAscend _ = Bool
False
timeoutAspect :: Aspect -> Bool
timeoutAspect :: Aspect -> Bool
timeoutAspect Timeout{} = Bool
True
timeoutAspect _ = Bool
False
onSmashEffect :: Effect -> Bool
onSmashEffect :: Effect -> Bool
onSmashEffect OnSmash{} = Bool
True
onSmashEffect _ = Bool
False
strengthOnSmash :: ItemKind -> [Effect]
strengthOnSmash :: ItemKind -> [Effect]
strengthOnSmash =
let f :: Effect -> [Effect]
f (OnSmash eff :: Effect
eff) = [Effect
eff]
f _ = []
in (Effect -> [Effect]) -> [Effect] -> [Effect]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap Effect -> [Effect]
f ([Effect] -> [Effect])
-> (ItemKind -> [Effect]) -> ItemKind -> [Effect]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ItemKind -> [Effect]
ieffects
getDropOrgans :: ItemKind -> [GroupName ItemKind]
getDropOrgans :: ItemKind -> [GroupName ItemKind]
getDropOrgans =
let f :: Effect -> [GroupName ItemKind]
f (DropItem _ _ COrgan grp :: GroupName ItemKind
grp) = [GroupName ItemKind
grp]
f Impress = ["impressed"]
f (OneOf l :: [Effect]
l) = (Effect -> [GroupName ItemKind])
-> [Effect] -> [GroupName ItemKind]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap Effect -> [GroupName ItemKind]
f [Effect]
l
f (Composite l :: [Effect]
l) = (Effect -> [GroupName ItemKind])
-> [Effect] -> [GroupName ItemKind]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap Effect -> [GroupName ItemKind]
f [Effect]
l
f _ = []
in (Effect -> [GroupName ItemKind])
-> [Effect] -> [GroupName ItemKind]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap Effect -> [GroupName ItemKind]
f ([Effect] -> [GroupName ItemKind])
-> (ItemKind -> [Effect]) -> ItemKind -> [GroupName ItemKind]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ItemKind -> [Effect]
ieffects
getMandatoryHideAsFromKind :: ItemKind -> Maybe (GroupName ItemKind)
getMandatoryHideAsFromKind :: ItemKind -> Maybe (GroupName ItemKind)
getMandatoryHideAsFromKind itemKind :: ItemKind
itemKind =
let f :: Aspect -> [GroupName ItemKind]
f (HideAs grp :: GroupName ItemKind
grp) = [GroupName ItemKind
grp]
f _ = []
in [GroupName ItemKind] -> Maybe (GroupName ItemKind)
forall a. [a] -> Maybe a
listToMaybe ([GroupName ItemKind] -> Maybe (GroupName ItemKind))
-> [GroupName ItemKind] -> Maybe (GroupName ItemKind)
forall a b. (a -> b) -> a -> b
$ (Aspect -> [GroupName ItemKind])
-> [Aspect] -> [GroupName ItemKind]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap Aspect -> [GroupName ItemKind]
f (ItemKind -> [Aspect]
iaspects ItemKind
itemKind)
damageUsefulness :: ItemKind -> Double
damageUsefulness :: ItemKind -> Double
damageUsefulness itemKind :: ItemKind
itemKind =
let v :: Double
v = Double -> Double -> Double
forall a. Ord a => a -> a -> a
min 1000 (10 Double -> Double -> Double
forall a. Num a => a -> a -> a
* Dice -> Double
Dice.meanDice (ItemKind -> Dice
idamage ItemKind
itemKind))
in Bool -> Double -> Double
forall a. HasCallStack => Bool -> a -> a
assert (Double
v Double -> Double -> Bool
forall a. Ord a => a -> a -> Bool
>= 0) Double
v
verbMsgNoLonger :: Text -> Effect
verbMsgNoLonger :: Text -> Effect
verbMsgNoLonger name :: Text
name = Text -> Effect
VerbNoLonger (Text -> Effect) -> Text -> Effect
forall a b. (a -> b) -> a -> b
$ "be no longer" Text -> Text -> Text
<+> Text
name
verbMsgLess :: Text -> Effect
verbMsgLess :: Text -> Effect
verbMsgLess name :: Text
name = Text -> Effect
VerbMsg (Text -> Effect) -> Text -> Effect
forall a b. (a -> b) -> a -> b
$ "look less" Text -> Text -> Text
<+> Text
name
toVelocity :: Int -> Aspect
toVelocity :: Int -> Aspect
toVelocity n :: Int
n = ThrowMod -> Aspect
ToThrow (ThrowMod -> Aspect) -> ThrowMod -> Aspect
forall a b. (a -> b) -> a -> b
$ Int -> Int -> Int -> ThrowMod
ThrowMod Int
n 100 1
toLinger :: Int -> Aspect
toLinger :: Int -> Aspect
toLinger n :: Int
n = ThrowMod -> Aspect
ToThrow (ThrowMod -> Aspect) -> ThrowMod -> Aspect
forall a b. (a -> b) -> a -> b
$ Int -> Int -> Int -> ThrowMod
ThrowMod 100 Int
n 1
timerNone :: TimerDice
timerNone :: TimerDice
timerNone = TimerDice
TimerNone
isTimerNone :: TimerDice -> Bool
isTimerNone :: TimerDice -> Bool
isTimerNone tim :: TimerDice
tim = TimerDice
tim TimerDice -> TimerDice -> Bool
forall a. Eq a => a -> a -> Bool
== TimerDice
TimerNone
foldTimer :: a -> (Dice.Dice -> a) -> (Dice.Dice -> a) -> TimerDice -> a
foldTimer :: a -> (Dice -> a) -> (Dice -> a) -> TimerDice -> a
foldTimer a :: a
a fgame :: Dice -> a
fgame factor :: Dice -> a
factor tim :: TimerDice
tim = case TimerDice
tim of
TimerNone -> a
a
TimerGameTurn nDm :: Dice
nDm -> Dice -> a
fgame Dice
nDm
TimerActorTurn nDm :: Dice
nDm -> Dice -> a
factor Dice
nDm
toOrganBad :: GroupName ItemKind -> Dice.Dice -> Effect
toOrganBad :: GroupName ItemKind -> Dice -> Effect
toOrganBad grp :: GroupName ItemKind
grp nDm :: Dice
nDm =
Bool -> Effect -> Effect
forall a. HasCallStack => Bool -> a -> a
assert (Dice -> Int
Dice.infDice Dice
nDm Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
> 0
Bool -> (String, (GroupName ItemKind, Dice)) -> Bool
forall a. Show a => Bool -> a -> Bool
`blame` "dice at organ creation should always roll above zero"
String
-> (GroupName ItemKind, Dice)
-> (String, (GroupName ItemKind, Dice))
forall v. String -> v -> (String, v)
`swith` (GroupName ItemKind
grp, Dice
nDm))
(Effect -> Effect) -> Effect -> Effect
forall a b. (a -> b) -> a -> b
$ CStore -> GroupName ItemKind -> TimerDice -> Effect
CreateItem CStore
COrgan GroupName ItemKind
grp (Dice -> TimerDice
TimerGameTurn Dice
nDm)
toOrganGood :: GroupName ItemKind -> Dice.Dice -> Effect
toOrganGood :: GroupName ItemKind -> Dice -> Effect
toOrganGood grp :: GroupName ItemKind
grp nDm :: Dice
nDm =
Bool -> Effect -> Effect
forall a. HasCallStack => Bool -> a -> a
assert (Dice -> Int
Dice.infDice Dice
nDm Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
> 0
Bool -> (String, (GroupName ItemKind, Dice)) -> Bool
forall a. Show a => Bool -> a -> Bool
`blame` "dice at organ creation should always roll above zero"
String
-> (GroupName ItemKind, Dice)
-> (String, (GroupName ItemKind, Dice))
forall v. String -> v -> (String, v)
`swith` (GroupName ItemKind
grp, Dice
nDm))
(Effect -> Effect) -> Effect -> Effect
forall a b. (a -> b) -> a -> b
$ CStore -> GroupName ItemKind -> TimerDice -> Effect
CreateItem CStore
COrgan GroupName ItemKind
grp (Dice -> TimerDice
TimerActorTurn Dice
nDm)
toOrganNoTimer :: GroupName ItemKind -> Effect
toOrganNoTimer :: GroupName ItemKind -> Effect
toOrganNoTimer grp :: GroupName ItemKind
grp = CStore -> GroupName ItemKind -> TimerDice -> Effect
CreateItem CStore
COrgan GroupName ItemKind
grp TimerDice
TimerNone
validateSingle :: ItemKind -> [Text]
validateSingle :: ItemKind -> [Text]
validateSingle ik :: ItemKind
ik@ItemKind{..} =
["iname longer than 23" | Text -> Int
T.length Text
iname Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
> 23]
[Text] -> [Text] -> [Text]
forall a. [a] -> [a] -> [a]
++ ["icount < 0" | Dice -> Int
Dice.infDice Dice
icount Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
< 0]
[Text] -> [Text] -> [Text]
forall a. [a] -> [a] -> [a]
++ Rarity -> [Text]
validateRarity Rarity
irarity
[Text] -> [Text] -> [Text]
forall a. [a] -> [a] -> [a]
++ Dice -> [Text]
validateDamage Dice
idamage
[Text] -> [Text] -> [Text]
forall a. [a] -> [a] -> [a]
++ (let ts :: [Aspect]
ts = (Aspect -> Bool) -> [Aspect] -> [Aspect]
forall a. (a -> Bool) -> [a] -> [a]
filter Aspect -> Bool
timeoutAspect [Aspect]
iaspects
in ["more than one Timeout specification" | [Aspect] -> Int
forall a. [a] -> Int
length [Aspect]
ts Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
> 1])
[Text] -> [Text] -> [Text]
forall a. [a] -> [a] -> [a]
++ [ "Conflicting Fragile and Durable"
| Flag -> Aspect
SetFlag Flag
Ability.Fragile Aspect -> [Aspect] -> Bool
forall (t :: * -> *) a. (Foldable t, Eq a) => a -> t a -> Bool
`elem` [Aspect]
iaspects
Bool -> Bool -> Bool
&& Flag -> Aspect
SetFlag Flag
Ability.Durable Aspect -> [Aspect] -> Bool
forall (t :: * -> *) a. (Foldable t, Eq a) => a -> t a -> Bool
`elem` [Aspect]
iaspects ]
[Text] -> [Text] -> [Text]
forall a. [a] -> [a] -> [a]
++ (let f :: Aspect -> Bool
f :: Aspect -> Bool
f EqpSlot{} = Bool
True
f _ = Bool
False
ts :: [Aspect]
ts = (Aspect -> Bool) -> [Aspect] -> [Aspect]
forall a. (a -> Bool) -> [a] -> [a]
filter Aspect -> Bool
f [Aspect]
iaspects
in [ "EqpSlot specified but not Equipable nor Meleeable"
| [Aspect] -> Int
forall a. [a] -> Int
length [Aspect]
ts Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
> 0 Bool -> Bool -> Bool
&& Flag -> Aspect
SetFlag Flag
Ability.Equipable Aspect -> [Aspect] -> Bool
forall (t :: * -> *) a. (Foldable t, Eq a) => a -> t a -> Bool
`notElem` [Aspect]
iaspects
Bool -> Bool -> Bool
&& Flag -> Aspect
SetFlag Flag
Ability.Meleeable Aspect -> [Aspect] -> Bool
forall (t :: * -> *) a. (Foldable t, Eq a) => a -> t a -> Bool
`notElem` [Aspect]
iaspects ])
[Text] -> [Text] -> [Text]
forall a. [a] -> [a] -> [a]
++ [ "Redundant Equipable or Meleeable"
| Flag -> Aspect
SetFlag Flag
Ability.Equipable Aspect -> [Aspect] -> Bool
forall (t :: * -> *) a. (Foldable t, Eq a) => a -> t a -> Bool
`elem` [Aspect]
iaspects
Bool -> Bool -> Bool
&& Flag -> Aspect
SetFlag Flag
Ability.Meleeable Aspect -> [Aspect] -> Bool
forall (t :: * -> *) a. (Foldable t, Eq a) => a -> t a -> Bool
`elem` [Aspect]
iaspects ]
[Text] -> [Text] -> [Text]
forall a. [a] -> [a] -> [a]
++ [ "Conflicting Durable and Blast"
| Flag -> Aspect
SetFlag Flag
Ability.Durable Aspect -> [Aspect] -> Bool
forall (t :: * -> *) a. (Foldable t, Eq a) => a -> t a -> Bool
`elem` [Aspect]
iaspects
Bool -> Bool -> Bool
&& Flag -> Aspect
SetFlag Flag
Ability.Blast Aspect -> [Aspect] -> Bool
forall (t :: * -> *) a. (Foldable t, Eq a) => a -> t a -> Bool
`elem` [Aspect]
iaspects ]
[Text] -> [Text] -> [Text]
forall a. [a] -> [a] -> [a]
++ [ "Conflicting Durable and Condition"
| Flag -> Aspect
SetFlag Flag
Ability.Durable Aspect -> [Aspect] -> Bool
forall (t :: * -> *) a. (Foldable t, Eq a) => a -> t a -> Bool
`elem` [Aspect]
iaspects
Bool -> Bool -> Bool
&& Flag -> Aspect
SetFlag Flag
Ability.Condition Aspect -> [Aspect] -> Bool
forall (t :: * -> *) a. (Foldable t, Eq a) => a -> t a -> Bool
`elem` [Aspect]
iaspects ]
[Text] -> [Text] -> [Text]
forall a. [a] -> [a] -> [a]
++ [ "Conflicting Blast and Condition"
| Flag -> Aspect
SetFlag Flag
Ability.Blast Aspect -> [Aspect] -> Bool
forall (t :: * -> *) a. (Foldable t, Eq a) => a -> t a -> Bool
`elem` [Aspect]
iaspects
Bool -> Bool -> Bool
&& Flag -> Aspect
SetFlag Flag
Ability.Condition Aspect -> [Aspect] -> Bool
forall (t :: * -> *) a. (Foldable t, Eq a) => a -> t a -> Bool
`elem` [Aspect]
iaspects ]
[Text] -> [Text] -> [Text]
forall a. [a] -> [a] -> [a]
++ (let f :: Aspect -> Bool
f :: Aspect -> Bool
f ELabel{} = Bool
True
f _ = Bool
False
ts :: [Aspect]
ts = (Aspect -> Bool) -> [Aspect] -> [Aspect]
forall a. (a -> Bool) -> [a] -> [a]
filter Aspect -> Bool
f [Aspect]
iaspects
in ["more than one ELabel specification" | [Aspect] -> Int
forall a. [a] -> Int
length [Aspect]
ts Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
> 1])
[Text] -> [Text] -> [Text]
forall a. [a] -> [a] -> [a]
++ (let f :: Aspect -> Bool
f :: Aspect -> Bool
f ToThrow{} = Bool
True
f _ = Bool
False
ts :: [Aspect]
ts = (Aspect -> Bool) -> [Aspect] -> [Aspect]
forall a. (a -> Bool) -> [a] -> [a]
filter Aspect -> Bool
f [Aspect]
iaspects
in ["more than one ToThrow specification" | [Aspect] -> Int
forall a. [a] -> Int
length [Aspect]
ts Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
> 1])
[Text] -> [Text] -> [Text]
forall a. [a] -> [a] -> [a]
++ (let f :: Aspect -> Bool
f :: Aspect -> Bool
f HideAs{} = Bool
True
f _ = Bool
False
ts :: [Aspect]
ts = (Aspect -> Bool) -> [Aspect] -> [Aspect]
forall a. (a -> Bool) -> [a] -> [a]
filter Aspect -> Bool
f [Aspect]
iaspects
in ["more than one HideAs specification" | [Aspect] -> Int
forall a. [a] -> Int
length [Aspect]
ts Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
> 1])
[Text] -> [Text] -> [Text]
forall a. [a] -> [a] -> [a]
++ (Aspect -> [Text]) -> [Aspect] -> [Text]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap (ItemKind -> Aspect -> [Text]
validateDups ItemKind
ik) ((Flag -> Aspect) -> [Flag] -> [Aspect]
forall a b. (a -> b) -> [a] -> [b]
map Flag -> Aspect
SetFlag [Flag
forall a. Bounded a => a
minBound .. Flag
forall a. Bounded a => a
maxBound])
[Text] -> [Text] -> [Text]
forall a. [a] -> [a] -> [a]
++ (let f :: Effect -> Bool
f :: Effect -> Bool
f VerbMsg{} = Bool
True
f _ = Bool
False
in [Effect] -> Text -> (Effect -> Bool) -> [Text]
validateOnlyOne [Effect]
ieffects "VerbMsg" Effect -> Bool
f)
[Text] -> [Text] -> [Text]
forall a. [a] -> [a] -> [a]
++ (let f :: Effect -> Bool
f :: Effect -> Bool
f VerbNoLonger{} = Bool
True
f _ = Bool
False
in [Effect] -> Text -> (Effect -> Bool) -> [Text]
validateOnlyOne [Effect]
ieffects "VerbNoLonger" Effect -> Bool
f)
[Text] -> [Text] -> [Text]
forall a. [a] -> [a] -> [a]
++ ([Effect] -> Text -> (Effect -> Bool) -> [Text]
validateNotNested [Effect]
ieffects "OnSmash" Effect -> Bool
onSmashEffect)
validateOnlyOne :: [Effect] -> Text -> (Effect -> Bool) -> [Text]
validateOnlyOne :: [Effect] -> Text -> (Effect -> Bool) -> [Text]
validateOnlyOne effs :: [Effect]
effs t :: Text
t f :: Effect -> Bool
f =
let ts :: [Effect]
ts = (Effect -> Bool) -> [Effect] -> [Effect]
forall a. (a -> Bool) -> [a] -> [a]
filter Effect -> Bool
f [Effect]
effs
in ["more than one" Text -> Text -> Text
<+> Text
t Text -> Text -> Text
<+> "specification" | [Effect] -> Int
forall a. [a] -> Int
length [Effect]
ts Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
> 1]
validateNotNested :: [Effect] -> Text -> (Effect -> Bool) -> [Text]
validateNotNested :: [Effect] -> Text -> (Effect -> Bool) -> [Text]
validateNotNested effs :: [Effect]
effs t :: Text
t f :: Effect -> Bool
f =
let g :: Effect -> Bool
g (OneOf l :: [Effect]
l) = (Effect -> Bool) -> [Effect] -> Bool
forall (t :: * -> *) a. Foldable t => (a -> Bool) -> t a -> Bool
any Effect -> Bool
f [Effect]
l Bool -> Bool -> Bool
|| (Effect -> Bool) -> [Effect] -> Bool
forall (t :: * -> *) a. Foldable t => (a -> Bool) -> t a -> Bool
any Effect -> Bool
g [Effect]
l
g (OnSmash effect :: Effect
effect) = Effect -> Bool
f Effect
effect Bool -> Bool -> Bool
|| Effect -> Bool
g Effect
effect
g (Composite l :: [Effect]
l) = (Effect -> Bool) -> [Effect] -> Bool
forall (t :: * -> *) a. Foldable t => (a -> Bool) -> t a -> Bool
any Effect -> Bool
f [Effect]
l Bool -> Bool -> Bool
|| (Effect -> Bool) -> [Effect] -> Bool
forall (t :: * -> *) a. Foldable t => (a -> Bool) -> t a -> Bool
any Effect -> Bool
g [Effect]
l
g _ = Bool
False
ts :: [Effect]
ts = (Effect -> Bool) -> [Effect] -> [Effect]
forall a. (a -> Bool) -> [a] -> [a]
filter Effect -> Bool
g [Effect]
effs
in [ "effect" Text -> Text -> Text
<+> Text
t Text -> Text -> Text
<+> "should be specified at top level, not nested"
| [Effect] -> Int
forall a. [a] -> Int
length [Effect]
ts Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
> 0 ]
validateDups :: ItemKind -> Aspect -> [Text]
validateDups :: ItemKind -> Aspect -> [Text]
validateDups ItemKind{..} feat :: Aspect
feat =
let ts :: [Aspect]
ts = (Aspect -> Bool) -> [Aspect] -> [Aspect]
forall a. (a -> Bool) -> [a] -> [a]
filter (Aspect -> Aspect -> Bool
forall a. Eq a => a -> a -> Bool
== Aspect
feat) [Aspect]
iaspects
in ["more than one" Text -> Text -> Text
<+> Aspect -> Text
forall a. Show a => a -> Text
tshow Aspect
feat Text -> Text -> Text
<+> "specification" | [Aspect] -> Int
forall a. [a] -> Int
length [Aspect]
ts Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
> 1]
validateDamage :: Dice.Dice -> [Text]
validateDamage :: Dice -> [Text]
validateDamage dice :: Dice
dice = [ "potentially negative dice:" Text -> Text -> Text
<+> Dice -> Text
forall a. Show a => a -> Text
tshow Dice
dice
| Dice -> Int
Dice.infDice Dice
dice Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
< 0]
validateAll :: [ItemKind] -> ContentData ItemKind -> [Text]
validateAll :: [ItemKind] -> ContentData ItemKind -> [Text]
validateAll content :: [ItemKind]
content coitem :: ContentData ItemKind
coitem =
let missingKitGroups :: [GroupName ItemKind]
missingKitGroups = [ GroupName ItemKind
cgroup
| ItemKind
k <- [ItemKind]
content
, (cgroup :: GroupName ItemKind
cgroup, _) <- ItemKind -> [(GroupName ItemKind, CStore)]
ikit ItemKind
k
, Bool -> Bool
not (Bool -> Bool) -> Bool -> Bool
forall a b. (a -> b) -> a -> b
$ ContentData ItemKind -> GroupName ItemKind -> Bool
forall a. ContentData a -> GroupName a -> Bool
omemberGroup ContentData ItemKind
coitem GroupName ItemKind
cgroup ]
f :: Aspect -> Bool
f :: Aspect -> Bool
f HideAs{} = Bool
True
f _ = Bool
False
wrongHideAsGroups :: [GroupName ItemKind]
wrongHideAsGroups =
[ GroupName ItemKind
cgroup
| ItemKind
k <- [ItemKind]
content
, let (cgroup :: GroupName ItemKind
cgroup, notSingleton :: Bool
notSingleton) = case (Aspect -> Bool) -> [Aspect] -> Maybe Aspect
forall (t :: * -> *) a. Foldable t => (a -> Bool) -> t a -> Maybe a
find Aspect -> Bool
f (ItemKind -> [Aspect]
iaspects ItemKind
k) of
Just (HideAs grp :: GroupName ItemKind
grp) | Bool -> Bool
not (Bool -> Bool) -> Bool -> Bool
forall a b. (a -> b) -> a -> b
$ ContentData ItemKind -> GroupName ItemKind -> Bool
forall a. ContentData a -> GroupName a -> Bool
oisSingletonGroup ContentData ItemKind
coitem GroupName ItemKind
grp ->
(GroupName ItemKind
grp, Bool
True)
_ -> (GroupName ItemKind
forall a. HasCallStack => a
undefined, Bool
False)
, Bool
notSingleton
]
g :: Effect -> Maybe (GroupName ItemKind)
g :: Effect -> Maybe (GroupName ItemKind)
g (Explode grp :: GroupName ItemKind
grp) = GroupName ItemKind -> Maybe (GroupName ItemKind)
forall a. a -> Maybe a
Just GroupName ItemKind
grp
g (Summon grp :: GroupName ItemKind
grp _) = GroupName ItemKind -> Maybe (GroupName ItemKind)
forall a. a -> Maybe a
Just GroupName ItemKind
grp
g (CreateItem _ grp :: GroupName ItemKind
grp _) = GroupName ItemKind -> Maybe (GroupName ItemKind)
forall a. a -> Maybe a
Just GroupName ItemKind
grp
g (DropItem _ _ _ grp :: GroupName ItemKind
grp) = GroupName ItemKind -> Maybe (GroupName ItemKind)
forall a. a -> Maybe a
Just GroupName ItemKind
grp
g _ = Maybe (GroupName ItemKind)
forall a. Maybe a
Nothing
missingEffectGroups :: [(Text, [GroupName ItemKind])]
missingEffectGroups =
[ (ItemKind -> Text
iname ItemKind
k, [GroupName ItemKind]
absGroups)
| ItemKind
k <- [ItemKind]
content
, let grps :: [GroupName ItemKind]
grps = (Effect -> Maybe (GroupName ItemKind))
-> [Effect] -> [GroupName ItemKind]
forall a b. (a -> Maybe b) -> [a] -> [b]
mapMaybe Effect -> Maybe (GroupName ItemKind)
g ([Effect] -> [GroupName ItemKind])
-> [Effect] -> [GroupName ItemKind]
forall a b. (a -> b) -> a -> b
$ ItemKind -> [Effect]
ieffects ItemKind
k
absGroups :: [GroupName ItemKind]
absGroups = (GroupName ItemKind -> Bool)
-> [GroupName ItemKind] -> [GroupName ItemKind]
forall a. (a -> Bool) -> [a] -> [a]
filter (Bool -> Bool
not (Bool -> Bool)
-> (GroupName ItemKind -> Bool) -> GroupName ItemKind -> Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ContentData ItemKind -> GroupName ItemKind -> Bool
forall a. ContentData a -> GroupName a -> Bool
omemberGroup ContentData ItemKind
coitem) [GroupName ItemKind]
grps
, Bool -> Bool
not (Bool -> Bool) -> Bool -> Bool
forall a b. (a -> b) -> a -> b
$ [GroupName ItemKind] -> Bool
forall a. [a] -> Bool
null [GroupName ItemKind]
absGroups
]
missingHardwiredGroups :: [GroupName ItemKind]
missingHardwiredGroups =
(GroupName ItemKind -> Bool)
-> [GroupName ItemKind] -> [GroupName ItemKind]
forall a. (a -> Bool) -> [a] -> [a]
filter (Bool -> Bool
not (Bool -> Bool)
-> (GroupName ItemKind -> Bool) -> GroupName ItemKind -> Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ContentData ItemKind -> GroupName ItemKind -> Bool
forall a. ContentData a -> GroupName a -> Bool
omemberGroup ContentData ItemKind
coitem) [GroupName ItemKind]
hardwiredItemGroups
in [ "no ikit groups in content:" Text -> Text -> Text
<+> [GroupName ItemKind] -> Text
forall a. Show a => a -> Text
tshow [GroupName ItemKind]
missingKitGroups
| Bool -> Bool
not (Bool -> Bool) -> Bool -> Bool
forall a b. (a -> b) -> a -> b
$ [GroupName ItemKind] -> Bool
forall a. [a] -> Bool
null [GroupName ItemKind]
missingKitGroups ]
[Text] -> [Text] -> [Text]
forall a. [a] -> [a] -> [a]
++ [ "HideAs groups not singletons:" Text -> Text -> Text
<+> [GroupName ItemKind] -> Text
forall a. Show a => a -> Text
tshow [GroupName ItemKind]
wrongHideAsGroups
| Bool -> Bool
not (Bool -> Bool) -> Bool -> Bool
forall a b. (a -> b) -> a -> b
$ [GroupName ItemKind] -> Bool
forall a. [a] -> Bool
null [GroupName ItemKind]
wrongHideAsGroups ]
[Text] -> [Text] -> [Text]
forall a. [a] -> [a] -> [a]
++ [ "mentioned groups not in content:" Text -> Text -> Text
<+> [(Text, [GroupName ItemKind])] -> Text
forall a. Show a => a -> Text
tshow [(Text, [GroupName ItemKind])]
missingEffectGroups
| Bool -> Bool
not (Bool -> Bool) -> Bool -> Bool
forall a b. (a -> b) -> a -> b
$ [(Text, [GroupName ItemKind])] -> Bool
forall a. [a] -> Bool
null [(Text, [GroupName ItemKind])]
missingEffectGroups ]
[Text] -> [Text] -> [Text]
forall a. [a] -> [a] -> [a]
++ [ "hardwired groups not in content:" Text -> Text -> Text
<+> [GroupName ItemKind] -> Text
forall a. Show a => a -> Text
tshow [GroupName ItemKind]
missingHardwiredGroups
| Bool -> Bool
not (Bool -> Bool) -> Bool -> Bool
forall a b. (a -> b) -> a -> b
$ [GroupName ItemKind] -> Bool
forall a. [a] -> Bool
null [GroupName ItemKind]
missingHardwiredGroups ]
hardwiredItemGroups :: [GroupName ItemKind]
hardwiredItemGroups :: [GroupName ItemKind]
hardwiredItemGroups =
["condition", "common item"]
[GroupName ItemKind]
-> [GroupName ItemKind] -> [GroupName ItemKind]
forall a. [a] -> [a] -> [a]
++ ["bonus HP", "braced", "asleep", "impressed", "currency", "mobile"]
makeData :: [ItemKind] -> ContentData ItemKind
makeData :: [ItemKind] -> ContentData ItemKind
makeData = String
-> (ItemKind -> Text)
-> (ItemKind -> Freqs ItemKind)
-> (ItemKind -> [Text])
-> ([ItemKind] -> ContentData ItemKind -> [Text])
-> [ItemKind]
-> ContentData ItemKind
forall c.
Show c =>
String
-> (c -> Text)
-> (c -> Freqs c)
-> (c -> [Text])
-> ([c] -> ContentData c -> [Text])
-> [c]
-> ContentData c
makeContentData "ItemKind" ItemKind -> Text
iname ItemKind -> Freqs ItemKind
ifreq ItemKind -> [Text]
validateSingle [ItemKind] -> ContentData ItemKind -> [Text]
validateAll