/
RuleKind.hs
77 lines (71 loc) · 2.83 KB
/
RuleKind.hs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
{-# LANGUAGE TemplateHaskell #-}
-- | Game rules and assorted game setup data.
module Content.RuleKind
( standardRules
) where
import Prelude ()
import Game.LambdaHack.Core.Prelude
import qualified Data.Ini.Reader as Ini
import Instances.TH.Lift ()
import Language.Haskell.TH.Syntax
import System.FilePath
import System.IO
(IOMode (ReadMode), hGetContents, hSetEncoding, openFile, utf8)
-- Cabal
import qualified Paths_LambdaHack as Self (version)
import Game.LambdaHack.Content.ItemKind (ItemSymbolsUsedInEngine (..))
import Game.LambdaHack.Content.RuleKind
import Game.LambdaHack.Definition.DefsInternal
standardRules :: RuleContent
standardRules = RuleContent
{ rtitle = "LambdaHack"
, rWidthMax = 80
, rHeightMax = 21
, rexeVersion = Self.version
-- The strings containing the default configuration file
-- included from config.ui.default.
, rcfgUIName = "config.ui" <.> "ini"
, rcfgUIDefault = $(do
let path = "GameDefinition" </> "config.ui" <.> "default"
qAddDependentFile path
!s <- qRunIO $ do
inputHandle <- openFile path ReadMode
hSetEncoding inputHandle utf8
hGetContents inputHandle
let !cfgUIDefault =
either (error . ("Ini.parse of default config" `showFailure`)) id
$ Ini.parse s
lift (s, cfgUIDefault))
, rwriteSaveClips = 1000
, rleadLevelClips = 50
, rscoresFileName = "LambdaHack.scores"
, rnearby = 20
, rstairWordCarried = ["staircase"] -- only one, so inert
, ritemSymbols = ItemSymbolsUsedInEngine
{ rsymbolProjectile = toContentSymbol '|'
, rsymbolLight = toContentSymbol '('
, rsymbolTool = toContentSymbol '('
, rsymbolSpecial = toContentSymbol '*'
-- don't overuse; it clashes with projectiles
, rsymbolGold = toContentSymbol '$'
-- also gems
, rsymbolNecklace = toContentSymbol '"'
, rsymbolRing = toContentSymbol '='
, rsymbolPotion = toContentSymbol '!'
-- also concoction, bottle, jar, vial
, rsymbolFlask = toContentSymbol '!'
, rsymbolScroll = toContentSymbol '?'
-- also book, note, tablet, card
, rsymbolTorsoArmor = toContentSymbol '['
, rsymbolMiscArmor = toContentSymbol '['
, rsymbolClothes = toContentSymbol '['
, rsymbolShield = toContentSymbol ']'
, rsymbolPolearm = toContentSymbol ')'
, rsymbolEdged = toContentSymbol ')'
, rsymbolHafted = toContentSymbol ')'
, rsymbolWand = toContentSymbol '/'
-- also magical rod, pistol, instrument
, rsymbolFood = toContentSymbol ','
-- also body part; distinct enough from floor, which is middle dot
}
}