Lashtw commited on
Commit
f56259b
·
verified ·
1 Parent(s): dea0bf7

Upload 1633 files

Browse files
Files changed (5) hide show
  1. boss-test.html +316 -0
  2. css/game.css +87 -0
  3. js/admin.js +2 -1
  4. js/db.js +4 -4
  5. js/game.js +162 -12
boss-test.html CHANGED
@@ -1154,6 +1154,175 @@
1154
  transform: translateY(-2px);
1155
  box-shadow: 0 12px 30px rgba(245, 179, 35, 0.55);
1156
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1157
  </style>
1158
  </head>
1159
  <body>
@@ -1469,9 +1638,48 @@
1469
  </div>
1470
  </div>
1471
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1472
  <!-- ===================== 測試控制列 ===================== -->
1473
  <div class="debug-bar collapsed" id="debugBar">
1474
  <button class="debug-btn debug-toggle" id="btnDebugToggle" type="button">🛠️ 測試</button>
 
1475
  <button class="debug-btn" id="btnOpenEyeCalibrator" type="button" style="background:#4338ca;color:#fef08a;">👁️ 眼睛定位微調器</button>
1476
  <button class="debug-btn" id="btnPreviewPatch" type="button" style="background:#78350f;color:#fef08a;">📜 預覽週五更新公告</button>
1477
  <span>錯題:</span>
@@ -2052,6 +2260,113 @@
2052
  updateCalibratorUI();
2053
  }
2054
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2055
  // ==========================================
2056
  // 7. 事件綁定(只綁一次,使用事件委派)
2057
  // ==========================================
@@ -2079,6 +2394,7 @@
2079
  }));
2080
 
2081
  initCalibrator();
 
2082
  resetAll();
2083
  } catch (err) {
2084
  console.error('[boss-test] init 失敗:', err);
 
1154
  transform: translateY(-2px);
1155
  box-shadow: 0 12px 30px rgba(245, 179, 35, 0.55);
1156
  }
1157
+
1158
+ /* =====================================================
1159
+ 大地圖沙盤呈現預覽模態視窗
1160
+ ===================================================== */
1161
+ .map-preview-modal {
1162
+ width: 96vw;
1163
+ max-width: 1280px;
1164
+ height: 92vh;
1165
+ max-height: 840px;
1166
+ background: #0f121d;
1167
+ border: 1px solid rgba(245, 196, 81, 0.45);
1168
+ border-radius: 20px;
1169
+ display: flex;
1170
+ flex-direction: column;
1171
+ overflow: hidden;
1172
+ box-shadow: 0 30px 90px rgba(0,0,0,0.9);
1173
+ animation: cardIn 0.35s cubic-bezier(0.22, 1, 0.36, 1);
1174
+ }
1175
+ .map-preview-header {
1176
+ padding: 12px 20px;
1177
+ background: #161a29;
1178
+ border-bottom: 1px solid rgba(255,255,255,0.1);
1179
+ display: flex;
1180
+ align-items: center;
1181
+ justify-content: space-between;
1182
+ gap: 12px;
1183
+ flex-wrap: wrap;
1184
+ }
1185
+ .map-preview-body {
1186
+ flex: 1;
1187
+ position: relative;
1188
+ overflow: hidden;
1189
+ display: flex;
1190
+ align-items: center;
1191
+ justify-content: center;
1192
+ background: #faede1;
1193
+ padding: 8px;
1194
+ }
1195
+ .sandbox-wrap {
1196
+ position: relative;
1197
+ width: 100%;
1198
+ height: 100%;
1199
+ max-height: 100%;
1200
+ aspect-ratio: 16 / 9;
1201
+ border-radius: 14px;
1202
+ overflow: hidden;
1203
+ box-shadow: 0 16px 40px rgba(0,0,0,0.35);
1204
+ container-type: inline-size;
1205
+ user-select: none;
1206
+ }
1207
+ .sandbox-bg {
1208
+ width: 100%;
1209
+ height: 100%;
1210
+ object-fit: cover;
1211
+ display: block;
1212
+ pointer-events: none;
1213
+ }
1214
+ .sandbox-spots {
1215
+ position: absolute;
1216
+ inset: 0;
1217
+ pointer-events: none;
1218
+ }
1219
+ .sandbox-spot {
1220
+ position: absolute;
1221
+ pointer-events: auto;
1222
+ transform: translate(-50%, -50%);
1223
+ display: flex;
1224
+ flex-direction: column;
1225
+ align-items: center;
1226
+ gap: 2px;
1227
+ cursor: pointer;
1228
+ transition: all .25s cubic-bezier(.34,1.56,.64,1);
1229
+ }
1230
+ .sandbox-spot:hover {
1231
+ transform: translate(-50%, -54%) scale(1.08);
1232
+ z-index: 40;
1233
+ }
1234
+ .sandbox-thumb {
1235
+ position: relative;
1236
+ display: flex;
1237
+ align-items: center;
1238
+ justify-content: center;
1239
+ }
1240
+ .sandbox-thumb img {
1241
+ width: 100%;
1242
+ height: 100%;
1243
+ object-fit: contain;
1244
+ filter: drop-shadow(0 10px 18px rgba(45,30,20, 0.45));
1245
+ }
1246
+ .sandbox-label {
1247
+ background: rgba(255,255,255,0.92);
1248
+ border: 1px solid rgba(180,130,100,0.35);
1249
+ border-radius: 8px;
1250
+ padding: 3px 8px;
1251
+ font-size: 11px;
1252
+ font-weight: 800;
1253
+ color: #334155;
1254
+ white-space: nowrap;
1255
+ box-shadow: 0 4px 12px rgba(0,0,0,0.15);
1256
+ text-align: center;
1257
+ }
1258
+
1259
+ /* 世界 Boss 沙盤微縮手辦專屬特效 */
1260
+ .spot-boss-wrap {
1261
+ position: relative;
1262
+ display: flex;
1263
+ align-items: center;
1264
+ justify-content: center;
1265
+ animation: bossHoverFloat 4.2s ease-in-out infinite;
1266
+ }
1267
+ @keyframes bossHoverFloat {
1268
+ 0%, 100% { transform: translateY(0); }
1269
+ 50% { transform: translateY(-8px); }
1270
+ }
1271
+ .spot-boss-aura {
1272
+ position: absolute; inset: -15%; border-radius: 50%; pointer-events: none; z-index: 1;
1273
+ background: radial-gradient(circle, rgba(168, 85, 247, 0.45) 0%, rgba(239, 68, 68, 0.28) 45%, transparent 72%);
1274
+ animation: bossAuraPulse 3.2s ease-in-out infinite alternate;
1275
+ }
1276
+ @keyframes bossAuraPulse {
1277
+ 0% { transform: scale(0.92); opacity: 0.75; }
1278
+ 100% { transform: scale(1.18); opacity: 1; filter: drop-shadow(0 0 16px rgba(239, 68, 68, 0.6)); }
1279
+ }
1280
+ .spot-boss-img {
1281
+ position: relative; z-index: 2; width: 100%; height: 100%; object-fit: contain; display: block;
1282
+ filter: drop-shadow(0 14px 26px rgba(40, 10, 30, 0.6)) drop-shadow(0 0 20px rgba(168, 85, 247, 0.65));
1283
+ transition: all .28s cubic-bezier(.34,1.56,.64,1);
1284
+ }
1285
+ .sandbox-spot:hover .spot-boss-img {
1286
+ filter: drop-shadow(0 20px 36px rgba(40, 10, 30, 0.75)) drop-shadow(0 0 32px rgba(245, 158, 11, 0.95)) drop-shadow(0 0 16px rgba(239, 68, 68, 0.9));
1287
+ transform: scale(1.08);
1288
+ }
1289
+ /* 封印態 */
1290
+ .sandbox-spot.boss-sealed .spot-boss-aura {
1291
+ background: radial-gradient(circle, rgba(100, 116, 139, 0.35) 0%, rgba(15, 23, 42, 0.6) 55%, transparent 75%);
1292
+ }
1293
+ .sandbox-spot.boss-sealed .spot-boss-img {
1294
+ filter: brightness(0.24) contrast(1.45) drop-shadow(0 10px 22px rgba(0, 0, 0, 0.8)) drop-shadow(0 0 14px rgba(245, 196, 81, 0.4));
1295
+ }
1296
+ .sandbox-spot.boss-sealed:hover .spot-boss-img {
1297
+ filter: brightness(0.35) contrast(1.4) drop-shadow(0 16px 30px rgba(0, 0, 0, 0.9)) drop-shadow(0 0 24px rgba(245, 196, 81, 0.8));
1298
+ }
1299
+ .spot-boss-seal-ring {
1300
+ position: absolute; inset: 4%; border: 2px dashed rgba(245, 196, 81, 0.7);
1301
+ border-radius: 50%; pointer-events: none; z-index: 3;
1302
+ animation: sealRingRotate 18s linear infinite;
1303
+ box-shadow: inset 0 0 15px rgba(245, 196, 81, 0.3), 0 0 15px rgba(245, 196, 81, 0.3);
1304
+ }
1305
+ @keyframes sealRingRotate {
1306
+ from { transform: rotate(0deg); }
1307
+ to { transform: rotate(360deg); }
1308
+ }
1309
+ .spot-badge-boss {
1310
+ position: absolute; top: -6px; left: -8px; z-index: 6;
1311
+ background: linear-gradient(135deg, #ef4444, #f59e0b); color: #fff;
1312
+ font-size: 11px; font-weight: 900; padding: 2px 10px; border-radius: 99px;
1313
+ box-shadow: 0 4px 12px rgba(239, 68, 68, 0.45); border: 1.5px solid rgba(255, 255, 255, 0.9);
1314
+ display: flex; align-items: center; gap: 4px; white-space: nowrap;
1315
+ }
1316
+ .sandbox-spot.boss-sealed .spot-badge-boss {
1317
+ background: linear-gradient(135deg, #475569, #1e293b); color: #cbd5e1;
1318
+ box-shadow: 0 3px 10px rgba(15, 23, 42, 0.5); border-color: rgba(245, 196, 81, 0.6);
1319
+ }
1320
+ .sandbox-spot.spot-boss .sandbox-label {
1321
+ background: linear-gradient(135deg, rgba(26, 16, 36, 0.95), rgba(45, 18, 30, 0.95)) !important;
1322
+ border: 1.5px solid rgba(245, 196, 81, 0.6) !important;
1323
+ color: #fde047 !important;
1324
+ box-shadow: 0 8px 20px rgba(20, 10, 30, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.2) !important;
1325
+ }
1326
  </style>
1327
  </head>
1328
  <body>
 
1638
  </div>
1639
  </div>
1640
 
1641
+ <!-- ===================== 沙盤大地圖呈現預覽模態視窗 ===================== -->
1642
+ <div class="modal-overlay hidden" id="modalMapPreview" style="z-index: 9998;">
1643
+ <div class="map-preview-modal">
1644
+ <div class="map-preview-header">
1645
+ <div style="display:flex; align-items:center; gap:12px;">
1646
+ <h3 style="margin:0; font-size:16px; font-weight:900; color:var(--gold); display:flex; align-items:center; gap:6px;">
1647
+ 🗺️ 世界 Boss 在沙盤大地圖上的實裝呈現
1648
+ </h3>
1649
+ <span style="font-size:12px; color:#cbd5e1;">(展示於神州浮島極東雲海禁地,右上方)</span>
1650
+ </div>
1651
+ <div style="display:flex; align-items:center; gap:10px;">
1652
+ <!-- 狀態切換器 -->
1653
+ <div style="display:flex; background:rgba(255,255,255,0.08); border-radius:8px; padding:2px; border:1px solid rgba(255,255,255,0.15);">
1654
+ <button class="cal-pill-btn" id="btnMapStateSealed" type="button">🔒 10/27 封印態 (預設)</button>
1655
+ <button class="cal-pill-btn active" id="btnMapStateOpen" type="button">🔥 破印開放態 (討伐中)</button>
1656
+ </div>
1657
+ <button class="debug-btn" id="btnCloseMapPreview" type="button" style="padding:5px 12px; background:rgba(255,255,255,0.12); color:#fff;">✕ 關閉</button>
1658
+ </div>
1659
+ </div>
1660
+
1661
+ <div class="map-preview-body">
1662
+ <div class="sandbox-wrap" id="sandboxWrap">
1663
+ <img src="assets/map_chibi.jpg" class="sandbox-bg" alt="沙盤大地圖">
1664
+ <div class="sandbox-spots" id="sandboxSpots"></div>
1665
+ </div>
1666
+ </div>
1667
+
1668
+ <div style="padding:10px 16px; background:#161a29; border-top:1px solid rgba(255,255,255,0.1); display:flex; justify-content:space-between; align-items:center; font-size:12px; color:#94a3b8;">
1669
+ <div>
1670
+ 💡 <b>互動說明</b>:請將滑鼠移至右上方【上古・饕餮】體驗懸浮煞氣與紫金光暈;<b>直接點擊饕餮</b>可觸發前瞻情報或挑戰準備!
1671
+ </div>
1672
+ <div style="color:var(--gold); font-weight:700;">
1673
+ 當前座標:X: 81.5% | Y: 22.0% | 尺寸: 168px
1674
+ </div>
1675
+ </div>
1676
+ </div>
1677
+ </div>
1678
+
1679
  <!-- ===================== 測試控制列 ===================== -->
1680
  <div class="debug-bar collapsed" id="debugBar">
1681
  <button class="debug-btn debug-toggle" id="btnDebugToggle" type="button">🛠️ 測試</button>
1682
+ <button class="debug-btn" id="btnPreviewMap" type="button" style="background:#047857; color:#fef08a; font-weight:800;">🗺️ 預覽世界Boss地圖呈現</button>
1683
  <button class="debug-btn" id="btnOpenEyeCalibrator" type="button" style="background:#4338ca;color:#fef08a;">👁️ 眼睛定位微調器</button>
1684
  <button class="debug-btn" id="btnPreviewPatch" type="button" style="background:#78350f;color:#fef08a;">📜 預覽週五更新公告</button>
1685
  <span>錯題:</span>
 
2260
  updateCalibratorUI();
2261
  }
2262
 
2263
+ // ==========================================
2264
+ // 8. 世界 Boss 沙盤大地圖呈現預覽
2265
+ // ==========================================
2266
+ const PREVIEW_MAP_SPOTS = [
2267
+ { id: 'b1', name: '景陽瓷都', icon: '🏺', x: 27.8, y: 70.7, size: 100, src: 'assets/building_b1.png' },
2268
+ { id: 'b9', name: '柴桑水寨', icon: '⚓', x: 18.1, y: 62.1, size: 100, src: 'assets/building_b9.png' },
2269
+ { id: 'b2', name: '平原稻鄉', icon: '🌾', x: 37.7, y: 78.9, size: 100, src: 'assets/building_b2.png' },
2270
+ { id: 'b4', name: '百草藥谷', icon: '🌿', x: 62.1, y: 79.0, size: 100, src: 'assets/building_b4.png' },
2271
+ { id: 'b7', name: '塞外天馬', icon: '🐎', x: 71.8, y: 70.6, size: 100, src: 'assets/building_b7.png' },
2272
+ { id: 'b3', name: '神兵鐵城', icon: '⚔️', x: 50.5, y: 48.5, size: 105, src: 'assets/building_b3.png' },
2273
+ { id: 'b5', name: '蜀錦絲城', icon: '👘', x: 59.9, y: 42.2, size: 105, src: 'assets/building_b5.png' },
2274
+ { id: 'b6', name: '崑崙玉塞', icon: '⛏️', x: 81.6, y: 62.2, size: 105, src: 'assets/building_b6.png' },
2275
+ { id: 'b8', name: '軍機策府', icon: '🏫', x: 67.5, y: 34.7, size: 105, src: 'assets/building_b8.png' },
2276
+ { id: 'b10', name: '霸業王城', icon: '🏰', x: 52.0, y: 22.0, size: 90, isCapital: true },
2277
+ { id: 'tianji', name: '天機閣', icon: '🏯', x: 34.5, y: 29.7, size: 100, src: 'assets/building_tianji.png' },
2278
+ ];
2279
+
2280
+ let mapPreviewBossMode = 'open'; // 'sealed' | 'open'
2281
+
2282
+ function renderSandboxSpots() {
2283
+ const container = $('sandboxSpots');
2284
+ if (!container) return;
2285
+
2286
+ const isSealed = mapPreviewBossMode === 'sealed';
2287
+
2288
+ const spotsHtml = PREVIEW_MAP_SPOTS.map(s => {
2289
+ let visual = '';
2290
+ if (s.isCapital) {
2291
+ visual = `<div class="sandbox-thumb" style="width:clamp(45px, calc(${s.size} * 100cqw / 1400), ${s.size}px); height:clamp(35px, calc(${s.size * 0.75} * 100cqw / 1400), ${s.size * 0.75}px);">
2292
+ <span style="font-size:24px; filter:drop-shadow(0 2px 8px rgba(0,0,0,0.8));">👑</span>
2293
+ </div>`;
2294
+ } else {
2295
+ visual = `<div class="sandbox-thumb" style="width:clamp(40px, calc(${s.size} * 100cqw / 1400), ${s.size}px); height:clamp(40px, calc(${s.size} * 100cqw / 1400), ${s.size}px);">
2296
+ <img src="${s.src}" alt="${s.name}">
2297
+ </div>`;
2298
+ }
2299
+ return `
2300
+ <div class="sandbox-spot" style="left:${s.x}%; top:${s.y}%;">
2301
+ ${visual}
2302
+ <div class="sandbox-label">${s.icon} ${s.name}</div>
2303
+ </div>
2304
+ `;
2305
+ }).join('');
2306
+
2307
+ // 世界 Boss 饕餮點位(x: 81.5%, y: 22.0%, size: 135)
2308
+ const bossSize = 135;
2309
+ const bossBadge = isSealed
2310
+ ? `<span class="spot-badge-boss">🔒 10/27 破印開放</span>`
2311
+ : `<span class="spot-badge-boss">🔥 討伐次數 (3/3)</span>`;
2312
+ const bossSub = isSealed ? '需通關第三單元・封印中' : '⚔️ 全服討伐中・爭奪首破';
2313
+
2314
+ const bossHtml = `
2315
+ <div class="sandbox-spot spot-boss ${isSealed ? 'boss-sealed' : 'boss-open'}" id="sandboxSpotBoss" style="left:81.5%; top:22.0%; z-index:30;" title="點擊體驗世界Boss互動!">
2316
+ ${bossBadge}
2317
+ <div class="spot-boss-wrap" style="width:clamp(50px, calc(${bossSize} * 100cqw / 1400), ${bossSize}px); height:clamp(50px, calc(${bossSize} * 100cqw / 1400), ${bossSize}px);">
2318
+ <div class="spot-boss-aura"></div>
2319
+ ${isSealed ? '<div class="spot-boss-seal-ring"></div>' : ''}
2320
+ <img class="spot-boss-img" src="assets/boss_taotie.png" alt="上古・饕餮">
2321
+ </div>
2322
+ <div class="sandbox-label" style="display:flex; flex-direction:column; gap:2px; padding:4px 8px;">
2323
+ <div style="font-weight:900; font-size:12px;">🐲 上古・饕餮</div>
2324
+ <div style="font-size:10px; opacity:0.85; background:rgba(245,196,81,0.2); padding:1px 4px; border-radius:4px;">${bossSub}</div>
2325
+ </div>
2326
+ </div>
2327
+ `;
2328
+
2329
+ container.innerHTML = spotsHtml + bossHtml;
2330
+
2331
+ // 點擊世界Boss事件
2332
+ const bossSpotEl = $('sandboxSpotBoss');
2333
+ if (bossSpotEl) {
2334
+ bossSpotEl.addEventListener('click', (e) => {
2335
+ e.stopPropagation();
2336
+ if (mapPreviewBossMode === 'sealed') {
2337
+ $('modalMapPreview').classList.add('hidden');
2338
+ $('modalPatch').classList.remove('hidden');
2339
+ } else {
2340
+ $('modalMapPreview').classList.add('hidden');
2341
+ if (inBattle) return;
2342
+ renderIntro();
2343
+ }
2344
+ });
2345
+ }
2346
+ }
2347
+
2348
+ function initMapPreview() {
2349
+ $('btnPreviewMap').addEventListener('click', () => {
2350
+ $('modalMapPreview').classList.remove('hidden');
2351
+ renderSandboxSpots();
2352
+ });
2353
+ $('btnCloseMapPreview').addEventListener('click', () => {
2354
+ $('modalMapPreview').classList.add('hidden');
2355
+ });
2356
+ $('btnMapStateSealed').addEventListener('click', () => {
2357
+ mapPreviewBossMode = 'sealed';
2358
+ $('btnMapStateSealed').classList.add('active');
2359
+ $('btnMapStateOpen').classList.remove('active');
2360
+ renderSandboxSpots();
2361
+ });
2362
+ $('btnMapStateOpen').addEventListener('click', () => {
2363
+ mapPreviewBossMode = 'open';
2364
+ $('btnMapStateOpen').classList.add('active');
2365
+ $('btnMapStateSealed').classList.remove('active');
2366
+ renderSandboxSpots();
2367
+ });
2368
+ }
2369
+
2370
  // ==========================================
2371
  // 7. 事件綁定(只綁一次,使用事件委派)
2372
  // ==========================================
 
2394
  }));
2395
 
2396
  initCalibrator();
2397
+ initMapPreview();
2398
  resetAll();
2399
  } catch (err) {
2400
  console.error('[boss-test] init 失敗:', err);
css/game.css CHANGED
@@ -664,6 +664,93 @@ html[data-theme="dark"] .r-card { background: var(--bg-2); }
664
  background: #e2e8f0; color: #64748b; box-shadow: none; border-color: #cbd5e1;
665
  }
666
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
667
  /* 天機閣彈窗與軍備箱預覽 */
668
  .tianji-head-banner {
669
  display: flex; align-items: center; gap: 16px; padding: 14px 18px;
 
664
  background: #e2e8f0; color: #64748b; box-shadow: none; border-color: #cbd5e1;
665
  }
666
 
667
+ /* =============================================================
668
+ 世界 Boss:【上古・饕餮】地圖專屬沙盤點位樣式
669
+ ============================================================= */
670
+ .spot-boss-wrap {
671
+ position: relative; width: 146px; height: 146px;
672
+ display: flex; align-items: center; justify-content: center;
673
+ animation: bossHoverFloat 4.2s ease-in-out infinite;
674
+ }
675
+ @keyframes bossHoverFloat {
676
+ 0%, 100% { transform: translateY(0); }
677
+ 50% { transform: translateY(-8px); }
678
+ }
679
+
680
+ /* 底層煞氣法陣光暈 */
681
+ .spot-boss-aura {
682
+ position: absolute; inset: -15%; border-radius: 50%; pointer-events: none; z-index: 1;
683
+ background: radial-gradient(circle, rgba(168, 85, 247, 0.42) 0%, rgba(239, 68, 68, 0.26) 45%, transparent 72%);
684
+ animation: bossAuraPulse 3.2s ease-in-out infinite alternate;
685
+ }
686
+ @keyframes bossAuraPulse {
687
+ 0% { transform: scale(0.92); opacity: 0.75; }
688
+ 100% { transform: scale(1.18); opacity: 1; filter: drop-shadow(0 0 16px rgba(239, 68, 68, 0.6)); }
689
+ }
690
+
691
+ .spot-boss-img {
692
+ position: relative; z-index: 2; width: 100%; height: 100%; object-fit: contain; display: block;
693
+ filter: drop-shadow(0 14px 26px rgba(40, 10, 30, 0.6)) drop-shadow(0 0 20px rgba(168, 85, 247, 0.65));
694
+ transition: all .28s cubic-bezier(.34,1.56,.64,1);
695
+ }
696
+
697
+ .map-spot:hover .spot-boss-img {
698
+ filter: drop-shadow(0 20px 36px rgba(40, 10, 30, 0.75)) drop-shadow(0 0 32px rgba(245, 158, 11, 0.95)) drop-shadow(0 0 16px rgba(239, 68, 68, 0.9));
699
+ transform: scale(1.08);
700
+ }
701
+
702
+ /* 封印態:暗黑神秘剪影 + 金色鎖鏈結界 */
703
+ .map-spot.boss-sealed .spot-boss-aura {
704
+ background: radial-gradient(circle, rgba(100, 116, 139, 0.35) 0%, rgba(15, 23, 42, 0.6) 55%, transparent 75%);
705
+ }
706
+ .map-spot.boss-sealed .spot-boss-img {
707
+ filter: brightness(0.24) contrast(1.45) drop-shadow(0 10px 22px rgba(0, 0, 0, 0.8)) drop-shadow(0 0 14px rgba(245, 196, 81, 0.4));
708
+ }
709
+ .map-spot.boss-sealed:hover .spot-boss-img {
710
+ filter: brightness(0.35) contrast(1.4) drop-shadow(0 16px 30px rgba(0, 0, 0, 0.9)) drop-shadow(0 0 24px rgba(245, 196, 81, 0.8));
711
+ }
712
+
713
+ /* 封印結界環 */
714
+ .spot-boss-seal-ring {
715
+ position: absolute; inset: 4%; border: 2px dashed rgba(245, 196, 81, 0.7);
716
+ border-radius: 50%; pointer-events: none; z-index: 3;
717
+ animation: sealRingRotate 18s linear infinite;
718
+ box-shadow: inset 0 0 15px rgba(245, 196, 81, 0.3), 0 0 15px rgba(245, 196, 81, 0.3);
719
+ }
720
+ @keyframes sealRingRotate {
721
+ from { transform: rotate(0deg); }
722
+ to { transform: rotate(360deg); }
723
+ }
724
+
725
+ /* 狀態徽章 */
726
+ .spot-badge-boss {
727
+ position: absolute; top: -6px; left: -8px; z-index: 6;
728
+ background: linear-gradient(135deg, #ef4444, #f59e0b); color: #fff;
729
+ font-size: 11px; font-weight: 900; padding: 2px 10px; border-radius: 99px;
730
+ box-shadow: 0 4px 12px rgba(239, 68, 68, 0.45); border: 1.5px solid rgba(255, 255, 255, 0.9);
731
+ display: flex; align-items: center; gap: 4px;
732
+ }
733
+ .map-spot.boss-sealed .spot-badge-boss {
734
+ background: linear-gradient(135deg, #475569, #1e293b); color: #cbd5e1;
735
+ box-shadow: 0 3px 10px rgba(15, 23, 42, 0.5); border-color: rgba(245, 196, 81, 0.6);
736
+ }
737
+
738
+ /* 世界Boss專屬暗金尊榮標籤 */
739
+ .map-spot.spot-boss .spot-label {
740
+ background: linear-gradient(135deg, rgba(26, 16, 36, 0.95), rgba(45, 18, 30, 0.95)) !important;
741
+ border: 1.5px solid rgba(245, 196, 81, 0.6) !important;
742
+ color: #fde047 !important;
743
+ box-shadow: 0 8px 20px rgba(20, 10, 30, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.2) !important;
744
+ }
745
+ .map-spot.spot-boss .spot-label-top span {
746
+ color: #fde047 !important; font-weight: 900; text-shadow: 0 2px 6px rgba(0, 0, 0, 0.8);
747
+ }
748
+ .map-spot.spot-boss .spot-label-prod {
749
+ background: rgba(245, 196, 81, 0.14) !important;
750
+ color: #fbbf24 !important; font-weight: 800; border-radius: 4px; padding: 1px 6px;
751
+ }
752
+
753
+
754
  /* 天機閣彈窗與軍備箱預覽 */
755
  .tianji-head-banner {
756
  display: flex; align-items: center; gap: 16px; padding: 14px 18px;
js/admin.js CHANGED
@@ -967,6 +967,7 @@ const MAP_TOWNS_DEF = [
967
  { id: 'b8', name: '軍機策府', icon: '🏫', specialty: '天臺奇謀・九州文韜', defX: 67.5, defY: 34.7, defSize: 172 },
968
  { id: 'b10', name: '霸業王城', icon: '🏰', specialty: '皇極九五・天下歸心', defX: 52.0, defY: 22.0, defSize: 140 },
969
  { id: 'tianji', name: '天機閣', icon: '🏯', specialty: '急速快答・軍備寶箱', defX: 34.5, defY: 29.7, defSize: 154 },
 
970
  ];
971
 
972
  let mapLayoutData = null;
@@ -1012,7 +1013,7 @@ function renderMapEditor() {
1012
  <div class="map-editor-resize" data-bid="${t.id}" title="拖動調整大小"></div>
1013
  </div>`;
1014
  } else {
1015
- const imgSrc = t.id === 'tianji' ? 'assets/building_tianji.png' : `assets/building_${t.id}.png`;
1016
  innerContent = `
1017
  <div class="map-editor-thumb" style="width:${item.size}px; height:${item.size}px;">
1018
  <img src="${imgSrc}" class="map-editor-img" alt="${t.name}">
 
967
  { id: 'b8', name: '軍機策府', icon: '🏫', specialty: '天臺奇謀・九州文韜', defX: 67.5, defY: 34.7, defSize: 172 },
968
  { id: 'b10', name: '霸業王城', icon: '🏰', specialty: '皇極九五・天下歸心', defX: 52.0, defY: 22.0, defSize: 140 },
969
  { id: 'tianji', name: '天機閣', icon: '🏯', specialty: '急速快答・軍備寶箱', defX: 34.5, defY: 29.7, defSize: 154 },
970
+ { id: 'boss', name: '上古・饕餮', icon: '🐲', specialty: '世界Boss・懸空禁地', defX: 81.5, defY: 22.0, defSize: 168 },
971
  ];
972
 
973
  let mapLayoutData = null;
 
1013
  <div class="map-editor-resize" data-bid="${t.id}" title="拖動調整大小"></div>
1014
  </div>`;
1015
  } else {
1016
+ const imgSrc = t.id === 'tianji' ? 'assets/building_tianji.png' : (t.id === 'boss' ? 'assets/boss_taotie.png' : `assets/building_${t.id}.png`);
1017
  innerContent = `
1018
  <div class="map-editor-thumb" style="width:${item.size}px; height:${item.size}px;">
1019
  <img src="${imgSrc}" class="map-editor-img" alt="${t.name}">
js/db.js CHANGED
@@ -102,11 +102,11 @@ class FirebaseBackend {
102
  if (this._stCache && this._stCache.uid === uid) {
103
  const data = this._stCache.data;
104
  this._stCache = null; // 只用一次,之後一律讀最新資料
105
- return { uid, ...data };
106
  }
107
  const s = await this.F.getDoc(this.d('students', uid));
108
  trafficTracker.recordOp({ type: 'read', source: 'getStudent', count: 1, estimatedBytes: 4096, note: `讀取學生資料 (${uid.slice(0, 6)}...)` });
109
- return s.exists() ? { uid, ...s.data() } : null;
110
  }
111
 
112
  async saveGame(uid, { game, progress, stats }) {
@@ -225,7 +225,7 @@ class FirebaseBackend {
225
  const q = this.F.query(this.c('students'), this.F.where('classCode', '==', normCode(code)));
226
  const snap = await this.F.getDocs(q);
227
  trafficTracker.recordOp({ type: 'read', source: 'listStudents', count: Math.max(1, snap.docs.length), estimatedBytes: 4096 * Math.max(1, snap.docs.length), note: `讀取班級學生清單 (${code}, ${snap.docs.length}生)` });
228
- return snap.docs.map((x) => ({ uid: x.id, ...x.data() })).sort((a, b) => Number(a.seat) - Number(b.seat));
229
  } catch (e) {
230
  throw new DBError(friendlyError(e));
231
  }
@@ -564,7 +564,7 @@ class LocalBackend {
564
  this.ensureDemoStudents(db);
565
  }
566
  return Object.entries(db.students).filter(([, s]) => s.classCode === normCode(code))
567
- .map(([uid, s]) => ({ uid, ...s })).sort((a, b) => Number(a.seat) - Number(b.seat));
568
  }
569
 
570
  async createStudent({ classCode, seat, name, pin, bankId }) {
 
102
  if (this._stCache && this._stCache.uid === uid) {
103
  const data = this._stCache.data;
104
  this._stCache = null; // 只用一次,之後一律讀最新資料
105
+ return { ...data, uid };
106
  }
107
  const s = await this.F.getDoc(this.d('students', uid));
108
  trafficTracker.recordOp({ type: 'read', source: 'getStudent', count: 1, estimatedBytes: 4096, note: `讀取學生資料 (${uid.slice(0, 6)}...)` });
109
+ return s.exists() ? { ...s.data(), uid } : null;
110
  }
111
 
112
  async saveGame(uid, { game, progress, stats }) {
 
225
  const q = this.F.query(this.c('students'), this.F.where('classCode', '==', normCode(code)));
226
  const snap = await this.F.getDocs(q);
227
  trafficTracker.recordOp({ type: 'read', source: 'listStudents', count: Math.max(1, snap.docs.length), estimatedBytes: 4096 * Math.max(1, snap.docs.length), note: `讀取班級學生清單 (${code}, ${snap.docs.length}生)` });
228
+ return snap.docs.map((x) => ({ ...x.data(), uid: x.id })).sort((a, b) => Number(a.seat) - Number(b.seat));
229
  } catch (e) {
230
  throw new DBError(friendlyError(e));
231
  }
 
564
  this.ensureDemoStudents(db);
565
  }
566
  return Object.entries(db.students).filter(([, s]) => s.classCode === normCode(code))
567
+ .map(([uid, s]) => ({ ...s, uid })).sort((a, b) => Number(a.seat) - Number(b.seat));
568
  }
569
 
570
  async createStudent({ classCode, seat, name, pin, bankId }) {
js/game.js CHANGED
@@ -1,7 +1,8 @@
1
  import { getDB, DBError } from './db.js';
2
  import {
3
  BUILDINGS, TIERS, SCHEDULE, PASS_SCORE, THEME, QUIZ_COIN_MIN, QUIZ_COIN_SECONDS,
4
- CLASS_STAGES, LUCKY, STAR_BASE_MAX, QUIZ_COIN_DAILY_FULL, WEEKLY_SCHEDULE, SLOTH_PENALTY_MULT
 
5
  } from './config.js?v=20261019e';
6
  import {
7
  newGame, normalizeGame, derive, isUnlocked, levelCost, maxAffordable, bulkCost,
@@ -362,6 +363,7 @@ const MAP_POS = {
362
  b8: { x: 67.5, y: 34.7, size: 172 }, // 軍機策府
363
  b10: { x: 52.0, y: 22.0, size: 140 }, // 霸業王城
364
  tianji: { x: 34.5, y: 29.7, size: 154 }, // 天機閣
 
365
  };
366
 
367
  // 戰略行軍補給網絡連線(由四周外圍向內層層遞進,直通山巔)
@@ -523,7 +525,37 @@ function renderMapSpots() {
523
  </div>
524
  `;
525
 
526
- el.innerHTML = spotsHtml + tianjiHtml;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
527
 
528
  // 綁定地圖點位點擊事件
529
  $$('.map-spot', el).forEach(spot => {
@@ -531,6 +563,10 @@ function renderMapSpots() {
531
  bind(spot, 'touchstart', (e) => e.stopPropagation());
532
  bind(spot, 'click', (e) => {
533
  e.stopPropagation();
 
 
 
 
534
  if (spot.dataset.tianji) {
535
  openTianjiModal();
536
  return;
@@ -543,6 +579,96 @@ function renderMapSpots() {
543
  renderInMapTownPanel();
544
  }
545
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
546
  // 渲染地圖內置戰略指令面板(城池資訊與升級/出征按鈕直接在點選城池旁就近彈出)
547
  function renderInMapTownPanel() {
548
  const panel = $('#inMapTownPanel');
@@ -2605,7 +2731,7 @@ function renderClassRosterTable() {
2605
  let doneCount = 0;
2606
  const totalCount = cachedClassStudents.length;
2607
 
2608
- const rowsHtml = cachedClassStudents.map(s => {
2609
  const sGame = (s.uid === user.uid) ? game : normalizeGame(s.game);
2610
  const sWs = getWeekStatus(sGame);
2611
  const goal = sWs.currentGoal;
@@ -2635,7 +2761,7 @@ function renderClassRosterTable() {
2635
  } else if (isDone && !isSloth) {
2636
  actionBtn = `<span class="dim" style="font-size:12px;">✅ 圓滿達標</span>`;
2637
  } else {
2638
- actionBtn = `<button class="btn-aid-donate" data-uid="${s.uid}">🤝 支援代捐</button>`;
2639
  }
2640
 
2641
  const meTag = isMe ? '<span class="badge badge-accent" style="margin-left:4px; font-size:10px;">我</span>' : '';
@@ -2665,14 +2791,38 @@ function renderClassRosterTable() {
2665
  $('#lblClassDonePct').textContent = `${overallPct}%`;
2666
  $('#barClassOverall').style.width = `${overallPct}%`;
2667
 
2668
- // 綁定代捐按鈕
2669
- tb.querySelectorAll('.btn-aid-donate').forEach(btn => {
2670
- btn.addEventListener('click', () => {
2671
- const targetUid = btn.dataset.uid;
2672
- const targetStudent = cachedClassStudents.find(s => s.uid === targetUid);
2673
- if (targetStudent) openAidDonateModal(targetStudent);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2674
  });
2675
- });
2676
  }
2677
 
2678
  function openAidDonateModal(target) {
@@ -2767,7 +2917,7 @@ function openAidDonateModal(target) {
2767
  target.game = targetGame;
2768
  // 同步更新記憶體與快取名冊中的目標同袍資料,讓名冊立刻反映達標
2769
  if (cachedClassStudents) {
2770
- const rosterItem = cachedClassStudents.find(s => s.uid === target.uid);
2771
  if (rosterItem) rosterItem.game = targetGame;
2772
  }
2773
 
 
1
  import { getDB, DBError } from './db.js';
2
  import {
3
  BUILDINGS, TIERS, SCHEDULE, PASS_SCORE, THEME, QUIZ_COIN_MIN, QUIZ_COIN_SECONDS,
4
+ CLASS_STAGES, LUCKY, STAR_BASE_MAX, QUIZ_COIN_DAILY_FULL, WEEKLY_SCHEDULE, SLOTH_PENALTY_MULT,
5
+ WORLD_BOSS_UNLOCK_DATE
6
  } from './config.js?v=20261019e';
7
  import {
8
  newGame, normalizeGame, derive, isUnlocked, levelCost, maxAffordable, bulkCost,
 
363
  b8: { x: 67.5, y: 34.7, size: 172 }, // 軍機策府
364
  b10: { x: 52.0, y: 22.0, size: 140 }, // 霸業王城
365
  tianji: { x: 34.5, y: 29.7, size: 154 }, // 天機閣
366
+ boss: { x: 81.5, y: 22.0, size: 168 }, // 上古・饕餮(世界Boss)
367
  };
368
 
369
  // 戰略行軍補給網絡連線(由四周外圍向內層層遞進,直通山巔)
 
525
  </div>
526
  `;
527
 
528
+ // 注入世界 Boss 入口:【上古・饕餮】(雄踞於極東雲海古祭壇,封印/破印動態切換)
529
+ const bossStatus = getWorldBossStatus();
530
+ const bossLayout = getTownLayout('boss');
531
+ const isBossUnlocked = bossStatus.unlocked;
532
+ const bossCls = isBossUnlocked ? 'boss-open' : 'boss-sealed';
533
+ const bossBadge = isBossUnlocked
534
+ ? `<span class="spot-badge-boss">🔥 討伐 (${bossStatus.ordersLeft}/3)</span>`
535
+ : `<span class="spot-badge-boss">🔒 10/27 破印開放</span>`;
536
+ const bossSubText = isBossUnlocked
537
+ ? (bossStatus.defeated ? '🏆 首討告捷・全服已平定' : '⚔️ 全軍討伐・爭奪首破')
538
+ : '需通關第三單元・封印倒數中';
539
+
540
+ const bossHtml = `
541
+ <div class="map-spot spot-boss ${bossCls}" style="left:${bossLayout.x}%; top:${bossLayout.y}%;" data-boss="true" title="世界Boss【上古・饕餮】${isBossUnlocked ? '・全軍熱血討伐中!' : '・封印倒數中'}">
542
+ ${bossBadge}
543
+ <div class="spot-boss-wrap" style="width:clamp(56px, calc(${bossLayout.size} * 100cqw / 1400), ${bossLayout.size}px); height:clamp(56px, calc(${bossLayout.size} * 100cqw / 1400), ${bossLayout.size}px);">
544
+ <div class="spot-boss-aura"></div>
545
+ ${!isBossUnlocked ? '<div class="spot-boss-seal-ring"></div>' : ''}
546
+ <img class="spot-boss-img" src="assets/boss_taotie.png" alt="上古・饕餮">
547
+ </div>
548
+ <div class="spot-label">
549
+ <div class="spot-label-top">
550
+ <span>🐲 上古・饕餮</span>
551
+ <small style="${isBossUnlocked ? 'color:#ef4444; font-weight:800;' : 'color:#cbd5e1; font-weight:700;'}">${isBossUnlocked ? '世界 Boss' : '封印禁域'}</small>
552
+ </div>
553
+ <div class="spot-label-prod">${bossSubText}</div>
554
+ </div>
555
+ </div>
556
+ `;
557
+
558
+ el.innerHTML = spotsHtml + tianjiHtml + bossHtml;
559
 
560
  // 綁定地圖點位點擊事件
561
  $$('.map-spot', el).forEach(spot => {
 
563
  bind(spot, 'touchstart', (e) => e.stopPropagation());
564
  bind(spot, 'click', (e) => {
565
  e.stopPropagation();
566
+ if (spot.dataset.boss) {
567
+ openWorldBossModal();
568
+ return;
569
+ }
570
  if (spot.dataset.tianji) {
571
  openTianjiModal();
572
  return;
 
579
  renderInMapTownPanel();
580
  }
581
 
582
+ // ===================== 世界 Boss 地圖狀態與前置彈窗 =====================
583
+ function getWorldBossStatus() {
584
+ const isUnlockedDate = todayStr() >= WORLD_BOSS_UNLOCK_DATE;
585
+ // 檢查是否已通關第三單元 (u3, 51-75)
586
+ const isU3Passed = (progress?.u3?.best || 0) >= 85;
587
+ const unlocked = isUnlockedDate && isU3Passed;
588
+ const ordersLeft = game?.worldBossOrders !== undefined ? game.worldBossOrders : 3;
589
+ return {
590
+ unlocked,
591
+ isUnlockedDate,
592
+ isU3Passed,
593
+ ordersLeft,
594
+ defeated: false
595
+ };
596
+ }
597
+
598
+ function openWorldBossModal() {
599
+ const status = getWorldBossStatus();
600
+
601
+ if (!status.unlocked) {
602
+ // 尚未破印:展示霸氣封印情報與戰備預告
603
+ const contentHtml = `
604
+ <div style="font-size:14px; line-height:1.6;">
605
+ <div style="position:relative; border-radius:14px; overflow:hidden; margin-bottom:14px; border:1px solid rgba(245,196,81,0.35); box-shadow:0 10px 25px rgba(0,0,0,0.4);">
606
+ <img src="assets/boss_bg_arena.jpg" style="width:100%; height:180px; object-fit:cover; display:block; filter:brightness(0.7);" alt="戰鬥背景">
607
+ <div style="position:absolute; inset:0; background:linear-gradient(to top, rgba(10,10,16,0.95) 0%, rgba(10,10,16,0.4) 60%, transparent 100%);"></div>
608
+
609
+ <div style="position:absolute; bottom:12px; left:16px; right:16px; display:flex; align-items:flex-end; gap:14px;">
610
+ <div style="width:90px; height:90px; flex-shrink:0; position:relative;">
611
+ <img src="assets/boss_taotie.png" style="width:100%; height:100%; object-fit:contain; filter:brightness(0.22) contrast(1.4) drop-shadow(0 0 10px rgba(245,196,81,0.5));" alt="饕餮剪影">
612
+ <span style="position:absolute; top:28px; left:22px; width:7px; height:7px; border-radius:50%; background:#ef4444; box-shadow:0 0 8px #ef4444; animation:eyeGlow 2s infinite alternate;"></span>
613
+ <span style="position:absolute; top:28px; left:36px; width:7px; height:7px; border-radius:50%; background:#ef4444; box-shadow:0 0 8px #ef4444; animation:eyeGlow 2s infinite alternate;"></span>
614
+ </div>
615
+ <div>
616
+ <span class="badge" style="background:#dc2626; color:#fff; font-size:11px; font-weight:800; margin-bottom:4px; display:inline-block;">🔒 上古神秘封印</span>
617
+ <div style="font-size:20px; font-weight:900; color:var(--gold); text-shadow:0 2px 8px rgba(0,0,0,0.9);">
618
+ 上古・饕餮
619
+ </div>
620
+ <div style="font-size:12px; color:#cbd5e1;">神秘神獸沉睡於此,其威能足以吞食天地…</div>
621
+ </div>
622
+ </div>
623
+ </div>
624
+
625
+ <div style="background:var(--bg-2); border:1px solid var(--line); border-radius:12px; padding:12px 14px; margin-bottom:12px;">
626
+ <div style="font-weight:800; color:var(--gold); margin-bottom:6px; font-size:13px;">📜 破印開放條件:</div>
627
+ <div style="display:flex; flex-direction:column; gap:6px; font-size:13px;">
628
+ <div style="display:flex; justify-content:space-between; align-items:center;">
629
+ <span>1. 完成第三單元(51-75)軍機策驗</span>
630
+ <span class="badge ${status.isU3Passed ? 'badge-mint' : 'badge-rose'}">${status.isU3Passed ? '✅ 已達標' : '⏳ 尚未達標'}</span>
631
+ </div>
632
+ <div style="display:flex; justify-content:space-between; align-items:center;">
633
+ <span>2. 全服破印時程</span>
634
+ <b style="color:var(--gold);">2026/10/27 (二) 正式破印</b>
635
+ </div>
636
+ </div>
637
+ </div>
638
+
639
+ <div style="background:var(--bg-2); border:1px solid var(--line); border-radius:12px; padding:12px 14px; margin-bottom:14px;">
640
+ <div style="font-weight:800; color:#38bdf8; margin-bottom:6px; font-size:13px;">🎁 討伐成功全服獎勵:</div>
641
+ <div style="display:grid; grid-template-columns:1fr 1fr; gap:8px; font-size:12px;">
642
+ <div style="padding:6px 10px; background:var(--bg-1); border-radius:8px; border:1px solid var(--line);">
643
+ 🌾 <b>全軍糧草產量 1 小時包</b>
644
+ </div>
645
+ <div style="padding:6px 10px; background:var(--bg-1); border-radius:8px; border:1px solid var(--line);">
646
+ 🐅 <b>兵符碎片 (累積合成兵符)</b>
647
+ </div>
648
+ <div style="padding:6px 10px; background:var(--bg-1); border-radius:8px; border:1px solid var(--line);">
649
+ 📜 <b>全服首破永久榮譽碑</b>
650
+ </div>
651
+ <div style="padding:6px 10px; background:var(--bg-1); border-radius:8px; border:1px solid var(--line);">
652
+ 👑 <b>專屬稀有稱號【平荒伏獸】</b>
653
+ </div>
654
+ </div>
655
+ </div>
656
+
657
+ <div style="display:flex; gap:10px; justify-content:flex-end;">
658
+ <a href="boss-test.html" class="btn btn-gold" style="text-decoration:none; display:inline-flex; align-items:center; gap:6px;">
659
+ ⚔️ 開啟世界Boss討伐測試頁 ➔
660
+ </a>
661
+ </div>
662
+ </div>
663
+ `;
664
+ openModal(contentHtml, { wide: true });
665
+ return;
666
+ }
667
+
668
+ // 若已破印解鎖:直接跳轉前往世界 Boss 戰鬥測試頁
669
+ window.location.href = 'boss-test.html';
670
+ }
671
+
672
  // 渲染地圖內置戰略指令面板(城池資訊與升級/出征按鈕直接在點選城池旁就近彈出)
673
  function renderInMapTownPanel() {
674
  const panel = $('#inMapTownPanel');
 
2731
  let doneCount = 0;
2732
  const totalCount = cachedClassStudents.length;
2733
 
2734
+ const rowsHtml = cachedClassStudents.map((s, idx) => {
2735
  const sGame = (s.uid === user.uid) ? game : normalizeGame(s.game);
2736
  const sWs = getWeekStatus(sGame);
2737
  const goal = sWs.currentGoal;
 
2761
  } else if (isDone && !isSloth) {
2762
  actionBtn = `<span class="dim" style="font-size:12px;">✅ 圓滿達標</span>`;
2763
  } else {
2764
+ actionBtn = `<button class="btn-aid-donate" data-uid="${esc(s.uid)}" data-seat="${esc(s.seat)}" data-idx="${idx}">🤝 支援代捐</button>`;
2765
  }
2766
 
2767
  const meTag = isMe ? '<span class="badge badge-accent" style="margin-left:4px; font-size:10px;">我</span>' : '';
 
2791
  $('#lblClassDonePct').textContent = `${overallPct}%`;
2792
  $('#barClassOverall').style.width = `${overallPct}%`;
2793
 
2794
+ // 綁定代捐按鈕:使用事件委派與三重定位防護(索引 -> 座號 -> UID),徹底杜絕閉包或UID重疊造成的對象錯位
2795
+ if (!tb._hasAidDelegated) {
2796
+ tb._hasAidDelegated = true;
2797
+ tb.addEventListener('click', (e) => {
2798
+ const btn = e.target.closest('.btn-aid-donate');
2799
+ if (!btn) return;
2800
+ const seat = btn.dataset.seat;
2801
+ const uid = btn.dataset.uid;
2802
+ const idx = parseInt(btn.dataset.idx, 10);
2803
+
2804
+ let targetStudent = null;
2805
+ // 1. 優先以索引直接定位,並核對座號
2806
+ if (!isNaN(idx) && cachedClassStudents[idx] && String(cachedClassStudents[idx].seat) === String(seat)) {
2807
+ targetStudent = cachedClassStudents[idx];
2808
+ }
2809
+ // 2. 次之以班級唯一座號尋找
2810
+ if (!targetStudent && seat) {
2811
+ targetStudent = cachedClassStudents.find(s => String(s.seat) === String(seat));
2812
+ }
2813
+ // 3. 最後以 UID 作為後備
2814
+ if (!targetStudent && uid) {
2815
+ targetStudent = cachedClassStudents.find(s => s.uid === uid);
2816
+ }
2817
+
2818
+ if (targetStudent) {
2819
+ console.log(`[代捐發起] 鎖定目標同袍: #${targetStudent.seat} ${targetStudent.name} (uid: ${targetStudent.uid})`);
2820
+ openAidDonateModal(targetStudent);
2821
+ } else {
2822
+ toast('找不到該位同袍的資料,請重新整理名冊', 'warn');
2823
+ }
2824
  });
2825
+ }
2826
  }
2827
 
2828
  function openAidDonateModal(target) {
 
2917
  target.game = targetGame;
2918
  // 同步更新記憶體與快取名冊中的目標同袍資料,讓名冊立刻反映達標
2919
  if (cachedClassStudents) {
2920
+ const rosterItem = cachedClassStudents.find(s => (s.seat && String(s.seat) === String(target.seat)) || s.uid === target.uid);
2921
  if (rosterItem) rosterItem.game = targetGame;
2922
  }
2923