-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmana-base-suggester.html
168 lines (162 loc) · 5.39 KB
/
mana-base-suggester.html
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
<!doctype html>
<meta charset="utf-8">
<meta name="language" http-equiv="Content-Language" content="en-US">
<meta name="theme-color" content="#000000">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="Magic: The Gathering Mana Base Suggester">
<title>Mana Base Suggester</title>
<script type="module">
import { h, Component, Fragment, render } from 'https://unpkg.com/preact?module';
const colors = {
AZORIUS: 'wu',
DIMIR: 'ub',
RAKDOS: 'br',
GRUUL: 'gr',
SELESNYA: 'wg',
ORZHOV: 'wb',
GOLGARI: 'bg',
SIMIC: 'ug',
IZZET: 'ur',
BOROS: 'wr'
}
const lands = {
bike: [
{ colors: colors.AZORIUS, name: "Irrigated Farmland" },
{ colors: colors.DIMIR, name: "Fetid Pools" },
{ colors: colors.RAKDOS, name: "Canyon Slough" },
{ colors: colors.GRUUL, name: "Sheltered Thicket" },
{ colors: colors.SELESNYA, name: "Scattered Groves" }
],
bounce: [],
canopy: [],
check: [
{ colors: colors.AZORIUS, name: "Glacial Fortress" },
{ colors: colors.DIMIR, name: "Drowned Catacombs" },
{ colors: colors.RAKDOS, name: "Dragonskull Sumit" },
{ colors: colors.GRUUL, name: "Rootbound Crag" },
{ colors: colors.SELESNYA, name: "Sunpetal Grove" },
{ colors: colors.ORZHOV, name: "Isolated Chapel" },
{ colors: colors.IZZET, name: "Sulfur Falls" },
{ colors: colors.GOLGARI, name: "Woodland Cemetery" },
{ colors: colors.BOROS, name: "Clifftop Retreat" },
{ colors: colors.SIMIC, name: "Hinterland Harbor" }
],
dual: [
{ colors: colors.AZORIUS, name: "Tundra" },
{ colors: colors.DIMIR, name: "Underground Sea" },
{ colors: colors.RAKDOS, name: "Badlands" },
{ colors: colors.GRUUL, name: "Taiga" },
{ colors: colors.SELESNYA, name: "Savannah" },
{ colors: colors.ORZHOV, name: "Scrubland" },
{ colors: colors.IZZET, name: "Volcanic Island" },
{ colors: colors.GOLGARI, name: "Bayou" },
{ colors: colors.BOROS, name: "Plateau" },
{ colors: colors.SIMIC, name: "Tropical Island" }
],
fast: [],
fetch: [
{ colors: colors.AZORIUS, name: "Flooded Strand" },
{ colors: colors.DIMIR, name: "Polluted Delta" },
{ colors: colors.RAKDOS, name: "Bloodstained Mire" },
{ colors: colors.GRUUL, name: "Wooded Foothills" },
{ colors: colors.SELESNYA, name: "Windswept Heath" },
{ colors: colors.ORZHOV, name: "Marsh Flats" },
{ colors: colors.IZZET, name: "Scalding Tarn" },
{ colors: colors.GOLGARI, name: "Verdant Catacombs" },
{ colors: colors.BOROS, name: "Arid Mesa" },
{ colors: colors.SIMIC, name: "Misty Rainforest" }
],
filter: [],
gain: [],
pain: [],
scry: [],
shadow: [],
shock: [
{ colors: colors.AZORIUS, name: "Hallowed Fountain" },
{ colors: colors.DIMIR, name: "Watery Grave" },
{ colors: colors.RAKDOS, name: "Blood Crypt" },
{ colors: colors.GRUUL, name: "Stpmping Grounds" },
{ colors: colors.SELESNYA, name: "Temple Garden" },
{ colors: colors.ORZHOV, name: "Godless Shrine" },
{ colors: colors.IZZET, name: "Steam Vents" },
{ colors: colors.GOLGARI, name: "Overgrown Tomb" },
{ colors: colors.BOROS, name: "Sacred Foundry" },
{ colors: colors.SIMIC, name: "Breeding Pool" }
],
storage: [],
creature: [],
tri: [],
tango: []
}
const landTypes = Object.keys(lands);
class Suggester extends Component {
state = { selectedColors: {}, selectedTypes: {} }
onColorChange(event, color) {
this.setState(({ selectedColors }) => ({
selectedColors: { ...selectedColors, [color]: event.target.checked },
}))
}
onTypeChange(event, type) {
this.setState(({ selectedTypes }) => ({
selectedTypes: { ...selectedTypes, [type]: event.target.checked },
}))
}
render(props, { selectedColors, selectedTypes }) {
return h(
Fragment,
null,
h(
'div',
null,
'colors:',
'wubgr'
.split('')
.map((color) =>
h(
'label',
null,
h('input', {
type: 'checkbox',
checked: selectedColors[color],
onChange: (event) => this.onColorChange(event, color),
}),
color
)
)
),
h(
'div',
null,
'landtypes:',
landTypes.map((type) =>
h(
'label',
null,
h('input', {
type: 'checkbox',
checked: selectedTypes[type],
onChange: (event) => this.onTypeChange(event, type),
}),
type
)
)
),
h(
'ul',
{ style: { listStyle: 'none' } },
landTypes
.filter((type) => selectedTypes[type])
.map((type) =>
lands[type]
.filter((land) =>
Array.prototype.every.call(land.colors, (color) => selectedColors[color])
)
.map((land) => h('li', { key: land.name }, '1 ', land.name))
)
)
)
}
}
render(h(Suggester, null, null), document.body)
</script>
<noscript>You need to enable JavaScript to run this app.</noscript>