fix: 修復天機閣寶箱震動開啟動畫並新增節奏停桿小遊戲與雙兵符機率微幅加成 (v20261113_v2)
Browse files- boss-test.html +7 -7
- boss.html +3 -3
- css/game.css +147 -13
- index.html +3 -3
- js/admin.js +5 -5
- js/announcements.js +1 -1
- js/boss-battle.js +5 -5
- js/config.js +1 -1
- js/db.js +5 -5
- js/engine.js +3 -3
- js/game.js +11 -11
- js/map.js +4 -4
- js/merchant-ui.js +4 -4
- js/merchant.js +3 -3
- js/preload.js +4 -4
- js/quiz.js +2 -2
- js/tianji.js +301 -80
- js/world-boss-schedule.js +1 -1
- teacher.html +2 -2
- tools/verify-integrity.mjs +22 -0
boss-test.html
CHANGED
|
@@ -5,14 +5,14 @@
|
|
| 5 |
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
|
| 6 |
<title>上古・饕餮 討伐戰|世界王測試頁</title>
|
| 7 |
<meta name="description" content="世界王上古・饕餮討伐戰獨立測試頁:Boss 介紹、討伐獎勵與全螢幕答題戰鬥。">
|
| 8 |
-
<link rel="stylesheet" href="css/base.css?v=
|
| 9 |
<link rel="preconnect" href="https://fonts.googleapis.com">
|
| 10 |
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
| 11 |
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700;800;900&family=Noto+Sans+TC:wght@400;500;700;900&display=swap" rel="stylesheet">
|
| 12 |
<!-- KaTeX 數學式與科學記號渲染引擎 -->
|
| 13 |
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/katex.min.css">
|
| 14 |
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/katex.min.js"></script>
|
| 15 |
-
<link rel="stylesheet" href="css/boss.css?v=
|
| 16 |
</head>
|
| 17 |
<body>
|
| 18 |
|
|
@@ -410,15 +410,15 @@
|
|
| 410 |
</div>
|
| 411 |
|
| 412 |
<script type="module">
|
| 413 |
-
import { getDB, DBError, defaultBossState } from './js/db.js?v=
|
| 414 |
-
import { loadBank, loadBankIndex } from './js/quiz.js?v=
|
| 415 |
import {
|
| 416 |
recordMistake, recordCorrect, derive, totalProd, grantGrain, grantTally, grantScroll,
|
| 417 |
WORLD_BOSS_ROSTER, getActiveWorldBossConfig, calcWorldBossRewards, calcWorldBossStatus,
|
| 418 |
getBossDailyQuestionTheme, getBossWeaponBuffs
|
| 419 |
-
} from './js/engine.js?v=
|
| 420 |
-
import { loadEnglishWords, buildWordQuestion } from './js/merchant.js?v=
|
| 421 |
-
import { todayStr, fmt, shuffle, renderRichQuizText } from './js/util.js?v=
|
| 422 |
|
| 423 |
// ==========================================
|
| 424 |
// 1. 全域與連線狀態
|
|
|
|
| 5 |
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
|
| 6 |
<title>上古・饕餮 討伐戰|世界王測試頁</title>
|
| 7 |
<meta name="description" content="世界王上古・饕餮討伐戰獨立測試頁:Boss 介紹、討伐獎勵與全螢幕答題戰鬥。">
|
| 8 |
+
<link rel="stylesheet" href="css/base.css?v=20261113_v2">
|
| 9 |
<link rel="preconnect" href="https://fonts.googleapis.com">
|
| 10 |
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
| 11 |
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700;800;900&family=Noto+Sans+TC:wght@400;500;700;900&display=swap" rel="stylesheet">
|
| 12 |
<!-- KaTeX 數學式與科學記號渲染引擎 -->
|
| 13 |
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/katex.min.css">
|
| 14 |
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/katex.min.js"></script>
|
| 15 |
+
<link rel="stylesheet" href="css/boss.css?v=20261113_v2">
|
| 16 |
</head>
|
| 17 |
<body>
|
| 18 |
|
|
|
|
| 410 |
</div>
|
| 411 |
|
| 412 |
<script type="module">
|
| 413 |
+
import { getDB, DBError, defaultBossState } from './js/db.js?v=20261113_v2';
|
| 414 |
+
import { loadBank, loadBankIndex } from './js/quiz.js?v=20261113_v2';
|
| 415 |
import {
|
| 416 |
recordMistake, recordCorrect, derive, totalProd, grantGrain, grantTally, grantScroll,
|
| 417 |
WORLD_BOSS_ROSTER, getActiveWorldBossConfig, calcWorldBossRewards, calcWorldBossStatus,
|
| 418 |
getBossDailyQuestionTheme, getBossWeaponBuffs
|
| 419 |
+
} from './js/engine.js?v=20261113_v2';
|
| 420 |
+
import { loadEnglishWords, buildWordQuestion } from './js/merchant.js?v=20261113_v2';
|
| 421 |
+
import { todayStr, fmt, shuffle, renderRichQuizText } from './js/util.js?v=20261113_v2';
|
| 422 |
|
| 423 |
// ==========================================
|
| 424 |
// 1. 全域與連線狀態
|
boss.html
CHANGED
|
@@ -5,8 +5,8 @@
|
|
| 5 |
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
|
| 6 |
<title>世界 Boss 決戰殿堂|爭霸天下</title>
|
| 7 |
<meta name="description" content="全班共抗太古凶神!破除錯題迷障、連擊合力封印,奪取神獸寶庫與至高榮譽稱號!">
|
| 8 |
-
<link rel="stylesheet" href="css/base.css?v=
|
| 9 |
-
<link rel="stylesheet" href="css/boss.css?v=
|
| 10 |
<link rel="preconnect" href="https://fonts.googleapis.com">
|
| 11 |
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
| 12 |
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700;800;900&family=Noto+Sans+TC:wght@400;500;700;900&display=swap" rel="stylesheet">
|
|
@@ -252,6 +252,6 @@
|
|
| 252 |
|
| 253 |
<!-- ===================== 版本更新公告彈窗(模版展示) ===================== -->
|
| 254 |
|
| 255 |
-
<script type="module" src="js/boss-battle.js?v=
|
| 256 |
</body>
|
| 257 |
</html>
|
|
|
|
| 5 |
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
|
| 6 |
<title>世界 Boss 決戰殿堂|爭霸天下</title>
|
| 7 |
<meta name="description" content="全班共抗太古凶神!破除錯題迷障、連擊合力封印,奪取神獸寶庫與至高榮譽稱號!">
|
| 8 |
+
<link rel="stylesheet" href="css/base.css?v=20261113_v2">
|
| 9 |
+
<link rel="stylesheet" href="css/boss.css?v=20261113_v2">
|
| 10 |
<link rel="preconnect" href="https://fonts.googleapis.com">
|
| 11 |
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
| 12 |
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700;800;900&family=Noto+Sans+TC:wght@400;500;700;900&display=swap" rel="stylesheet">
|
|
|
|
| 252 |
|
| 253 |
<!-- ===================== 版本更新公告彈窗(模版展示) ===================== -->
|
| 254 |
|
| 255 |
+
<script type="module" src="js/boss-battle.js?v=20261113_v2"></script>
|
| 256 |
</body>
|
| 257 |
</html>
|
css/game.css
CHANGED
|
@@ -1123,37 +1123,171 @@ html[data-theme="dark"] .r-card { background: var(--bg-2); }
|
|
| 1123 |
|
| 1124 |
/* 開寶箱舞台與震撼動效 */
|
| 1125 |
.chest-stage {
|
| 1126 |
-
text-align: center; padding:
|
| 1127 |
}
|
| 1128 |
.chest-big-wrap {
|
| 1129 |
-
position: relative; width:
|
| 1130 |
-
cursor: pointer;
|
| 1131 |
}
|
| 1132 |
.chest-big-img {
|
|
|
|
| 1133 |
width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 14px 26px rgba(0,0,0,0.35));
|
| 1134 |
-
transition: transform .
|
|
|
|
|
|
|
|
|
|
| 1135 |
}
|
| 1136 |
.chest-big-wrap.rumble .chest-big-img {
|
| 1137 |
-
animation: chestRumble 0.
|
|
|
|
| 1138 |
}
|
| 1139 |
@keyframes chestRumble {
|
| 1140 |
-
0% { transform: translate(0, 0) rotate(0deg); }
|
| 1141 |
-
|
| 1142 |
-
|
| 1143 |
-
|
| 1144 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1145 |
}
|
| 1146 |
.chest-rays {
|
| 1147 |
-
position: absolute; inset: -
|
| 1148 |
-
background:
|
|
|
|
|
|
|
| 1149 |
transition: opacity 0.3s;
|
| 1150 |
}
|
| 1151 |
.chest-big-wrap.open .chest-rays { opacity: 1; animation: raysSpin 6s linear infinite; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1152 |
@keyframes raysSpin { to { transform: rotate(360deg); } }
|
| 1153 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1154 |
.rewards-grid {
|
| 1155 |
display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px; width: 100%; max-width: 480px;
|
| 1156 |
-
margin
|
| 1157 |
}
|
| 1158 |
@keyframes rewardsPop {
|
| 1159 |
from { opacity: 0; transform: scale(0.85) translateY(20px); }
|
|
|
|
| 1123 |
|
| 1124 |
/* 開寶箱舞台與震撼動效 */
|
| 1125 |
.chest-stage {
|
| 1126 |
+
text-align: center; padding: 18px 10px 10px; display: flex; flex-direction: column; align-items: center; gap: 14px;
|
| 1127 |
}
|
| 1128 |
.chest-big-wrap {
|
| 1129 |
+
position: relative; width: 164px; height: 164px; display: flex; align-items: center; justify-content: center;
|
| 1130 |
+
cursor: pointer; user-select: none; -webkit-tap-highlight-color: transparent;
|
| 1131 |
}
|
| 1132 |
.chest-big-img {
|
| 1133 |
+
position: relative; z-index: 2;
|
| 1134 |
width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 14px 26px rgba(0,0,0,0.35));
|
| 1135 |
+
transition: transform .25s cubic-bezier(.34,1.56,.64,1), filter .25s ease;
|
| 1136 |
+
}
|
| 1137 |
+
.chest-big-wrap:hover:not(.rumble):not(.open) .chest-big-img {
|
| 1138 |
+
transform: translateY(-4px) scale(1.03);
|
| 1139 |
}
|
| 1140 |
.chest-big-wrap.rumble .chest-big-img {
|
| 1141 |
+
animation: chestRumble 0.11s infinite ease-in-out;
|
| 1142 |
+
filter: drop-shadow(0 14px 28px rgba(245,158,11,0.6));
|
| 1143 |
}
|
| 1144 |
@keyframes chestRumble {
|
| 1145 |
+
0% { transform: translate(0, 0) rotate(0deg) scale(1.02); }
|
| 1146 |
+
20% { transform: translate(-6px, 3px) rotate(-4deg) scale(1.04); }
|
| 1147 |
+
40% { transform: translate(5px, -3px) rotate(4deg) scale(1.03); }
|
| 1148 |
+
60% { transform: translate(-5px, -2px) rotate(-3deg) scale(1.05); }
|
| 1149 |
+
80% { transform: translate(4px, 4px) rotate(3deg) scale(1.04); }
|
| 1150 |
+
100% { transform: translate(0, 0) rotate(0deg) scale(1.02); }
|
| 1151 |
+
}
|
| 1152 |
+
.chest-big-wrap.open .chest-big-img {
|
| 1153 |
+
animation: chestOpenPop 0.55s cubic-bezier(.34,1.56,.64,1) forwards;
|
| 1154 |
+
filter: drop-shadow(0 16px 32px rgba(245,196,81,0.75));
|
| 1155 |
+
}
|
| 1156 |
+
@keyframes chestOpenPop {
|
| 1157 |
+
0% { transform: scale(0.92); }
|
| 1158 |
+
45% { transform: scale(1.16) translateY(-10px); }
|
| 1159 |
+
100% { transform: scale(1.05) translateY(-3px); }
|
| 1160 |
}
|
| 1161 |
.chest-rays {
|
| 1162 |
+
position: absolute; inset: -48px; z-index: 1; pointer-events: none; opacity: 0; border-radius: 50%;
|
| 1163 |
+
background:
|
| 1164 |
+
repeating-conic-gradient(from 0deg, rgba(251,191,36,0.45) 0deg 14deg, transparent 14deg 30deg),
|
| 1165 |
+
radial-gradient(circle, rgba(245,196,81,0.85) 0%, rgba(245,158,11,0.28) 45%, transparent 72%);
|
| 1166 |
transition: opacity 0.3s;
|
| 1167 |
}
|
| 1168 |
.chest-big-wrap.open .chest-rays { opacity: 1; animation: raysSpin 6s linear infinite; }
|
| 1169 |
+
.chest-big-wrap.open.hit-bonus .chest-rays {
|
| 1170 |
+
background:
|
| 1171 |
+
repeating-conic-gradient(from 0deg, rgba(52,211,153,0.45) 0deg 14deg, rgba(251,191,36,0.35) 14deg 28deg, transparent 28deg 40deg),
|
| 1172 |
+
radial-gradient(circle, rgba(251,191,36,0.92) 0%, rgba(16,185,129,0.35) 48%, transparent 74%);
|
| 1173 |
+
}
|
| 1174 |
@keyframes raysSpin { to { transform: rotate(360deg); } }
|
| 1175 |
|
| 1176 |
+
.chest-burst-ring {
|
| 1177 |
+
position: absolute; inset: 10px; z-index: 1; border-radius: 50%; pointer-events: none; opacity: 0;
|
| 1178 |
+
border: 3px solid rgba(251,191,36,0.9);
|
| 1179 |
+
}
|
| 1180 |
+
.chest-big-wrap.open .chest-burst-ring {
|
| 1181 |
+
animation: chestBurstRing 0.7s ease-out forwards;
|
| 1182 |
+
}
|
| 1183 |
+
@keyframes chestBurstRing {
|
| 1184 |
+
0% { transform: scale(0.5); opacity: 1; }
|
| 1185 |
+
100% { transform: scale(1.85); opacity: 0; }
|
| 1186 |
+
}
|
| 1187 |
+
|
| 1188 |
+
.chest-title { margin: 0; font-size: 20px; font-weight: 900; color: var(--text); }
|
| 1189 |
+
.chest-subtitle { margin: 0; font-size: 13px; color: var(--text-dim); max-width: 480px; line-height: 1.5; }
|
| 1190 |
+
.chest-hint-text { font-size: 14px; font-weight: 700; color: var(--text-dim); min-height: 22px; }
|
| 1191 |
+
.chest-btn-area { display: flex; justify-content: center; width: 100%; }
|
| 1192 |
+
|
| 1193 |
+
/* 寶箱節奏停桿破鎖小遊戲 */
|
| 1194 |
+
.chest-rhythm-panel {
|
| 1195 |
+
width: 100%; max-width: 580px;
|
| 1196 |
+
display: grid; grid-template-columns: 1fr 205px; gap: 12px; align-items: stretch;
|
| 1197 |
+
text-align: left;
|
| 1198 |
+
}
|
| 1199 |
+
.chest-rhythm-main {
|
| 1200 |
+
background: var(--bg-1); border: 1.5px solid rgba(217,119,6,0.38); border-radius: 14px;
|
| 1201 |
+
padding: 14px 16px; display: flex; flex-direction: column; gap: 10px;
|
| 1202 |
+
box-shadow: 0 6px 18px rgba(120,70,50,0.08);
|
| 1203 |
+
}
|
| 1204 |
+
.chest-rhythm-head {
|
| 1205 |
+
display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap;
|
| 1206 |
+
}
|
| 1207 |
+
.chest-rhythm-title { font-size: 14px; font-weight: 900; color: var(--gold-dark); }
|
| 1208 |
+
.chest-rhythm-status {
|
| 1209 |
+
font-size: 12px; font-weight: 800; padding: 3px 9px; border-radius: 99px;
|
| 1210 |
+
background: rgba(245,158,11,0.14); color: #92400e;
|
| 1211 |
+
}
|
| 1212 |
+
.chest-rhythm-status.is-hit { background: rgba(16,185,129,0.16); color: #047857; }
|
| 1213 |
+
.chest-rhythm-status.is-miss { background: rgba(239,68,68,0.12); color: #b91c1c; }
|
| 1214 |
+
|
| 1215 |
+
.chest-rhythm-track {
|
| 1216 |
+
position: relative; width: 100%; height: 34px; border-radius: 99px;
|
| 1217 |
+
background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
|
| 1218 |
+
border: 2px solid #92400e; box-shadow: inset 0 3px 8px rgba(0,0,0,0.55);
|
| 1219 |
+
cursor: pointer; touch-action: manipulation; user-select: none;
|
| 1220 |
+
margin: 4px 0; transition: border-color .2s, box-shadow .2s;
|
| 1221 |
+
}
|
| 1222 |
+
.chest-rhythm-track.is-hit {
|
| 1223 |
+
border-color: #10b981;
|
| 1224 |
+
box-shadow: inset 0 3px 8px rgba(0,0,0,0.45), 0 0 18px rgba(16,185,129,0.55);
|
| 1225 |
+
}
|
| 1226 |
+
.chest-rhythm-track.is-miss {
|
| 1227 |
+
border-color: #f87171;
|
| 1228 |
+
box-shadow: inset 0 3px 8px rgba(0,0,0,0.45), 0 0 12px rgba(239,68,68,0.35);
|
| 1229 |
+
}
|
| 1230 |
+
.chest-rhythm-zone {
|
| 1231 |
+
position: absolute; top: 3px; bottom: 3px; border-radius: 99px;
|
| 1232 |
+
background: linear-gradient(180deg, rgba(52,211,153,0.92), rgba(5,150,105,0.95));
|
| 1233 |
+
border: 1.5px solid #a7f3d0;
|
| 1234 |
+
box-shadow: 0 0 14px rgba(16,185,129,0.7);
|
| 1235 |
+
pointer-events: none;
|
| 1236 |
+
}
|
| 1237 |
+
.chest-rhythm-zone::after {
|
| 1238 |
+
content: '✦'; position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
|
| 1239 |
+
font-size: 13px; color: #ecfdf5; font-weight: 900; text-shadow: 0 1px 3px rgba(0,0,0,0.5);
|
| 1240 |
+
}
|
| 1241 |
+
.chest-rhythm-needle {
|
| 1242 |
+
position: absolute; top: -6px; bottom: -6px; left: 0%; width: 10px;
|
| 1243 |
+
transform: translateX(-50%); border-radius: 99px; pointer-events: none;
|
| 1244 |
+
background: linear-gradient(180deg, #fef08a 0%, #f59e0b 52%, #b45309 100%);
|
| 1245 |
+
border: 2px solid #ffffff;
|
| 1246 |
+
box-shadow: 0 0 12px rgba(251,191,36,0.95), 0 2px 6px rgba(0,0,0,0.5);
|
| 1247 |
+
will-change: left;
|
| 1248 |
+
}
|
| 1249 |
+
.chest-rhythm-track.is-hit .chest-rhythm-needle {
|
| 1250 |
+
background: linear-gradient(180deg, #a7f3d0 0%, #10b981 55%, #047857 100%);
|
| 1251 |
+
box-shadow: 0 0 16px rgba(16,185,129,1), 0 2px 6px rgba(0,0,0,0.5);
|
| 1252 |
+
}
|
| 1253 |
+
.chest-rhythm-track.is-miss .chest-rhythm-needle {
|
| 1254 |
+
background: linear-gradient(180deg, #fecaca 0%, #ef4444 55%, #b91c1c 100%);
|
| 1255 |
+
box-shadow: 0 0 12px rgba(239,68,68,0.8), 0 2px 6px rgba(0,0,0,0.5);
|
| 1256 |
+
}
|
| 1257 |
+
.chest-rhythm-btn {
|
| 1258 |
+
width: 100%; min-height: 46px; font-size: 15px; font-weight: 900;
|
| 1259 |
+
box-shadow: 0 6px 18px rgba(217,119,6,0.32); touch-action: manipulation;
|
| 1260 |
+
transition: transform .12s ease, box-shadow .12s ease;
|
| 1261 |
+
}
|
| 1262 |
+
.chest-rhythm-btn:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 8px 22px rgba(217,119,6,0.42); }
|
| 1263 |
+
.chest-rhythm-btn:active:not(:disabled) { transform: scale(0.97); }
|
| 1264 |
+
|
| 1265 |
+
.chest-rhythm-note {
|
| 1266 |
+
background: linear-gradient(145deg, rgba(254,243,199,0.85), rgba(253,230,138,0.42));
|
| 1267 |
+
border: 1.5px dashed rgba(217,119,6,0.55); border-radius: 14px;
|
| 1268 |
+
padding: 12px 14px; display: flex; flex-direction: column; justify-content: center; gap: 6px;
|
| 1269 |
+
}
|
| 1270 |
+
.chest-rhythm-note-tag {
|
| 1271 |
+
font-size: 12px; font-weight: 900; color: #92400e; display: flex; align-items: center; gap: 4px;
|
| 1272 |
+
}
|
| 1273 |
+
.chest-rhythm-note-body {
|
| 1274 |
+
margin: 0; font-size: 12.5px; line-height: 1.55; color: #78350f; font-weight: 700;
|
| 1275 |
+
}
|
| 1276 |
+
.chest-bonus-pill {
|
| 1277 |
+
display: inline-block; margin-bottom: 10px; padding: 5px 14px; border-radius: 99px;
|
| 1278 |
+
background: linear-gradient(135deg, rgba(16,185,129,0.16), rgba(245,158,11,0.16));
|
| 1279 |
+
border: 1px solid rgba(16,185,129,0.45); color: #047857; font-size: 12.5px; font-weight: 900;
|
| 1280 |
+
}
|
| 1281 |
+
|
| 1282 |
+
@media (max-width: 620px) {
|
| 1283 |
+
.chest-rhythm-panel { grid-template-columns: 1fr; }
|
| 1284 |
+
.chest-rhythm-track { height: 40px; }
|
| 1285 |
+
.chest-rhythm-keyhint { display: none; }
|
| 1286 |
+
}
|
| 1287 |
+
|
| 1288 |
.rewards-grid {
|
| 1289 |
display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px; width: 100%; max-width: 480px;
|
| 1290 |
+
margin: 4px auto 0; animation: rewardsPop 0.5s cubic-bezier(.34,1.56,.64,1);
|
| 1291 |
}
|
| 1292 |
@keyframes rewardsPop {
|
| 1293 |
from { opacity: 0; transform: scale(0.85) translateY(20px); }
|
index.html
CHANGED
|
@@ -8,8 +8,8 @@
|
|
| 8 |
<link rel="preconnect" href="https://fonts.googleapis.com">
|
| 9 |
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
| 10 |
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700;800&family=Noto+Sans+TC:wght@400;600;700;900&display=swap" rel="stylesheet">
|
| 11 |
-
<link rel="stylesheet" href="css/base.css?v=
|
| 12 |
-
<link rel="stylesheet" href="css/game.css?v=
|
| 13 |
<!-- KaTeX 數學式與科學記號渲染引擎 -->
|
| 14 |
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/katex.min.css">
|
| 15 |
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/katex.min.js"></script>
|
|
@@ -368,6 +368,6 @@
|
|
| 368 |
<iframe id="bossBattleIframe" style="width:100%; height:100%; border:none; background:#000;" allow="autoplay" src="about:blank"></iframe>
|
| 369 |
</div>
|
| 370 |
|
| 371 |
-
<script type="module" src="js/game.js?v=
|
| 372 |
</body>
|
| 373 |
</html>
|
|
|
|
| 8 |
<link rel="preconnect" href="https://fonts.googleapis.com">
|
| 9 |
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
| 10 |
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700;800&family=Noto+Sans+TC:wght@400;600;700;900&display=swap" rel="stylesheet">
|
| 11 |
+
<link rel="stylesheet" href="css/base.css?v=20261113_v2">
|
| 12 |
+
<link rel="stylesheet" href="css/game.css?v=20261113_v2">
|
| 13 |
<!-- KaTeX 數學式與科學記號渲染引擎 -->
|
| 14 |
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/katex.min.css">
|
| 15 |
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/katex.min.js"></script>
|
|
|
|
| 368 |
<iframe id="bossBattleIframe" style="width:100%; height:100%; border:none; background:#000;" allow="autoplay" src="about:blank"></iframe>
|
| 369 |
</div>
|
| 370 |
|
| 371 |
+
<script type="module" src="js/game.js?v=20261113_v2"></script>
|
| 372 |
</body>
|
| 373 |
</html>
|
js/admin.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
| 1 |
-
import { getDB, normCode } from './db.js?v=
|
| 2 |
-
import { $, $$, bind, withLoading, toast, openModal, fmtDateTime, fmt, esc, todayStr, addDays } from './util.js?v=
|
| 3 |
-
import { loadBankIndex } from './quiz.js?v=
|
| 4 |
-
import { SCHEDULE, TIERS, OPEN_OFFSET_DAYS, EVENTS_CONFIG, WORLD_BOSS_SCHEDULE } from './config.js?v=
|
| 5 |
import {
|
| 6 |
newGame, normalizeGame, derive, totalProd, isEventOpen, getEventStatusInfo,
|
| 7 |
checkYieldHealth, healYield, calcWorldBossStatus, calcWorldBossRewards,
|
| 8 |
hasClaimedBossReward, formatCountdown, formatOpenAt,
|
| 9 |
getActiveWorldBossConfig, getBossDailyQuestionTheme, calcDynamicWorldBossBalance
|
| 10 |
-
} from './engine.js?v=
|
| 11 |
|
| 12 |
let db, user, currentClassCode = null;
|
| 13 |
let classes = [], students = [], banks = [];
|
|
|
|
| 1 |
+
import { getDB, normCode } from './db.js?v=20261113_v2';
|
| 2 |
+
import { $, $$, bind, withLoading, toast, openModal, fmtDateTime, fmt, esc, todayStr, addDays } from './util.js?v=20261113_v2';
|
| 3 |
+
import { loadBankIndex } from './quiz.js?v=20261113_v2';
|
| 4 |
+
import { SCHEDULE, TIERS, OPEN_OFFSET_DAYS, EVENTS_CONFIG, WORLD_BOSS_SCHEDULE } from './config.js?v=20261113_v2';
|
| 5 |
import {
|
| 6 |
newGame, normalizeGame, derive, totalProd, isEventOpen, getEventStatusInfo,
|
| 7 |
checkYieldHealth, healYield, calcWorldBossStatus, calcWorldBossRewards,
|
| 8 |
hasClaimedBossReward, formatCountdown, formatOpenAt,
|
| 9 |
getActiveWorldBossConfig, getBossDailyQuestionTheme, calcDynamicWorldBossBalance
|
| 10 |
+
} from './engine.js?v=20261113_v2';
|
| 11 |
|
| 12 |
let db, user, currentClassCode = null;
|
| 13 |
let classes = [], students = [], banks = [];
|
js/announcements.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
| 4 |
* 支援預約生效時間、剪影展示、未讀自動彈出、手動隨時回看。
|
| 5 |
*/
|
| 6 |
|
| 7 |
-
import { openModal } from './util.js?v=
|
| 8 |
|
| 9 |
export const ANNOUNCEMENT_REGISTRY = [
|
| 10 |
{
|
|
|
|
| 4 |
* 支援預約生效時間、剪影展示、未讀自動彈出、手動隨時回看。
|
| 5 |
*/
|
| 6 |
|
| 7 |
+
import { openModal } from './util.js?v=20261113_v2';
|
| 8 |
|
| 9 |
export const ANNOUNCEMENT_REGISTRY = [
|
| 10 |
{
|
js/boss-battle.js
CHANGED
|
@@ -2,16 +2,16 @@
|
|
| 2 |
// js/boss-battle.js
|
| 3 |
// 世界 Boss 決戰殿堂:戰鬥流程、音效合成、題庫連動、血量同步與即時傷害結算
|
| 4 |
// ============================================================================
|
| 5 |
-
import { getDB, DBError, defaultBossState, recordBossHighWaterMark, mergeBossObj } from './db.js?v=
|
| 6 |
-
import { loadBank, loadBankIndex } from './quiz.js?v=
|
| 7 |
import {
|
| 8 |
recordMistake, recordCorrect, derive, totalProd, grantGrain, grantTally, grantScroll,
|
| 9 |
WORLD_BOSS_ROSTER, getActiveWorldBossConfig, calcWorldBossRewards, calcWorldBossStatus,
|
| 10 |
hasClaimedBossReward, markBossRewardClaimed, formatCountdown, formatOpenAt,
|
| 11 |
getBossDailyQuestionTheme, buildAdaptiveChargeThresholds, calcStudentChargeQuestions, getBossWeaponBuffs
|
| 12 |
-
} from './engine.js?v=
|
| 13 |
-
import { loadEnglishWords, buildWordQuestion } from './merchant.js?v=
|
| 14 |
-
import { todayStr, fmt, shuffle, renderRichQuizText } from './util.js?v=
|
| 15 |
|
| 16 |
// ==========================================
|
| 17 |
// 1. 全域與連線狀態
|
|
|
|
| 2 |
// js/boss-battle.js
|
| 3 |
// 世界 Boss 決戰殿堂:戰鬥流程、音效合成、題庫連動、血量同步與即時傷害結算
|
| 4 |
// ============================================================================
|
| 5 |
+
import { getDB, DBError, defaultBossState, recordBossHighWaterMark, mergeBossObj } from './db.js?v=20261113_v2';
|
| 6 |
+
import { loadBank, loadBankIndex } from './quiz.js?v=20261113_v2';
|
| 7 |
import {
|
| 8 |
recordMistake, recordCorrect, derive, totalProd, grantGrain, grantTally, grantScroll,
|
| 9 |
WORLD_BOSS_ROSTER, getActiveWorldBossConfig, calcWorldBossRewards, calcWorldBossStatus,
|
| 10 |
hasClaimedBossReward, markBossRewardClaimed, formatCountdown, formatOpenAt,
|
| 11 |
getBossDailyQuestionTheme, buildAdaptiveChargeThresholds, calcStudentChargeQuestions, getBossWeaponBuffs
|
| 12 |
+
} from './engine.js?v=20261113_v2';
|
| 13 |
+
import { loadEnglishWords, buildWordQuestion } from './merchant.js?v=20261113_v2';
|
| 14 |
+
import { todayStr, fmt, shuffle, renderRichQuizText } from './util.js?v=20261113_v2';
|
| 15 |
|
| 16 |
// ==========================================
|
| 17 |
// 1. 全域與連線狀態
|
js/config.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
| 3 |
// 所有數值都集中在這裡,調整平衡只要改這個檔案。
|
| 4 |
// =============================================================
|
| 5 |
|
| 6 |
-
export const APP_BUILD_VERSION = '
|
| 7 |
|
| 8 |
// ---------- 主題(攻城掠地世界觀) ----------
|
| 9 |
export const THEME = {
|
|
|
|
| 3 |
// 所有數值都集中在這裡,調整平衡只要改這個檔案。
|
| 4 |
// =============================================================
|
| 5 |
|
| 6 |
+
export const APP_BUILD_VERSION = '20261113_v2';
|
| 7 |
|
| 8 |
// ---------- 主題(攻城掠地世界觀) ----------
|
| 9 |
export const THEME = {
|
js/db.js
CHANGED
|
@@ -3,11 +3,11 @@
|
|
| 3 |
// 1. FirebaseBackend:正式使用(Auth + Firestore)
|
| 4 |
// 2. LocalBackend :firebaseConfig 未填時的本機示範模式(localStorage)
|
| 5 |
// =============================================================
|
| 6 |
-
import { firebaseConfig, STUDENT_EMAIL_DOMAIN, PIN_SUFFIX } from './firebase-config.js?v=
|
| 7 |
-
import { WEEKLY_SCHEDULE } from './config.js?v=
|
| 8 |
-
import { trafficTracker } from './traffic-tracker.js?v=
|
| 9 |
-
import { normalizeWorldBossState } from './world-boss-schedule.js?v=
|
| 10 |
-
import { todayStr } from './util.js?v=
|
| 11 |
|
| 12 |
const WEEK_TARGET_MAP = Object.fromEntries(WEEKLY_SCHEDULE.map(w => [w.id, w.target]));
|
| 13 |
function clampWeekCap(weekId, val) {
|
|
|
|
| 3 |
// 1. FirebaseBackend:正式使用(Auth + Firestore)
|
| 4 |
// 2. LocalBackend :firebaseConfig 未填時的本機示範模式(localStorage)
|
| 5 |
// =============================================================
|
| 6 |
+
import { firebaseConfig, STUDENT_EMAIL_DOMAIN, PIN_SUFFIX } from './firebase-config.js?v=20261113_v2';
|
| 7 |
+
import { WEEKLY_SCHEDULE } from './config.js?v=20261113_v2';
|
| 8 |
+
import { trafficTracker } from './traffic-tracker.js?v=20261113_v2';
|
| 9 |
+
import { normalizeWorldBossState } from './world-boss-schedule.js?v=20261113_v2';
|
| 10 |
+
import { todayStr } from './util.js?v=20261113_v2';
|
| 11 |
|
| 12 |
const WEEK_TARGET_MAP = Object.fromEntries(WEEKLY_SCHEDULE.map(w => [w.id, w.target]));
|
| 13 |
function clampWeekCap(weekId, val) {
|
js/engine.js
CHANGED
|
@@ -7,9 +7,9 @@ import {
|
|
| 7 |
OPEN_OFFSET_DAYS, DEFAULT_OPEN_HOUR, SYSTEMS, WEEKLY_SCHEDULE, SLOTH_PENALTY_MULT,
|
| 8 |
EVENTS_CONFIG, WORLD_BOSS_ROSTER, WORLD_BOSS_END_DATE, MERCHANT,
|
| 9 |
ERA2_TALLY_COST, ERA2_BASE_PROD, ERA2_SEQUENCE, ERA2_CONDITIONS, ERA2_TOWN_NAMES,
|
| 10 |
-
} from './config.js?v=
|
| 11 |
-
import { todayStr, addDays } from './util.js?v=
|
| 12 |
-
import { normalizeWorldBossState, getScheduledOpenTs, formatCountdown, formatOpenAt } from './world-boss-schedule.js?v=
|
| 13 |
export { normalizeWorldBossState, formatCountdown, formatOpenAt };
|
| 14 |
export { todayStr, REVIEW_MAX_QUESTIONS, WORLD_BOSS_ROSTER, ERA2_TALLY_COST, ERA2_BASE_PROD, ERA2_SEQUENCE, ERA2_CONDITIONS, ERA2_TOWN_NAMES };
|
| 15 |
|
|
|
|
| 7 |
OPEN_OFFSET_DAYS, DEFAULT_OPEN_HOUR, SYSTEMS, WEEKLY_SCHEDULE, SLOTH_PENALTY_MULT,
|
| 8 |
EVENTS_CONFIG, WORLD_BOSS_ROSTER, WORLD_BOSS_END_DATE, MERCHANT,
|
| 9 |
ERA2_TALLY_COST, ERA2_BASE_PROD, ERA2_SEQUENCE, ERA2_CONDITIONS, ERA2_TOWN_NAMES,
|
| 10 |
+
} from './config.js?v=20261113_v2';
|
| 11 |
+
import { todayStr, addDays } from './util.js?v=20261113_v2';
|
| 12 |
+
import { normalizeWorldBossState, getScheduledOpenTs, formatCountdown, formatOpenAt } from './world-boss-schedule.js?v=20261113_v2';
|
| 13 |
export { normalizeWorldBossState, formatCountdown, formatOpenAt };
|
| 14 |
export { todayStr, REVIEW_MAX_QUESTIONS, WORLD_BOSS_ROSTER, ERA2_TALLY_COST, ERA2_BASE_PROD, ERA2_SEQUENCE, ERA2_CONDITIONS, ERA2_TOWN_NAMES };
|
| 15 |
|
js/game.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
| 1 |
-
import { getDB, DBError, recordBossHighWaterMark, mergeBossObj } from './db.js?v=
|
| 2 |
import {
|
| 3 |
BUILDINGS, TIERS, SCHEDULE, PASS_SCORE, REVIEW_MAX_QUESTIONS, 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, WORLD_BOSS_END_DATE, MERCHANT, APP_BUILD_VERSION,
|
| 6 |
TITLE_DEFS, getTitleDef, formatTitleBadge,
|
| 7 |
ERA2_TALLY_COST, ERA2_SEQUENCE, ERA2_CONDITIONS, ERA2_TOWN_NAMES
|
| 8 |
-
} from './config.js?v=
|
| 9 |
import {
|
| 10 |
loadEnglishWords, getMerchantStatus, getMerchantDayInfo, generateMerchantQuiz, speakWord, submitMerchantAnswer,
|
| 11 |
generateDailyChallengeQueue, calcPriceMultiplier, calcBargainDiscount, settleDailyChallenge, buyMerchantItem,
|
| 12 |
getRandomBeggingSpeech, getCaravanImgSrc, getLeaderImgSrc
|
| 13 |
-
} from './merchant.js?v=
|
| 14 |
import {
|
| 15 |
newGame, normalizeGame, derive, isUnlocked, levelCost, maxAffordable, bulkCost,
|
| 16 |
starCost, nextStarMult, donationValue, clickValue, advance, classStage, openDate, isRangeOpen,
|
|
@@ -21,23 +21,23 @@ import {
|
|
| 21 |
WORLD_BOSS_ROSTER, getActiveWorldBossConfig, calcWorldBossRewards, calcWorldBossStatus,
|
| 22 |
hasClaimedBossReward, markBossRewardClaimed,
|
| 23 |
getEra2Status, getEra2UpgradeInfo, evolveTownToEra2
|
| 24 |
-
} from './engine.js?v=
|
| 25 |
-
import { $, $$, fmt, fmtTime, todayStr, bind, withLoading, toast, openModal, esc, fmtDateTime, shuffle, renderRichQuizText } from './util.js?v=
|
| 26 |
-
import { loadBankIndex, buildQuiz, loadBank } from './quiz.js?v=
|
| 27 |
-
import { checkAndShowAnnouncements, showAnnouncementModal } from './announcements.js?v=
|
| 28 |
-
import { startSecretRotator, stopSecretRotator, preloadStudentBankImages } from './preload.js?v=
|
| 29 |
import {
|
| 30 |
setupMap, renderMapSpots, renderInMapTownPanel, updateMapBossHpUI,
|
| 31 |
focusTownOnMap, openWorldBossModal, getWorldBossStatus,
|
| 32 |
MAP_POS, STRATEGIC_ROUTES, getTownLayout
|
| 33 |
-
} from './map.js?v=
|
| 34 |
import {
|
| 35 |
setupMerchantUI, openTodayWordsModal, openCaravanLevelsModal,
|
| 36 |
openMerchantQuizModal, openMerchantEventModal
|
| 37 |
-
} from './merchant-ui.js?v=
|
| 38 |
import {
|
| 39 |
setupTianji, openTianjiModal, rollChestRewards, showChestUnboxModal
|
| 40 |
-
} from './tianji.js?v=
|
| 41 |
export { openTodayWordsModal, openCaravanLevelsModal, openMerchantQuizModal, openMerchantEventModal, openTianjiModal };
|
| 42 |
window.showAnnouncementModal = showAnnouncementModal;
|
| 43 |
window.getRandomBeggingSpeech = getRandomBeggingSpeech;
|
|
|
|
| 1 |
+
import { getDB, DBError, recordBossHighWaterMark, mergeBossObj } from './db.js?v=20261113_v2';
|
| 2 |
import {
|
| 3 |
BUILDINGS, TIERS, SCHEDULE, PASS_SCORE, REVIEW_MAX_QUESTIONS, 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, WORLD_BOSS_END_DATE, MERCHANT, APP_BUILD_VERSION,
|
| 6 |
TITLE_DEFS, getTitleDef, formatTitleBadge,
|
| 7 |
ERA2_TALLY_COST, ERA2_SEQUENCE, ERA2_CONDITIONS, ERA2_TOWN_NAMES
|
| 8 |
+
} from './config.js?v=20261113_v2';
|
| 9 |
import {
|
| 10 |
loadEnglishWords, getMerchantStatus, getMerchantDayInfo, generateMerchantQuiz, speakWord, submitMerchantAnswer,
|
| 11 |
generateDailyChallengeQueue, calcPriceMultiplier, calcBargainDiscount, settleDailyChallenge, buyMerchantItem,
|
| 12 |
getRandomBeggingSpeech, getCaravanImgSrc, getLeaderImgSrc
|
| 13 |
+
} from './merchant.js?v=20261113_v2';
|
| 14 |
import {
|
| 15 |
newGame, normalizeGame, derive, isUnlocked, levelCost, maxAffordable, bulkCost,
|
| 16 |
starCost, nextStarMult, donationValue, clickValue, advance, classStage, openDate, isRangeOpen,
|
|
|
|
| 21 |
WORLD_BOSS_ROSTER, getActiveWorldBossConfig, calcWorldBossRewards, calcWorldBossStatus,
|
| 22 |
hasClaimedBossReward, markBossRewardClaimed,
|
| 23 |
getEra2Status, getEra2UpgradeInfo, evolveTownToEra2
|
| 24 |
+
} from './engine.js?v=20261113_v2';
|
| 25 |
+
import { $, $$, fmt, fmtTime, todayStr, bind, withLoading, toast, openModal, esc, fmtDateTime, shuffle, renderRichQuizText } from './util.js?v=20261113_v2';
|
| 26 |
+
import { loadBankIndex, buildQuiz, loadBank } from './quiz.js?v=20261113_v2';
|
| 27 |
+
import { checkAndShowAnnouncements, showAnnouncementModal } from './announcements.js?v=20261113_v2';
|
| 28 |
+
import { startSecretRotator, stopSecretRotator, preloadStudentBankImages } from './preload.js?v=20261113_v2';
|
| 29 |
import {
|
| 30 |
setupMap, renderMapSpots, renderInMapTownPanel, updateMapBossHpUI,
|
| 31 |
focusTownOnMap, openWorldBossModal, getWorldBossStatus,
|
| 32 |
MAP_POS, STRATEGIC_ROUTES, getTownLayout
|
| 33 |
+
} from './map.js?v=20261113_v2';
|
| 34 |
import {
|
| 35 |
setupMerchantUI, openTodayWordsModal, openCaravanLevelsModal,
|
| 36 |
openMerchantQuizModal, openMerchantEventModal
|
| 37 |
+
} from './merchant-ui.js?v=20261113_v2';
|
| 38 |
import {
|
| 39 |
setupTianji, openTianjiModal, rollChestRewards, showChestUnboxModal
|
| 40 |
+
} from './tianji.js?v=20261113_v2';
|
| 41 |
export { openTodayWordsModal, openCaravanLevelsModal, openMerchantQuizModal, openMerchantEventModal, openTianjiModal };
|
| 42 |
window.showAnnouncementModal = showAnnouncementModal;
|
| 43 |
window.getRandomBeggingSpeech = getRandomBeggingSpeech;
|
js/map.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
| 2 |
// js/map.js
|
| 3 |
// 超大戰略沙盤大地圖系統(沙盤名都佈局、動態路網、即時互動面板與世界 Boss 標記)
|
| 4 |
// ============================================================================
|
| 5 |
-
import { BUILDINGS, APP_BUILD_VERSION } from './config.js?v=
|
| 6 |
import {
|
| 7 |
isUnlocked, buildingProd, getConquerRequirements, canConquer, conquerTown,
|
| 8 |
maxAffordable, bulkCost, starCost, nextStarMult, nextMilestone, getTianjiStatus,
|
|
@@ -10,9 +10,9 @@ import {
|
|
| 10 |
formatCountdown, formatOpenAt,
|
| 11 |
checkConstructionStatus, isEventOpen, derive,
|
| 12 |
getEra2Status, getEra2UpgradeInfo, evolveTownToEra2, ERA2_TOWN_NAMES, ERA2_SEQUENCE, ERA2_TALLY_COST
|
| 13 |
-
} from './engine.js?v=
|
| 14 |
-
import { getMerchantStatus, getCaravanImgSrc } from './merchant.js?v=
|
| 15 |
-
import { $, $$, bind, esc, fmt, toast, openModal } from './util.js?v=
|
| 16 |
|
| 17 |
// 目前在地圖上選中的城池(預設關閉,點擊城池時才彈出)
|
| 18 |
let selectedTownId = null;
|
|
|
|
| 2 |
// js/map.js
|
| 3 |
// 超大戰略沙盤大地圖系統(沙盤名都佈局、動態路網、即時互動面板與世界 Boss 標記)
|
| 4 |
// ============================================================================
|
| 5 |
+
import { BUILDINGS, APP_BUILD_VERSION } from './config.js?v=20261113_v2';
|
| 6 |
import {
|
| 7 |
isUnlocked, buildingProd, getConquerRequirements, canConquer, conquerTown,
|
| 8 |
maxAffordable, bulkCost, starCost, nextStarMult, nextMilestone, getTianjiStatus,
|
|
|
|
| 10 |
formatCountdown, formatOpenAt,
|
| 11 |
checkConstructionStatus, isEventOpen, derive,
|
| 12 |
getEra2Status, getEra2UpgradeInfo, evolveTownToEra2, ERA2_TOWN_NAMES, ERA2_SEQUENCE, ERA2_TALLY_COST
|
| 13 |
+
} from './engine.js?v=20261113_v2';
|
| 14 |
+
import { getMerchantStatus, getCaravanImgSrc } from './merchant.js?v=20261113_v2';
|
| 15 |
+
import { $, $$, bind, esc, fmt, toast, openModal } from './util.js?v=20261113_v2';
|
| 16 |
|
| 17 |
// 目前在地圖上選中的城池(預設關閉,點擊城池時才彈出)
|
| 18 |
let selectedTownId = null;
|
js/merchant-ui.js
CHANGED
|
@@ -2,14 +2,14 @@
|
|
| 2 |
// js/merchant-ui.js
|
| 3 |
// 西域商隊大活動彈窗、夷語單字研讀、商隊等級總覽、行商交流與西域集市系統
|
| 4 |
// ============================================================================
|
| 5 |
-
import { MERCHANT, APP_BUILD_VERSION } from './config.js?v=
|
| 6 |
-
import { totalProd, derive, isEventOpen, getEventStatusInfo, recordMistake, recordCorrect } from './engine.js?v=
|
| 7 |
import {
|
| 8 |
loadEnglishWords, getMerchantStatus, getMerchantDayInfo, generateMerchantQuiz, speakWord, submitMerchantAnswer,
|
| 9 |
generateDailyChallengeQueue, calcPriceMultiplier, calcBargainDiscount, settleDailyChallenge, buyMerchantItem,
|
| 10 |
getRandomBeggingSpeech, getCaravanImgSrc, getLeaderImgSrc, maskExampleSentence
|
| 11 |
-
} from './merchant.js?v=
|
| 12 |
-
import { $, $$, bind, esc, fmt, toast, openModal } from './util.js?v=
|
| 13 |
|
| 14 |
let merchantCtx = null;
|
| 15 |
|
|
|
|
| 2 |
// js/merchant-ui.js
|
| 3 |
// 西域商隊大活動彈窗、夷語單字研讀、商隊等級總覽、行商交流與西域集市系統
|
| 4 |
// ============================================================================
|
| 5 |
+
import { MERCHANT, APP_BUILD_VERSION } from './config.js?v=20261113_v2';
|
| 6 |
+
import { totalProd, derive, isEventOpen, getEventStatusInfo, recordMistake, recordCorrect } from './engine.js?v=20261113_v2';
|
| 7 |
import {
|
| 8 |
loadEnglishWords, getMerchantStatus, getMerchantDayInfo, generateMerchantQuiz, speakWord, submitMerchantAnswer,
|
| 9 |
generateDailyChallengeQueue, calcPriceMultiplier, calcBargainDiscount, settleDailyChallenge, buyMerchantItem,
|
| 10 |
getRandomBeggingSpeech, getCaravanImgSrc, getLeaderImgSrc, maskExampleSentence
|
| 11 |
+
} from './merchant.js?v=20261113_v2';
|
| 12 |
+
import { $, $$, bind, esc, fmt, toast, openModal } from './util.js?v=20261113_v2';
|
| 13 |
|
| 14 |
let merchantCtx = null;
|
| 15 |
|
js/merchant.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
| 1 |
// =============================================================
|
| 2 |
// 西域駱駝商隊系統(英文單字出題、發音、獎勵與進度管理)
|
| 3 |
// =============================================================
|
| 4 |
-
import { MERCHANT } from './config.js?v=
|
| 5 |
-
import { todayStr, shuffle } from './util.js?v=
|
| 6 |
-
import { grantGrain, grantTally, grantScroll, recordMistake, recordCorrect, getCaravanRotation } from './engine.js?v=
|
| 7 |
|
| 8 |
let cachedWords = null;
|
| 9 |
|
|
|
|
| 1 |
// =============================================================
|
| 2 |
// 西域駱駝商隊系統(英文單字出題、發音、獎勵與進度管理)
|
| 3 |
// =============================================================
|
| 4 |
+
import { MERCHANT } from './config.js?v=20261113_v2';
|
| 5 |
+
import { todayStr, shuffle } from './util.js?v=20261113_v2';
|
| 6 |
+
import { grantGrain, grantTally, grantScroll, recordMistake, recordCorrect, getCaravanRotation } from './engine.js?v=20261113_v2';
|
| 7 |
|
| 8 |
let cachedWords = null;
|
| 9 |
|
js/preload.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
| 1 |
// =============================================================
|
| 2 |
// 題庫卷宗圖片預載與軍中秘史圖卷畫冊系統
|
| 3 |
// =============================================================
|
| 4 |
-
import { SCHEDULE } from './config.js?v=
|
| 5 |
-
import { isRangeOpen } from './engine.js?v=
|
| 6 |
-
import { todayStr } from './util.js?v=
|
| 7 |
-
import { loadBank } from './quiz.js?v=
|
| 8 |
|
| 9 |
export const ILLUSTRATED_SECRETS = [
|
| 10 |
// b1: 瓷鎮(大內官窯・天朝神都)
|
|
|
|
| 1 |
// =============================================================
|
| 2 |
// 題庫卷宗圖片預載與軍中秘史圖卷畫冊系統
|
| 3 |
// =============================================================
|
| 4 |
+
import { SCHEDULE } from './config.js?v=20261113_v2';
|
| 5 |
+
import { isRangeOpen } from './engine.js?v=20261113_v2';
|
| 6 |
+
import { todayStr } from './util.js?v=20261113_v2';
|
| 7 |
+
import { loadBank } from './quiz.js?v=20261113_v2';
|
| 8 |
|
| 9 |
export const ILLUSTRATED_SECRETS = [
|
| 10 |
// b1: 瓷鎮(大內官窯・天朝神都)
|
js/quiz.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
// 題庫載入與出題
|
| 2 |
-
import { TIERS, BANKS_FALLBACK } from './config.js?v=
|
| 3 |
-
import { shuffle } from './util.js?v=
|
| 4 |
|
| 5 |
const cache = new Map();
|
| 6 |
|
|
|
|
| 1 |
// 題庫載入與出題
|
| 2 |
+
import { TIERS, BANKS_FALLBACK } from './config.js?v=20261113_v2';
|
| 3 |
+
import { shuffle } from './util.js?v=20261113_v2';
|
| 4 |
|
| 5 |
const cache = new Map();
|
| 6 |
|
js/tianji.js
CHANGED
|
@@ -2,14 +2,15 @@
|
|
| 2 |
// js/tianji.js
|
| 3 |
// 天機閣急速快答演武與三階軍備箱開箱系統
|
| 4 |
// ============================================================================
|
| 5 |
-
import { SCHEDULE, APP_BUILD_VERSION } from './config.js?v=
|
| 6 |
import {
|
| 7 |
-
isRangeOpen, totalProd, getTianjiStatus, recordMistake, recordCorrect
|
| 8 |
-
|
| 9 |
-
|
|
|
|
| 10 |
import {
|
| 11 |
$, $$, fmt, todayStr, bind, toast, openModal, esc, shuffle, renderRichQuizText
|
| 12 |
-
} from './util.js?v=
|
| 13 |
|
| 14 |
let tianjiCtx = null;
|
| 15 |
|
|
@@ -70,44 +71,128 @@ export async function getTianjiQuestions() {
|
|
| 70 |
}
|
| 71 |
|
| 72 |
/**
|
| 73 |
-
*
|
| 74 |
*/
|
| 75 |
-
export
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 76 |
const prod = Math.max(2, curProd);
|
|
|
|
| 77 |
if (chestType === 'bronze') {
|
| 78 |
// 答對 1 ~ 7 題:
|
| 79 |
-
// 🌾 糧草 100%(5分鐘掛機產量)
|
| 80 |
// 穩得 1 張卷軸(70% 刪去卷,30% 偷看卷)
|
| 81 |
-
const isElim =
|
|
|
|
| 82 |
return {
|
| 83 |
-
coins: Math.round(prod * 300),
|
| 84 |
bp: 0,
|
| 85 |
peek: isElim ? 0 : 1,
|
| 86 |
-
eliminate: isElim ? 1 : 0
|
|
|
|
| 87 |
};
|
| 88 |
} else if (chestType === 'silver') {
|
| 89 |
// 答對 8 ~ 14 題:
|
| 90 |
// 🌾 糧草 100%(15分鐘掛機產量)
|
| 91 |
-
// 🐅 兵符 20% 機率得 1 枚
|
| 92 |
-
// ✂️ 刪去卷 100% 必得 1 張
|
| 93 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 94 |
return {
|
| 95 |
coins: Math.round(prod * 900),
|
| 96 |
-
bp
|
| 97 |
eliminate: 1,
|
| 98 |
-
peek:
|
|
|
|
| 99 |
};
|
| 100 |
} else if (chestType === 'gold') {
|
| 101 |
// 答對 15 題以上:
|
| 102 |
// 🌾 糧草 100%(30分鐘暴風掛機產量)
|
| 103 |
-
// 🐅 兵符
|
| 104 |
-
// 📜 偷看卷 100% 必得 1~2 張
|
| 105 |
-
|
|
|
|
|
|
|
| 106 |
return {
|
| 107 |
coins: Math.round(prod * 1800),
|
| 108 |
-
bp: 1 + (
|
| 109 |
-
peek: 1 + (
|
| 110 |
-
eliminate: 1
|
|
|
|
| 111 |
};
|
| 112 |
}
|
| 113 |
// 答對 0 題(安慰獎)
|
|
@@ -115,7 +200,8 @@ export function rollChestRewards(chestType, curProd) {
|
|
| 115 |
coins: Math.round(prod * 60),
|
| 116 |
bp: 0,
|
| 117 |
peek: 0,
|
| 118 |
-
eliminate: 0
|
|
|
|
| 119 |
};
|
| 120 |
}
|
| 121 |
|
|
@@ -229,6 +315,9 @@ export function openTianjiModal() {
|
|
| 229 |
</tr>
|
| 230 |
</tbody>
|
| 231 |
</table>
|
|
|
|
|
|
|
|
|
|
| 232 |
</div>
|
| 233 |
|
| 234 |
<!-- 操作按鈕區 -->
|
|
@@ -544,15 +633,13 @@ export function showChestUnboxModal(modal, correctCount, reason, wrongLogs = [])
|
|
| 544 |
if (!chestType) {
|
| 545 |
const rewards = rollChestRewards(null, curProd);
|
| 546 |
modal.el.innerHTML = `
|
| 547 |
-
<div class="chest-
|
| 548 |
-
<div style="font-size:15px; margin-bottom:
|
| 549 |
-
<div
|
| 550 |
-
|
| 551 |
-
|
| 552 |
-
<p class="dim" style="font-size:13px; margin:6px 0 0;">勝敗乃兵家常事,天機閣特頒發安慰糧草以資督勵!明日再來定能大展身手!</p>
|
| 553 |
-
</div>
|
| 554 |
|
| 555 |
-
<div class="rewards-grid" style="margin:
|
| 556 |
<div class="reward-item-card">
|
| 557 |
<img src="assets/icon_grain.jpg" alt="糧草">
|
| 558 |
<b>+${fmt(rewards.coins)}</b>
|
|
@@ -560,7 +647,7 @@ export function showChestUnboxModal(modal, correctCount, reason, wrongLogs = [])
|
|
| 560 |
</div>
|
| 561 |
</div>
|
| 562 |
|
| 563 |
-
<div>
|
| 564 |
<button id="btnClaimTianjiConsolation" class="btn btn-primary" style="min-width:200px; font-size:16px; font-weight:800; padding:12px 28px;">
|
| 565 |
📥 領取安慰糧草
|
| 566 |
</button>
|
|
@@ -569,8 +656,7 @@ export function showChestUnboxModal(modal, correctCount, reason, wrongLogs = [])
|
|
| 569 |
`;
|
| 570 |
|
| 571 |
bind($('#btnClaimTianjiConsolation', modal.el), 'click', () => {
|
| 572 |
-
game
|
| 573 |
-
game.totalEarned += rewards.coins;
|
| 574 |
game.tianjiDate = todayStr();
|
| 575 |
game.tianjiPlayed = 1;
|
| 576 |
tianjiCtx?.save?.();
|
|
@@ -582,39 +668,67 @@ export function showChestUnboxModal(modal, correctCount, reason, wrongLogs = [])
|
|
| 582 |
return;
|
| 583 |
}
|
| 584 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 585 |
modal.el.innerHTML = `
|
| 586 |
-
<div class="chest-
|
| 587 |
-
<div style="font-size:14px;
|
| 588 |
-
<div class="chest-wrap" id="chestAnimWrap">
|
| 589 |
-
<div class="chest-
|
| 590 |
-
<
|
|
|
|
|
|
|
|
|
|
| 591 |
<h2 class="chest-title">${chestName}</h2>
|
| 592 |
-
<p class="chest-subtitle">${subText}</p>
|
| 593 |
</div>
|
| 594 |
|
| 595 |
<div class="chest-hint-text" id="chestHintText">
|
| 596 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 597 |
</div>
|
| 598 |
|
| 599 |
<!-- 開箱物資網格容器(開箱後動態注入) -->
|
| 600 |
<div class="chest-rewards-container hidden" id="chestRewardsContainer"></div>
|
| 601 |
|
| 602 |
-
<div class="chest-btn-area" id="chestBtnArea">
|
| 603 |
-
<button id="btnOpenTianjiChest" class="btn btn-primary" style="min-width:200px; font-size:16px; font-weight:800; padding:12px 28px; box-shadow:0 6px 20px rgba(239,90,86,0.4);">
|
| 604 |
-
🔓 破鎖開啟軍備箱!
|
| 605 |
-
</button>
|
| 606 |
-
</div>
|
| 607 |
|
| 608 |
<!-- 機率公示按鈕 -->
|
| 609 |
-
<div style="margin-top:
|
| 610 |
<button id="btnViewChestProbInUnbox" class="btn btn-ghost btn-sm" style="font-size:12px; color:var(--text-mute);">
|
| 611 |
🎲 查看此軍備箱掉落機率公示
|
| 612 |
</button>
|
| 613 |
<div class="chest-prob-detail hidden" id="chestProbDetailInUnbox" style="margin-top:8px; text-align:left;">
|
| 614 |
<div style="font-size:12px; line-height:1.6; color:var(--text-dim);">
|
| 615 |
-
${chestType === 'bronze' ? '🥉 青銅軍備箱:100% 獲得 5 分鐘糧草;70% 機率得刪去卷 ×1、30% 機率得偷看卷 ×1。' : ''}
|
| 616 |
-
${chestType === 'silver' ? '🥈 白銀軍備箱:100% 獲得 15 分鐘糧草;100% 必得刪去卷 ×1;50% 機率得偷看卷 ×1;20% 機率
|
| 617 |
-
${chestType === 'gold' ? '🥇 黃金軍備箱:100% 獲得 30 分鐘暴風糧草;100% 必得兵符 1~2 枚;100% 必得偷看卷 1~2 張;100% 必得刪去卷 ×1!' : ''}
|
| 618 |
</div>
|
| 619 |
</div>
|
| 620 |
</div>
|
|
@@ -632,25 +746,141 @@ export function showChestUnboxModal(modal, correctCount, reason, wrongLogs = [])
|
|
| 632 |
const chestWrap = $('#chestAnimWrap', modal.el);
|
| 633 |
const btnOpen = $('#btnOpenTianjiChest', modal.el);
|
| 634 |
const hintText = $('#chestHintText', modal.el);
|
|
|
|
|
|
|
|
|
|
|
|
|
| 635 |
|
| 636 |
let opened = false;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 637 |
const doOpen = () => {
|
| 638 |
if (opened) return;
|
| 639 |
opened = true;
|
|
|
|
| 640 |
|
| 641 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 642 |
if (btnViewProb) btnViewProb.classList.add('hidden');
|
| 643 |
if (thisDetail) thisDetail.classList.add('hidden');
|
| 644 |
|
| 645 |
-
|
| 646 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 647 |
|
| 648 |
setTimeout(() => {
|
| 649 |
-
|
| 650 |
-
|
| 651 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 652 |
|
| 653 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 654 |
|
| 655 |
let cardsHtml = `
|
| 656 |
<div class="reward-item-card">
|
|
@@ -688,40 +918,31 @@ export function showChestUnboxModal(modal, correctCount, reason, wrongLogs = [])
|
|
| 688 |
}
|
| 689 |
|
| 690 |
const container = $('#chestRewardsContainer', modal.el);
|
| 691 |
-
container
|
| 692 |
-
|
|
|
|
|
|
|
| 693 |
|
| 694 |
const btnArea = $('#chestBtnArea', modal.el);
|
| 695 |
-
btnArea
|
| 696 |
-
|
| 697 |
-
|
| 698 |
-
|
| 699 |
-
|
|
|
|
|
|
|
|
|
|
| 700 |
|
| 701 |
bind($('#btnClaimTianjiRewards', modal.el), 'click', () => {
|
| 702 |
-
game.coins += rewards.coins;
|
| 703 |
-
game.totalEarned += rewards.coins;
|
| 704 |
-
if (rewards.bp > 0) game.blueprints += rewards.bp;
|
| 705 |
-
if (!game.items) game.items = { peek: 0, eliminate: 0 };
|
| 706 |
-
if (rewards.peek > 0) game.items.peek = (game.items.peek || 0) + rewards.peek;
|
| 707 |
-
if (rewards.eliminate > 0) game.items.eliminate = (game.items.eliminate || 0) + rewards.eliminate;
|
| 708 |
-
|
| 709 |
-
// 標記今日已玩完
|
| 710 |
-
game.tianjiDate = todayStr();
|
| 711 |
-
game.tianjiPlayed = 1;
|
| 712 |
-
|
| 713 |
-
tianjiCtx?.save?.();
|
| 714 |
-
tianjiCtx?.renderRes?.();
|
| 715 |
-
tianjiCtx?.renderBuild?.();
|
| 716 |
modal.close();
|
| 717 |
-
|
| 718 |
toast(`🎉 軍備已悉數入庫!獲得 +${fmt(rewards.coins)} 糧草${rewards.bp ? `、+${rewards.bp} 兵符` : ''}${rewards.peek ? `、+${rewards.peek} 偷看卷` : ''}${rewards.eliminate ? `、+${rewards.eliminate} 刪去卷` : ''}`, 'gold', 5000);
|
| 719 |
});
|
| 720 |
}, 1200);
|
| 721 |
};
|
| 722 |
|
| 723 |
if (btnOpen) bind(btnOpen, 'click', doOpen);
|
| 724 |
-
bind(
|
|
|
|
| 725 |
}
|
| 726 |
|
| 727 |
if (typeof window !== 'undefined') {
|
|
|
|
| 2 |
// js/tianji.js
|
| 3 |
// 天機閣急速快答演武與三階軍備箱開箱系統
|
| 4 |
// ============================================================================
|
| 5 |
+
import { SCHEDULE, APP_BUILD_VERSION } from './config.js?v=20261113_v2';
|
| 6 |
import {
|
| 7 |
+
isRangeOpen, totalProd, getTianjiStatus, recordMistake, recordCorrect,
|
| 8 |
+
grantGrain, grantTally, grantScroll
|
| 9 |
+
} from './engine.js?v=20261113_v2';
|
| 10 |
+
import { loadBank } from './quiz.js?v=20261113_v2';
|
| 11 |
import {
|
| 12 |
$, $$, fmt, todayStr, bind, toast, openModal, esc, shuffle, renderRichQuizText
|
| 13 |
+
} from './util.js?v=20261113_v2';
|
| 14 |
|
| 15 |
let tianjiCtx = null;
|
| 16 |
|
|
|
|
| 71 |
}
|
| 72 |
|
| 73 |
/**
|
| 74 |
+
* 天機閣軍備箱節奏破鎖參數(集中管理)
|
| 75 |
*/
|
| 76 |
+
export const CHEST_RHYTHM_CFG = {
|
| 77 |
+
zoneWidthPct: 20, // 綠光正確區域寬度(佔橫條 20%)
|
| 78 |
+
zoneMinStartPct: 32, // 目標區左起點最小值(%),使位置落在中央附近
|
| 79 |
+
zoneMaxStartPct: 48, // 目標區左起點最大值(%)
|
| 80 |
+
sweepDurationMs: 920, // 桿子單趟掃過橫條時間(毫秒)
|
| 81 |
+
goldBaseTwoTallyProb: 0.35, // 黃金箱基礎 2 枚兵符機率(35%)
|
| 82 |
+
goldBonusTwoTallyProb: 0.50, // 節奏成功後黃金箱 2 枚兵符機率(微幅提升至 50%)
|
| 83 |
+
silverBaseOneTallyProb: 0.20, // 白銀箱基礎 1 枚兵符機率(20%)
|
| 84 |
+
silverBonusTwoTallyProb: 0.05, // 節奏成功後白銀箱新增 5% 機率直得 2 枚兵符
|
| 85 |
+
silverBonusOneTallyProb: 0.20, // 節奏成功後白銀箱保留 20% 機率得 1 枚(合計 25%)
|
| 86 |
+
bronzeBonusGrainMult: 1.15, // 青銅箱節奏成功額外加贈 +15% 糧草
|
| 87 |
+
};
|
| 88 |
+
|
| 89 |
+
/**
|
| 90 |
+
* 判定桿子停止位置是否落在正確區域內
|
| 91 |
+
*/
|
| 92 |
+
export function evaluateChestRhythm(posPct, zoneStartPct, zoneWidthPct = CHEST_RHYTHM_CFG.zoneWidthPct) {
|
| 93 |
+
const pos = Number(posPct);
|
| 94 |
+
const start = Number(zoneStartPct);
|
| 95 |
+
const width = Number(zoneWidthPct);
|
| 96 |
+
if (!Number.isFinite(pos) || !Number.isFinite(start) || !Number.isFinite(width)) return false;
|
| 97 |
+
return pos >= start && pos <= (start + width);
|
| 98 |
+
}
|
| 99 |
+
|
| 100 |
+
let chestAudioCtx = null;
|
| 101 |
+
function playChestSfx(kind) {
|
| 102 |
+
try {
|
| 103 |
+
const AC = window.AudioContext || window.webkitAudioContext;
|
| 104 |
+
if (!AC) return;
|
| 105 |
+
if (!chestAudioCtx) chestAudioCtx = new AC();
|
| 106 |
+
if (chestAudioCtx.state === 'suspended') chestAudioCtx.resume();
|
| 107 |
+
const t0 = chestAudioCtx.currentTime;
|
| 108 |
+
const playTone = (freq, type, dur, gainPeak = 0.12, delay = 0) => {
|
| 109 |
+
const osc = chestAudioCtx.createOscillator();
|
| 110 |
+
const gain = chestAudioCtx.createGain();
|
| 111 |
+
osc.type = type;
|
| 112 |
+
osc.frequency.setValueAtTime(freq, t0 + delay);
|
| 113 |
+
gain.gain.setValueAtTime(0.0001, t0 + delay);
|
| 114 |
+
gain.gain.exponentialRampToValueAtTime(gainPeak, t0 + delay + 0.015);
|
| 115 |
+
gain.gain.exponentialRampToValueAtTime(0.0001, t0 + delay + dur);
|
| 116 |
+
osc.connect(gain);
|
| 117 |
+
gain.connect(chestAudioCtx.destination);
|
| 118 |
+
osc.start(t0 + delay);
|
| 119 |
+
osc.stop(t0 + delay + dur + 0.02);
|
| 120 |
+
};
|
| 121 |
+
if (kind === 'hit') {
|
| 122 |
+
playTone(587.3, 'triangle', 0.12, 0.14, 0);
|
| 123 |
+
playTone(880.0, 'triangle', 0.18, 0.15, 0.07);
|
| 124 |
+
} else if (kind === 'miss') {
|
| 125 |
+
playTone(210, 'sawtooth', 0.14, 0.08, 0);
|
| 126 |
+
playTone(150, 'sine', 0.18, 0.10, 0.06);
|
| 127 |
+
} else if (kind === 'rumble') {
|
| 128 |
+
[0, 0.18, 0.36, 0.56, 0.78].forEach((d, idx) => {
|
| 129 |
+
playTone(95 + idx * 14, 'triangle', 0.11, 0.06, d);
|
| 130 |
+
});
|
| 131 |
+
} else if (kind === 'open') {
|
| 132 |
+
[523.25, 659.25, 783.99, 1046.5].forEach((f, idx) => {
|
| 133 |
+
playTone(f, 'triangle', 0.28, 0.12, idx * 0.055);
|
| 134 |
+
});
|
| 135 |
+
}
|
| 136 |
+
} catch (err) {
|
| 137 |
+
// 音訊被瀏覽器政策阻擋時靜默略過
|
| 138 |
+
}
|
| 139 |
+
}
|
| 140 |
+
|
| 141 |
+
/**
|
| 142 |
+
* 計算軍備箱隨機掉落物資(支援節奏開鎖加成 timingSuccess)
|
| 143 |
+
*/
|
| 144 |
+
export function rollChestRewards(chestType, curProd, options = {}) {
|
| 145 |
+
const { timingSuccess = false, rng = Math.random } = options || {};
|
| 146 |
+
const rand = typeof rng === 'function' ? rng : Math.random;
|
| 147 |
const prod = Math.max(2, curProd);
|
| 148 |
+
|
| 149 |
if (chestType === 'bronze') {
|
| 150 |
// 答對 1 ~ 7 題:
|
| 151 |
+
// 🌾 糧草 100%(5分鐘掛機產量;節奏開鎖成功額外 +15%)
|
| 152 |
// 穩得 1 張卷軸(70% 刪去卷,30% 偷看卷)
|
| 153 |
+
const isElim = rand() < 0.70;
|
| 154 |
+
const grainMult = timingSuccess ? CHEST_RHYTHM_CFG.bronzeBonusGrainMult : 1;
|
| 155 |
return {
|
| 156 |
+
coins: Math.round(prod * 300 * grainMult),
|
| 157 |
bp: 0,
|
| 158 |
peek: isElim ? 0 : 1,
|
| 159 |
+
eliminate: isElim ? 1 : 0,
|
| 160 |
+
timingSuccess: !!timingSuccess
|
| 161 |
};
|
| 162 |
} else if (chestType === 'silver') {
|
| 163 |
// 答對 8 ~ 14 題:
|
| 164 |
// 🌾 糧草 100%(15分鐘掛機產量)
|
| 165 |
+
// 🐅 兵符:平時 20% 機率得 1 枚;節奏開鎖成功時微幅調整為 5% 得 2 枚 + 20% 得 1 枚
|
| 166 |
+
// ✂️ 刪去卷 100% 必得 1 張;📜 偷看卷 50% 機率得 1 張
|
| 167 |
+
const rTally = rand();
|
| 168 |
+
let bp = 0;
|
| 169 |
+
if (timingSuccess) {
|
| 170 |
+
if (rTally < CHEST_RHYTHM_CFG.silverBonusTwoTallyProb) bp = 2;
|
| 171 |
+
else if (rTally < CHEST_RHYTHM_CFG.silverBonusTwoTallyProb + CHEST_RHYTHM_CFG.silverBonusOneTallyProb) bp = 1;
|
| 172 |
+
} else {
|
| 173 |
+
bp = rTally < CHEST_RHYTHM_CFG.silverBaseOneTallyProb ? 1 : 0;
|
| 174 |
+
}
|
| 175 |
return {
|
| 176 |
coins: Math.round(prod * 900),
|
| 177 |
+
bp,
|
| 178 |
eliminate: 1,
|
| 179 |
+
peek: rand() < 0.50 ? 1 : 0,
|
| 180 |
+
timingSuccess: !!timingSuccess
|
| 181 |
};
|
| 182 |
} else if (chestType === 'gold') {
|
| 183 |
// 答對 15 題以上:
|
| 184 |
// 🌾 糧草 100%(30分鐘暴風掛機產量)
|
| 185 |
+
// 🐅 兵符:必得 1~2 枚(基礎 35% 機率得 2 枚;節奏開鎖成功微幅提高至 50%)
|
| 186 |
+
// 📜 偷看卷 100% 必得 1~2 張;✂️ 刪去卷 100% 必得 1 張
|
| 187 |
+
const twoTallyProb = timingSuccess
|
| 188 |
+
? CHEST_RHYTHM_CFG.goldBonusTwoTallyProb
|
| 189 |
+
: CHEST_RHYTHM_CFG.goldBaseTwoTallyProb;
|
| 190 |
return {
|
| 191 |
coins: Math.round(prod * 1800),
|
| 192 |
+
bp: 1 + (rand() < twoTallyProb ? 1 : 0),
|
| 193 |
+
peek: 1 + (rand() < 0.35 ? 1 : 0),
|
| 194 |
+
eliminate: 1,
|
| 195 |
+
timingSuccess: !!timingSuccess
|
| 196 |
};
|
| 197 |
}
|
| 198 |
// 答對 0 題(安慰獎)
|
|
|
|
| 200 |
coins: Math.round(prod * 60),
|
| 201 |
bp: 0,
|
| 202 |
peek: 0,
|
| 203 |
+
eliminate: 0,
|
| 204 |
+
timingSuccess: false
|
| 205 |
};
|
| 206 |
}
|
| 207 |
|
|
|
|
| 315 |
</tr>
|
| 316 |
</tbody>
|
| 317 |
</table>
|
| 318 |
+
<div style="font-size:11.5px; color:#92400e; margin-top:8px; padding:6px 10px; background:rgba(245,158,11,0.1); border-radius:8px;">
|
| 319 |
+
🤫 古卷秘辛:聽說在開箱時用正確的節奏破鎖,會微幅增加拿到 <b>2 個兵符</b> 的機率…
|
| 320 |
+
</div>
|
| 321 |
</div>
|
| 322 |
|
| 323 |
<!-- 操作按鈕區 -->
|
|
|
|
| 633 |
if (!chestType) {
|
| 634 |
const rewards = rollChestRewards(null, curProd);
|
| 635 |
modal.el.innerHTML = `
|
| 636 |
+
<div class="chest-stage">
|
| 637 |
+
<div style="font-size:15px; margin-bottom:2px;">${reasonText}</div>
|
| 638 |
+
<div style="font-size:64px; margin:4px 0;">🌾</div>
|
| 639 |
+
<h2 class="chest-title">慰勞糧草包</h2>
|
| 640 |
+
<p class="chest-subtitle">勝敗乃兵家常事,天機閣特頒發安慰糧草以資督勵!明日再來定能大展身手!</p>
|
|
|
|
|
|
|
| 641 |
|
| 642 |
+
<div class="rewards-grid" style="margin:12px auto;">
|
| 643 |
<div class="reward-item-card">
|
| 644 |
<img src="assets/icon_grain.jpg" alt="糧草">
|
| 645 |
<b>+${fmt(rewards.coins)}</b>
|
|
|
|
| 647 |
</div>
|
| 648 |
</div>
|
| 649 |
|
| 650 |
+
<div class="chest-btn-area">
|
| 651 |
<button id="btnClaimTianjiConsolation" class="btn btn-primary" style="min-width:200px; font-size:16px; font-weight:800; padding:12px 28px;">
|
| 652 |
📥 領取安慰糧草
|
| 653 |
</button>
|
|
|
|
| 656 |
`;
|
| 657 |
|
| 658 |
bind($('#btnClaimTianjiConsolation', modal.el), 'click', () => {
|
| 659 |
+
grantGrain(game, rewards.coins);
|
|
|
|
| 660 |
game.tianjiDate = todayStr();
|
| 661 |
game.tianjiPlayed = 1;
|
| 662 |
tianjiCtx?.save?.();
|
|
|
|
| 668 |
return;
|
| 669 |
}
|
| 670 |
|
| 671 |
+
// 隨機決定本局節奏條「正確區域」位置(落在中央附近 32%~48%,寬 20%)
|
| 672 |
+
const zoneWidth = CHEST_RHYTHM_CFG.zoneWidthPct;
|
| 673 |
+
const zoneStart = Math.round(
|
| 674 |
+
CHEST_RHYTHM_CFG.zoneMinStartPct +
|
| 675 |
+
Math.random() * (CHEST_RHYTHM_CFG.zoneMaxStartPct - CHEST_RHYTHM_CFG.zoneMinStartPct)
|
| 676 |
+
);
|
| 677 |
+
|
| 678 |
modal.el.innerHTML = `
|
| 679 |
+
<div class="chest-stage">
|
| 680 |
+
<div style="font-size:14px;">${reasonText}</div>
|
| 681 |
+
<div class="chest-big-wrap" id="chestAnimWrap" title="點擊寶箱或下方按鈕抓準時機破鎖">
|
| 682 |
+
<div class="chest-rays"></div>
|
| 683 |
+
<div class="chest-burst-ring"></div>
|
| 684 |
+
<img src="${chestImg}" class="chest-big-img" alt="${chestName}">
|
| 685 |
+
</div>
|
| 686 |
+
<div>
|
| 687 |
<h2 class="chest-title">${chestName}</h2>
|
| 688 |
+
<p class="chest-subtitle" style="margin-top:4px;">${subText}</p>
|
| 689 |
</div>
|
| 690 |
|
| 691 |
<div class="chest-hint-text" id="chestHintText">
|
| 692 |
+
🎯 抓準節奏把桿子停在綠色發光區,一舉震開軍備箱!
|
| 693 |
+
</div>
|
| 694 |
+
|
| 695 |
+
<!-- 節奏開鎖小遊戲 + 傳聞備註 -->
|
| 696 |
+
<div class="chest-rhythm-panel" id="chestRhythmPanel">
|
| 697 |
+
<div class="chest-rhythm-main">
|
| 698 |
+
<div class="chest-rhythm-head">
|
| 699 |
+
<span class="chest-rhythm-title">🗝️ 巧手開箱節奏</span>
|
| 700 |
+
<span class="chest-rhythm-status" id="chestRhythmStatus">準備中:看準綠區停桿!</span>
|
| 701 |
+
</div>
|
| 702 |
+
<div class="chest-rhythm-track" id="chestRhythmTrack" role="button" tabindex="0" aria-label="點擊橫條停止桿子">
|
| 703 |
+
<div class="chest-rhythm-zone" style="left:${zoneStart}%; width:${zoneWidth}%;"></div>
|
| 704 |
+
<div class="chest-rhythm-needle" id="chestRhythmNeedle" style="left:0%;"></div>
|
| 705 |
+
</div>
|
| 706 |
+
<button id="btnOpenTianjiChest" class="btn btn-primary chest-rhythm-btn">
|
| 707 |
+
🔓 停桿・破鎖開啟寶箱!<span class="chest-rhythm-keyhint">(空白鍵)</span>
|
| 708 |
+
</button>
|
| 709 |
+
</div>
|
| 710 |
+
|
| 711 |
+
<aside class="chest-rhythm-note" aria-label="秘辛備註">
|
| 712 |
+
<div class="chest-rhythm-note-tag">🤫 備註傳聞</div>
|
| 713 |
+
<p class="chest-rhythm-note-body">聽說用正確的方式打開,會增加拿到 <b>2 個兵符</b> 的機率…</p>
|
| 714 |
+
</aside>
|
| 715 |
</div>
|
| 716 |
|
| 717 |
<!-- 開箱物資網格容器(開箱後動態注入) -->
|
| 718 |
<div class="chest-rewards-container hidden" id="chestRewardsContainer"></div>
|
| 719 |
|
| 720 |
+
<div class="chest-btn-area hidden" id="chestBtnArea"></div>
|
|
|
|
|
|
|
|
|
|
|
|
|
| 721 |
|
| 722 |
<!-- 機率公示按鈕 -->
|
| 723 |
+
<div style="margin-top:4px;">
|
| 724 |
<button id="btnViewChestProbInUnbox" class="btn btn-ghost btn-sm" style="font-size:12px; color:var(--text-mute);">
|
| 725 |
🎲 查看此軍備箱掉落機率公示
|
| 726 |
</button>
|
| 727 |
<div class="chest-prob-detail hidden" id="chestProbDetailInUnbox" style="margin-top:8px; text-align:left;">
|
| 728 |
<div style="font-size:12px; line-height:1.6; color:var(--text-dim);">
|
| 729 |
+
${chestType === 'bronze' ? '🥉 青銅軍備箱:100% 獲得 5 分鐘糧草;70% 機率得刪去卷 ×1、30% 機率得偷看卷 ×1。(巧鎖開箱成功加贈 +15% 糧草)' : ''}
|
| 730 |
+
${chestType === 'silver' ? '🥈 白銀軍備箱:100% 獲得 15 分鐘糧草;100% 必得刪去卷 ×1;50% 機率得偷看卷 ×1;基礎 20% 機率得兵符 ×1(巧鎖開箱成功微幅提高獲得 2 枚兵符機率)。' : ''}
|
| 731 |
+
${chestType === 'gold' ? '🥇 黃金軍備箱:100% 獲得 30 分鐘暴風糧草;100% 必得兵符 1~2 枚(基礎 35% 得 2 枚,巧鎖開箱成功提升至 50%);100% 必得偷看卷 1~2 張;100% 必得刪去卷 ×1!' : ''}
|
| 732 |
</div>
|
| 733 |
</div>
|
| 734 |
</div>
|
|
|
|
| 746 |
const chestWrap = $('#chestAnimWrap', modal.el);
|
| 747 |
const btnOpen = $('#btnOpenTianjiChest', modal.el);
|
| 748 |
const hintText = $('#chestHintText', modal.el);
|
| 749 |
+
const rhythmTrack = $('#chestRhythmTrack', modal.el);
|
| 750 |
+
const rhythmNeedle = $('#chestRhythmNeedle', modal.el);
|
| 751 |
+
const rhythmStatus = $('#chestRhythmStatus', modal.el);
|
| 752 |
+
const rhythmPanel = $('#chestRhythmPanel', modal.el);
|
| 753 |
|
| 754 |
let opened = false;
|
| 755 |
+
let rewardsCredited = false;
|
| 756 |
+
let rafId = null;
|
| 757 |
+
let needlePos = 0;
|
| 758 |
+
let direction = 1;
|
| 759 |
+
let lastTs = null;
|
| 760 |
+
const speedPctPerMs = 100 / CHEST_RHYTHM_CFG.sweepDurationMs;
|
| 761 |
+
|
| 762 |
+
const preventUnboxLeave = (e) => {
|
| 763 |
+
if (rewardsCredited) return;
|
| 764 |
+
e.preventDefault();
|
| 765 |
+
e.returnValue = '⚠️ 軍備箱尚未領取完成,現在離開可能錯失開箱戰利品!';
|
| 766 |
+
return e.returnValue;
|
| 767 |
+
};
|
| 768 |
+
window.addEventListener('beforeunload', preventUnboxLeave);
|
| 769 |
+
|
| 770 |
+
const onKeyDown = (e) => {
|
| 771 |
+
if (opened || e.repeat) return;
|
| 772 |
+
if (!rhythmTrack || !document.body.contains(rhythmTrack)) {
|
| 773 |
+
cleanupMiniGameListeners();
|
| 774 |
+
window.removeEventListener('beforeunload', preventUnboxLeave);
|
| 775 |
+
return;
|
| 776 |
+
}
|
| 777 |
+
if (e.code === 'Space' || e.code === 'Enter') {
|
| 778 |
+
e.preventDefault();
|
| 779 |
+
doOpen();
|
| 780 |
+
}
|
| 781 |
+
};
|
| 782 |
+
document.addEventListener('keydown', onKeyDown);
|
| 783 |
+
|
| 784 |
+
const cleanupMiniGameListeners = () => {
|
| 785 |
+
if (rafId !== null) {
|
| 786 |
+
cancelAnimationFrame(rafId);
|
| 787 |
+
rafId = null;
|
| 788 |
+
}
|
| 789 |
+
document.removeEventListener('keydown', onKeyDown);
|
| 790 |
+
};
|
| 791 |
+
|
| 792 |
+
const stepNeedle = (ts) => {
|
| 793 |
+
if (opened || !rhythmTrack || !document.body.contains(rhythmTrack)) {
|
| 794 |
+
cleanupMiniGameListeners();
|
| 795 |
+
return;
|
| 796 |
+
}
|
| 797 |
+
if (lastTs !== null) {
|
| 798 |
+
const dt = Math.min(50, Math.max(0, ts - lastTs));
|
| 799 |
+
needlePos += direction * speedPctPerMs * dt;
|
| 800 |
+
if (needlePos >= 100) {
|
| 801 |
+
needlePos = 100 - (needlePos - 100);
|
| 802 |
+
direction = -1;
|
| 803 |
+
} else if (needlePos <= 0) {
|
| 804 |
+
needlePos = Math.abs(needlePos);
|
| 805 |
+
direction = 1;
|
| 806 |
+
}
|
| 807 |
+
if (rhythmNeedle) rhythmNeedle.style.left = `${needlePos.toFixed(2)}%`;
|
| 808 |
+
}
|
| 809 |
+
lastTs = ts;
|
| 810 |
+
rafId = requestAnimationFrame(stepNeedle);
|
| 811 |
+
};
|
| 812 |
+
rafId = requestAnimationFrame(stepNeedle);
|
| 813 |
+
|
| 814 |
const doOpen = () => {
|
| 815 |
if (opened) return;
|
| 816 |
opened = true;
|
| 817 |
+
cleanupMiniGameListeners();
|
| 818 |
|
| 819 |
+
const hitSuccess = evaluateChestRhythm(needlePos, zoneStart, zoneWidth);
|
| 820 |
+
if (rhythmNeedle) rhythmNeedle.style.left = `${needlePos.toFixed(2)}%`;
|
| 821 |
+
if (rhythmTrack) {
|
| 822 |
+
rhythmTrack.classList.add(hitSuccess ? 'is-hit' : 'is-miss');
|
| 823 |
+
rhythmTrack.style.cursor = 'default';
|
| 824 |
+
}
|
| 825 |
+
if (rhythmStatus) {
|
| 826 |
+
rhythmStatus.classList.add(hitSuccess ? 'is-hit' : 'is-miss');
|
| 827 |
+
rhythmStatus.textContent = hitSuccess ? '✨ 手法精準!成功對準綠區' : '💥 歪了一點・強行破鎖中';
|
| 828 |
+
}
|
| 829 |
+
if (btnOpen) {
|
| 830 |
+
btnOpen.disabled = true;
|
| 831 |
+
btnOpen.textContent = hitSuccess ? '✨ 節奏成功!震動破鎖中…' : '🔨 奮力砸鎖!震動開啟中…';
|
| 832 |
+
}
|
| 833 |
if (btnViewProb) btnViewProb.classList.add('hidden');
|
| 834 |
if (thisDetail) thisDetail.classList.add('hidden');
|
| 835 |
|
| 836 |
+
playChestSfx(hitSuccess ? 'hit' : 'miss');
|
| 837 |
+
playChestSfx('rumble');
|
| 838 |
+
|
| 839 |
+
if (hintText) {
|
| 840 |
+
hintText.innerHTML = hitSuccess
|
| 841 |
+
? '<span style="color:#059669; font-weight:900;">🌟 手法巧妙!寶箱正在共鳴劇烈震動…</span>'
|
| 842 |
+
: '<span style="color:var(--gold); font-weight:800;">⚡ 正在奮力破鎖震開寶箱…</span>';
|
| 843 |
+
}
|
| 844 |
+
if (chestWrap) chestWrap.classList.add('rumble'); // CSS 晃動動畫
|
| 845 |
|
| 846 |
setTimeout(() => {
|
| 847 |
+
if (chestWrap) {
|
| 848 |
+
chestWrap.classList.remove('rumble');
|
| 849 |
+
chestWrap.classList.add('open'); // CSS 金芒爆發動畫
|
| 850 |
+
if (hitSuccess) chestWrap.classList.add('hit-bonus');
|
| 851 |
+
}
|
| 852 |
+
if (rhythmPanel) rhythmPanel.classList.add('hidden');
|
| 853 |
+
playChestSfx('open');
|
| 854 |
+
|
| 855 |
+
if (hintText) {
|
| 856 |
+
hintText.innerHTML = hitSuccess
|
| 857 |
+
? '<span style="color:#047857; font-size:16px; font-weight:900;">✨ 巧手破鎖成功!戰利品光芒萬丈!</span>'
|
| 858 |
+
: '<span style="color:var(--gold-dark); font-size:16px; font-weight:900;">✨ 寶箱開啟!軍備物資噴湧而出!</span>';
|
| 859 |
+
}
|
| 860 |
+
|
| 861 |
+
const rewards = rollChestRewards(chestType, curProd, { timingSuccess: hitSuccess });
|
| 862 |
+
|
| 863 |
+
// 寶箱爆開瞬間立即入庫與存檔(防斷線/誤關遺失)
|
| 864 |
+
grantGrain(game, rewards.coins);
|
| 865 |
+
if (rewards.bp > 0) grantTally(game, rewards.bp);
|
| 866 |
+
if (rewards.peek > 0) grantScroll(game, 'peek', rewards.peek);
|
| 867 |
+
if (rewards.eliminate > 0) grantScroll(game, 'eliminate', rewards.eliminate);
|
| 868 |
+
game.tianjiDate = todayStr();
|
| 869 |
+
game.tianjiPlayed = 1;
|
| 870 |
+
rewardsCredited = true;
|
| 871 |
+
window.removeEventListener('beforeunload', preventUnboxLeave);
|
| 872 |
+
tianjiCtx?.save?.();
|
| 873 |
+
tianjiCtx?.renderRes?.();
|
| 874 |
+
tianjiCtx?.renderBuild?.();
|
| 875 |
|
| 876 |
+
let bonusPillHtml = '';
|
| 877 |
+
if (hitSuccess) {
|
| 878 |
+
let bonusMsg = '✨ 巧手破鎖成功・幸運祝禱發動!';
|
| 879 |
+
if (chestType === 'bronze') bonusMsg = '✨ 巧手破鎖成功・額外加贈 +15% 軍備糧草!';
|
| 880 |
+
else if (rewards.bp >= 2) bonusMsg = '✨ 巧手破鎖成功・幸運喚出 2 枚兵符!';
|
| 881 |
+
else bonusMsg = '✨ 巧手破鎖成功・獲得 2 枚兵符機率已微幅提升!';
|
| 882 |
+
bonusPillHtml = `<div class="chest-bonus-pill">${bonusMsg}</div>`;
|
| 883 |
+
}
|
| 884 |
|
| 885 |
let cardsHtml = `
|
| 886 |
<div class="reward-item-card">
|
|
|
|
| 918 |
}
|
| 919 |
|
| 920 |
const container = $('#chestRewardsContainer', modal.el);
|
| 921 |
+
if (container) {
|
| 922 |
+
container.innerHTML = `${bonusPillHtml}<div class="rewards-grid">${cardsHtml}</div>`;
|
| 923 |
+
container.classList.remove('hidden');
|
| 924 |
+
}
|
| 925 |
|
| 926 |
const btnArea = $('#chestBtnArea', modal.el);
|
| 927 |
+
if (btnArea) {
|
| 928 |
+
btnArea.classList.remove('hidden');
|
| 929 |
+
btnArea.innerHTML = `
|
| 930 |
+
<button id="btnClaimTianjiRewards" class="btn btn-primary" style="min-width:220px; min-height:46px; font-size:16px; font-weight:800; padding:12px 28px; box-shadow:0 4px 16px rgba(16,185,129,0.35); background:linear-gradient(135deg, #10b981, #059669);">
|
| 931 |
+
📥 收下戰利品返回
|
| 932 |
+
</button>
|
| 933 |
+
`;
|
| 934 |
+
}
|
| 935 |
|
| 936 |
bind($('#btnClaimTianjiRewards', modal.el), 'click', () => {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 937 |
modal.close();
|
|
|
|
| 938 |
toast(`🎉 軍備已悉數入庫!獲得 +${fmt(rewards.coins)} 糧草${rewards.bp ? `、+${rewards.bp} 兵符` : ''}${rewards.peek ? `、+${rewards.peek} 偷看卷` : ''}${rewards.eliminate ? `、+${rewards.eliminate} 刪去卷` : ''}`, 'gold', 5000);
|
| 939 |
});
|
| 940 |
}, 1200);
|
| 941 |
};
|
| 942 |
|
| 943 |
if (btnOpen) bind(btnOpen, 'click', doOpen);
|
| 944 |
+
if (rhythmTrack) bind(rhythmTrack, 'click', doOpen);
|
| 945 |
+
if (chestWrap) bind(chestWrap, 'click', doOpen);
|
| 946 |
}
|
| 947 |
|
| 948 |
if (typeof window !== 'undefined') {
|
js/world-boss-schedule.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
| 3 |
// 世界 Boss 當期自動排程(純函數,無副作用)
|
| 4 |
// - 供 db.js(讀寫時正規化)、engine.js(狀態計算)共用,確保全站看到同一隻 Boss
|
| 5 |
// ============================================================================
|
| 6 |
-
import { WORLD_BOSS_ROSTER, WORLD_BOSS_SCHEDULE } from './config.js?v=
|
| 7 |
|
| 8 |
/** 將 ISO 字串 / Date / 毫秒數轉為毫秒時間戳;無法解析回傳 NaN */
|
| 9 |
export function toTs(v) {
|
|
|
|
| 3 |
// 世界 Boss 當期自動排程(純函數,無副作用)
|
| 4 |
// - 供 db.js(讀寫時正規化)、engine.js(狀態計算)共用,確保全站看到同一隻 Boss
|
| 5 |
// ============================================================================
|
| 6 |
+
import { WORLD_BOSS_ROSTER, WORLD_BOSS_SCHEDULE } from './config.js?v=20261113_v2';
|
| 7 |
|
| 8 |
/** 將 ISO 字串 / Date / 毫秒數轉為毫秒時間戳;無法解析回傳 NaN */
|
| 9 |
export function toTs(v) {
|
teacher.html
CHANGED
|
@@ -5,7 +5,7 @@
|
|
| 5 |
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
|
| 6 |
<title>教師管理後台 - 放置測驗遊戲</title>
|
| 7 |
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;600;800&family=Noto+Sans+TC:wght@400;700&display=swap" rel="stylesheet">
|
| 8 |
-
<link rel="stylesheet" href="css/base.css?v=
|
| 9 |
<style>
|
| 10 |
:root {
|
| 11 |
--admin-bg: #f9e9da; /* 柔和暖杏底色 */
|
|
@@ -1022,6 +1022,6 @@
|
|
| 1022 |
<!-- Float layer for toasts -->
|
| 1023 |
<div id="floatLayer"></div>
|
| 1024 |
|
| 1025 |
-
<script type="module" src="js/admin.js?v=
|
| 1026 |
</body>
|
| 1027 |
</html>
|
|
|
|
| 5 |
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
|
| 6 |
<title>教師管理後台 - 放置測驗遊戲</title>
|
| 7 |
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;600;800&family=Noto+Sans+TC:wght@400;700&display=swap" rel="stylesheet">
|
| 8 |
+
<link rel="stylesheet" href="css/base.css?v=20261113_v2">
|
| 9 |
<style>
|
| 10 |
:root {
|
| 11 |
--admin-bg: #f9e9da; /* 柔和暖杏底色 */
|
|
|
|
| 1022 |
<!-- Float layer for toasts -->
|
| 1023 |
<div id="floatLayer"></div>
|
| 1024 |
|
| 1025 |
+
<script type="module" src="js/admin.js?v=20261113_v2"></script>
|
| 1026 |
</body>
|
| 1027 |
</html>
|
tools/verify-integrity.mjs
CHANGED
|
@@ -54,6 +54,7 @@ import {
|
|
| 54 |
} from '../js/merchant.js';
|
| 55 |
import { BUILDINGS, MERCHANT, SCHEDULE, WEEKLY_SCHEDULE, APP_BUILD_VERSION, ERA2_TALLY_COST, ERA2_SEQUENCE, ERA2_CONDITIONS, ERA2_TOWN_NAMES } from '../js/config.js';
|
| 56 |
import { renderRichQuizText, todayStr } from '../js/util.js';
|
|
|
|
| 57 |
|
| 58 |
const ROOT = process.cwd();
|
| 59 |
let passedChecks = 0;
|
|
@@ -815,4 +816,25 @@ const testClickDStateLucky = { ...testClickDState2, lucky: true };
|
|
| 815 |
assert.equal(clickValue(testClickGame, testClickDStateLucky), expectedCps * 1.5, '祥瑞狀態下巡營催糧應為每秒產量 x 1.5 倍');
|
| 816 |
ok('巡營催糧數量精準等於每秒產量(100% CPS)與祥瑞加成檢驗通過');
|
| 817 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 818 |
console.log(`\n🎉 全部 ${passedChecks} 大項工程防呆檢驗 100% 通過!可安全部署上線。`);
|
|
|
|
| 54 |
} from '../js/merchant.js';
|
| 55 |
import { BUILDINGS, MERCHANT, SCHEDULE, WEEKLY_SCHEDULE, APP_BUILD_VERSION, ERA2_TALLY_COST, ERA2_SEQUENCE, ERA2_CONDITIONS, ERA2_TOWN_NAMES } from '../js/config.js';
|
| 56 |
import { renderRichQuizText, todayStr } from '../js/util.js';
|
| 57 |
+
import { rollChestRewards, evaluateChestRhythm, CHEST_RHYTHM_CFG } from '../js/tianji.js';
|
| 58 |
|
| 59 |
const ROOT = process.cwd();
|
| 60 |
let passedChecks = 0;
|
|
|
|
| 816 |
assert.equal(clickValue(testClickGame, testClickDStateLucky), expectedCps * 1.5, '祥瑞狀態下巡營催糧應為每秒產量 x 1.5 倍');
|
| 817 |
ok('巡營催糧數量精準等於每秒產量(100% CPS)與祥瑞加成檢驗通過');
|
| 818 |
|
| 819 |
+
// 14. 天機閣軍備箱震動/開啟 CSS 與節奏開鎖兵符機率驗證
|
| 820 |
+
const tianjiSrc = fs.readFileSync(path.join(ROOT, 'js', 'tianji.js'), 'utf8');
|
| 821 |
+
const gameCssSrc = fs.readFileSync(path.join(ROOT, 'css', 'game.css'), 'utf8');
|
| 822 |
+
for (const cls of ['chest-stage', 'chest-big-wrap', 'chest-big-img', 'chest-rays', 'rumble', 'chest-rhythm-track', 'chest-rhythm-zone', 'chest-rhythm-needle', 'chest-rhythm-note']) {
|
| 823 |
+
assert.ok(tianjiSrc.includes(cls), `js/tianji.js 必須包含樣式類別 .${cls}`);
|
| 824 |
+
assert.ok(gameCssSrc.includes(`.${cls}`), `css/game.css 必須定義樣式類別 .${cls}`);
|
| 825 |
+
}
|
| 826 |
+
assert.equal(evaluateChestRhythm(39, 40, 20), false, '桿子落在綠區左側應判失敗');
|
| 827 |
+
assert.equal(evaluateChestRhythm(40, 40, 20), true, '桿子落在綠區左邊界應判成功');
|
| 828 |
+
assert.equal(evaluateChestRhythm(50, 40, 20), true, '桿子落在綠區中央應判成功');
|
| 829 |
+
assert.equal(evaluateChestRhythm(60, 40, 20), true, '桿子落在綠區右邊界應判成功');
|
| 830 |
+
assert.equal(evaluateChestRhythm(61, 40, 20), false, '桿子超過綠區右側應判失敗');
|
| 831 |
+
|
| 832 |
+
assert.equal(rollChestRewards('gold', 100, { timingSuccess: false, rng: () => 0.42 }).bp, 1, '黃金箱未過節奏關在 roll=0.42 應為 1 枚兵符');
|
| 833 |
+
assert.equal(rollChestRewards('gold', 100, { timingSuccess: true, rng: () => 0.42 }).bp, 2, '黃金箱成功過節奏關在 roll=0.42 應提升為 2 枚兵符');
|
| 834 |
+
assert.equal(rollChestRewards('gold', 100, { timingSuccess: true, rng: () => 0.55 }).bp, 1, '黃金箱提升幅度為微幅調整(roll=0.55 仍為 1 枚)');
|
| 835 |
+
assert.equal(rollChestRewards('silver', 100, { timingSuccess: false, rng: () => 0.03 }).bp, 1, '白銀箱未過節奏關在 roll=0.03 僅得 1 枚兵符');
|
| 836 |
+
assert.equal(rollChestRewards('silver', 100, { timingSuccess: true, rng: () => 0.03 }).bp, 2, '白銀箱過節奏關後(<5%)有機會取得 2 枚兵符');
|
| 837 |
+
assert.ok(CHEST_RHYTHM_CFG.goldBonusTwoTallyProb > CHEST_RHYTHM_CFG.goldBaseTwoTallyProb, '黃金箱節奏成功機率必須高於基礎值');
|
| 838 |
+
ok('天機閣寶箱震動開啟動畫類別、節奏桿判定與兵符微幅提升機制檢驗通過');
|
| 839 |
+
|
| 840 |
console.log(`\n🎉 全部 ${passedChecks} 大項工程防呆檢驗 100% 通過!可安全部署上線。`);
|