/
ItemKind.hs
153 lines (146 loc) · 4.02 KB
/
ItemKind.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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
module Content.ItemKind (ItemKind(..)) where
import Color
import qualified Content.Content
import Effect
import Flavour
import Random
-- TODO: jpower is out of place here. It doesn't make sense for all items,
-- and will mean different things for different items. Perhaps it should
-- be part of the Effect, but then we have to be careful to distinguish
-- parts of the Effect that are rolled on item creation and those rolled
-- at each use (e.g., sword magical +damage vs. sword damage dice).
-- Another thing to keep in minds is that jpower will heavily determine
-- the value of the item for shops, treasure chests, artifact set rebalancing,
-- etc., so if we make jpower complex, the value computation gets complex too.
data ItemKind = ItemKind
{ isymbol :: !Char -- ^ map symbol
, iflavour :: ![Flavour] -- ^ possible flavours
, iname :: !String -- ^ group name
, ieffect :: !Effect -- ^ the effect when activated
, icount :: !RollQuad -- ^ created in that quantify
, ifreq :: !Int -- ^ created that often
, ipower :: !RollQuad -- ^ created with that power
}
deriving (Show, Eq, Ord)
instance Content.Content.Content ItemKind where
getFreq = ifreq
content =
[amulet, dart, gem1, gem2, gem3, gem4, gold, potion1, potion2, potion3, ring, scroll1, scroll2, sword, fist, wand]
amulet, dart, gem1, gem2, gem3, gem4, gold, potion1, potion2, potion3, ring, scroll1, scroll2, sword, fist, wand :: ItemKind
gem, potion, scroll :: ItemKind -- generic templates
-- rollQuad (a, b, x, y) = a * roll b + (lvl * x * roll y) / 10
amulet = ItemKind
{ isymbol = '"'
, iflavour = [(BrGreen, True)]
, iname = "amulet"
, ieffect = Regneration
, icount = intToQuad 1
, ifreq = 10
, ipower = (2, 1, 2, 2)
}
dart = ItemKind
{ isymbol = ')'
, iflavour = [(Yellow, False)]
, iname = "dart"
, ieffect = Wound (1, 1)
, icount = (3, 3, 0, 0)
, ifreq = 30
, ipower = intToQuad 0
}
gem = ItemKind
{ isymbol = '*'
, iflavour = zipPlain brightCol -- natural, so not fancy
, iname = "gem"
, ieffect = NoEffect
, icount = intToQuad 0
, ifreq = 20 -- x4, but rare on shallow levels
, ipower = intToQuad 0
}
gem1 = gem
{ icount = (1, 1, 0, 0) -- appears on lvl 1
}
gem2 = gem
{ icount = (0, 0, 2, 1) -- appears on lvl 5, doubled on lvl 10
}
gem3 = gem
{ icount = (0, 0, 1, 1) -- appears on lvl 10
}
gem4 = gem
{ icount = (0, 0, 1, 1) -- appears on lvl 10
}
gold = ItemKind
{ isymbol = '$'
, iflavour = [(BrYellow, False)]
, iname = "gold piece"
, ieffect = NoEffect
, icount = (0, 0, 10, 10)
, ifreq = 80
, ipower = intToQuad 0
}
potion = ItemKind
{ isymbol = '!'
, iflavour = zipFancy stdCol
, iname = "potion"
, ieffect = NoEffect
, icount = intToQuad 1
, ifreq = 10
, ipower = intToQuad 0
}
potion1 = potion
{ ieffect = ApplyPerfume
}
potion2 = potion
{ ieffect = Heal
, ipower = (10, 1, 0, 0)
}
potion3 = potion
{ ieffect = Wound (0, 0)
, ipower = (10, 1, 0, 0)
}
ring = ItemKind
{ isymbol = '='
, iflavour = [(White, False)]
, iname = "ring"
, ieffect = Searching
, icount = intToQuad 1
, ifreq = 10
, ipower = (1, 1, 2, 2)
}
scroll = ItemKind
{ isymbol = '?'
, iflavour = zipFancy darkCol -- arcane and old
, iname = "scroll"
, ieffect = NoEffect
, icount = intToQuad 1
, ifreq = 10
, ipower = intToQuad 0
}
scroll1 = scroll
{ ieffect = SummonFriend
, ifreq = 20
}
scroll2 = scroll
{ ieffect = SummonEnemy
}
sword = ItemKind
{ isymbol = ')'
, iflavour = [(BrCyan, False)]
, iname = "sword"
, ieffect = Wound (3, 1)
, icount = intToQuad 1
, ifreq = 60
, ipower = (1, 2, 4, 2)
}
fist = sword
{ iname = "fist"
, ifreq = 0 -- Does not appear randomly in the dungeon.
}
wand = ItemKind
{ isymbol = '/'
, iflavour = [(BrRed, True)]
, iname = "wand"
, ieffect = Dominate
, icount = intToQuad 1
, ifreq = 10
, ipower = intToQuad 0
}