-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathinput.js
197 lines (191 loc) · 4.05 KB
/
input.js
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
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
const G = require('generatorics');
const HeroSet = require('./hero-set');
/**
* Weapons: Cost Damage Armor
* Dagger 8 4 0
* Shortsword 10 5 0
* Warhammer 25 6 0
* Longsword 40 7 0
* Greataxe 74 8 0
*
* Armor: Cost Damage Armor
* Leather 13 0 1
* Chainmail 31 0 2
* Splintmail 53 0 3
* Bandedmail 75 0 4
* Platemail 102 0 5
*
* Rings: Cost Damage Armor
* Damage +1 25 1 0
* Damage +2 50 2 0
* Damage +3 100 3 0
* Defense +1 20 0 1
* Defense +2 40 0 2
* Defense +3 80 0 3
*/
const WEAPONS = [
{
name: 'Dagger',
cost: 8,
damage: 4,
armor: 0,
},
{
name: 'Shortsword',
cost: 10,
damage: 5,
armor: 0,
},
{
name: 'Warhammer',
cost: 25,
damage: 6,
armor: 0,
},
{
name: 'Longsword',
cost: 40,
damage: 7,
armor: 0,
},
{
name: 'Greataxe',
cost: 74,
damage: 8,
armor: 0,
},
];
const ARMOR = [
{
// Easier to just loop through the full list, and fake having
// "no" armor by creating a dummy armor set
name: 'none',
cost: 0,
damage: 0,
armor: 0,
},
{
name: 'Leather',
cost: 13,
damage: 0,
armor: 1,
},
{
name: 'Chainmail',
cost: 31,
damage: 0,
armor: 2,
},
{
name: 'Splintmail',
cost: 53,
damage: 0,
armor: 3,
},
{
name: 'Bandedmail',
cost: 75,
damage: 0,
armor: 4,
},
{
name: 'Platemail',
cost: 102,
damage: 0,
armor: 5,
},
];
const RINGS = [
{
// Similar to armor, create two empty rings so we can do a simply (n choose 2)
// selection. Only thing is, we'll need to prune the list slightly since we'll
// have two copies of just one ring (one with 'none1' plus all other rings, and
// one with 'none2' plus all other rings)
name: 'none1',
cost: 0,
damage: 0,
armor: 0,
},
{
name: 'none2',
cost: 0,
damage: 0,
armor: 0,
},
{
name: 'Damage+1',
cost: 25,
damage: 1,
armor: 0,
},
{
name: 'Damage+2',
cost: 50,
damage: 2,
armor: 0,
},
{
name: 'Damage+3',
cost: 100,
damage: 3,
armor: 0,
},
{
name: 'Defense+1',
cost: 20,
damage: 0,
armor: 1,
},
{
name: 'Defense+2',
cost: 40,
damage: 0,
armor: 2,
},
{
name: 'Defense+3',
cost: 80,
damage: 0,
armor: 3,
},
];
/**
* - You must buy exactly one weapon; no dual-wielding.
* - Armor is optional, but you can't use more than one.
* - You can buy 0-2 rings (at most one for each hand).
* - You must use any items you buy.
* - The shop only has one of each item, so you can't buy,
* for example, two rings of Damage +3.
*/
let HERO_SETS = [];
for (let weapon of WEAPONS) {
for (let armor of ARMOR) {
for (let ring of G.clone.combination(RINGS, 2)) {
let ring_names = ring.map(r => r.name);
if (ring_names.includes('none2') && !ring_names.includes('none1')) {
// Then skip this set of rings so we don't duplicate the 1-ring instance
} else {
HERO_SETS.push(
new HeroSet({
weapon,
armor,
ringLeft: ring[0],
ringRight: ring[1],
})
);
}
}
}
}
const BOSS_STATS = {
hp: 103,
damage: 9,
armor: 2,
};
module.exports = {
WEAPONS,
ARMOR,
RINGS,
HERO_SETS,
BOSS_STATS,
};