module Game.LambdaHack.Client.UI.ItemDescription
( partItem, partItemShort, partItemShortest, partItemHigh, partItemWs
, partItemWsRanged, partItemShortAW, partItemMediumAW, partItemShortWownW
, viewItem, itemDesc
#ifdef EXPOSE_INTERNAL
, partItemN, textAllPowers, partItemWsR
#endif
) where
import Prelude ()
import Game.LambdaHack.Core.Prelude
import qualified Data.EnumMap.Strict as EM
import qualified Data.Text as T
import qualified NLP.Miniutter.English as MU
import Game.LambdaHack.Client.UI.EffectDescription
import Game.LambdaHack.Client.UI.Overlay
import Game.LambdaHack.Common.Faction
import Game.LambdaHack.Common.Item
import qualified Game.LambdaHack.Common.ItemAspect as IA
import Game.LambdaHack.Common.Misc
import Game.LambdaHack.Common.Time
import Game.LambdaHack.Common.Types
import qualified Game.LambdaHack.Content.ItemKind as IK
import qualified Game.LambdaHack.Core.Dice as Dice
import qualified Game.LambdaHack.Definition.Ability as Ability
import qualified Game.LambdaHack.Definition.Color as Color
import Game.LambdaHack.Definition.Defs
import Game.LambdaHack.Definition.Flavour
partItemN :: FactionId -> FactionDict -> Bool -> DetailLevel -> Int
-> Time -> ItemFull -> ItemQuant
-> (MU.Part, MU.Part)
partItemN :: FactionId
-> FactionDict
-> Bool
-> DetailLevel
-> Int
-> Time
-> ItemFull
-> ItemQuant
-> (Part, Part)
partItemN side :: FactionId
side factionD :: FactionDict
factionD ranged :: Bool
ranged detailLevel :: DetailLevel
detailLevel maxWordsToShow :: Int
maxWordsToShow localTime :: Time
localTime
itemFull :: ItemFull
itemFull@ItemFull{Item
itemBase :: ItemFull -> Item
itemBase :: Item
itemBase, ItemKind
itemKind :: ItemFull -> ItemKind
itemKind :: ItemKind
itemKind, Bool
itemSuspect :: ItemFull -> Bool
itemSuspect :: Bool
itemSuspect}
(itemK :: Int
itemK, itemTimer :: ItemTimer
itemTimer) =
let flav :: Text
flav = Flavour -> Text
flavourToName (Flavour -> Text) -> Flavour -> Text
forall a b. (a -> b) -> a -> b
$ Item -> Flavour
jflavour Item
itemBase
arItem :: AspectRecord
arItem = ItemFull -> AspectRecord
aspectRecordFull ItemFull
itemFull
timeout :: Int
timeout = AspectRecord -> Int
IA.aTimeout AspectRecord
arItem
temporary :: Bool
temporary = Flag -> AspectRecord -> Bool
IA.checkFlag Flag
Ability.Fragile AspectRecord
arItem
Bool -> Bool -> Bool
&& Flag -> AspectRecord -> Bool
IA.checkFlag Flag
Ability.Periodic AspectRecord
arItem
lenCh :: Int
lenCh = Int
itemK Int -> Int -> Int
forall a. Num a => a -> a -> a
- Time -> ItemFull -> ItemQuant -> Int
ncharges Time
localTime ItemFull
itemFull (Int
itemK, ItemTimer
itemTimer)
charges :: Text
charges | Int
lenCh Int -> Int -> Bool
forall a. Eq a => a -> a -> Bool
== 0 Bool -> Bool -> Bool
|| Bool
temporary = ""
| Int
itemK Int -> Int -> Bool
forall a. Eq a => a -> a -> Bool
== 1 Bool -> Bool -> Bool
&& Int
lenCh Int -> Int -> Bool
forall a. Eq a => a -> a -> Bool
== 1 = "(charging)"
| Int
itemK Int -> Int -> Bool
forall a. Eq a => a -> a -> Bool
== Int
lenCh = "(all charging)"
| Bool
otherwise = "(" Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Int -> Text
forall a. Show a => a -> Text
tshow Int
lenCh Text -> Text -> Text
<+> "charging)"
skipRecharging :: Bool
skipRecharging = DetailLevel
detailLevel DetailLevel -> DetailLevel -> Bool
forall a. Ord a => a -> a -> Bool
<= DetailLevel
DetailLow Bool -> Bool -> Bool
&& Int
lenCh Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
>= Int
itemK
(powerTsRaw :: [Text]
powerTsRaw, rangedDamage :: [Text]
rangedDamage) =
DetailLevel -> Bool -> ItemFull -> ([Text], [Text])
textAllPowers DetailLevel
detailLevel Bool
skipRecharging ItemFull
itemFull
powerTs :: [Text]
powerTs = [Text]
powerTsRaw [Text] -> [Text] -> [Text]
forall a. [a] -> [a] -> [a]
++ if Bool
ranged then [Text]
rangedDamage else []
lsource :: [Text]
lsource = case Item -> Maybe FactionId
jfid Item
itemBase of
Just fid :: FactionId
fid | ItemKind -> Text
IK.iname ItemKind
itemKind Text -> [Text] -> Bool
forall (t :: * -> *) a. (Foldable t, Eq a) => a -> t a -> Bool
`elem` ["impressed"] ->
["by" Text -> Text -> Text
<+> if FactionId
fid FactionId -> FactionId -> Bool
forall a. Eq a => a -> a -> Bool
== FactionId
side
then "us"
else Faction -> Text
gname (FactionDict
factionD FactionDict -> FactionId -> Faction
forall k a. Enum k => EnumMap k a -> k -> a
EM.! FactionId
fid)]
_ -> []
ts :: [Text]
ts = [Text]
lsource
[Text] -> [Text] -> [Text]
forall a. [a] -> [a] -> [a]
++ Int -> [Text] -> [Text]
forall a. Int -> [a] -> [a]
take Int
maxWordsToShow [Text]
powerTs
[Text] -> [Text] -> [Text]
forall a. [a] -> [a] -> [a]
++ ["(...)" | [Text] -> Int
forall a. [a] -> Int
length [Text]
powerTs Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
> Int
maxWordsToShow Bool -> Bool -> Bool
&& Int
maxWordsToShow Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
> 0]
[Text] -> [Text] -> [Text]
forall a. [a] -> [a] -> [a]
++ [Text
charges | Int
maxWordsToShow Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
> 1]
name :: Text
name | Bool
temporary =
let adj :: Text
adj = if Int
timeout Int -> Int -> Bool
forall a. Eq a => a -> a -> Bool
== 0 then "temporarily" else "impermanent"
in Text
adj Text -> Text -> Text
<+> ItemKind -> Text
IK.iname ItemKind
itemKind
| Bool
itemSuspect = Text
flav Text -> Text -> Text
<+> ItemKind -> Text
IK.iname ItemKind
itemKind
| Bool
otherwise = ItemKind -> Text
IK.iname ItemKind
itemKind
capName :: Part
capName = if Flag -> AspectRecord -> Bool
IA.checkFlag Flag
Ability.Unique AspectRecord
arItem
then Part -> Part
MU.Capitalize (Part -> Part) -> Part -> Part
forall a b. (a -> b) -> a -> b
$ Text -> Part
MU.Text Text
name
else Text -> Part
MU.Text Text
name
in (Part
capName, [Part] -> Part
MU.Phrase ([Part] -> Part) -> [Part] -> Part
forall a b. (a -> b) -> a -> b
$ (Text -> Part) -> [Text] -> [Part]
forall a b. (a -> b) -> [a] -> [b]
map Text -> Part
MU.Text [Text]
ts)
textAllPowers :: DetailLevel -> Bool -> ItemFull -> ([Text], [Text])
textAllPowers :: DetailLevel -> Bool -> ItemFull -> ([Text], [Text])
textAllPowers detailLevel :: DetailLevel
detailLevel skipRecharging :: Bool
skipRecharging
itemFull :: ItemFull
itemFull@ItemFull{ItemKind
itemKind :: ItemKind
itemKind :: ItemFull -> ItemKind
itemKind, ItemDisco
itemDisco :: ItemFull -> ItemDisco
itemDisco :: ItemDisco
itemDisco} =
let arItem :: AspectRecord
arItem = ItemFull -> AspectRecord
aspectRecordFull ItemFull
itemFull
aspectsFull :: [Aspect]
aspectsFull = case ItemDisco
itemDisco of
ItemDiscoMean IA.KindMean{..} | Bool
kmConst ->
AspectRecord -> [Aspect]
IA.aspectRecordToList AspectRecord
kmMean
ItemDiscoMean{} -> ItemKind -> [Aspect]
IK.iaspects ItemKind
itemKind
ItemDiscoFull iAspect :: AspectRecord
iAspect -> AspectRecord -> [Aspect]
IA.aspectRecordToList AspectRecord
iAspect
mtimeout :: Maybe Aspect
mtimeout = (Aspect -> Bool) -> [Aspect] -> Maybe Aspect
forall (t :: * -> *) a. Foldable t => (a -> Bool) -> t a -> Maybe a
find Aspect -> Bool
IK.timeoutAspect [Aspect]
aspectsFull
elab :: Text
elab = AspectRecord -> Text
IA.aELabel AspectRecord
arItem
periodic :: Bool
periodic = Flag -> AspectRecord -> Bool
IA.checkFlag Flag
Ability.Periodic AspectRecord
arItem
hurtMeleeAspect :: IK.Aspect -> Bool
hurtMeleeAspect :: Aspect -> Bool
hurtMeleeAspect (IK.AddSkill Ability.SkHurtMelee _) = Bool
True
hurtMeleeAspect _ = Bool
False
active :: Bool
active = AspectRecord -> Bool
IA.goesIntoEqp AspectRecord
arItem
splitA :: DetailLevel -> [IK.Aspect] -> [Text]
splitA :: DetailLevel -> [Aspect] -> [Text]
splitA detLev :: DetailLevel
detLev aspects :: [Aspect]
aspects =
let ppA :: Aspect -> Text
ppA = Aspect -> Text
kindAspectToSuffix
ppE :: Effect -> Text
ppE = DetailLevel -> Effect -> Text
effectToSuffix DetailLevel
detLev
reduce_a :: Dice -> Text
reduce_a = Text -> (Int -> Text) -> Maybe Int -> Text
forall b a. b -> (a -> b) -> Maybe a -> b
maybe "?" Int -> Text
forall a. Show a => a -> Text
tshow (Maybe Int -> Text) -> (Dice -> Maybe Int) -> Dice -> Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Dice -> Maybe Int
Dice.reduceDice
restEs :: [Effect]
restEs | DetailLevel
detLev DetailLevel -> DetailLevel -> Bool
forall a. Ord a => a -> a -> Bool
>= DetailLevel
DetailHigh
Bool -> Bool -> Bool
|| Bool -> Bool
not (Flag -> AspectRecord -> Bool
IA.checkFlag Flag
Ability.MinorEffects AspectRecord
arItem) =
ItemKind -> [Effect]
IK.ieffects ItemKind
itemKind
| Bool
otherwise = []
(smashEffs :: [Effect]
smashEffs, noSmashEffs :: [Effect]
noSmashEffs) = (Effect -> Bool) -> [Effect] -> ([Effect], [Effect])
forall a. (a -> Bool) -> [a] -> ([a], [a])
partition Effect -> Bool
IK.onSmashEffect [Effect]
restEs
unSmash :: Effect -> Effect
unSmash (IK.OnSmash eff :: Effect
eff) = Effect
eff
unSmash eff :: Effect
eff = Effect
eff
onSmashTs :: Text
onSmashTs = Text -> [Text] -> Text
T.intercalate " " ([Text] -> Text) -> [Text] -> Text
forall a b. (a -> b) -> a -> b
$ (Text -> Bool) -> [Text] -> [Text]
forall a. (a -> Bool) -> [a] -> [a]
filter (Bool -> Bool
not (Bool -> Bool) -> (Text -> Bool) -> Text -> Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Text -> Bool
T.null)
([Text] -> [Text]) -> [Text] -> [Text]
forall a b. (a -> b) -> a -> b
$ (Effect -> Text) -> [Effect] -> [Text]
forall a b. (a -> b) -> [a] -> [b]
map (Effect -> Text
ppE (Effect -> Text) -> (Effect -> Effect) -> Effect -> Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Effect -> Effect
unSmash) [Effect]
smashEffs
rechargingTs :: Text
rechargingTs = Text -> [Text] -> Text
T.intercalate " "
([Text] -> Text) -> [Text] -> Text
forall a b. (a -> b) -> a -> b
$ [Text
damageText | ItemKind -> Dice
IK.idamage ItemKind
itemKind Dice -> Dice -> Bool
forall a. Eq a => a -> a -> Bool
/= 0]
[Text] -> [Text] -> [Text]
forall a. [a] -> [a] -> [a]
++ (Text -> Bool) -> [Text] -> [Text]
forall a. (a -> Bool) -> [a] -> [a]
filter (Bool -> Bool
not (Bool -> Bool) -> (Text -> Bool) -> Text -> Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Text -> Bool
T.null) ((Effect -> Text) -> [Effect] -> [Text]
forall a b. (a -> b) -> [a] -> [b]
map Effect -> Text
ppE [Effect]
noSmashEffs)
fragile :: Bool
fragile = Flag -> AspectRecord -> Bool
IA.checkFlag Flag
Ability.Fragile AspectRecord
arItem
periodicText :: Text
periodicText =
if Bool
periodic Bool -> Bool -> Bool
&& Bool -> Bool
not Bool
skipRecharging Bool -> Bool -> Bool
&& Bool -> Bool
not (Text -> Bool
T.null Text
rechargingTs)
then case (Maybe Aspect
mtimeout, Bool
fragile) of
(Nothing, True) ->
"(each turn until gone:" Text -> Text -> Text
<+> Text
rechargingTs Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> ")"
(Nothing, False) ->
"(each turn:" Text -> Text -> Text
<+> Text
rechargingTs Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> ")"
(Just (IK.Timeout t :: Dice
t), True) ->
"(every" Text -> Text -> Text
<+> Dice -> Text
reduce_a Dice
t Text -> Text -> Text
<+> "until gone:"
Text -> Text -> Text
<+> Text
rechargingTs Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> ")"
(Just (IK.Timeout t :: Dice
t), False) ->
"(every" Text -> Text -> Text
<+> Dice -> Text
reduce_a Dice
t Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> ":" Text -> Text -> Text
<+> Text
rechargingTs Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> ")"
_ -> [Char] -> Text
forall a. HasCallStack => [Char] -> a
error ([Char] -> Text) -> [Char] -> Text
forall a b. (a -> b) -> a -> b
$ "" [Char] -> Maybe Aspect -> [Char]
forall v. Show v => [Char] -> v -> [Char]
`showFailure` Maybe Aspect
mtimeout
else ""
ppERestEs :: [Text]
ppERestEs = if Bool
periodic then [Text
periodicText] else (Effect -> Text) -> [Effect] -> [Text]
forall a b. (a -> b) -> [a] -> [b]
map Effect -> Text
ppE [Effect]
noSmashEffs
aes :: [Text]
aes = if Bool
active
then (Aspect -> Text) -> [Aspect] -> [Text]
forall a b. (a -> b) -> [a] -> [b]
map Aspect -> Text
ppA [Aspect]
aspects [Text] -> [Text] -> [Text]
forall a. [a] -> [a] -> [a]
++ [Text]
ppERestEs
else [Text]
ppERestEs [Text] -> [Text] -> [Text]
forall a. [a] -> [a] -> [a]
++ (Aspect -> Text) -> [Aspect] -> [Text]
forall a b. (a -> b) -> [a] -> [b]
map Aspect -> Text
ppA [Aspect]
aspects
onSmash :: Text
onSmash = if Text -> Bool
T.null Text
onSmashTs then ""
else "(on smash:" Text -> Text -> Text
<+> Text
onSmashTs Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> ")"
damageText :: Text
damageText = case (Aspect -> Bool) -> [Aspect] -> Maybe Aspect
forall (t :: * -> *) a. Foldable t => (a -> Bool) -> t a -> Maybe a
find Aspect -> Bool
hurtMeleeAspect [Aspect]
aspects of
Just (IK.AddSkill Ability.SkHurtMelee hurtMelee :: Dice
hurtMelee) ->
(if ItemKind -> Dice
IK.idamage ItemKind
itemKind Dice -> Dice -> Bool
forall a. Eq a => a -> a -> Bool
== 0
then "0d0"
else Dice -> Text
forall a. Show a => a -> Text
tshow (ItemKind -> Dice
IK.idamage ItemKind
itemKind))
Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Dice -> Text
affixDice Dice
hurtMelee Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> "%"
_ -> if ItemKind -> Dice
IK.idamage ItemKind
itemKind Dice -> Dice -> Bool
forall a. Eq a => a -> a -> Bool
== 0
then ""
else Dice -> Text
forall a. Show a => a -> Text
tshow (ItemKind -> Dice
IK.idamage ItemKind
itemKind)
timeoutText :: Text
timeoutText = case Maybe Aspect
mtimeout of
Nothing -> ""
Just (IK.Timeout t :: Dice
t) -> "(cooldown" Text -> Text -> Text
<+> Dice -> Text
reduce_a Dice
t Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> ")"
_ -> [Char] -> Text
forall a. HasCallStack => [Char] -> a
error ([Char] -> Text) -> [Char] -> Text
forall a b. (a -> b) -> a -> b
$ "" [Char] -> Maybe Aspect -> [Char]
forall v. Show v => [Char] -> v -> [Char]
`showFailure` Maybe Aspect
mtimeout
in [ Text
damageText
| DetailLevel
detLev DetailLevel -> DetailLevel -> Bool
forall a. Ord a => a -> a -> Bool
> DetailLevel
DetailNone Bool -> Bool -> Bool
&& (Bool -> Bool
not Bool
periodic Bool -> Bool -> Bool
|| ItemKind -> Dice
IK.idamage ItemKind
itemKind Dice -> Dice -> Bool
forall a. Eq a => a -> a -> Bool
== 0) ]
[Text] -> [Text] -> [Text]
forall a. [a] -> [a] -> [a]
++ [Text
timeoutText | DetailLevel
detLev DetailLevel -> DetailLevel -> Bool
forall a. Ord a => a -> a -> Bool
> DetailLevel
DetailNone Bool -> Bool -> Bool
&& Bool -> Bool
not Bool
periodic]
[Text] -> [Text] -> [Text]
forall a. [a] -> [a] -> [a]
++ if DetailLevel
detLev DetailLevel -> DetailLevel -> Bool
forall a. Ord a => a -> a -> Bool
>= DetailLevel
DetailMedium
then [Text]
aes [Text] -> [Text] -> [Text]
forall a. [a] -> [a] -> [a]
++ [Text
onSmash | DetailLevel
detLev DetailLevel -> DetailLevel -> Bool
forall a. Ord a => a -> a -> Bool
>= DetailLevel
DetailAll]
else []
hurtMult :: Int
hurtMult = Bool -> Skills -> Skills -> Int
armorHurtCalculation Bool
True (AspectRecord -> Skills
IA.aSkills AspectRecord
arItem)
Skills
Ability.zeroSkills
dmg :: Double
dmg = Dice -> Double
Dice.meanDice (Dice -> Double) -> Dice -> Double
forall a b. (a -> b) -> a -> b
$ ItemKind -> Dice
IK.idamage ItemKind
itemKind
rawDeltaHP :: Int64
rawDeltaHP = Double -> Int64
forall a b. (RealFrac a, Integral b) => a -> b
ceiling (Double -> Int64) -> Double -> Int64
forall a b. (a -> b) -> a -> b
$ Int -> Double
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
hurtMult Double -> Double -> Double
forall a. Num a => a -> a -> a
* Double -> Double
xD Double
dmg Double -> Double -> Double
forall a. Fractional a => a -> a -> a
/ 100
IK.ThrowMod{Int
throwVelocity :: ThrowMod -> Int
throwVelocity :: Int
IK.throwVelocity} = AspectRecord -> ThrowMod
IA.aToThrow AspectRecord
arItem
speed :: Speed
speed = Int -> Int -> Speed
speedFromWeight (ItemKind -> Int
IK.iweight ItemKind
itemKind) Int
throwVelocity
pdeltaHP :: Int64
pdeltaHP = Int64 -> Speed -> Int64
modifyDamageBySpeed Int64
rawDeltaHP Speed
speed
rangedDamageDesc :: [Text]
rangedDamageDesc = if Int64
pdeltaHP Int64 -> Int64 -> Bool
forall a. Eq a => a -> a -> Bool
== 0
then []
else ["{avg" Text -> Text -> Text
<+> Int64 -> Text
show64With2 Int64
pdeltaHP Text -> Text -> Text
<+> "ranged}"]
splitTry :: [Aspect] -> [Text]
splitTry ass :: [Aspect]
ass =
let splits :: [[Text]]
splits = (DetailLevel -> [Text]) -> [DetailLevel] -> [[Text]]
forall a b. (a -> b) -> [a] -> [b]
map (DetailLevel -> [Aspect] -> [Text]
`splitA` [Aspect]
ass) [DetailLevel
forall a. Bounded a => a
minBound..DetailLevel
forall a. Bounded a => a
maxBound]
splitsToTry :: [[Text]]
splitsToTry = Int -> [[Text]] -> [[Text]]
forall a. Int -> [a] -> [a]
drop (DetailLevel -> Int
forall a. Enum a => a -> Int
fromEnum DetailLevel
detailLevel) [[Text]]
splits
splitsValid :: [[Text]]
splitsValid | Text -> Bool
T.null Text
elab = ([Text] -> Bool) -> [[Text]] -> [[Text]]
forall a. (a -> Bool) -> [a] -> [a]
filter ([Text] -> [Text] -> Bool
forall a. Eq a => a -> a -> Bool
/= []) [[Text]]
splitsToTry
| Bool
otherwise = [[Text]]
splitsToTry
in [[Text]] -> [Text]
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat ([[Text]] -> [Text]) -> [[Text]] -> [Text]
forall a b. (a -> b) -> a -> b
$ Int -> [[Text]] -> [[Text]]
forall a. Int -> [a] -> [a]
take 1 [[Text]]
splitsValid
aspectDescs :: [Text]
aspectDescs =
let aMain :: Aspect -> Bool
aMain IK.AddSkill{} = Bool
True
aMain _ = Bool
False
(aspectsMain :: [Aspect]
aspectsMain, aspectsAux :: [Aspect]
aspectsAux) = (Aspect -> Bool) -> [Aspect] -> ([Aspect], [Aspect])
forall a. (a -> Bool) -> [a] -> ([a], [a])
partition Aspect -> Bool
aMain [Aspect]
aspectsFull
in (Text -> Bool) -> [Text] -> [Text]
forall a. (a -> Bool) -> [a] -> [a]
filter (Text -> Text -> Bool
forall a. Eq a => a -> a -> Bool
/= "")
([Text] -> [Text]) -> [Text] -> [Text]
forall a b. (a -> b) -> a -> b
$ Text
elab
Text -> [Text] -> [Text]
forall a. a -> [a] -> [a]
: [Aspect] -> [Text]
splitTry [Aspect]
aspectsMain
[Text] -> [Text] -> [Text]
forall a. [a] -> [a] -> [a]
++ if DetailLevel
detailLevel DetailLevel -> DetailLevel -> Bool
forall a. Ord a => a -> a -> Bool
>= DetailLevel
DetailAll
then (Aspect -> Text) -> [Aspect] -> [Text]
forall a b. (a -> b) -> [a] -> [b]
map Aspect -> Text
kindAspectToSuffix [Aspect]
aspectsAux
else []
in ([Text]
aspectDescs, [Text]
rangedDamageDesc)
partItem :: FactionId -> FactionDict -> Time -> ItemFull -> ItemQuant
-> (MU.Part, MU.Part)
partItem :: FactionId
-> FactionDict -> Time -> ItemFull -> ItemQuant -> (Part, Part)
partItem side :: FactionId
side factionD :: FactionDict
factionD = FactionId
-> FactionDict
-> Bool
-> DetailLevel
-> Int
-> Time
-> ItemFull
-> ItemQuant
-> (Part, Part)
partItemN FactionId
side FactionDict
factionD Bool
False DetailLevel
DetailMedium 4
partItemShort :: FactionId -> FactionDict -> Time -> ItemFull -> ItemQuant
-> (MU.Part, MU.Part)
partItemShort :: FactionId
-> FactionDict -> Time -> ItemFull -> ItemQuant -> (Part, Part)
partItemShort side :: FactionId
side factionD :: FactionDict
factionD = FactionId
-> FactionDict
-> Bool
-> DetailLevel
-> Int
-> Time
-> ItemFull
-> ItemQuant
-> (Part, Part)
partItemN FactionId
side FactionDict
factionD Bool
False DetailLevel
DetailLow 4
partItemShortest :: FactionId -> FactionDict -> Time -> ItemFull -> ItemQuant
-> (MU.Part, MU.Part)
partItemShortest :: FactionId
-> FactionDict -> Time -> ItemFull -> ItemQuant -> (Part, Part)
partItemShortest side :: FactionId
side factionD :: FactionDict
factionD = FactionId
-> FactionDict
-> Bool
-> DetailLevel
-> Int
-> Time
-> ItemFull
-> ItemQuant
-> (Part, Part)
partItemN FactionId
side FactionDict
factionD Bool
False DetailLevel
DetailNone 1
partItemHigh :: FactionId -> FactionDict -> Time -> ItemFull -> ItemQuant
-> (MU.Part, MU.Part)
partItemHigh :: FactionId
-> FactionDict -> Time -> ItemFull -> ItemQuant -> (Part, Part)
partItemHigh side :: FactionId
side factionD :: FactionDict
factionD = FactionId
-> FactionDict
-> Bool
-> DetailLevel
-> Int
-> Time
-> ItemFull
-> ItemQuant
-> (Part, Part)
partItemN FactionId
side FactionDict
factionD Bool
False DetailLevel
DetailAll 100
partItemWsR :: FactionId -> FactionDict -> Bool -> Int -> Time -> ItemFull
-> ItemQuant
-> MU.Part
partItemWsR :: FactionId
-> FactionDict
-> Bool
-> Int
-> Time
-> ItemFull
-> ItemQuant
-> Part
partItemWsR side :: FactionId
side factionD :: FactionDict
factionD ranged :: Bool
ranged count :: Int
count localTime :: Time
localTime itemFull :: ItemFull
itemFull kit :: ItemQuant
kit =
let (name :: Part
name, powers :: Part
powers) =
FactionId
-> FactionDict
-> Bool
-> DetailLevel
-> Int
-> Time
-> ItemFull
-> ItemQuant
-> (Part, Part)
partItemN FactionId
side FactionDict
factionD Bool
ranged DetailLevel
DetailMedium 4 Time
localTime ItemFull
itemFull ItemQuant
kit
arItem :: AspectRecord
arItem = ItemFull -> AspectRecord
aspectRecordFull ItemFull
itemFull
periodic :: Bool
periodic = Flag -> AspectRecord -> Bool
IA.checkFlag Flag
Ability.Periodic AspectRecord
arItem
condition :: Bool
condition = Flag -> AspectRecord -> Bool
IA.checkFlag Flag
Ability.Condition AspectRecord
arItem
maxCount :: Int
maxCount = Dice -> Int
Dice.supDice (Dice -> Int) -> Dice -> Int
forall a b. (a -> b) -> a -> b
$ ItemKind -> Dice
IK.icount (ItemKind -> Dice) -> ItemKind -> Dice
forall a b. (a -> b) -> a -> b
$ ItemFull -> ItemKind
itemKind ItemFull
itemFull
in if | Bool
condition Bool -> Bool -> Bool
&& Int
count Int -> Int -> Bool
forall a. Eq a => a -> a -> Bool
== 1 -> [Part] -> Part
MU.Phrase [Part
name, Part
powers]
| Bool
condition Bool -> Bool -> Bool
&& Bool -> Bool
not Bool
periodic Bool -> Bool -> Bool
&& Int
maxCount Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
> 1 ->
let percent :: Int
percent = 100 Int -> Int -> Int
forall a. Num a => a -> a -> a
* Int
count Int -> Int -> Int
forall a. Integral a => a -> a -> a
`divUp` Int
maxCount
amount :: Text
amount = Int -> Text
forall a. Show a => a -> Text
tshow Int
count Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> "-strong"
Text -> Text -> Text
<+> "(" Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Int -> Text
forall a. Show a => a -> Text
tshow Int
percent Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> "%)"
in [Part] -> Part
MU.Phrase [Text -> Part
MU.Text Text
amount, Part
name, Part
powers]
| Bool
condition ->
[Part] -> Part
MU.Phrase [Text -> Part
MU.Text (Text -> Part) -> Text -> Part
forall a b. (a -> b) -> a -> b
$ Int -> Text
forall a. Show a => a -> Text
tshow Int
count Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> "-fold", Part
name, Part
powers]
| Flag -> AspectRecord -> Bool
IA.checkFlag Flag
Ability.Unique AspectRecord
arItem Bool -> Bool -> Bool
&& Int
count Int -> Int -> Bool
forall a. Eq a => a -> a -> Bool
== 1 ->
[Part] -> Part
MU.Phrase ["the", Part
name, Part
powers]
| Bool
otherwise -> [Part] -> Part
MU.Phrase [Int -> Part -> Part
MU.CarAWs Int
count Part
name, Part
powers]
partItemWs :: FactionId -> FactionDict -> Int -> Time -> ItemFull -> ItemQuant
-> MU.Part
partItemWs :: FactionId
-> FactionDict -> Int -> Time -> ItemFull -> ItemQuant -> Part
partItemWs side :: FactionId
side factionD :: FactionDict
factionD = FactionId
-> FactionDict
-> Bool
-> Int
-> Time
-> ItemFull
-> ItemQuant
-> Part
partItemWsR FactionId
side FactionDict
factionD Bool
False
partItemWsRanged :: FactionId -> FactionDict -> Int -> Time -> ItemFull
-> ItemQuant
-> MU.Part
partItemWsRanged :: FactionId
-> FactionDict -> Int -> Time -> ItemFull -> ItemQuant -> Part
partItemWsRanged side :: FactionId
side factionD :: FactionDict
factionD = FactionId
-> FactionDict
-> Bool
-> Int
-> Time
-> ItemFull
-> ItemQuant
-> Part
partItemWsR FactionId
side FactionDict
factionD Bool
True
partItemShortAW :: FactionId -> FactionDict -> Time -> ItemFull -> ItemQuant
-> MU.Part
partItemShortAW :: FactionId -> FactionDict -> Time -> ItemFull -> ItemQuant -> Part
partItemShortAW side :: FactionId
side factionD :: FactionDict
factionD localTime :: Time
localTime itemFull :: ItemFull
itemFull kit :: ItemQuant
kit =
let (name :: Part
name, _) = FactionId
-> FactionDict -> Time -> ItemFull -> ItemQuant -> (Part, Part)
partItemShort FactionId
side FactionDict
factionD Time
localTime ItemFull
itemFull ItemQuant
kit
arItem :: AspectRecord
arItem = ItemFull -> AspectRecord
aspectRecordFull ItemFull
itemFull
in if Flag -> AspectRecord -> Bool
IA.checkFlag Flag
Ability.Unique AspectRecord
arItem
then [Part] -> Part
MU.Phrase ["the", Part
name]
else Part -> Part
MU.AW Part
name
partItemMediumAW :: FactionId -> FactionDict -> Time -> ItemFull -> ItemQuant
-> MU.Part
partItemMediumAW :: FactionId -> FactionDict -> Time -> ItemFull -> ItemQuant -> Part
partItemMediumAW side :: FactionId
side factionD :: FactionDict
factionD localTime :: Time
localTime itemFull :: ItemFull
itemFull kit :: ItemQuant
kit =
let (name :: Part
name, powers :: Part
powers) =
FactionId
-> FactionDict
-> Bool
-> DetailLevel
-> Int
-> Time
-> ItemFull
-> ItemQuant
-> (Part, Part)
partItemN FactionId
side FactionDict
factionD Bool
False DetailLevel
DetailMedium 100 Time
localTime ItemFull
itemFull ItemQuant
kit
arItem :: AspectRecord
arItem = ItemFull -> AspectRecord
aspectRecordFull ItemFull
itemFull
in if Flag -> AspectRecord -> Bool
IA.checkFlag Flag
Ability.Unique AspectRecord
arItem
then [Part] -> Part
MU.Phrase ["the", Part
name, Part
powers]
else Part -> Part
MU.AW (Part -> Part) -> Part -> Part
forall a b. (a -> b) -> a -> b
$ [Part] -> Part
MU.Phrase [Part
name, Part
powers]
partItemShortWownW :: FactionId -> FactionDict -> MU.Part -> Time -> ItemFull
-> ItemQuant
-> MU.Part
partItemShortWownW :: FactionId
-> FactionDict -> Part -> Time -> ItemFull -> ItemQuant -> Part
partItemShortWownW side :: FactionId
side factionD :: FactionDict
factionD partA :: Part
partA localTime :: Time
localTime itemFull :: ItemFull
itemFull kit :: ItemQuant
kit =
let (name :: Part
name, _) = FactionId
-> FactionDict -> Time -> ItemFull -> ItemQuant -> (Part, Part)
partItemShort FactionId
side FactionDict
factionD Time
localTime ItemFull
itemFull ItemQuant
kit
in Part -> Part -> Part
MU.WownW Part
partA Part
name
viewItem :: ItemFull -> Color.AttrCharW32
{-# INLINE viewItem #-}
viewItem :: ItemFull -> AttrCharW32
viewItem itemFull :: ItemFull
itemFull =
Color -> Char -> AttrCharW32
Color.attrChar2ToW32 (Flavour -> Color
flavourToColor (Flavour -> Color) -> Flavour -> Color
forall a b. (a -> b) -> a -> b
$ Item -> Flavour
jflavour (Item -> Flavour) -> Item -> Flavour
forall a b. (a -> b) -> a -> b
$ ItemFull -> Item
itemBase ItemFull
itemFull)
(ItemKind -> Char
IK.isymbol (ItemKind -> Char) -> ItemKind -> Char
forall a b. (a -> b) -> a -> b
$ ItemFull -> ItemKind
itemKind ItemFull
itemFull)
itemDesc :: Bool -> FactionId -> FactionDict -> Int -> CStore -> Time -> LevelId
-> ItemFull -> ItemQuant
-> AttrLine
itemDesc :: Bool
-> FactionId
-> FactionDict
-> Int
-> CStore
-> Time
-> LevelId
-> ItemFull
-> ItemQuant
-> AttrLine
itemDesc markParagraphs :: Bool
markParagraphs side :: FactionId
side factionD :: FactionDict
factionD aHurtMeleeOfOwner :: Int
aHurtMeleeOfOwner store :: CStore
store localTime :: Time
localTime jlid :: LevelId
jlid
itemFull :: ItemFull
itemFull@ItemFull{Item
itemBase :: Item
itemBase :: ItemFull -> Item
itemBase, ItemKind
itemKind :: ItemKind
itemKind :: ItemFull -> ItemKind
itemKind, ItemDisco
itemDisco :: ItemDisco
itemDisco :: ItemFull -> ItemDisco
itemDisco, Bool
itemSuspect :: Bool
itemSuspect :: ItemFull -> Bool
itemSuspect} kit :: ItemQuant
kit =
let (name :: Part
name, powers :: Part
powers) = FactionId
-> FactionDict -> Time -> ItemFull -> ItemQuant -> (Part, Part)
partItemHigh FactionId
side FactionDict
factionD Time
localTime ItemFull
itemFull ItemQuant
kit
arItem :: AspectRecord
arItem = ItemFull -> AspectRecord
aspectRecordFull ItemFull
itemFull
npowers :: Text
npowers = [Part] -> Text
makePhrase [Part
name, Part
powers]
IK.ThrowMod{Int
throwVelocity :: Int
throwVelocity :: ThrowMod -> Int
IK.throwVelocity, Int
throwLinger :: ThrowMod -> Int
throwLinger :: Int
IK.throwLinger} = AspectRecord -> ThrowMod
IA.aToThrow AspectRecord
arItem
speed :: Speed
speed = Int -> Int -> Speed
speedFromWeight (ItemKind -> Int
IK.iweight ItemKind
itemKind) Int
throwVelocity
range :: Int
range = Speed -> Int -> Int
rangeFromSpeedAndLinger Speed
speed Int
throwLinger
tspeed :: Text
tspeed | Flag -> AspectRecord -> Bool
IA.checkFlag Flag
Ability.Condition AspectRecord
arItem
Bool -> Bool -> Bool
|| ItemKind -> Int
IK.iweight ItemKind
itemKind Int -> Int -> Bool
forall a. Eq a => a -> a -> Bool
== 0 = ""
| Speed
speed Speed -> Speed -> Bool
forall a. Ord a => a -> a -> Bool
< Speed
speedLimp = "When thrown, it drops at once."
| Speed
speed Speed -> Speed -> Bool
forall a. Ord a => a -> a -> Bool
< Speed
speedWalk = "When thrown, it drops after one meter."
| Bool
otherwise =
"Can be thrown at"
Text -> Text -> Text
<+> [Char] -> Text
T.pack (Int -> [Char]
displaySpeed (Int -> [Char]) -> Int -> [Char]
forall a b. (a -> b) -> a -> b
$ Speed -> Int
fromSpeed Speed
speed)
Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> if Int
throwLinger Int -> Int -> Bool
forall a. Eq a => a -> a -> Bool
/= 100
then " dropping after" Text -> Text -> Text
<+> Int -> Text
forall a. Show a => a -> Text
tshow Int
range Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> "m."
else "."
tsuspect :: [Text]
tsuspect = ["You are unsure what it does." | Bool
itemSuspect]
(desc :: Text
desc, aspectSentences :: Text
aspectSentences, damageAnalysis :: Text
damageAnalysis) =
let aspects :: [Aspect]
aspects = case ItemDisco
itemDisco of
ItemDiscoMean IA.KindMean{..} | Bool
kmConst ->
AspectRecord -> [Aspect]
IA.aspectRecordToList AspectRecord
kmMean
ItemDiscoMean{} -> ItemKind -> [Aspect]
IK.iaspects ItemKind
itemKind
ItemDiscoFull iAspect :: AspectRecord
iAspect -> AspectRecord -> [Aspect]
IA.aspectRecordToList AspectRecord
iAspect
sentences :: [Text]
sentences = [Text]
tsuspect [Text] -> [Text] -> [Text]
forall a. [a] -> [a] -> [a]
++ (Aspect -> Maybe Text) -> [Aspect] -> [Text]
forall a b. (a -> Maybe b) -> [a] -> [b]
mapMaybe Aspect -> Maybe Text
aspectToSentence [Aspect]
aspects
aHurtMeleeOfItem :: Int
aHurtMeleeOfItem = Skill -> AspectRecord -> Int
IA.getSkill Skill
Ability.SkHurtMelee AspectRecord
arItem
meanDmg :: Int
meanDmg = Double -> Int
forall a b. (RealFrac a, Integral b) => a -> b
ceiling (Double -> Int) -> Double -> Int
forall a b. (a -> b) -> a -> b
$ Dice -> Double
Dice.meanDice (ItemKind -> Dice
IK.idamage ItemKind
itemKind)
dmgAn :: Text
dmgAn = if Int
meanDmg Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
<= 0 then "" else
let multRaw :: Int
multRaw = Int
aHurtMeleeOfOwner
Int -> Int -> Int
forall a. Num a => a -> a -> a
+ if CStore
store CStore -> [CStore] -> Bool
forall (t :: * -> *) a. (Foldable t, Eq a) => a -> t a -> Bool
`elem` [CStore
CEqp, CStore
COrgan]
then 0
else Int
aHurtMeleeOfItem
mult :: Int
mult = 100 Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int -> Int -> Int
forall a. Ord a => a -> a -> a
min 99 (Int -> Int -> Int
forall a. Ord a => a -> a -> a
max (-99) Int
multRaw)
minDeltaHP :: Int64
minDeltaHP = Int -> Int64
xM Int
meanDmg Int64 -> Int64 -> Int64
forall a. Integral a => a -> a -> a
`divUp` 100
rawDeltaHP :: Int64
rawDeltaHP = Int -> Int64
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
mult Int64 -> Int64 -> Int64
forall a. Num a => a -> a -> a
* Int64
minDeltaHP
pmult :: Int
pmult = 100 Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int -> Int -> Int
forall a. Ord a => a -> a -> a
min 99 (Int -> Int -> Int
forall a. Ord a => a -> a -> a
max (-99) Int
aHurtMeleeOfItem)
prawDeltaHP :: Int64
prawDeltaHP = Int -> Int64
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
pmult Int64 -> Int64 -> Int64
forall a. Num a => a -> a -> a
* Int64
minDeltaHP
pdeltaHP :: Int64
pdeltaHP = Int64 -> Speed -> Int64
modifyDamageBySpeed Int64
prawDeltaHP Speed
speed
mDeltaHP :: Int64
mDeltaHP = Int64 -> Speed -> Int64
modifyDamageBySpeed Int64
minDeltaHP Speed
speed
in "Against defenceless foes you'd inflict around"
Text -> Text -> Text
<+> Int -> Text
forall a. Show a => a -> Text
tshow Int
meanDmg
Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> "*" Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Int -> Text
forall a. Show a => a -> Text
tshow Int
mult Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> "%"
Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> "=" Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Int64 -> Text
show64With2 Int64
rawDeltaHP
Text -> Text -> Text
<+> "melee damage (min" Text -> Text -> Text
<+> Int64 -> Text
show64With2 Int64
minDeltaHP
Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> ") and"
Text -> Text -> Text
<+> Int -> Text
forall a. Show a => a -> Text
tshow Int
meanDmg
Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> "*" Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Int -> Text
forall a. Show a => a -> Text
tshow Int
pmult Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> "%"
Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> "*" Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> "speed^2"
Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> "/" Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Int -> Text
forall a. Show a => a -> Text
tshow (Speed -> Int
fromSpeed Speed
speedThrust Int -> Int -> Int
forall a. Integral a => a -> a -> a
`divUp` 10) Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> "^2"
Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> "=" Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Int64 -> Text
show64With2 Int64
pdeltaHP
Text -> Text -> Text
<+> "ranged damage (min" Text -> Text -> Text
<+> Int64 -> Text
show64With2 Int64
mDeltaHP
Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> ") with it"
Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> if Dice -> Int
Dice.infDice (ItemKind -> Dice
IK.idamage ItemKind
itemKind)
Int -> Int -> Bool
forall a. Eq a => a -> a -> Bool
== Dice -> Int
Dice.supDice (ItemKind -> Dice
IK.idamage ItemKind
itemKind)
then "."
else "on average."
in (ItemKind -> Text
IK.idesc ItemKind
itemKind, Text -> [Text] -> Text
T.intercalate " " [Text]
sentences, Text
tspeed Text -> Text -> Text
<+> Text
dmgAn)
weight :: Int
weight = ItemKind -> Int
IK.iweight ItemKind
itemKind
(scaledWeight :: Text
scaledWeight, unitWeight :: Part
unitWeight)
| Int
weight Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
> 1000 =
(Double -> Text
forall a. Show a => a -> Text
tshow (Double -> Text) -> Double -> Text
forall a b. (a -> b) -> a -> b
$ Int -> Double
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
weight Double -> Double -> Double
forall a. Fractional a => a -> a -> a
/ (1000 :: Double), "kg")
| Bool
otherwise = (Int -> Text
forall a. Show a => a -> Text
tshow Int
weight, "g")
onLevel :: Text
onLevel = "on level" Text -> Text -> Text
<+> Int -> Text
forall a. Show a => a -> Text
tshow (Int -> Int
forall a. Num a => a -> a
abs (Int -> Int) -> Int -> Int
forall a b. (a -> b) -> a -> b
$ LevelId -> Int
forall a. Enum a => a -> Int
fromEnum LevelId
jlid) Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> "."
discoFirst :: Text
discoFirst = (if Flag -> AspectRecord -> Bool
IA.checkFlag Flag
Ability.Unique AspectRecord
arItem
then "Discovered"
else "First seen")
Text -> Text -> Text
<+> Text
onLevel
whose :: FactionId -> Text
whose fid :: FactionId
fid = Faction -> Text
gname (FactionDict
factionD FactionDict -> FactionId -> Faction
forall k a. Enum k => EnumMap k a -> k -> a
EM.! FactionId
fid)
sourceDesc :: Text
sourceDesc =
case Item -> Maybe FactionId
jfid Item
itemBase of
Just fid :: FactionId
fid | Flag -> AspectRecord -> Bool
IA.checkFlag Flag
Ability.Condition AspectRecord
arItem ->
"Caused by" Text -> Text -> Text
<+> (if FactionId
fid FactionId -> FactionId -> Bool
forall a. Eq a => a -> a -> Bool
== FactionId
side then "us" else FactionId -> Text
whose FactionId
fid)
Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> ". First observed" Text -> Text -> Text
<+> Text
onLevel
Just fid :: FactionId
fid ->
"Coming from" Text -> Text -> Text
<+> FactionId -> Text
whose FactionId
fid
Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> "." Text -> Text -> Text
<+> Text
discoFirst
_ -> Text
discoFirst
ikitNames :: [Text]
ikitNames = ((GroupName ItemKind, CStore) -> Text)
-> [(GroupName ItemKind, CStore)] -> [Text]
forall a b. (a -> b) -> [a] -> [b]
map (GroupName ItemKind -> Text
forall a. GroupName a -> Text
fromGroupName (GroupName ItemKind -> Text)
-> ((GroupName ItemKind, CStore) -> GroupName ItemKind)
-> (GroupName ItemKind, CStore)
-> Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (GroupName ItemKind, CStore) -> GroupName ItemKind
forall a b. (a, b) -> a
fst) ([(GroupName ItemKind, CStore)] -> [Text])
-> [(GroupName ItemKind, CStore)] -> [Text]
forall a b. (a -> b) -> a -> b
$ ((GroupName ItemKind, CStore) -> Bool)
-> [(GroupName ItemKind, CStore)] -> [(GroupName ItemKind, CStore)]
forall a. (a -> Bool) -> [a] -> [a]
filter ((CStore -> CStore -> Bool
forall a. Eq a => a -> a -> Bool
== CStore
COrgan) (CStore -> Bool)
-> ((GroupName ItemKind, CStore) -> CStore)
-> (GroupName ItemKind, CStore)
-> Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (GroupName ItemKind, CStore) -> CStore
forall a b. (a, b) -> b
snd)
([(GroupName ItemKind, CStore)] -> [(GroupName ItemKind, CStore)])
-> [(GroupName ItemKind, CStore)] -> [(GroupName ItemKind, CStore)]
forall a b. (a -> b) -> a -> b
$ ItemKind -> [(GroupName ItemKind, CStore)]
IK.ikit ItemKind
itemKind
ikitDesc :: Text
ikitDesc | [Text] -> Bool
forall a. [a] -> Bool
null [Text]
ikitNames = ""
| Bool
otherwise = [Part] -> Text
makeSentence
[ "the actor also has organs of this kind:"
, Text -> Part
MU.Text (Text -> Part) -> Text -> Part
forall a b. (a -> b) -> a -> b
$ Text -> [Text] -> Text
T.intercalate ", " [Text]
ikitNames ]
colorSymbol :: AttrCharW32
colorSymbol = ItemFull -> AttrCharW32
viewItem ItemFull
itemFull
blurb :: Text
blurb =
((" "
Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
npowers
Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> (if Bool
markParagraphs then ":\n\n" else ": ")
Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
desc
Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> (if Bool
markParagraphs Bool -> Bool -> Bool
&& Bool -> Bool
not (Text -> Bool
T.null Text
desc) then "\n\n" else ""))
Text -> Text -> Text
<+> (if Int
weight Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
> 0
then [Part] -> Text
makeSentence
["Weighs around", Text -> Part
MU.Text Text
scaledWeight Part -> Part -> Part
forall a. Semigroup a => a -> a -> a
<> Part
unitWeight]
else ""))
Text -> Text -> Text
<+> Text
aspectSentences
Text -> Text -> Text
<+> Text
sourceDesc
Text -> Text -> Text
<+> Text
damageAnalysis
Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> (if Bool
markParagraphs Bool -> Bool -> Bool
&& Bool -> Bool
not (Text -> Bool
T.null Text
ikitDesc) then "\n\n" else "\n")
Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
ikitDesc
in AttrCharW32
colorSymbol AttrCharW32 -> AttrLine -> AttrLine
forall a. a -> [a] -> [a]
: Text -> AttrLine
textToAL Text
blurb