Lashtw commited on
Commit
ccfe2bd
·
verified ·
1 Parent(s): 4408257

Upload 26 files

Browse files
Files changed (8) hide show
  1. .gitattributes +2 -0
  2. kingdom_map.html +1 -1
  3. tower.html +527 -0
  4. tower.jpg +3 -0
  5. tower.js +489 -0
  6. tower.mp3 +3 -0
  7. valley.html +5 -2
  8. valley.js +19 -3
.gitattributes CHANGED
@@ -40,3 +40,5 @@ bgm.mp3 filter=lfs diff=lfs merge=lfs -text
40
  spring.mp3 filter=lfs diff=lfs merge=lfs -text
41
  valley.jpg filter=lfs diff=lfs merge=lfs -text
42
  valley.mp3 filter=lfs diff=lfs merge=lfs -text
 
 
 
40
  spring.mp3 filter=lfs diff=lfs merge=lfs -text
41
  valley.jpg filter=lfs diff=lfs merge=lfs -text
42
  valley.mp3 filter=lfs diff=lfs merge=lfs -text
43
+ tower.jpg filter=lfs diff=lfs merge=lfs -text
44
+ tower.mp3 filter=lfs diff=lfs merge=lfs -text
kingdom_map.html CHANGED
@@ -233,7 +233,7 @@
233
  <!-- 展開之塔 -->
234
  <div class="location-item locked" id="tower-location">
235
  <div class="location-image-container">
236
- <img src="palace.jpg" alt="展開之塔" class="location-image">
237
  </div>
238
  <div class="location-content">
239
  <h2 class="location-name">展開之塔</h2>
 
233
  <!-- 展開之塔 -->
234
  <div class="location-item locked" id="tower-location">
235
  <div class="location-image-container">
236
+ <img src="tower.jpg" alt="展開之塔" class="location-image">
237
  </div>
238
  <div class="location-content">
239
  <h2 class="location-name">展開之塔</h2>
tower.html ADDED
@@ -0,0 +1,527 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="zh-TW">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>展開之塔 - 數學魔法王國:平方之旅</title>
7
+ <link rel="stylesheet" href="style.css">
8
+ <style>
9
+ body.tower-page {
10
+ background-image: url('tower.jpg');
11
+ background-size: cover;
12
+ background-position: center;
13
+ background-attachment: fixed;
14
+ }
15
+
16
+ .tower-container {
17
+ max-width: 800px;
18
+ margin: 0 auto;
19
+ padding: 20px;
20
+ background-color: rgba(0, 0, 0, 0.7);
21
+ border-radius: 15px;
22
+ box-shadow: 0 0 20px rgba(255, 140, 0, 0.5);
23
+ border: 2px solid rgba(255, 140, 0, 0.7);
24
+ }
25
+
26
+ .tower-title {
27
+ color: rgba(255, 165, 0, 0.9);
28
+ font-size: 2rem;
29
+ margin-bottom: 20px;
30
+ text-align: center;
31
+ text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
32
+ }
33
+
34
+ .tower-story {
35
+ color: white;
36
+ font-size: 1.1rem;
37
+ line-height: 1.6;
38
+ margin-bottom: 30px;
39
+ text-align: center;
40
+ }
41
+
42
+ .tower-emoji {
43
+ font-size: 2rem;
44
+ margin-bottom: 10px;
45
+ text-align: center;
46
+ }
47
+
48
+ .video-links {
49
+ background-color: rgba(60, 60, 60, 0.8);
50
+ border: 2px solid rgba(255, 140, 0, 0.7);
51
+ border-radius: 10px;
52
+ padding: 15px;
53
+ margin-bottom: 20px;
54
+ }
55
+
56
+ .video-links h3 {
57
+ color: rgba(255, 165, 0, 0.9);
58
+ font-size: 1.2rem;
59
+ margin-bottom: 10px;
60
+ text-align: center;
61
+ }
62
+
63
+ .video-links ul {
64
+ color: white;
65
+ list-style-type: none;
66
+ padding: 0;
67
+ text-align: center;
68
+ }
69
+
70
+ .video-links li {
71
+ margin-bottom: 10px;
72
+ }
73
+
74
+ .video-links a {
75
+ color: #3498db;
76
+ text-decoration: none;
77
+ transition: all 0.3s;
78
+ }
79
+
80
+ .video-links a:hover {
81
+ color: #2980b9;
82
+ text-decoration: underline;
83
+ }
84
+
85
+ .quiz-container {
86
+ display: none;
87
+ margin-top: 20px;
88
+ }
89
+
90
+ .quiz-title {
91
+ color: rgba(255, 165, 0, 0.9);
92
+ font-size: 1.5rem;
93
+ margin-bottom: 20px;
94
+ text-align: center;
95
+ }
96
+
97
+ .question {
98
+ color: white;
99
+ font-size: 1.2rem;
100
+ margin-bottom: 20px;
101
+ text-align: center;
102
+ }
103
+
104
+ .stage-indicator {
105
+ display: flex;
106
+ justify-content: center;
107
+ gap: 20px;
108
+ margin-bottom: 20px;
109
+ }
110
+
111
+ .stage-btn {
112
+ background-color: rgba(60, 60, 60, 0.8);
113
+ border: 2px solid rgba(255, 140, 0, 0.7);
114
+ border-radius: 10px;
115
+ padding: 10px 15px;
116
+ color: white;
117
+ font-size: 1rem;
118
+ cursor: pointer;
119
+ transition: all 0.3s;
120
+ }
121
+
122
+ .stage-btn.active {
123
+ background-color: rgba(255, 140, 0, 0.8);
124
+ box-shadow: 0 0 15px rgba(255, 140, 0, 0.5);
125
+ }
126
+
127
+ .formula-display {
128
+ background-color: rgba(60, 60, 60, 0.8);
129
+ border: 2px solid rgba(255, 140, 0, 0.7);
130
+ border-radius: 10px;
131
+ padding: 15px;
132
+ margin-bottom: 20px;
133
+ color: white;
134
+ font-size: 1.2rem;
135
+ text-align: center;
136
+ }
137
+
138
+ .drag-drop-container {
139
+ display: flex;
140
+ flex-direction: column;
141
+ align-items: center;
142
+ margin-bottom: 30px;
143
+ }
144
+
145
+ .formula-template {
146
+ background-color: rgba(80, 80, 80, 0.8);
147
+ border: 2px solid rgba(255, 140, 0, 0.7);
148
+ border-radius: 10px;
149
+ padding: 15px;
150
+ margin-bottom: 20px;
151
+ color: white;
152
+ font-size: 1.2rem;
153
+ text-align: center;
154
+ width: 100%;
155
+ }
156
+
157
+ .drop-zone {
158
+ display: inline-block;
159
+ width: 50px;
160
+ height: 30px;
161
+ background-color: rgba(100, 100, 100, 0.5);
162
+ border: 2px dashed rgba(255, 140, 0, 0.7);
163
+ border-radius: 5px;
164
+ margin: 0 5px;
165
+ vertical-align: middle;
166
+ }
167
+
168
+ .drop-zone.filled {
169
+ background-color: rgba(255, 140, 0, 0.3);
170
+ border: 2px solid rgba(255, 140, 0, 0.9);
171
+ }
172
+
173
+ .drag-items {
174
+ display: flex;
175
+ flex-wrap: wrap;
176
+ justify-content: center;
177
+ gap: 10px;
178
+ margin-top: 20px;
179
+ }
180
+
181
+ .drag-item {
182
+ background-color: rgba(255, 140, 0, 0.8);
183
+ border: 2px solid rgba(255, 165, 0, 0.9);
184
+ border-radius: 5px;
185
+ padding: 5px 10px;
186
+ color: white;
187
+ font-size: 1rem;
188
+ cursor: grab;
189
+ user-select: none;
190
+ transition: all 0.3s;
191
+ }
192
+
193
+ .drag-item:hover {
194
+ transform: translateY(-3px);
195
+ box-shadow: 0 5px 15px rgba(255, 140, 0, 0.3);
196
+ }
197
+
198
+ .drag-item.dragging {
199
+ opacity: 0.5;
200
+ }
201
+
202
+ .check-answer-btn {
203
+ background-color: rgba(255, 140, 0, 0.8);
204
+ color: white;
205
+ border: none;
206
+ border-radius: 10px;
207
+ padding: 10px 20px;
208
+ font-size: 1.1rem;
209
+ cursor: pointer;
210
+ transition: all 0.3s;
211
+ display: block;
212
+ margin: 0 auto;
213
+ }
214
+
215
+ .check-answer-btn:hover {
216
+ background-color: rgba(255, 165, 0, 0.9);
217
+ box-shadow: 0 0 15px rgba(255, 165, 0, 0.5);
218
+ transform: translateY(-3px);
219
+ }
220
+
221
+ .next-btn {
222
+ background-color: rgba(255, 140, 0, 0.8);
223
+ color: white;
224
+ border: none;
225
+ border-radius: 10px;
226
+ padding: 15px 30px;
227
+ font-size: 1.2rem;
228
+ cursor: pointer;
229
+ transition: all 0.3s;
230
+ display: none;
231
+ margin: 20px auto 0;
232
+ }
233
+
234
+ .next-btn:hover {
235
+ background-color: rgba(255, 165, 0, 0.9);
236
+ box-shadow: 0 0 15px rgba(255, 165, 0, 0.5);
237
+ transform: translateY(-3px);
238
+ }
239
+
240
+ .feedback-container {
241
+ margin-top: 20px;
242
+ padding: 10px;
243
+ border-radius: 10px;
244
+ text-align: center;
245
+ font-size: 1.1rem;
246
+ display: none;
247
+ }
248
+
249
+ .feedback-container.correct {
250
+ background-color: rgba(100, 200, 100, 0.3);
251
+ border: 2px solid rgba(100, 200, 100, 0.7);
252
+ color: #2ecc71;
253
+ }
254
+
255
+ .feedback-container.incorrect {
256
+ background-color: rgba(200, 100, 100, 0.3);
257
+ border: 2px solid rgba(200, 100, 100, 0.7);
258
+ color: #e74c3c;
259
+ }
260
+
261
+ .door-container {
262
+ display: flex;
263
+ justify-content: center;
264
+ gap: 10px;
265
+ margin-bottom: 20px;
266
+ }
267
+
268
+ .door {
269
+ width: 30px;
270
+ height: 40px;
271
+ background-color: rgba(150, 150, 150, 0.8);
272
+ border-radius: 5px 5px 0 0;
273
+ transition: all 0.5s;
274
+ }
275
+
276
+ .door.opened {
277
+ background-color: rgba(255, 140, 0, 0.8);
278
+ transform: scaleY(0.7);
279
+ opacity: 0.5;
280
+ }
281
+
282
+ .progress-container {
283
+ display: flex;
284
+ justify-content: center;
285
+ align-items: center;
286
+ margin-bottom: 20px;
287
+ }
288
+
289
+ .progress-text {
290
+ color: white;
291
+ font-size: 1.1rem;
292
+ margin-right: 10px;
293
+ }
294
+
295
+ .result-container {
296
+ display: none;
297
+ text-align: center;
298
+ margin-top: 30px;
299
+ }
300
+
301
+ .result-title {
302
+ color: rgba(255, 165, 0, 0.9);
303
+ font-size: 1.8rem;
304
+ margin-bottom: 20px;
305
+ }
306
+
307
+ .result-message {
308
+ color: white;
309
+ font-size: 1.2rem;
310
+ line-height: 1.6;
311
+ margin-bottom: 30px;
312
+ }
313
+
314
+ .stars-result {
315
+ display: flex;
316
+ justify-content: center;
317
+ gap: 15px;
318
+ margin: 20px 0;
319
+ }
320
+
321
+ .star-result {
322
+ font-size: 2.5rem;
323
+ color: rgba(255, 255, 255, 0.3);
324
+ transition: all 0.5s;
325
+ }
326
+
327
+ .star-result.earned {
328
+ color: gold;
329
+ text-shadow: 0 0 15px rgba(255, 215, 0, 0.7);
330
+ animation: starPulse 2s infinite alternate;
331
+ }
332
+
333
+ @keyframes starPulse {
334
+ 0% {
335
+ transform: scale(1);
336
+ text-shadow: 0 0 10px rgba(255, 215, 0, 0.7);
337
+ }
338
+ 100% {
339
+ transform: scale(1.15);
340
+ text-shadow: 0 0 20px rgba(255, 215, 0, 0.9), 0 0 30px rgba(255, 180, 0, 0.5);
341
+ }
342
+ }
343
+
344
+ .navigation-buttons {
345
+ display: flex;
346
+ justify-content: center;
347
+ gap: 20px;
348
+ margin-top: 30px;
349
+ }
350
+
351
+ .nav-btn {
352
+ background-color: rgba(80, 80, 80, 0.8);
353
+ color: white;
354
+ border: 2px solid rgba(255, 140, 0, 0.7);
355
+ border-radius: 8px;
356
+ padding: 10px 20px;
357
+ font-size: 1rem;
358
+ cursor: pointer;
359
+ transition: all 0.3s;
360
+ }
361
+
362
+ .nav-btn:hover {
363
+ background-color: rgba(100, 100, 100, 0.8);
364
+ box-shadow: 0 0 15px rgba(255, 140, 0, 0.3);
365
+ }
366
+
367
+ /* 響應式設計 */
368
+ @media (max-width: 768px) {
369
+ .tower-container {
370
+ padding: 15px;
371
+ margin: 10px;
372
+ }
373
+
374
+ .tower-title {
375
+ font-size: 1.8rem;
376
+ }
377
+
378
+ .navigation-buttons {
379
+ flex-direction: column;
380
+ gap: 10px;
381
+ }
382
+
383
+ .drag-items {
384
+ flex-direction: column;
385
+ }
386
+ }
387
+ </style>
388
+ </head>
389
+ <body class="tower-page">
390
+ <!-- 音效元素 -->
391
+ <audio id="bgm" loop>
392
+ <source src="tower.mp3" type="audio/mpeg">
393
+ </audio>
394
+ <audio id="correct-sound">
395
+ <source src="bingo.mp3" type="audio/mpeg">
396
+ </audio>
397
+ <audio id="wrong-sound">
398
+ <source src="wrong.mp3" type="audio/mpeg">
399
+ </audio>
400
+
401
+ <div class="game-container">
402
+ <div class="tower-container">
403
+ <div class="tower-emoji">🗼</div>
404
+ <h1 class="tower-title">第三試煉:展開之塔</h1>
405
+
406
+ <div class="tower-story">
407
+ <p>你來到「展開之塔」,這裡的門需要你將 (a ± b)² 展開後才能解鎖。</p>
408
+ <p>塔的守衛問你:「你知道 (30 - 1)² 等於什麼嗎?展開這件事看起來有點難,但凡事都有其規則!」</p>
409
+ <p>守衛設下了六道考驗,測試你對平方展開公式的理解與應用。每答對一題,塔中的一扇門就會打開;全部答對,塔頂將賦予你「展開融合」的力量。</p>
410
+ </div>
411
+
412
+ <div class="video-links">
413
+ <h3>參考教學影片</h3>
414
+ <ul>
415
+ <li><a href="https://youtu.be/f5ydFDsqPz4?si=7RecrelWpskrzuFx" target="_blank">和的平方公式</a></li>
416
+ <li><a href="https://youtu.be/3M7LCwpeXwk?si=QAp4wyEG_4BAJO1M" target="_blank">差的平方公式</a></li>
417
+ </ul>
418
+ </div>
419
+
420
+ <button id="start-challenge" class="check-answer-btn">進入考驗</button>
421
+
422
+ <div id="quiz-container" class="quiz-container">
423
+ <div class="door-container" id="doors-progress">
424
+ <div class="door" id="door-1"></div>
425
+ <div class="door" id="door-2"></div>
426
+ <div class="door" id="door-3"></div>
427
+ <div class="door" id="door-4"></div>
428
+ <div class="door" id="door-5"></div>
429
+ <div class="door" id="door-6"></div>
430
+ </div>
431
+
432
+ <div class="progress-container">
433
+ <div class="progress-text">進度:<span id="current-question">1</span>/6</div>
434
+ </div>
435
+
436
+ <h2 class="quiz-title" id="question-title">問題 1</h2>
437
+ <div class="formula-display" id="formula-display"></div>
438
+
439
+ <div class="stage-indicator">
440
+ <button class="stage-btn active" id="stage-1-btn">第一階段:展開後</button>
441
+ <button class="stage-btn" id="stage-2-btn">第二階段:合併中間項</button>
442
+ </div>
443
+
444
+ <div class="drag-drop-container">
445
+ <div class="formula-template" id="formula-template">
446
+ <!-- 將由JavaScript動態生成 -->
447
+ </div>
448
+
449
+ <div class="drag-items" id="drag-items">
450
+ <!-- 將由JavaScript動態生成 -->
451
+ </div>
452
+ </div>
453
+
454
+ <div class="feedback-container" id="feedback-container"></div>
455
+
456
+ <button id="check-answer" class="check-answer-btn">檢查答案</button>
457
+ <button id="next-question" class="next-btn">下一題</button>
458
+ </div>
459
+
460
+ <div id="result-container" class="result-container">
461
+ <h2 class="result-title" id="result-title">試煉完成!</h2>
462
+ <div class="result-message" id="result-message"></div>
463
+
464
+ <div class="stars-result">
465
+ <span class="star-result" id="star-1">★</span>
466
+ <span class="star-result" id="star-2">★</span>
467
+ <span class="star-result" id="star-3">★</span>
468
+ </div>
469
+
470
+ <div class="navigation-buttons" id="success-buttons" style="display: none;">
471
+ <button id="back-to-map" class="nav-btn">返回王國地圖</button>
472
+ <button id="next-trial" class="nav-btn">完成旅程</button>
473
+ </div>
474
+ <div class="navigation-buttons" id="fail-buttons" style="display: none;">
475
+ <button id="retry-challenge" class="nav-btn">重新挑戰</button>
476
+ </div>
477
+ </div>
478
+
479
+ <!-- 音樂來源註記 -->
480
+ <div class="music-credit">
481
+ <p>背景音樂:由Suno製作</p>
482
+ <button id="toggle-bgm" class="small-btn">音樂開/關</button>
483
+ </div>
484
+ </div>
485
+ </div>
486
+
487
+ <script src="tower.js"></script>
488
+
489
+ <!-- 音樂連續播放控制 -->
490
+ <script>
491
+ // 嘗試從localStorage獲取音樂播放狀態和時間
492
+ document.addEventListener('DOMContentLoaded', function() {
493
+ const bgmAudio = document.getElementById('bgm');
494
+ const toggleBgmBtn = document.getElementById('toggle-bgm');
495
+
496
+ // 檢查是否有保存的音樂狀態
497
+ const musicPlaying = localStorage.getItem('towerMusicPlaying') === 'true';
498
+ const musicTime = parseFloat(localStorage.getItem('towerMusicTime') || '0');
499
+
500
+ if (musicPlaying) {
501
+ // 設置音樂播放位置
502
+ bgmAudio.currentTime = musicTime;
503
+ bgmAudio.play().catch(e => console.log('自動播放被阻止:', e));
504
+ toggleBgmBtn.textContent = '音樂關';
505
+ } else {
506
+ toggleBgmBtn.textContent = '音樂開';
507
+ }
508
+
509
+ // 定期保存音樂播放位置
510
+ setInterval(function() {
511
+ if (!bgmAudio.paused) {
512
+ localStorage.setItem('towerMusicTime', bgmAudio.currentTime.toString());
513
+ localStorage.setItem('towerMusicPlaying', 'true');
514
+ } else {
515
+ localStorage.setItem('towerMusicPlaying', 'false');
516
+ }
517
+ }, 1000);
518
+
519
+ // 頁面離開前保存音樂狀態
520
+ window.addEventListener('beforeunload', function() {
521
+ localStorage.setItem('towerMusicTime', bgmAudio.currentTime.toString());
522
+ localStorage.setItem('towerMusicPlaying', !bgmAudio.paused ? 'true' : 'false');
523
+ });
524
+ });
525
+ </script>
526
+ </body>
527
+ </html>
tower.jpg ADDED

Git LFS Details

  • SHA256: 33f178b835fcfb88f94bbf7503f7721a92dc32ffdab69592005515fafb7a7d73
  • Pointer size: 131 Bytes
  • Size of remote file: 679 kB
tower.js ADDED
@@ -0,0 +1,489 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ document.addEventListener('DOMContentLoaded', function() {
2
+ // 檢查是否有玩家資料
3
+ const currentPlayerId = localStorage.getItem('currentPlayerId');
4
+ const playerName = localStorage.getItem('playerName');
5
+ const playerProfession = localStorage.getItem('playerProfession');
6
+
7
+ // 如果沒有玩家資料,重定向到首頁
8
+ if (!currentPlayerId || !playerName || !playerProfession) {
9
+ alert('請先登入遊戲!');
10
+ window.location.href = 'index.html';
11
+ return;
12
+ }
13
+
14
+ // 獲取DOM元素
15
+ const startChallengeBtn = document.getElementById('start-challenge');
16
+ const quizContainer = document.getElementById('quiz-container');
17
+ const resultContainer = document.getElementById('result-container');
18
+ const questionTitle = document.getElementById('question-title');
19
+ const formulaDisplay = document.getElementById('formula-display');
20
+ const formulaTemplate = document.getElementById('formula-template');
21
+ const dragItems = document.getElementById('drag-items');
22
+ const stage1Btn = document.getElementById('stage-1-btn');
23
+ const stage2Btn = document.getElementById('stage-2-btn');
24
+ const checkAnswerBtn = document.getElementById('check-answer');
25
+ const nextQuestionBtn = document.getElementById('next-question');
26
+ const currentQuestionSpan = document.getElementById('current-question');
27
+ const feedbackContainer = document.getElementById('feedback-container');
28
+ const resultTitle = document.getElementById('result-title');
29
+ const resultMessage = document.getElementById('result-message');
30
+ const retryBtn = document.getElementById('retry-challenge');
31
+ const backToMapBtn = document.getElementById('back-to-map');
32
+ const nextTrialBtn = document.getElementById('next-trial');
33
+ const doorsProgress = document.getElementById('doors-progress').children;
34
+ const successButtons = document.getElementById('success-buttons');
35
+ const failButtons = document.getElementById('fail-buttons');
36
+ const bgmAudio = document.getElementById('bgm');
37
+ const correctSound = document.getElementById('correct-sound');
38
+ const wrongSound = document.getElementById('wrong-sound');
39
+ const toggleBgmBtn = document.getElementById('toggle-bgm');
40
+ const starResults = [
41
+ document.getElementById('star-1'),
42
+ document.getElementById('star-2'),
43
+ document.getElementById('star-3')
44
+ ];
45
+
46
+ // 音樂控制
47
+ let isBgmPlaying = false;
48
+
49
+ // 播放背景音樂
50
+ function playBgm() {
51
+ bgmAudio.volume = 0.3; // 設置音量
52
+ bgmAudio.play().catch(e => console.log('自動播放被阻止:', e));
53
+ isBgmPlaying = true;
54
+ toggleBgmBtn.textContent = '音樂關';
55
+ }
56
+
57
+ // 嘗試自動播放背景音樂(大多數瀏覽器會阻止)
58
+ playBgm();
59
+
60
+ // 音樂開關按鈕
61
+ toggleBgmBtn.addEventListener('click', function() {
62
+ if (isBgmPlaying) {
63
+ bgmAudio.pause();
64
+ isBgmPlaying = false;
65
+ toggleBgmBtn.textContent = '音樂開';
66
+ localStorage.setItem('towerMusicPlaying', 'false');
67
+ } else {
68
+ bgmAudio.play();
69
+ isBgmPlaying = true;
70
+ toggleBgmBtn.textContent = '音樂關';
71
+ localStorage.setItem('towerMusicPlaying', 'true');
72
+ }
73
+ });
74
+
75
+ // 問題資料
76
+ const questions = [
77
+ {
78
+ title: "101² = (100 + 1)²",
79
+ stage1: {
80
+ template: "100² + ___ × ___ + ___ × ___ + 1²",
81
+ dragItems: ["100", "99", "200", "1", "2"],
82
+ answers: [["1", "100"], ["1", "100"]] // 順序不限
83
+ },
84
+ stage2: {
85
+ template: "100² + ___ × ___ + 1²",
86
+ dragItems: ["100", "99", "200", "1", "2"],
87
+ answers: [["2", "100"]] // 順序不限
88
+ }
89
+ },
90
+ {
91
+ title: "99² = (100 - 1)²",
92
+ stage1: {
93
+ template: "100² - ___ × ___ - ___ × ___ + 1²",
94
+ dragItems: ["1", "2", "100", "98", "200"],
95
+ answers: [["1", "100"], ["1", "100"]] // 順序不限
96
+ },
97
+ stage2: {
98
+ template: "100² - ___ × ___ + 1²",
99
+ dragItems: ["1", "2", "100", "98", "200"],
100
+ answers: [["2", "100"]] // 順序不限
101
+ }
102
+ },
103
+ {
104
+ title: "21² = (20 + 1)²",
105
+ stage1: {
106
+ template: "20² + ___ × ___ + ___ × ___ + 1²",
107
+ dragItems: ["1", "20", "2", "21", "19"],
108
+ answers: [["1", "20"], ["1", "20"]] // 順序不限
109
+ },
110
+ stage2: {
111
+ template: "20² + ___ × ___ + 1²",
112
+ dragItems: ["1", "20", "2", "21", "19"],
113
+ answers: [["2", "20"]] // 順序不限
114
+ }
115
+ },
116
+ {
117
+ title: "41² = (40 + 1)²",
118
+ stage1: {
119
+ template: "40² + ___ × ___ + ___ × ___ + 1²",
120
+ dragItems: ["1", "2", "40", "39", "42"],
121
+ answers: [["1", "40"], ["1", "40"]] // 順序不限
122
+ },
123
+ stage2: {
124
+ template: "40² + ___ × ___ + 1²",
125
+ dragItems: ["1", "2", "40", "39", "42"],
126
+ answers: [["2", "40"]] // 順序不限
127
+ }
128
+ },
129
+ {
130
+ title: "202² = (200 + 2)²",
131
+ stage1: {
132
+ template: "200² + ___ × ___ + ___ × ___ + 2²",
133
+ dragItems: ["2", "3", "200", "201", "400"],
134
+ answers: [["2", "200"], ["2", "200"]] // 順序不限
135
+ },
136
+ stage2: {
137
+ template: "200² + ___ × ___ + 2²",
138
+ dragItems: ["2", "3", "200", "201", "400"],
139
+ answers: [["2", "200"]] // 順序不限
140
+ }
141
+ },
142
+ {
143
+ title: "198² = (200 - 2)²",
144
+ stage1: {
145
+ template: "200² - ___ × ___ - ___ × ___ + 2²",
146
+ dragItems: ["2", "200", "4", "199", "202"],
147
+ answers: [["2", "200"], ["2", "200"]] // 順序不限
148
+ },
149
+ stage2: {
150
+ template: "200² - ___ × ___ + 2²",
151
+ dragItems: ["2", "200", "4", "199", "202"],
152
+ answers: [["2", "200"]] // 順序不限
153
+ }
154
+ }
155
+ ];
156
+
157
+ // 遊戲狀態
158
+ let currentQuestionIndex = 0;
159
+ let currentStage = 1;
160
+ let correctAnswers = 0;
161
+ let userAnswers = []; // 記錄用戶答案
162
+ let dropZones = []; // 當前問題的所有拖放區
163
+ let dragItemElements = []; // 當前問題的所有拖拽項
164
+
165
+ // 獲取遊戲進度
166
+ const gameProgress = JSON.parse(localStorage.getItem(`gameProgress_${currentPlayerId}`)) || {
167
+ completedTrials: {
168
+ "平方之泉": { completed: false, score: 0, challengesCompleted: [false, false, false, false, false, false] },
169
+ "變換山谷": { completed: false, score: 0, challengesCompleted: [false, false, false, false, false, false] },
170
+ "展開之塔": { completed: false, score: 0, challengesCompleted: [false, false, false, false, false, false] }
171
+ },
172
+ currentLocation: "展開之塔",
173
+ lastSaved: new Date().toISOString()
174
+ };
175
+
176
+ // 開始挑戰按鈕點擊事件
177
+ startChallengeBtn.addEventListener('click', function() {
178
+ startChallengeBtn.style.display = 'none';
179
+ quizContainer.style.display = 'block';
180
+ loadQuestion(0, 1);
181
+ });
182
+
183
+ // 載入問題
184
+ function loadQuestion(questionIndex, stageIndex) {
185
+ currentQuestionIndex = questionIndex;
186
+ currentStage = stageIndex;
187
+
188
+ // 更新問題標題和進度
189
+ currentQuestionSpan.textContent = questionIndex + 1;
190
+ questionTitle.textContent = `問題 ${questionIndex + 1}`;
191
+ formulaDisplay.textContent = questions[questionIndex].title;
192
+
193
+ // 更新階段按鈕狀態
194
+ stage1Btn.classList.toggle('active', stageIndex === 1);
195
+ stage2Btn.classList.toggle('active', stageIndex === 2);
196
+
197
+ // 清空公式模板和拖拽項
198
+ formulaTemplate.innerHTML = '';
199
+ dragItems.innerHTML = '';
200
+
201
+ // 獲取當前階段的問題數據
202
+ const stageData = stageIndex === 1 ? questions[questionIndex].stage1 : questions[questionIndex].stage2;
203
+
204
+ // 創建公式模板
205
+ const templateParts = stageData.template.split('___');
206
+ for (let i = 0; i < templateParts.length; i++) {
207
+ // 添加文本部分
208
+ formulaTemplate.appendChild(document.createTextNode(templateParts[i]));
209
+
210
+ // 如果不是最後一部分,添加拖放區
211
+ if (i < templateParts.length - 1) {
212
+ const dropZone = document.createElement('span');
213
+ dropZone.className = 'drop-zone';
214
+ dropZone.dataset.index = i;
215
+ formulaTemplate.appendChild(dropZone);
216
+ dropZones.push(dropZone);
217
+
218
+ // 添加拖放事件
219
+ dropZone.addEventListener('dragover', function(e) {
220
+ e.preventDefault();
221
+ });
222
+
223
+ dropZone.addEventListener('drop', function(e) {
224
+ e.preventDefault();
225
+ const draggedItemId = e.dataTransfer.getData('text/plain');
226
+ const draggedItem = document.getElementById(draggedItemId);
227
+
228
+ // 如果拖放區已有內容,先清空
229
+ if (this.firstChild) {
230
+ const oldItem = this.firstChild;
231
+ oldItem.style.display = 'inline-block';
232
+ dragItems.appendChild(oldItem);
233
+ }
234
+
235
+ // 將拖拽項放入拖放區
236
+ this.appendChild(draggedItem);
237
+ this.classList.add('filled');
238
+ });
239
+ }
240
+ }
241
+
242
+ // 創建拖拽項
243
+ stageData.dragItems.forEach((item, index) => {
244
+ const dragItem = document.createElement('div');
245
+ dragItem.className = 'drag-item';
246
+ dragItem.id = `drag-item-${index}`;
247
+ dragItem.textContent = item;
248
+ dragItem.draggable = true;
249
+
250
+ dragItem.addEventListener('dragstart', function(e) {
251
+ e.dataTransfer.setData('text/plain', this.id);
252
+ this.classList.add('dragging');
253
+
254
+ // 如果拖拽項在拖放區中,需要從拖放區移除
255
+ if (this.parentElement.classList.contains('drop-zone')) {
256
+ this.parentElement.classList.remove('filled');
257
+ }
258
+ });
259
+
260
+ dragItem.addEventListener('dragend', function() {
261
+ this.classList.remove('dragging');
262
+ });
263
+
264
+ dragItems.appendChild(dragItem);
265
+ dragItemElements.push(dragItem);
266
+ });
267
+
268
+ // 重置反饋和下一題按鈕
269
+ feedbackContainer.style.display = 'none';
270
+ feedbackContainer.className = 'feedback-container';
271
+ nextQuestionBtn.style.display = 'none';
272
+ checkAnswerBtn.style.display = 'block';
273
+ }
274
+
275
+ // 階段按鈕點擊事件
276
+ stage1Btn.addEventListener('click', function() {
277
+ if (currentStage !== 1) {
278
+ loadQuestion(currentQuestionIndex, 1);
279
+ }
280
+ });
281
+
282
+ stage2Btn.addEventListener('click', function() {
283
+ if (currentStage !== 2) {
284
+ loadQuestion(currentQuestionIndex, 2);
285
+ }
286
+ });
287
+
288
+ // 檢查答案按鈕點擊事件
289
+ checkAnswerBtn.addEventListener('click', function() {
290
+ // 獲取所有填充的拖放區
291
+ const filledDropZones = document.querySelectorAll('.drop-zone.filled');
292
+
293
+ // 如果有拖放區未填充,顯示提示
294
+ if (filledDropZones.length < dropZones.length) {
295
+ alert('請填寫所有空格!');
296
+ return;
297
+ }
298
+
299
+ // 獲取用戶答案
300
+ const userAnswerValues = [];
301
+ filledDropZones.forEach(zone => {
302
+ userAnswerValues.push(zone.firstChild.textContent);
303
+ });
304
+
305
+ // 獲取正確答案
306
+ const stageData = currentStage === 1 ? questions[currentQuestionIndex].stage1 : questions[currentQuestionIndex].stage2;
307
+ const correctAnswerSets = stageData.answers;
308
+
309
+ // 檢查答案是否正確
310
+ let isCorrect = false;
311
+
312
+ // 檢查每一組可能的正確答案
313
+ for (const answerSet of correctAnswerSets) {
314
+ // 如果是第一階段,需要檢查兩組答案
315
+ if (currentStage === 1 && answerSet.length === 2 && userAnswerValues.length === 4) {
316
+ // 檢查第一組和第二組是否匹配
317
+ const firstPairCorrect =
318
+ (userAnswerValues[0] === answerSet[0] && userAnswerValues[1] === answerSet[1]) ||
319
+ (userAnswerValues[0] === answerSet[1] && userAnswerValues[1] === answerSet[0]);
320
+
321
+ const secondPairCorrect =
322
+ (userAnswerValues[2] === answerSet[0] && userAnswerValues[3] === answerSet[1]) ||
323
+ (userAnswerValues[2] === answerSet[1] && userAnswerValues[3] === answerSet[0]);
324
+
325
+ if (firstPairCorrect && secondPairCorrect) {
326
+ isCorrect = true;
327
+ break;
328
+ }
329
+ }
330
+ // 如果是第二階段,只需檢查一組答案
331
+ else if (currentStage === 2 && answerSet.length === 2 && userAnswerValues.length === 2) {
332
+ if ((userAnswerValues[0] === answerSet[0] && userAnswerValues[1] === answerSet[1]) ||
333
+ (userAnswerValues[0] === answerSet[1] && userAnswerValues[1] === answerSet[0])) {
334
+ isCorrect = true;
335
+ break;
336
+ }
337
+ }
338
+ }
339
+
340
+ // 顯示反饋
341
+ feedbackContainer.style.display = 'block';
342
+
343
+ if (isCorrect) {
344
+ feedbackContainer.textContent = '答對了!';
345
+ feedbackContainer.classList.add('correct');
346
+ correctSound.play();
347
+
348
+ // 如果是第二階段,標記問題已完成
349
+ if (currentStage === 2) {
350
+ // 更新門的狀態
351
+ doorsProgress[currentQuestionIndex].classList.add('opened');
352
+
353
+ // 記錄答對
354
+ if (!userAnswers[currentQuestionIndex]) {
355
+ userAnswers[currentQuestionIndex] = true;
356
+ correctAnswers++;
357
+ }
358
+ }
359
+
360
+ // 隱藏檢查按鈕,顯示下一步按鈕
361
+ checkAnswerBtn.style.display = 'none';
362
+ nextQuestionBtn.style.display = 'block';
363
+ } else {
364
+ feedbackContainer.textContent = '答錯了,請再試一次!';
365
+ feedbackContainer.classList.add('incorrect');
366
+ wrongSound.play();
367
+ }
368
+ });
369
+
370
+ // 下一題按鈕點擊事件
371
+ nextQuestionBtn.addEventListener('click', function() {
372
+ // 如果當前是第一階段,進入第二階段
373
+ if (currentStage === 1) {
374
+ loadQuestion(currentQuestionIndex, 2);
375
+ }
376
+ // 如果當前是第二階段,進入下一題或完成
377
+ else {
378
+ // 清空拖放區和拖拽項
379
+ dropZones = [];
380
+ dragItemElements = [];
381
+
382
+ if (currentQuestionIndex < questions.length - 1) {
383
+ loadQuestion(currentQuestionIndex + 1, 1);
384
+ } else {
385
+ showResult();
386
+ }
387
+ }
388
+ });
389
+
390
+ // 顯示結果
391
+ function showResult() {
392
+ quizContainer.style.display = 'none';
393
+ resultContainer.style.display = 'block';
394
+
395
+ // 計算得分
396
+ const score = Math.round((correctAnswers / questions.length) * 100);
397
+
398
+ // 更新遊戲進度
399
+ gameProgress.completedTrials["展開之塔"].score = score;
400
+ gameProgress.completedTrials["展開之塔"].challengesCompleted = Array(questions.length).fill(false).map((_, i) => i < correctAnswers);
401
+
402
+ // 根據答對題數顯示不同結果
403
+ if (correctAnswers >= 4) {
404
+ gameProgress.completedTrials["展開之塔"].completed = true;
405
+
406
+ resultTitle.textContent = '試煉成功!';
407
+ resultMessage.innerHTML = `
408
+ <p>恭喜你答對了 ${correctAnswers} 題,獲得了 ${score} 分!</p>
409
+ <p>成功通過試煉後,守衛恭敬地說:「恭喜你,勇者,你已經掌握了平方之力的三種境界。現在,返回王宮吧,智者正等著你重新點燃王國的平方之力核心。」</p>
410
+ `;
411
+
412
+ // 顯示星星
413
+ updateStars(correctAnswers);
414
+
415
+ // 顯示成功按鈕,隱藏失敗按鈕
416
+ successButtons.style.display = 'flex';
417
+ failButtons.style.display = 'none';
418
+ } else {
419
+ gameProgress.completedTrials["展開之塔"].completed = false;
420
+
421
+ resultTitle.textContent = '試煉失敗';
422
+ resultMessage.innerHTML = `
423
+ <p>你只答對了 ${correctAnswers} 題,需要至少答對4題才能通過試煉。</p>
424
+ <p>守衛說道:「不要氣餒,再試一次吧!展開的力量需要更多練習才能掌握。」</p>
425
+ `;
426
+
427
+ // 不顯示星星
428
+ updateStars(0);
429
+
430
+ // 顯示失敗按鈕,隱藏成功按鈕
431
+ successButtons.style.display = 'none';
432
+ failButtons.style.display = 'flex';
433
+ }
434
+
435
+ // 保存遊戲進度
436
+ localStorage.setItem(`gameProgress_${currentPlayerId}`, JSON.stringify(gameProgress));
437
+ }
438
+
439
+ // 更新星星顯示
440
+ function updateStars(correctCount) {
441
+ // 根據答對題數顯示星星
442
+ // 6題全對 = 3星, 5題對 = 2星, 4題對 = 1星, 少於4題 = 0星
443
+ let earnedStars = 0;
444
+ if (correctCount >= 6) earnedStars = 3;
445
+ else if (correctCount >= 5) earnedStars = 2;
446
+ else if (correctCount >= 4) earnedStars = 1;
447
+
448
+ // 更新星星顯示
449
+ for (let i = 0; i < starResults.length; i++) {
450
+ if (i < earnedStars) {
451
+ starResults[i].classList.add('earned');
452
+ } else {
453
+ starResults[i].classList.remove('earned');
454
+ }
455
+ }
456
+ }
457
+
458
+ // 重新挑戰按鈕點擊事件
459
+ retryBtn.addEventListener('click', function() {
460
+ // 重置遊戲狀態
461
+ currentQuestionIndex = 0;
462
+ currentStage = 1;
463
+ correctAnswers = 0;
464
+ userAnswers = [];
465
+ dropZones = [];
466
+ dragItemElements = [];
467
+
468
+ // 重置門的狀態
469
+ for (let i = 0; i < doorsProgress.length; i++) {
470
+ doorsProgress[i].classList.remove('opened');
471
+ }
472
+
473
+ // 顯示問題
474
+ resultContainer.style.display = 'none';
475
+ quizContainer.style.display = 'block';
476
+ loadQuestion(0, 1);
477
+ });
478
+
479
+ // 返回地圖按鈕點擊事件
480
+ backToMapBtn.addEventListener('click', function() {
481
+ window.location.href = 'kingdom_map.html';
482
+ });
483
+
484
+ // 完成旅程按鈕點擊事件
485
+ nextTrialBtn.addEventListener('click', function() {
486
+ alert('恭喜你完成了所有試煉!你已經成為真正的數學勇者,掌握了平方之力的三種境界。');
487
+ window.location.href = 'kingdom_map.html';
488
+ });
489
+ });
tower.mp3 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1f637bede5165075cceb796f1705449688be67ebda5f7316da669ff3c502bf32
3
+ size 2513184
valley.html CHANGED
@@ -320,9 +320,12 @@
320
  <span class="star-result" id="star-3">★</span>
321
  </div>
322
 
323
- <div class="navigation-buttons">
324
- <button id="retry-challenge" class="nav-btn">重新挑戰</button>
325
  <button id="back-to-map" class="nav-btn">返回王國地圖</button>
 
 
 
 
326
  </div>
327
  </div>
328
 
 
320
  <span class="star-result" id="star-3">★</span>
321
  </div>
322
 
323
+ <div class="navigation-buttons" id="success-buttons" style="display: none;">
 
324
  <button id="back-to-map" class="nav-btn">返回王國地圖</button>
325
+ <button id="next-trial" class="nav-btn">挑戰下一試煉</button>
326
+ </div>
327
+ <div class="navigation-buttons" id="fail-buttons" style="display: none;">
328
+ <button id="retry-challenge" class="nav-btn">重新挑戰</button>
329
  </div>
330
  </div>
331
 
valley.js CHANGED
@@ -216,6 +216,10 @@ document.addEventListener('DOMContentLoaded', function() {
216
  quizContainer.style.display = 'none';
217
  resultContainer.style.display = 'block';
218
 
 
 
 
 
219
  // 計算得分
220
  const score = Math.round((correctAnswers / questions.length) * 100);
221
 
@@ -235,6 +239,10 @@ document.addEventListener('DOMContentLoaded', function() {
235
 
236
  // 顯示星星
237
  updateStars(correctAnswers);
 
 
 
 
238
  } else {
239
  gameProgress.completedTrials["變換山谷"].completed = false;
240
 
@@ -246,6 +254,10 @@ document.addEventListener('DOMContentLoaded', function() {
246
 
247
  // 不顯示星星
248
  updateStars(0);
 
 
 
 
249
  }
250
 
251
  // 保存遊戲進度
@@ -288,9 +300,13 @@ document.addEventListener('DOMContentLoaded', function() {
288
  quizContainer.style.display = 'block';
289
  loadQuestion(0);
290
  });
291
-
292
- // 返回地圖按鈕點擊事件
293
  backToMapBtn.addEventListener('click', function() {
294
  window.location.href = 'kingdom_map.html';
295
  });
296
- });
 
 
 
 
 
 
216
  quizContainer.style.display = 'none';
217
  resultContainer.style.display = 'block';
218
 
219
+ // 獲取成功和失敗按鈕容器
220
+ const successButtons = document.getElementById('success-buttons');
221
+ const failButtons = document.getElementById('fail-buttons');
222
+
223
  // 計算得分
224
  const score = Math.round((correctAnswers / questions.length) * 100);
225
 
 
239
 
240
  // 顯示星星
241
  updateStars(correctAnswers);
242
+
243
+ // 顯示成功按鈕,隱藏失敗按鈕
244
+ successButtons.style.display = 'flex';
245
+ failButtons.style.display = 'none';
246
  } else {
247
  gameProgress.completedTrials["變換山谷"].completed = false;
248
 
 
254
 
255
  // 不顯示星星
256
  updateStars(0);
257
+
258
+ // 顯示失敗按鈕,隱藏成功按鈕
259
+ successButtons.style.display = 'none';
260
+ failButtons.style.display = 'flex';
261
  }
262
 
263
  // 保存遊戲進度
 
300
  quizContainer.style.display = 'block';
301
  loadQuestion(0);
302
  });
303
+ // 返回地圖按鈕點擊事件
 
304
  backToMapBtn.addEventListener('click', function() {
305
  window.location.href = 'kingdom_map.html';
306
  });
307
+
308
+ // 前往下一試煉按鈕點擊事件
309
+ nextTrialBtn.addEventListener('click', function() {
310
+ // 直接導向展開之塔
311
+ window.location.href = 'tower.html';
312
+ });});