-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.html
412 lines (360 loc) · 9.78 KB
/
index.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
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
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>The Encroaching Darkness</title>
</head>
<body>
<style>
body {
display: grid;
grid-template-areas:
'a b'
'c b';
gap: 0 2.5rem;
grid-template-columns: 600px 1fr;
grid-template-rows: 650px 1fr;
background: #fdfdfd;
}
.grid {
margin-top: 1rem;
display: grid;
grid-template-columns: 40px 40px 40px 1fr;
grid-gap: 2rem;
align-items: start;
justify-content: center;
grid-area: b;
}
.hcenter {
justify-self: center;
}
.vcenter {
align-self: center;
}
.tile {
width: 50px;
height: 50px;
display: inline-flex;
justify-content: center;
align-items: center;
outline: 1px solid;
}
.span2 {
grid-column: 2 / -1;
}
.heading {
text-decoration: underline;
margin-top: 2rem;
}
.nearby, .adjacent {
position: relative;
}
.adjacent:before,
.nearby:before {
content: '';
position: absolute;
width: 100%;
height: calc(40px / 3);
outline: 1px solid;
background: linear-gradient(
to right,
transparent 33%,
black 33%,
black 66%,
transparent 66%,
transparent 100%
);
}
.adjacent:after,
.nearby:after {
content: '';
position: absolute;
width: calc(40px / 3);
height: 100%;
outline: 1px solid;
}
ul {
margin: 0.5rem 1rem;
padding: 0;
}
i {
font-style: normal;
color: dodgerblue;
font-weight: bold;
}
html {
font-size: 18px;
}
#available {
display: flex;
gap: 1rem;
min-height: 11rem;
margin-top: 1rem;
}
button {
border: 1px solid;
border-radius: 4px;
font-size: 1rem;
}
button:disabled:hover {
background: rgba(233, 233, 237, 0.5);
}
button.available {
max-width: 9.5rem;
border: 1px solid;
background: none;
padding: 0.5rem;
border-radius: 5px;
display: flex;
align-items: center;
position: relative;
}
button.selected {
background: lightgray;
}
button.available:hover {
background: lightgray;
cursor: pointer;
}
#reroll {
margin-top: 1rem;
padding: 0.25rem 0.5rem;
margin-bottom: 2rem;
}
#rules {
margin-top: 2rem;
display: flex;
flex-direction: column;
gap: 1rem;
}
canvas {
outline: 1px solid;
}
canvas.play {
cursor: pointer;
background: #101720 url(./haze.png);
animation-name: MOVE-BG;
animation-duration: 100s;
animation-timing-function: linear;
animation-iteration-count: infinite;
}
.game {
position: relative;
font-family: arial;
}
.game button {
width: 9rem;
padding: 0.5rem 1rem;
position: absolute;
top: 50%;
}
.game h1 {
position: absolute;
top: 15%;
left: 50%;
margin-left: -50%;
font-size: 3rem;
text-align: center;
max-width: 550px;
}
canvas.play ~ * {
display: none;
}
#dailySeed {
left: 10%;
}
#randSeed {
right: calc(25% - 2rem);
}
@keyframes MOVE-BG {
from {
background-position: 0 0;
}
to {
background-position: 100% 0;
}
}
.tile.H {
background: #fa8072 url(./tiles.png) -150px 0;
}
.tile.L {
background: #b3c6e0 url(./tiles.png) -400px 0;
}
.tile.F {
background: #f7e7aa url(./tiles.png) -50px 0;
}
.tile.LM {
background: #c9a999 url(./tiles.png) -300px 0;
}
.tile.SM {
background: #cfcfc4 url(./tiles.png) -350px 0;
}
.tile.C {
background: #CCBEF0 url(./tiles.png);
}
.tile.LT {
background: #ffcd91 url(./tiles.png) -200px 0;
}
#gameScore,
#final {
display: none;
}
.score {
display: flex;
gap: 1rem;
scale: 0.7;
margin-left: -6rem;
}
.score > div {
height: 50px;
display: flex;
}
.game .tile + * {
outline: 1px solid;
width: 3rem;
font-size: 2rem;
display: flex;
align-items: center;
justify-content: center;
height: 50px;
}
#final {
position: absolute;
right: 0;
gap: 0;
}
</style>
<div class="game">
<canvas id="canvas" width="550" height="550"></canvas>
<h1>The Encroaching Darkness</h1>
<button id="dailySeed">Daily Seed</button>
<button id="randSeed">Random Seed</button>
<div id="gameScore" class="score">
<div>
<div class="tile H"></div>
<div id="HScore"></div>
</div>
<div>
<div class="tile L"></div>
<div id="LScore"></div>
</div>
<div>
<div class="tile F"></div>
<div id="FScore"></div>
</div>
<div>
<div class="tile LM"></div>
<div id="LMScore"></div>
</div>
<div>
<div class="tile SM"></div>
<div id="SMScore"></div>
</div>
<div>
<div class="tile C"></div>
<div id="CScore"></div>
</div>
<div>
<div class="tile LT"></div>
<div id="LTScore"></div>
</div>
</div>
<div id="final" class="score">
<div class="tile">Total</div>
<div id="finalScore"></div>
</div>
</div>
<div class="grid">
<div class="tile adjacent" style="outline: 0"></div>
<div class="vcenter" style="margin-left: -1rem;">Adjacent</div>
<div class="tile nearby"></div>
<div class="vcenter" style="margin-left: -1rem;">Nearby</div>
<div class="heading">Tile</div>
<div class="heading span2">Description and Scoring</div>
<div class="tile" style="background: #101720 url(./haze.png);"></div>
<div class="span2"><b>Darkness</b>. Cannot build buildings on these squares.</div>
<div class="tile" style="background: #c5dec1 url(./tiles.png) -100px 0"></div>
<div class="span2"><b>Forest</b>. Cannot build buildings on these squares.</div>
<div class="tile" style="background: #dfdfdf url(./tiles.png) -250px 0"></div>
<div class="span2"><b>Mountain</b>. Cannot build buildings on these squares.</div>
<div class="tile H"></div>
<div class="span2">
<b>Houses</b> want to be adjacent lots of other <b>Houses</b>.
<ul>
<li>+2 points for each <b>House</b> in a group of at least two adjacent <b>Houses</b>.</li>
</ul>
</div>
<div class="tile L"></div>
<div class="span2">
<b>Lakes</b> want to be nearby lots of other things.
<ul>
<li>+1 point for each nearby building, <b>Forest</b>, or <b>Mountain</b></li>
</ul>
</div>
<div class="tile F"></div>
<div class="span2">
<b>Farms</b> want to be part of large areas.
<ul>
<li>+1 point for each square in a <b>Farms</b> shape (but only if the Farm building is not covered by darkness).</li>
</ul>
</div>
<div class="tile LM"></div>
<div class="span2">
<b>Sawmills</b> want to be nearby <b>Forests</b>.
<ul>
<li>+1 point for each nearby <b>Forest</b></li>
</ul>
</div>
<div class="tile SM"></div>
<div class="span2">
<b>Stone Masons</b> want to be nearby <b>Mountains</b>.
<ul>
<li>+1 point for each nearby <b>Mountain</b></li>
</ul>
</div>
<div class="tile C"></div>
<div class="span2">
<b>Churches</b> want to be far away from the <b>Darkness</b> and other <b>Churches</b>.
<ul>
<li>+1 point for each square between the <b>Church</b> and the nearest <b>Darkness</b> or other <b>Church</b></li>
</ul>
</div>
<div class="tile LT"></div>
<div class="span2">
<b>Light Towers</b> prevent the <b>Darkness</b> from spreading into nearby squares. Does not want to be nearby or in the same row or column as another <b>Light Tower</b>
<ul>
<li>+2 point if not nearby or in the same row or column as another <b>Light Tower</b></li>
</ul>
</div>
</div>
<div>
<div><b>Round:</b> <span id="roundS">1</span></div>
<div><b>Tiles:</b></div>
<div id="available"></div>
<button id="rotate" style="margin-top: 1rem;">Rotate Tile (R)</button>
<div id="rules">
<div>
<b>Objective</b>
<ul>
<li>Earn the most points at the end of 16 rounds</li>
</ul>
</div>
<div>
<b>How to Play</b>
<ul>
<li>Each round you choose a Tile to place.</li>
<li>Each Tile has a building (the image), a value (the number), and a shape.</li>
<li>You cannot place a Tile if any part of its shape overlaps the <b>Darkness</b>, <b>Forest</b>, <b>Mountain</b>, or another building or shape.</li>
<li>Press "R" to rotate the shape, or press the "Rotate Tile" button below the Tiles.</li>
<li>When placing a Tile, if the total value of all buildings in the same row or column as the placed building is equal to or great than 13, the <b>Darkness</b> will grow.</li>
<li>At the end of every round the <b>Darkness</b> will grow.</li>
<li><u>Be aware</u> that <b>Darkness</b> can overtake other tiles and even your buildings (removing them from the board) unless you have a <b>Light Tower</b> nearby. A building that is covered by <b>Darkness</b> does not score points or contribute to points of other Tiles.</li>
<li>On round 13 the <b>Darkness</b> will grow twice.</li>
<li>For scoring purposes, nearby and adjacency is calculated <u>using the building square</u> (the image) and not the shape of the Tile.</li>
</ul>
</div>
</div>
<script type="module" src="./src/index.js"></script>
</body>
</html>