Lashtw commited on
Commit
ddf71f0
·
1 Parent(s): 54d2fa5

feat(boss,ui): 窮奇大地圖直入大廳與內嵌倒數、平板第二紀元飛升按鈕適配、獎勵統一

Browse files
Files changed (10) hide show
  1. boss-test.html +34 -47
  2. boss.html +34 -28
  3. css/boss.css +67 -19
  4. css/game.css +20 -5
  5. js/announcements.js +2 -2
  6. js/boss-battle.js +132 -136
  7. js/engine.js +51 -25
  8. js/game.js +20 -4
  9. js/map.js +26 -10
  10. tools/verify-integrity.mjs +19 -3
boss-test.html CHANGED
@@ -30,11 +30,8 @@
30
 
31
  <div class="intro-info">
32
  <h1 class="boss-title" id="introBossTitle">上古・饕餮</h1>
33
- <div id="introBossSubtitle" style="display:inline-flex; align-items:center; gap:6px; background:rgba(245,158,11,0.15); border:1px solid rgba(245,158,11,0.4); border-radius:6px; padding:3px 10px; font-size:12px; color:#fde68a; font-weight:700; margin-bottom:10px;">
34
- 🏛️ 門檻:完成第三單元(51-75)軍機策驗 | ⏳ 實裝破印時間:10/27(二)
35
- </div>
36
- <!-- 今日出題輪替主題 (一天技藝班專業錯題,一天英文單字錯題) -->
37
- <div id="introDailyTheme" style="display:flex; align-items:center; gap:8px; margin-bottom:12px; flex-wrap:wrap;"></div>
38
  <p class="boss-desc" id="introBossDesc">
39
  貪食萬物的太古凶獸,自封印中甦醒,盤踞在雲海之上的八卦古壇。
40
  牠以學子們的「錯題」為食——答錯越多,牠就越強大。
@@ -73,42 +70,42 @@
73
  <div class="reward-box">
74
  <div class="reward-head">
75
  <h2>討伐成功獎勵</h2>
76
- <span id="rewardTierTag">依個人遊戲進度動態調整・擊破後全員發放</span>
77
  </div>
78
  <div class="reward-list">
79
  <div class="reward-item">
80
  <span class="reward-ico">🌾</span>
81
  <div>
82
- <div class="reward-name" id="rewardGrainTitle">1 小時產量包 ×4</div>
83
- <div class="reward-sub" id="rewardGrainSub">依個人當下產能與進度補給(2~8小時)</div>
84
  </div>
85
  </div>
86
  <div class="reward-item">
87
  <span class="reward-ico">🧧</span>
88
  <div>
89
- <div class="reward-name" id="rewardBpTitle">兵符 ×4</div>
90
- <div class="reward-sub" id="rewardBpSub">依通關進度動態提升(2~10枚)</div>
91
  </div>
92
  </div>
93
  <div class="reward-item">
94
  <span class="reward-ico">📜</span>
95
  <div>
96
  <div class="reward-name" id="rewardScrollTitle">錦囊包 ×2</div>
97
- <div class="reward-sub" id="rewardScrollSub">偷看卷+刪去卷各 2 張</div>
98
  </div>
99
  </div>
100
  <div class="reward-item">
101
  <span class="reward-ico">🏅</span>
102
  <div>
103
  <div class="reward-name">個人稱號</div>
104
- <div class="reward-sub" id="rewardTitleSub">【平妖勇士】</div>
105
  </div>
106
  </div>
107
  <div class="reward-item mvp">
108
  <span class="reward-ico">⚔️</span>
109
  <div>
110
- <div class="reward-name" id="rewardMvpTitle">MVP/最後一擊加碼:兵符 +2(共 6 枚)</div>
111
- <div class="reward-sub" id="rewardMvpSub">傷害第一【破魔先鋒】・最後一擊【斬魔將軍】</div>
112
  </div>
113
  </div>
114
  </div>
@@ -418,7 +415,7 @@
418
  import {
419
  recordMistake, recordCorrect, derive, totalProd, grantGrain, grantTally, grantScroll,
420
  WORLD_BOSS_ROSTER, getActiveWorldBossConfig, calcWorldBossRewards, calcWorldBossStatus,
421
- getBossDailyQuestionTheme
422
  } from './js/engine.js?v=20261107_v1';
423
  import { loadEnglishWords, buildWordQuestion } from './js/merchant.js?v=20261107_v1';
424
  import { todayStr, fmt, shuffle, renderRichQuizText } from './js/util.js?v=20261107_v1';
@@ -451,9 +448,8 @@
451
  if (introTitle) introTitle.textContent = cfg.name;
452
  const introSub = $('introBossSubtitle');
453
  if (introSub) {
454
- introSub.textContent = activeBossKey === 'qiongqi'
455
- ? '⚡ 上古四凶之貳 | 決戰領域:【天罰雷獄・斷魂絕谷】'
456
- : '🏛️ 門檻:完成第三單元(51-75)軍機策驗 | ⏳ 實裝破印時間:10/27(二)';
457
  }
458
  const introDesc = $('introBossDesc');
459
  if (introDesc) introDesc.textContent = cfg.loreSummary;
@@ -544,8 +540,8 @@
544
 
545
  function calcCritRate(isCharge) {
546
  const base = isCharge ? 0.40 : 0.15;
547
- const buff = currentStudent?.game?.merchantBuffs?.bossCritRate || 0;
548
- return Math.min(1.0, base + buff);
549
  }
550
 
551
  // 依今日出題主題(一天技藝班專業錯題,一天英文單字錯題,每日嚴格輪流)載入題庫與錯題
@@ -621,8 +617,16 @@
621
  console.warn('載入學科題庫失敗', e);
622
  }
623
 
 
 
 
 
 
 
 
 
624
  myMistakes = Object.values(currentStudent?.game?.mistakes || {})
625
- .filter(m => !m.mastered && m.q && Array.isArray(m.o) && m.bank !== 'english' && (!m.bank || m.bank === myBankId || m.bank === 'default'))
626
  .map(m => ({ ...m, bank: myBankId }));
627
 
628
  peerMistakes = [];
@@ -632,8 +636,8 @@
632
  const myQSet = new Set(myMistakes.map(m => m.q));
633
  const seenPeerQ = new Set();
634
  for (const s of classStudents) {
635
- if (s.uid !== currentUser?.uid && s.bankId === myBankId && s.game?.mistakes) {
636
- const sMists = Object.values(s.game.mistakes).filter(m => !m.mastered && m.q && Array.isArray(m.o) && m.bank !== 'english' && (!m.bank || m.bank === myBankId || m.bank === 'default'));
637
  for (const sm of sMists) {
638
  if (!myQSet.has(sm.q) && !seenPeerQ.has(sm.q)) {
639
  seenPeerQ.add(sm.q);
@@ -662,18 +666,10 @@
662
  $('introHpBar').style.width = `${pct}%`;
663
  $('introClassTitle').textContent = currentClass?.name ? `【${currentClass.name}】全班討伐進度` : '全班討伐進度';
664
 
665
- // 今日出題主題橫幅(一天技藝班專業錯題,一天英文單字錯題,每日嚴格輪流出)
666
- const dailyTheme = getBossDailyQuestionTheme(effClass, today);
667
  const themeEl = $('introDailyTheme');
668
  if (themeEl) {
669
- themeEl.innerHTML = `
670
- <span style="display:inline-flex; align-items:center; gap:6px; background:linear-gradient(135deg, rgba(245,158,11,0.25), rgba(217,119,6,0.3)); border:1.5px solid #f59e0b; border-radius:8px; padding:4px 10px; font-size:12px; font-weight:800; color:#fde68a; box-shadow:0 0 10px rgba(245,158,11,0.2);">
671
- ${dailyTheme.badge}
672
- </span>
673
- <span style="font-size:12px; color:#cbd5e1; font-weight:600;">
674
- ${dailyTheme.desc}
675
- </span>
676
- `;
677
  }
678
 
679
  // 累計個人傷害
@@ -697,21 +693,17 @@
697
  const rew = calcWorldBossRewards(currentStudent?.progress, currentStudent?.game, currentClass, isKillerMe);
698
  const cfg = getCurBossCfg();
699
  if ($('rewardTierTag')) {
700
- $('rewardTierTag').textContent = currentStudent
701
- ? `當前進度【${rew.tierLabel}】專屬加成・擊破後全員發放`
702
- : '依個人遊戲進度動態調整・擊破後全員發放';
703
  }
704
  if ($('rewardGrainTitle')) $('rewardGrainTitle').textContent = `1 小時產量包 ×${rew.grainHours}`;
705
  if ($('rewardGrainSub')) {
706
  $('rewardGrainSub').textContent = currentStudent
707
  ? `預估可得 +${rew.coins.toLocaleString()} 糧草`
708
- : '依個人當下產能與進度補給(2~8小時)';
709
  }
710
  if ($('rewardBpTitle')) $('rewardBpTitle').textContent = `兵符 ×${rew.baseBp}`;
711
  if ($('rewardBpSub')) {
712
- $('rewardBpSub').textContent = currentStudent
713
- ? `${rew.tierLabel}(隨通關進度提升 2~10 枚)`
714
- : '隨通關進度動態提升(2~10 枚)';
715
  }
716
  if ($('rewardScrollTitle')) $('rewardScrollTitle').textContent = `錦囊包 ×${rew.peekCount}`;
717
  if ($('rewardScrollSub')) $('rewardScrollSub').textContent = `偷看卷 ×${rew.peekCount} + 刪去卷 ×${rew.eliminateCount}`;
@@ -1056,13 +1048,8 @@
1056
  const isCrit = Math.random() < critRate;
1057
 
1058
  // 基礎傷害與暴擊傷害(支援西域商隊珍寶加成)
1059
- let dmg = 1;
1060
- if (isCrit) {
1061
- dmg = 2 + (currentStudent?.game?.merchantBuffs?.bossCritFlat || 0);
1062
- if (currentStudent?.game?.merchantBuffs?.bossCritDmg) {
1063
- dmg = Math.round(dmg * (1 + currentStudent.game.merchantBuffs.bossCritDmg));
1064
- }
1065
- }
1066
  currentRoundDamage += dmg;
1067
  hasChargeBuff = false;
1068
  applyDamage(dmg, isCrit);
 
30
 
31
  <div class="intro-info">
32
  <h1 class="boss-title" id="introBossTitle">上古・饕餮</h1>
33
+ <div id="introBossSubtitle" class="hidden" style="display:none;"></div>
34
+ <div id="introDailyTheme" class="hidden" style="display:none;"></div>
 
 
 
35
  <p class="boss-desc" id="introBossDesc">
36
  貪食萬物的太古凶獸,自封印中甦醒,盤踞在雲海之上的八卦古壇。
37
  牠以學子們的「錯題」為食——答錯越多,牠就越強大。
 
70
  <div class="reward-box">
71
  <div class="reward-head">
72
  <h2>討伐成功獎勵</h2>
73
+ <span id="rewardTierTag">全班合力封印・達標全員發放</span>
74
  </div>
75
  <div class="reward-list">
76
  <div class="reward-item">
77
  <span class="reward-ico">🌾</span>
78
  <div>
79
+ <div class="reward-name" id="rewardGrainTitle">1 小時產量包 ×6</div>
80
+ <div class="reward-sub" id="rewardGrainSub">依個人當下產能補給 6 小時糧草</div>
81
  </div>
82
  </div>
83
  <div class="reward-item">
84
  <span class="reward-ico">🧧</span>
85
  <div>
86
+ <div class="reward-name" id="rewardBpTitle">兵符 ×6</div>
87
+ <div class="reward-sub" id="rewardBpSub">全班成功封印全員發放 6 枚兵符</div>
88
  </div>
89
  </div>
90
  <div class="reward-item">
91
  <span class="reward-ico">📜</span>
92
  <div>
93
  <div class="reward-name" id="rewardScrollTitle">錦囊包 ×2</div>
94
+ <div class="reward-sub" id="rewardScrollSub">偷看卷 ×2 + 刪去卷 ×2</div>
95
  </div>
96
  </div>
97
  <div class="reward-item">
98
  <span class="reward-ico">🏅</span>
99
  <div>
100
  <div class="reward-name">個人稱號</div>
101
+ <div class="reward-sub" id="rewardTitleSub">【鎮雷天將】</div>
102
  </div>
103
  </div>
104
  <div class="reward-item mvp">
105
  <span class="reward-ico">⚔️</span>
106
  <div>
107
+ <div class="reward-name" id="rewardMvpTitle">MVP/最後一擊加碼:兵符 +3(共 9 枚)</div>
108
+ <div class="reward-sub" id="rewardMvpSub">傷害第一【破雷先鋒】・最後一擊【誅邪武聖】</div>
109
  </div>
110
  </div>
111
  </div>
 
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=20261107_v1';
420
  import { loadEnglishWords, buildWordQuestion } from './js/merchant.js?v=20261107_v1';
421
  import { todayStr, fmt, shuffle, renderRichQuizText } from './js/util.js?v=20261107_v1';
 
448
  if (introTitle) introTitle.textContent = cfg.name;
449
  const introSub = $('introBossSubtitle');
450
  if (introSub) {
451
+ introSub.classList.add('hidden');
452
+ introSub.style.display = 'none';
 
453
  }
454
  const introDesc = $('introBossDesc');
455
  if (introDesc) introDesc.textContent = cfg.loreSummary;
 
540
 
541
  function calcCritRate(isCharge) {
542
  const base = isCharge ? 0.40 : 0.15;
543
+ const wp = getBossWeaponBuffs(currentStudent?.game);
544
+ return Math.min(1.0, base + (wp.critRateBonus || 0));
545
  }
546
 
547
  // 依今日出題主題(一天技藝班專業錯題,一天英文單字錯題,每日嚴格輪流)載入題庫與錯題
 
617
  console.warn('載入學科題庫失敗', e);
618
  }
619
 
620
+ const validVocQSet = new Set(realBankQuestions.map(q => q.q));
621
+ const isSameSubjectVocMistake = (m) => {
622
+ if (!m || m.bank === 'english') return false;
623
+ if (m.bank && m.bank !== myBankId && m.bank !== 'default') return false;
624
+ if (validVocQSet.size > 0 && !validVocQSet.has(m.q)) return false;
625
+ return true;
626
+ };
627
+
628
  myMistakes = Object.values(currentStudent?.game?.mistakes || {})
629
+ .filter(m => (Number(m.reviewCorrectCount) || 0) < 3 && m.q && Array.isArray(m.o) && isSameSubjectVocMistake(m))
630
  .map(m => ({ ...m, bank: myBankId }));
631
 
632
  peerMistakes = [];
 
636
  const myQSet = new Set(myMistakes.map(m => m.q));
637
  const seenPeerQ = new Set();
638
  for (const s of classStudents) {
639
+ if (s.uid !== currentUser?.uid && s.role !== 'teacher' && Number(s.seat) !== 20 && s.bankId === myBankId && s.game?.mistakes) {
640
+ const sMists = Object.values(s.game.mistakes).filter(m => (Number(m.reviewCorrectCount) || 0) < 3 && m.q && Array.isArray(m.o) && isSameSubjectVocMistake(m));
641
  for (const sm of sMists) {
642
  if (!myQSet.has(sm.q) && !seenPeerQ.has(sm.q)) {
643
  seenPeerQ.add(sm.q);
 
666
  $('introHpBar').style.width = `${pct}%`;
667
  $('introClassTitle').textContent = currentClass?.name ? `【${currentClass.name}】全班討伐進度` : '全班討伐進度';
668
 
 
 
669
  const themeEl = $('introDailyTheme');
670
  if (themeEl) {
671
+ themeEl.classList.add('hidden');
672
+ themeEl.style.display = 'none';
 
 
 
 
 
 
673
  }
674
 
675
  // 累計個人傷害
 
693
  const rew = calcWorldBossRewards(currentStudent?.progress, currentStudent?.game, currentClass, isKillerMe);
694
  const cfg = getCurBossCfg();
695
  if ($('rewardTierTag')) {
696
+ $('rewardTierTag').textContent = '全班合力封印・達標全員發放';
 
 
697
  }
698
  if ($('rewardGrainTitle')) $('rewardGrainTitle').textContent = `1 小時產量包 ×${rew.grainHours}`;
699
  if ($('rewardGrainSub')) {
700
  $('rewardGrainSub').textContent = currentStudent
701
  ? `預估可得 +${rew.coins.toLocaleString()} 糧草`
702
+ : `依個人當下產能補給 ${rew.grainHours} 小時糧草`;
703
  }
704
  if ($('rewardBpTitle')) $('rewardBpTitle').textContent = `兵符 ×${rew.baseBp}`;
705
  if ($('rewardBpSub')) {
706
+ $('rewardBpSub').textContent = `全班成功封印全員發放 ${rew.baseBp} 枚兵符`;
 
 
707
  }
708
  if ($('rewardScrollTitle')) $('rewardScrollTitle').textContent = `錦囊包 ×${rew.peekCount}`;
709
  if ($('rewardScrollSub')) $('rewardScrollSub').textContent = `偷看卷 ×${rew.peekCount} + 刪去卷 ×${rew.eliminateCount}`;
 
1048
  const isCrit = Math.random() < critRate;
1049
 
1050
  // 基礎傷害與暴擊傷害(支援西域商隊珍寶加成)
1051
+ const wp = getBossWeaponBuffs(currentStudent?.game);
1052
+ const dmg = isCrit ? wp.critDamage : 1;
 
 
 
 
 
1053
  currentRoundDamage += dmg;
1054
  hasChargeBuff = false;
1055
  applyDamage(dmg, isCrit);
boss.html CHANGED
@@ -30,11 +30,8 @@
30
 
31
  <div class="intro-info">
32
  <h1 class="boss-title" id="introBossTitle">上古・饕餮</h1>
33
- <div id="introBossSubtitle" style="display:inline-flex; align-items:center; gap:6px; background:rgba(245,158,11,0.15); border:1px solid rgba(245,158,11,0.4); border-radius:6px; padding:3px 10px; font-size:12px; color:#fde68a; font-weight:700; margin-bottom:10px;">
34
- 🏛️ 門檻:完成第三單元(51-75)軍機策驗 | ⏳ 實裝破印時間:10/27(二)
35
- </div>
36
- <!-- 今日出題輪替主題 (一天技藝班專業錯題,一天英文單字錯題) -->
37
- <div id="introDailyTheme" style="display:flex; align-items:center; gap:8px; margin-bottom:12px; flex-wrap:wrap;"></div>
38
  <p class="boss-desc" id="introBossDesc">
39
  貪食萬物的太古凶獸,自封印中甦醒,盤踞在雲海之上的八卦古壇。
40
  牠以學子們的「錯題」為食——答錯越多,牠就越強大。
@@ -53,24 +50,25 @@
53
  <div id="introYinYangBox" class="yinyang-hp-box hidden">
54
  <div class="yinyang-hp-head">
55
  <span>☯️ 【雙生同命】陰陽雙軀封印狀態</span>
56
- <small>須陽軀與陰軀雙雙歸零方能徹底封印(單邊歸零後傷害溢出不轉移)</small>
57
  </div>
58
  <div class="yinyang-hp-grid">
59
  <div class="yinyang-hp-card yang" id="introYangCard">
60
  <div class="yy-row">
61
- <span class="yy-title">🔥 陽之軀・天工雷罡(技藝錯題)</span>
 
 
 
62
  <span class="yy-val" id="introYangHpText">1200 / 1200 HP</span>
63
  </div>
64
- <div class="yy-bar-track"><div class="yy-bar-fill yang" id="introYangHpBar" style="width:100%"></div></div>
65
- <div class="yy-sub" id="introYangSub">⚔️ 弱點:技藝班專業科目錯題</div>
66
  </div>
67
  <div class="yinyang-hp-card yin" id="introYinCard">
68
  <div class="yy-row">
69
- <span class="yy-title">❄️ 陰之軀・西域玄煞(英文錯題)</span>
 
 
 
70
  <span class="yy-val" id="introYinHpText">800 / 800 HP</span>
71
  </div>
72
- <div class="yy-bar-track"><div class="yy-bar-fill yin" id="introYinHpBar" style="width:100%"></div></div>
73
- <div class="yy-sub" id="introYinSub">⚔️ 弱點:西域商隊英文單字錯題</div>
74
  </div>
75
  </div>
76
  </div>
@@ -99,42 +97,42 @@
99
  <div class="reward-box">
100
  <div class="reward-head">
101
  <h2>討伐成功獎勵</h2>
102
- <span id="rewardTierTag">依個人遊戲進度動態調整・擊破後全員發放</span>
103
  </div>
104
  <div class="reward-list">
105
  <div class="reward-item">
106
  <span class="reward-ico">🌾</span>
107
  <div>
108
- <div class="reward-name" id="rewardGrainTitle">1 小時產量包 ×4</div>
109
- <div class="reward-sub" id="rewardGrainSub">依個人當下產能與進度補給(2~8小時)</div>
110
  </div>
111
  </div>
112
  <div class="reward-item">
113
  <span class="reward-ico">🧧</span>
114
  <div>
115
- <div class="reward-name" id="rewardBpTitle">兵符 ×4</div>
116
- <div class="reward-sub" id="rewardBpSub">依通關進度動態提升(2~10枚)</div>
117
  </div>
118
  </div>
119
  <div class="reward-item">
120
  <span class="reward-ico">📜</span>
121
  <div>
122
  <div class="reward-name" id="rewardScrollTitle">錦囊包 ×2</div>
123
- <div class="reward-sub" id="rewardScrollSub">偷看卷+刪去卷各 2 張</div>
124
  </div>
125
  </div>
126
  <div class="reward-item">
127
  <span class="reward-ico">🏅</span>
128
  <div>
129
  <div class="reward-name">個人稱號</div>
130
- <div class="reward-sub" id="rewardTitleSub">【平妖勇士】</div>
131
  </div>
132
  </div>
133
  <div class="reward-item mvp">
134
  <span class="reward-ico">⚔️</span>
135
  <div>
136
- <div class="reward-name" id="rewardMvpTitle">MVP/最後一擊加碼:兵符 +2(共 6 枚)</div>
137
- <div class="reward-sub" id="rewardMvpSub">傷害第一【破魔先鋒】・最後一擊【斬魔將軍】</div>
138
  </div>
139
  </div>
140
  </div>
@@ -144,27 +142,35 @@
144
  </button>
145
  </div>
146
 
 
 
 
 
 
 
 
 
147
  <div id="introOrdersNotice" class="orders-notice-bar">
148
  <span>⚔️ 今日剩餘討伐令:<b id="introOrdersCount">3 / 3</b></span>
149
- <span id="introMistakeBuffHint" style="font-size:11px; color:#fde68a;">⚡ 個人待精熟錯題越多,出征將觸發額外【集氣試煉】大幅提升暴擊率!</span>
150
  </div>
151
 
152
  <!-- ☯️ 方案 B:自由選邊破陣制(三顆出征按鈕) -->
153
  <div id="introYinYangBtns" class="yinyang-btn-group hidden">
154
  <button class="btn-mode yang" id="btnStartYang" type="button">
155
  <div class="mode-top">🔥 專攻陽軀</div>
156
- <div class="mode-sub">10 題技藝錯題|100% 扣陽軀</div>
157
- <div class="mode-meta" id="metaStartYang">待精熟 0 題</div>
158
  </button>
159
  <button class="btn-mode yin" id="btnStartYin" type="button">
160
  <div class="mode-top">❄️ 專攻陰軀</div>
161
- <div class="mode-sub">10 題英文錯題|100% 扣陰軀</div>
162
- <div class="mode-meta" id="metaStartYin">待精熟 0 題</div>
163
  </button>
164
  <button class="btn-mode dual" id="btnStartDual" type="button">
165
  <div class="mode-top">☯️ 陰陽雙修</div>
166
- <div class="mode-sub">6 題技藝+4 題英文|雙軀分擊</div>
167
- <div class="mode-meta" id="metaStartDual">陰陽破陣推薦</div>
168
  </button>
169
  </div>
170
 
 
30
 
31
  <div class="intro-info">
32
  <h1 class="boss-title" id="introBossTitle">上古・饕餮</h1>
33
+ <div id="introBossSubtitle" class="hidden" style="display:none;"></div>
34
+ <div id="introDailyTheme" class="hidden" style="display:none;"></div>
 
 
 
35
  <p class="boss-desc" id="introBossDesc">
36
  貪食萬物的太古凶獸,自封印中甦醒,盤踞在雲海之上的八卦古壇。
37
  牠以學子們的「錯題」為食——答錯越多,牠就越強大。
 
50
  <div id="introYinYangBox" class="yinyang-hp-box hidden">
51
  <div class="yinyang-hp-head">
52
  <span>☯️ 【雙生同命】陰陽雙軀封印狀態</span>
 
53
  </div>
54
  <div class="yinyang-hp-grid">
55
  <div class="yinyang-hp-card yang" id="introYangCard">
56
  <div class="yy-row">
57
+ <span class="yy-title">🔥 陽之軀・天工雷罡</span>
58
+ </div>
59
+ <div class="yy-bar-line">
60
+ <div class="yy-bar-track"><div class="yy-bar-fill yang" id="introYangHpBar" style="width:100%"></div></div>
61
  <span class="yy-val" id="introYangHpText">1200 / 1200 HP</span>
62
  </div>
 
 
63
  </div>
64
  <div class="yinyang-hp-card yin" id="introYinCard">
65
  <div class="yy-row">
66
+ <span class="yy-title">❄️ 陰之軀・西域玄煞</span>
67
+ </div>
68
+ <div class="yy-bar-line">
69
+ <div class="yy-bar-track"><div class="yy-bar-fill yin" id="introYinHpBar" style="width:100%"></div></div>
70
  <span class="yy-val" id="introYinHpText">800 / 800 HP</span>
71
  </div>
 
 
72
  </div>
73
  </div>
74
  </div>
 
97
  <div class="reward-box">
98
  <div class="reward-head">
99
  <h2>討伐成功獎勵</h2>
100
+ <span id="rewardTierTag">全班合力封印・達標全員發放</span>
101
  </div>
102
  <div class="reward-list">
103
  <div class="reward-item">
104
  <span class="reward-ico">🌾</span>
105
  <div>
106
+ <div class="reward-name" id="rewardGrainTitle">1 小時產量包 ×6</div>
107
+ <div class="reward-sub" id="rewardGrainSub">依個人當下產能補給 6 小時糧草</div>
108
  </div>
109
  </div>
110
  <div class="reward-item">
111
  <span class="reward-ico">🧧</span>
112
  <div>
113
+ <div class="reward-name" id="rewardBpTitle">兵符 ×6</div>
114
+ <div class="reward-sub" id="rewardBpSub">全班成功封印全員發放 6 枚兵符</div>
115
  </div>
116
  </div>
117
  <div class="reward-item">
118
  <span class="reward-ico">📜</span>
119
  <div>
120
  <div class="reward-name" id="rewardScrollTitle">錦囊包 ×2</div>
121
+ <div class="reward-sub" id="rewardScrollSub">偷看卷 ×2 + 刪去卷 ×2</div>
122
  </div>
123
  </div>
124
  <div class="reward-item">
125
  <span class="reward-ico">🏅</span>
126
  <div>
127
  <div class="reward-name">個人稱號</div>
128
+ <div class="reward-sub" id="rewardTitleSub">【鎮雷天將】</div>
129
  </div>
130
  </div>
131
  <div class="reward-item mvp">
132
  <span class="reward-ico">⚔️</span>
133
  <div>
134
+ <div class="reward-name" id="rewardMvpTitle">MVP/最後一擊加碼:兵符 +3(共 9 枚)</div>
135
+ <div class="reward-sub" id="rewardMvpSub">傷害第一【破雷先鋒】・最後一擊【誅邪武聖】</div>
136
  </div>
137
  </div>
138
  </div>
 
142
  </button>
143
  </div>
144
 
145
+ <div id="introCountdownBanner" class="boss-countdown-banner hidden">
146
+ <div class="cd-left">
147
+ <span class="cd-badge">⏳ 封印破除倒數</span>
148
+ <span class="cd-open-at" id="introCountdownOpenAt">11/9(一) 07:00 準時開打</span>
149
+ </div>
150
+ <div class="cd-timer" id="introCountdownTimer">剩餘 --:--:--</div>
151
+ </div>
152
+
153
  <div id="introOrdersNotice" class="orders-notice-bar">
154
  <span>⚔️ 今日剩餘討伐令:<b id="introOrdersCount">3 / 3</b></span>
155
+ <span id="introMistakeBuffHint" style="font-size:11px; color:#fde68a;">⚔️ 普通命中扣 1 HP・暴擊扣 2 HP(錯題答對滿 3 次即精熟移出)</span>
156
  </div>
157
 
158
  <!-- ☯️ 方案 B:自由選邊破陣制(三顆出征按鈕) -->
159
  <div id="introYinYangBtns" class="yinyang-btn-group hidden">
160
  <button class="btn-mode yang" id="btnStartYang" type="button">
161
  <div class="mode-top">🔥 專攻陽軀</div>
162
+ <div class="mode-sub">10 題技藝錯題</div>
163
+ <div class="mode-meta hidden" id="metaStartYang"></div>
164
  </button>
165
  <button class="btn-mode yin" id="btnStartYin" type="button">
166
  <div class="mode-top">❄️ 專攻陰軀</div>
167
+ <div class="mode-sub">10 題英文錯題</div>
168
+ <div class="mode-meta hidden" id="metaStartYin"></div>
169
  </button>
170
  <button class="btn-mode dual" id="btnStartDual" type="button">
171
  <div class="mode-top">☯️ 陰陽雙修</div>
172
+ <div class="mode-sub">6 題技藝+4 題英文</div>
173
+ <div class="mode-meta hidden" id="metaStartDual"></div>
174
  </button>
175
  </div>
176
 
css/boss.css CHANGED
@@ -179,13 +179,14 @@
179
  position: relative;
180
  border-radius: 18px;
181
  background:
182
- radial-gradient(circle at 50% 55%, rgba(168, 85, 247, 0.45), transparent 62%),
183
  url('../assets/boss_bg_arena.jpg') center / cover no-repeat;
184
- border: 1px solid rgba(245, 196, 81, 0.35);
185
  overflow: hidden;
186
  display: flex;
187
- align-items: flex-end;
188
  justify-content: center;
 
189
  min-height: 380px;
190
  box-shadow: inset 0 0 60px rgba(0,0,0,0.6);
191
  }
@@ -193,16 +194,17 @@
193
  content: '';
194
  position: absolute;
195
  inset: 0;
196
- background: linear-gradient(180deg, transparent 55%, rgba(0,0,0,0.55));
197
  pointer-events: none;
198
  }
199
  .intro-portrait img {
200
  position: relative;
201
  z-index: 1;
202
- width: 100%;
203
- max-height: 400px;
 
204
  object-fit: contain;
205
- filter: drop-shadow(0 16px 26px rgba(0,0,0,0.85));
206
  animation: idleFloat 3.8s ease-in-out infinite;
207
  }
208
  .intro-info {
@@ -1465,10 +1467,10 @@
1465
  padding: 18px 22px;
1466
  }
1467
  .intro-portrait {
1468
- min-height: 280px;
1469
  }
1470
  .intro-portrait img {
1471
- max-height: 280px;
1472
  }
1473
  .boss-title {
1474
  font-size: 30px;
@@ -1550,23 +1552,32 @@
1550
  justify-content: space-between;
1551
  align-items: center;
1552
  gap: 6px;
1553
- font-size: 12px;
1554
  font-weight: 800;
1555
- margin-bottom: 6px;
1556
  }
1557
  .yinyang-hp-card.yang .yy-title { color: #fed7aa; }
1558
  .yinyang-hp-card.yin .yy-title { color: #bae6fd; }
1559
- .yy-val {
1560
- font-variant-numeric: tabular-nums;
1561
- color: #fff;
 
1562
  }
1563
  .yy-bar-track {
1564
- height: 10px;
 
1565
  border-radius: 99px;
1566
  background: rgba(0,0,0,0.55);
1567
  overflow: hidden;
1568
  border: 1px solid rgba(255,255,255,0.18);
1569
  }
 
 
 
 
 
 
 
1570
  .yy-bar-fill {
1571
  height: 100%;
1572
  border-radius: 99px;
@@ -1580,11 +1591,48 @@
1580
  background: linear-gradient(90deg, #2563eb, #06b6d4, #a855f7);
1581
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.75);
1582
  }
1583
- .yy-sub {
1584
- margin-top: 6px;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1585
  font-size: 11px;
1586
- font-weight: 700;
1587
- color: #cbd5e1;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1588
  }
1589
  .orders-notice-bar {
1590
  display: flex;
 
179
  position: relative;
180
  border-radius: 18px;
181
  background:
182
+ radial-gradient(circle at 50% 50%, rgba(168, 85, 247, 0.48), transparent 65%),
183
  url('../assets/boss_bg_arena.jpg') center / cover no-repeat;
184
+ border: 1px solid rgba(245, 196, 81, 0.38);
185
  overflow: hidden;
186
  display: flex;
187
+ align-items: center;
188
  justify-content: center;
189
+ padding: 20px 14px;
190
  min-height: 380px;
191
  box-shadow: inset 0 0 60px rgba(0,0,0,0.6);
192
  }
 
194
  content: '';
195
  position: absolute;
196
  inset: 0;
197
+ background: radial-gradient(circle at 50% 50%, transparent 45%, rgba(0,0,0,0.45) 100%), linear-gradient(180deg, rgba(0,0,0,0.18) 0%, transparent 35%, transparent 65%, rgba(0,0,0,0.5) 100%);
198
  pointer-events: none;
199
  }
200
  .intro-portrait img {
201
  position: relative;
202
  z-index: 1;
203
+ width: 96%;
204
+ max-height: 460px;
205
+ margin: auto;
206
  object-fit: contain;
207
+ filter: drop-shadow(0 16px 28px rgba(0,0,0,0.88));
208
  animation: idleFloat 3.8s ease-in-out infinite;
209
  }
210
  .intro-info {
 
1467
  padding: 18px 22px;
1468
  }
1469
  .intro-portrait {
1470
+ min-height: 320px;
1471
  }
1472
  .intro-portrait img {
1473
+ max-height: 380px;
1474
  }
1475
  .boss-title {
1476
  font-size: 30px;
 
1552
  justify-content: space-between;
1553
  align-items: center;
1554
  gap: 6px;
1555
+ font-size: 13px;
1556
  font-weight: 800;
1557
+ margin-bottom: 8px;
1558
  }
1559
  .yinyang-hp-card.yang .yy-title { color: #fed7aa; }
1560
  .yinyang-hp-card.yin .yy-title { color: #bae6fd; }
1561
+ .yy-bar-line {
1562
+ display: flex;
1563
+ align-items: center;
1564
+ gap: 10px;
1565
  }
1566
  .yy-bar-track {
1567
+ flex: 1;
1568
+ height: 12px;
1569
  border-radius: 99px;
1570
  background: rgba(0,0,0,0.55);
1571
  overflow: hidden;
1572
  border: 1px solid rgba(255,255,255,0.18);
1573
  }
1574
+ .yy-val {
1575
+ font-variant-numeric: tabular-nums;
1576
+ font-size: 12px;
1577
+ font-weight: 800;
1578
+ color: #fde68a;
1579
+ white-space: nowrap;
1580
+ }
1581
  .yy-bar-fill {
1582
  height: 100%;
1583
  border-radius: 99px;
 
1591
  background: linear-gradient(90deg, #2563eb, #06b6d4, #a855f7);
1592
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.75);
1593
  }
1594
+ .boss-countdown-banner {
1595
+ display: flex;
1596
+ justify-content: space-between;
1597
+ align-items: center;
1598
+ flex-wrap: wrap;
1599
+ gap: 10px;
1600
+ padding: 10px 14px;
1601
+ border-radius: 12px;
1602
+ background: linear-gradient(135deg, rgba(220, 38, 38, 0.25), rgba(245, 158, 11, 0.22));
1603
+ border: 1.5px solid rgba(251, 191, 36, 0.65);
1604
+ box-shadow: 0 6px 20px rgba(239, 68, 68, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.2);
1605
+ }
1606
+ .boss-countdown-banner .cd-left {
1607
+ display: flex;
1608
+ align-items: center;
1609
+ gap: 8px;
1610
+ flex-wrap: wrap;
1611
+ }
1612
+ .boss-countdown-banner .cd-badge {
1613
+ background: linear-gradient(135deg, #ef4444, #d97706);
1614
+ color: #fff;
1615
  font-size: 11px;
1616
+ font-weight: 900;
1617
+ padding: 3px 9px;
1618
+ border-radius: 99px;
1619
+ letter-spacing: 0.5px;
1620
+ }
1621
+ .boss-countdown-banner .cd-open-at {
1622
+ font-size: 13px;
1623
+ font-weight: 800;
1624
+ color: #fef3c7;
1625
+ }
1626
+ .boss-countdown-banner .cd-timer {
1627
+ font-variant-numeric: tabular-nums;
1628
+ font-size: 15px;
1629
+ font-weight: 900;
1630
+ color: #fde047;
1631
+ background: rgba(0, 0, 0, 0.45);
1632
+ padding: 4px 12px;
1633
+ border-radius: 8px;
1634
+ border: 1px solid rgba(253, 224, 71, 0.4);
1635
+ text-shadow: 0 2px 6px rgba(0, 0, 0, 0.8);
1636
  }
1637
  .orders-notice-bar {
1638
  display: flex;
css/game.css CHANGED
@@ -328,12 +328,14 @@ html[data-theme="dark"] .map-spot.ready .spot-label { color: #fcd34d; border-col
328
  /* 地圖內置:城池戰略指令面板(In-Map Town Popover Panel 就近在城池旁顯示) */
329
  .inmap-town-panel {
330
  position: absolute; width: clamp(260px, 30cqw, 340px); max-width: calc(100% - 24px);
331
- z-index: 60; background: rgba(255, 255, 255, 0.96);
 
332
  backdrop-filter: blur(18px); border: 2px solid rgba(217,119,6, 0.7);
333
  border-radius: 18px; box-shadow: 0 16px 40px -8px rgba(45,25,15, 0.38), 0 0 0 1px rgba(255,255,255,0.6) inset;
334
- padding: 14px 16px; display: flex; flex-direction: column; gap: 10px;
335
  animation: panelPopoverIn 0.22s cubic-bezier(.34,1.56,.64,1);
336
  transform-origin: center center;
 
337
  }
338
  html[data-theme="dark"] .inmap-town-panel {
339
  background: rgba(18, 25, 42, 0.96); border-color: rgba(245,196,81, 0.65);
@@ -737,6 +739,11 @@ html[data-theme="dark"] .r-card { background: var(--bg-2); }
737
  @media (min-width: 901px) and (max-width: 1199px) {
738
  .main { max-width: 100%; padding: 12px 14px 80px; }
739
  .territory-map-wrap { height: auto !important; }
 
 
 
 
 
740
  }
741
 
742
  /* 2. iPad 9 直向與小平板 (641px ~ 900px) */
@@ -744,6 +751,14 @@ html[data-theme="dark"] .r-card { background: var(--bg-2); }
744
  .main { padding: 14px 14px 90px; }
745
  .territory-map-wrap { height: auto !important; }
746
  .class-layout { grid-template-columns: 1fr; }
 
 
 
 
 
 
 
 
747
  }
748
 
749
  /* 3. 手機垂直緊湊視圖 (<= 640px) */
@@ -4776,9 +4791,9 @@ html[data-theme="dark"] .r-card { background: var(--bg-2); }
4776
  transform: translateY(-1px) scale(1.02);
4777
  box-shadow: 0 6px 18px rgba(245, 158, 11, 0.45) !important;
4778
  }
4779
- .btn-inmap-era2.disabled, .btn-inmap-era2:disabled {
4780
- opacity: 0.55;
4781
- cursor: not-allowed;
4782
  background: #94a3b8 !important;
4783
  box-shadow: none !important;
4784
  }
 
328
  /* 地圖內置:城池戰略指令面板(In-Map Town Popover Panel 就近在城池旁顯示) */
329
  .inmap-town-panel {
330
  position: absolute; width: clamp(260px, 30cqw, 340px); max-width: calc(100% - 24px);
331
+ max-height: calc(100% - 16px); overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain;
332
+ z-index: 75; background: rgba(255, 255, 255, 0.97);
333
  backdrop-filter: blur(18px); border: 2px solid rgba(217,119,6, 0.7);
334
  border-radius: 18px; box-shadow: 0 16px 40px -8px rgba(45,25,15, 0.38), 0 0 0 1px rgba(255,255,255,0.6) inset;
335
+ padding: 12px 15px; display: flex; flex-direction: column; gap: 8px;
336
  animation: panelPopoverIn 0.22s cubic-bezier(.34,1.56,.64,1);
337
  transform-origin: center center;
338
+ touch-action: pan-y;
339
  }
340
  html[data-theme="dark"] .inmap-town-panel {
341
  background: rgba(18, 25, 42, 0.96); border-color: rgba(245,196,81, 0.65);
 
739
  @media (min-width: 901px) and (max-width: 1199px) {
740
  .main { max-width: 100%; padding: 12px 14px 80px; }
741
  .territory-map-wrap { height: auto !important; }
742
+ .inmap-town-panel {
743
+ padding: 10px 13px;
744
+ gap: 6px;
745
+ max-height: calc(100% - 14px);
746
+ }
747
  }
748
 
749
  /* 2. iPad 9 直向與小平板 (641px ~ 900px) */
 
751
  .main { padding: 14px 14px 90px; }
752
  .territory-map-wrap { height: auto !important; }
753
  .class-layout { grid-template-columns: 1fr; }
754
+ .inmap-town-panel {
755
+ top: 8px !important;
756
+ bottom: auto !important;
757
+ max-height: calc(100% - 16px) !important;
758
+ padding: 10px 12px;
759
+ gap: 6px;
760
+ }
761
+ .inmap-town-panel::before { display: none !important; }
762
  }
763
 
764
  /* 3. 手機垂直緊湊視圖 (<= 640px) */
 
4791
  transform: translateY(-1px) scale(1.02);
4792
  box-shadow: 0 6px 18px rgba(245, 158, 11, 0.45) !important;
4793
  }
4794
+ .btn-inmap-era2.disabled, .btn-inmap-era2:disabled, .btn-inmap-era2.locked-action, .btn-era2.locked-action {
4795
+ opacity: 0.82;
4796
+ cursor: pointer;
4797
  background: #94a3b8 !important;
4798
  box-shadow: none !important;
4799
  }
js/announcements.js CHANGED
@@ -33,8 +33,8 @@ export const ANNOUNCEMENT_REGISTRY = [
33
  },
34
  {
35
  icon: '🧧',
36
- title: '討伐獎勵隨進度全面升級(2~10 枚兵符)',
37
- desc: '依個人通關進度動態發放:兵符 ×2~10 枚(尾刀再加碼 +2~4 枚)、2~8 小時產量糧草包、錦囊卷軸與專屬稱號【鎮雷天將】/【誅邪武聖】!'
38
  }
39
  ],
40
  ctaText: '⚡ 戒除粗心・備戰雷翼窮奇'
 
33
  },
34
  {
35
  icon: '🧧',
36
+ title: '討伐成功全服豐厚獎勵(兵符 ×6、MVP/尾刀 +3)',
37
+ desc: '成功封印全員獲贈:兵符 ×6 枚(MVP/最後一擊再加碼 +3 枚,共 9 枚)、6 小時產量糧草包、錦囊包 ×2 與專屬稱號【鎮雷天將】/【破雷先鋒】/【誅邪武聖】!'
38
  }
39
  ],
40
  ctaText: '⚡ 戒除粗心・備戰雷翼窮奇'
js/boss-battle.js CHANGED
@@ -8,7 +8,7 @@
8
  recordMistake, recordCorrect, derive, totalProd, grantGrain, grantTally, grantScroll,
9
  WORLD_BOSS_ROSTER, getActiveWorldBossConfig, calcWorldBossRewards, calcWorldBossStatus,
10
  hasClaimedBossReward, markBossRewardClaimed, formatCountdown, formatOpenAt,
11
- getBossDailyQuestionTheme, buildAdaptiveChargeThresholds, calcStudentChargeQuestions
12
  } from './engine.js?v=20261107_v1';
13
  import { loadEnglishWords, buildWordQuestion } from './merchant.js?v=20261107_v1';
14
  import { todayStr, fmt, shuffle, renderRichQuizText } from './util.js?v=20261107_v1';
@@ -42,9 +42,8 @@
42
  if (introTitle) introTitle.textContent = cfg.name;
43
  const introSub = $('introBossSubtitle');
44
  if (introSub) {
45
- introSub.textContent = activeBossKey === 'qiongqi'
46
- ? '☯️ 上古四凶之貳・陰陽雙生同命 | 門檻:完成第六單元(126-150)'
47
- : '🏛️ 門檻:完成第三單元(51-75)軍機策驗 | ⏳ 實裝破印時間:10/27(二)';
48
  }
49
  const introDesc = $('introBossDesc');
50
  if (introDesc) introDesc.textContent = cfg.loreSummary;
@@ -156,8 +155,8 @@
156
  function calcCritRate(isCharge, stacks = chargeBuffStacks) {
157
  const effStacks = isCharge ? Math.max(1, stacks || 1) : 0;
158
  const base = effStacks >= 2 ? 0.65 : (effStacks === 1 ? 0.40 : 0.15);
159
- const buff = currentStudent?.game?.merchantBuffs?.bossCritRate || 0;
160
- return Math.min(1.0, base + buff);
161
  }
162
 
163
  // 同時載入【技藝班專業題庫(陽軀)】與【西域英文單字題庫(陰軀)】與全班錯題池
@@ -170,19 +169,51 @@
170
  bankName = myBankId;
171
  }
172
 
173
- // 1. 個人錯題分流(統一依「累計答對 < 3 次」判定為未精熟,讓之前僅答對 2 次的題目也回歸錯題池)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
174
  const isUnmastered = (m) => m && (Number(m.reviewCorrectCount) || 0) < 3 && m.q && Array.isArray(m.o);
175
  const allMyMistakes = Object.values(currentStudent?.game?.mistakes || {}).filter(isUnmastered);
176
 
177
  myVocMistakes = allMyMistakes
178
- .filter(m => m.bank !== 'english' && (!m.bank || m.bank === myBankId || m.bank === 'default'))
179
  .map(m => ({ ...m, bank: myBankId, mastered: false }));
180
 
181
  myEngMistakes = allMyMistakes
182
  .filter(m => m.bank === 'english')
183
  .map(m => ({ ...m, bank: 'english', mastered: false }));
184
 
185
- // 2. 全班同袍錯題分流(一次讀取,同時提取技藝與英文同袍錯題)
186
  peerVocMistakes = [];
187
  peerEngMistakes = [];
188
  try {
@@ -204,19 +235,19 @@
204
  classVocCounts.push(sVocCnt);
205
  classEngCounts.push(sEngCnt);
206
  classDualCounts.push(sVocCnt + sEngCnt);
207
- }
208
- if (s.uid !== currentUser?.uid && s.game?.mistakes) {
209
- const sMists = Object.values(s.game.mistakes).filter(isUnmastered);
210
- for (const sm of sMists) {
211
- if (sm.bank === 'english') {
212
- if (!myEngQSet.has(sm.q) && !seenEngQ.has(sm.q)) {
213
- seenEngQ.add(sm.q);
214
- peerEngMistakes.push({ ...sm, bank: 'english', mastered: false, donorName: s.name || `座號${s.seat}` });
215
- }
216
- } else if (s.bankId === myBankId && (!sm.bank || sm.bank === myBankId || sm.bank === 'default')) {
217
- if (!myVocQSet.has(sm.q) && !seenVocQ.has(sm.q)) {
218
- seenVocQ.add(sm.q);
219
- peerVocMistakes.push({ ...sm, bank: myBankId, mastered: false, donorName: s.name || `座號${s.seat}` });
220
  }
221
  }
222
  }
@@ -233,29 +264,6 @@
233
  console.warn('[boss] 載入同袍錯題失敗', err);
234
  }
235
 
236
- // 3. 平行載入技藝題庫與英文單字題庫
237
- const [vocRes, engRes] = await Promise.allSettled([
238
- loadBank(myBankId),
239
- loadEnglishWords()
240
- ]);
241
-
242
- if (vocRes.status === 'fulfilled' && vocRes.value && Array.isArray(vocRes.value.questions)) {
243
- vocBankQuestions = vocRes.value.questions.map(q => ({ ...q, bank: myBankId }));
244
- }
245
- if (engRes.status === 'fulfilled' && Array.isArray(engRes.value) && engRes.value.length > 0) {
246
- const englishWords = engRes.value;
247
- engBankQuestions = englishWords.map(w => {
248
- const bq = buildWordQuestion(w, englishWords);
249
- return {
250
- q: `請問英文單字【${bq.word}】${bq.pos ? `(${bq.pos})` : ''} 的意思是?`,
251
- o: bq.options.map(o => o.text),
252
- a: bq.correctAns,
253
- bank: 'english',
254
- tag: '西域單字策題'
255
- };
256
- });
257
- }
258
-
259
  // 向下相容舊版單一題庫變數
260
  const effClass = { ...(currentClass || {}), worldBoss: worldBossData || currentClass?.worldBoss };
261
  const dailyTheme = getBossDailyQuestionTheme(effClass, todayStr());
@@ -304,51 +312,22 @@
304
  const yangPct = yangMax > 0 ? Math.max(0, Math.min(100, (yangHp / yangMax) * 100)) : 0;
305
  const yinPct = yinMax > 0 ? Math.max(0, Math.min(100, (yinHp / yinMax) * 100)) : 0;
306
 
307
- if ($('introYangHpText')) $('introYangHpText').textContent = yangHp <= 0 ? `⛓️ 已鎮壓鎖定 (0 / ${yangMax})` : `${yangHp} / ${yangMax} HP`;
308
  if ($('introYangHpBar')) $('introYangHpBar').style.width = `${yangPct}%`;
309
  if ($('introYangCard')) $('introYangCard').classList.toggle('sealed', yangHp <= 0);
310
- if ($('introYangSub')) {
311
- $('introYangSub').innerHTML = yangHp <= 0
312
- ? '<span style="color:#86efac;">⛓️ 陽軀已鎮壓鎖定!請集中火力攻破陰軀(溢傷不轉移)</span>'
313
- : `⚔️ 弱點:技藝班專業錯題(我的待精熟:<b style="color:#fde047;">${myVocMistakes.length}</b> 題)`;
314
- }
315
 
316
- if ($('introYinHpText')) $('introYinHpText').textContent = yinHp <= 0 ? `⛓️ 已鎮壓鎖定 (0 / ${yinMax})` : `${yinHp} / ${yinMax} HP`;
317
  if ($('introYinHpBar')) $('introYinHpBar').style.width = `${yinPct}%`;
318
  if ($('introYinCard')) $('introYinCard').classList.toggle('sealed', yinHp <= 0);
319
- if ($('introYinSub')) {
320
- $('introYinSub').innerHTML = yinHp <= 0
321
- ? '<span style="color:#86efac;">⛓️ 陰軀已鎮壓鎖定!請集中火力攻破陽軀(溢傷不轉移)</span>'
322
- : `⚔️ 弱點:西域商隊英文錯題(我的待精熟:<b style="color:#fde047;">${myEngMistakes.length}</b> 題)`;
323
- }
324
  } else {
325
  yyBox.classList.add('hidden');
326
  }
327
  }
328
 
329
- // 今日出題主題橫幅(窮奇改為顯示【陰陽雙生・自由選邊破陣制】)
330
- const dailyTheme = getBossDailyQuestionTheme(effClass, today);
331
  const themeEl = $('introDailyTheme');
332
  if (themeEl) {
333
- if (isYinYang) {
334
- themeEl.innerHTML = `
335
- <span style="display:inline-flex; align-items:center; gap:6px; background:linear-gradient(135deg, rgba(234,88,12,0.3), rgba(14,165,233,0.3)); border:1.5px solid #fde047; border-radius:8px; padding:4px 10px; font-size:12px; font-weight:800; color:#fde68a; box-shadow:0 0 12px rgba(245,158,11,0.25);">
336
- ☯️ 陰陽雙生・自由選邊破陣
337
- </span>
338
- <span style="font-size:12px; color:#cbd5e1; font-weight:600;">
339
- 自由選擇【🔥專攻陽軀(10題技藝)】、【❄️專攻陰軀(10題英文)】或【☯️陰陽雙修(6技藝+4英文)】!錯題答對滿 3 次即精熟移出!
340
- </span>
341
- `;
342
- } else {
343
- themeEl.innerHTML = `
344
- <span style="display:inline-flex; align-items:center; gap:6px; background:linear-gradient(135deg, rgba(245,158,11,0.25), rgba(217,119,6,0.3)); border:1.5px solid #f59e0b; border-radius:8px; padding:4px 10px; font-size:12px; font-weight:800; color:#fde68a; box-shadow:0 0 10px rgba(245,158,11,0.2);">
345
- ${dailyTheme.badge}
346
- </span>
347
- <span style="font-size:12px; color:#cbd5e1; font-weight:600;">
348
- ${dailyTheme.desc}
349
- </span>
350
- `;
351
- }
352
  }
353
 
354
  // 累計個人傷害
@@ -367,26 +346,25 @@
367
  qual.classList.remove('ok');
368
  }
369
 
370
- // 動態計算並顯示依遊戲進度調整之討伐獎勵
 
 
 
371
  const isKillerMe = !!(worldBossData?.killer?.uid && currentUser?.uid && worldBossData.killer.uid === currentUser.uid);
372
- const rew = calcWorldBossRewards(currentStudent?.progress, currentStudent?.game, currentClass, isKillerMe);
373
  const cfg = getCurBossCfg();
374
  if ($('rewardTierTag')) {
375
- $('rewardTierTag').textContent = currentStudent
376
- ? `當前進度【${rew.tierLabel}】專屬加成・擊破後全員發放`
377
- : '依個人遊戲進度動態調整・擊破後全員發放';
378
  }
379
  if ($('rewardGrainTitle')) $('rewardGrainTitle').textContent = `1 小時產量包 ×${rew.grainHours}`;
380
  if ($('rewardGrainSub')) {
381
  $('rewardGrainSub').textContent = currentStudent
382
  ? `預估可得 +${rew.coins.toLocaleString()} 糧草`
383
- : '依個人當下產能與進度補給(2~8小時)';
384
  }
385
  if ($('rewardBpTitle')) $('rewardBpTitle').textContent = `兵符 ×${rew.baseBp}`;
386
  if ($('rewardBpSub')) {
387
- $('rewardBpSub').textContent = currentStudent
388
- ? `${rew.tierLabel}(隨通關進度提升 2~10 枚)`
389
- : '隨通關進度動態提升(2~10 枚)';
390
  }
391
  if ($('rewardScrollTitle')) $('rewardScrollTitle').textContent = `錦囊包 ×${rew.peekCount}`;
392
  if ($('rewardScrollSub')) $('rewardScrollSub').textContent = `偷看卷 ×${rew.peekCount} + 刪去卷 ×${rew.eliminateCount}`;
@@ -439,13 +417,28 @@
439
  if ($('introOrdersCount')) {
440
  $('introOrdersCount').textContent = `${ordersLeft} / ${maxOrders}`;
441
  }
 
 
 
 
 
 
 
442
 
443
- // 依模式動態計算集氣試煉加題數(優先採用後台設定之 chargeThresholds,其次採用全班即時分位數自適應門檻)
444
- const activeThresholds = wbStatus.chargeThresholds || adaptiveChargeThresholds;
445
- const calcChargeBonus = (cnt, modeType) => {
446
- const c = calcStudentChargeQuestions(cnt, modeType, activeThresholds);
447
- return c > 0 ? `+${c}題集氣` : '無額外集氣';
448
- };
 
 
 
 
 
 
 
 
449
 
450
  const yyBtns = $('introYinYangBtns');
451
  const btn = $('btnStart');
@@ -453,31 +446,27 @@
453
  yyBtns.classList.remove('hidden');
454
  btn.classList.add('hidden');
455
 
456
- const vocCnt = myVocMistakes.length || simulatedMistakeCount;
457
- const engCnt = myEngMistakes.length || simulatedMistakeCount;
458
- const dualCnt = (myVocMistakes.length + myEngMistakes.length) || simulatedMistakeCount;
459
-
460
- if ($('metaStartYang')) {
461
- $('metaStartYang').textContent = wbStatus.yangSealed
462
- ? '⛓️ 陽軀已鎮壓鎖定'
463
- : `個人錯題 ${vocCnt} 題(${calcChargeBonus(vocCnt, 'yang')})`;
464
- }
465
- if ($('metaStartYin')) {
466
- $('metaStartYin').textContent = wbStatus.yinSealed
467
- ? '⛓️ 陰軀已鎮壓鎖定'
468
- : `個人錯題 ${engCnt} 題(${calcChargeBonus(engCnt, 'yin')})`;
469
- }
470
- if ($('metaStartDual')) {
471
- $('metaStartDual').textContent = isDefeated
472
- ? '🏆 陰陽雙軀已封印'
473
- : `雙科錯題 ${dualCnt} 題(${calcChargeBonus(dualCnt, 'dual')})`;
474
- }
475
 
476
  if (wbStatus.isCountdown) {
477
  const cdMsg = `⏳ ${formatOpenAt(wbStatus.openAt)} 開打(剩 ${formatCountdown(wbStatus.countdownMs)})`;
478
- if ($('metaStartYang')) $('metaStartYang').textContent = cdMsg;
479
- if ($('metaStartYin')) $('metaStartYin').textContent = cdMsg;
480
- if ($('metaStartDual')) $('metaStartDual').textContent = cdMsg;
 
 
 
 
481
  }
482
  const canFight = !isDefeated && !wbStatus.isCountdown && wbStatus.isUnlockedDate && ordersLeft > 0 && !!currentUser;
483
  if ($('btnStartYang')) $('btnStartYang').disabled = !canFight;
@@ -595,7 +584,7 @@
595
  pushFormatted(q, isEng ? '❄️ 陰軀・西域單字策題' : `🔥 陽軀・${bankName || '學科策題'}`);
596
  }
597
 
598
- const leftover = [...myPool, ...peerPool, ...bankPool].map(q => ({
599
  id: q.id || (activeBank + '_' + (q.n || q.word || '')),
600
  n: q.n,
601
  q: q.q,
@@ -603,11 +592,15 @@
603
  a: q.a,
604
  bank: activeBank,
605
  side: side,
606
- tag: isEng ? '❄️ 夷語集氣試煉' : '🔥 技藝集氣試煉',
607
  isCharge: true
608
- }));
 
 
 
 
609
 
610
- return { picked, leftover };
611
  }
612
 
613
  // ==========================================
@@ -700,7 +693,12 @@
700
  if (iList.length > 0) combatQuestions.push(iList.shift());
701
  if (yList.length > 0) combatQuestions.push(yList.shift());
702
  }
703
- chargePool = shuffle([...yangRes.leftover, ...yinRes.leftover]);
 
 
 
 
 
704
  mistakeCount = (myVocMistakes.length + myEngMistakes.length) || simulatedMistakeCount;
705
  }
706
  } else {
@@ -763,11 +761,13 @@
763
  }
764
 
765
  const critRate = calcCritRate(hasChargeBuff, chargeBuffStacks);
 
 
766
  const crit = $('qCrit');
767
  crit.textContent = hasChargeBuff
768
- ? `⚡ 集氣蓄力中!暴擊率 ${Math.round(critRate * 100)}%`
769
- : `暴擊率 ${Math.round(critRate * 100)}%`;
770
- crit.classList.toggle('buff', hasChargeBuff);
771
 
772
  $('qStem').innerHTML =
773
  (q.isCharge ? '<span class="charge-tag">【⚡集氣】</span>' : '') +
@@ -820,14 +820,9 @@
820
  const critRate = calcCritRate(hasChargeBuff, chargeBuffStacks);
821
  const isCrit = Math.random() < critRate;
822
 
823
- // 基礎傷害與暴擊傷害(支援西域商隊珍寶加成)
824
- let dmg = 1;
825
- if (isCrit) {
826
- dmg = 2 + (currentStudent?.game?.merchantBuffs?.bossCritFlat || 0);
827
- if (currentStudent?.game?.merchantBuffs?.bossCritDmg) {
828
- dmg = Math.round(dmg * (1 + currentStudent.game.merchantBuffs.bossCritDmg));
829
- }
830
- }
831
  const side = q.side === 'yin' ? 'yin' : 'yang';
832
  if (side === 'yin') {
833
  currentYinDamage += dmg;
@@ -1118,7 +1113,10 @@
1118
 
1119
  try {
1120
  const isKiller = !!(worldBossData.killer?.uid && currentUser?.uid && worldBossData.killer.uid === currentUser.uid);
1121
- const rew = calcWorldBossRewards(currentStudent.progress, currentStudent.game, currentClass, isKiller);
 
 
 
1122
  const cfg = getCurBossCfg();
1123
 
1124
  grantGrain(currentStudent.game, rew.coins);
@@ -1135,9 +1133,7 @@
1135
  if (isKiller && cfg.titles?.killer && !currentStudent.game.titles.includes(cfg.titles.killer)) {
1136
  currentStudent.game.titles.push(cfg.titles.killer);
1137
  }
1138
- const damagesObj = worldBossData?.damages || {};
1139
- const ranking = Object.entries(damagesObj).map(([uid, r]) => ({ uid, dmg: Number(r?.dmg) || 0 })).filter(x => x.dmg > 0).sort((a, b) => b.dmg - a.dmg);
1140
- const isMvp = ranking[0]?.uid === currentUser?.uid;
1141
  if (isMvp && cfg.titles?.mvp && !currentStudent.game.titles.includes(cfg.titles.mvp)) {
1142
  currentStudent.game.titles.push(cfg.titles.mvp);
1143
  }
@@ -1154,7 +1150,7 @@
1154
  });
1155
  }
1156
 
1157
- alert(`🎉 恭喜成功領取【${rew.tierLabel}】神獸寶庫!\n🌾 糧草 +${rew.coins.toLocaleString()}(${rew.grainHours}小時產量包)\n🧧 兵符 +${rew.totalBp}${isKiller ? `(含尾刀加碼 +${rew.killerBonusBp})` : ''}\n📜 偷看卷 ×${rew.peekCount}、刪去卷 ×${rew.eliminateCount}\n🏅 獲得榮譽稱號【${cfg.titles.participant}】${isKiller ? ` 及【${cfg.titles.killer}】` : ''}!`);
1158
  renderIntro();
1159
  } catch (e) {
1160
  console.error('領取失敗', e);
 
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=20261107_v1';
13
  import { loadEnglishWords, buildWordQuestion } from './merchant.js?v=20261107_v1';
14
  import { todayStr, fmt, shuffle, renderRichQuizText } from './util.js?v=20261107_v1';
 
42
  if (introTitle) introTitle.textContent = cfg.name;
43
  const introSub = $('introBossSubtitle');
44
  if (introSub) {
45
+ introSub.classList.add('hidden');
46
+ introSub.style.display = 'none';
 
47
  }
48
  const introDesc = $('introBossDesc');
49
  if (introDesc) introDesc.textContent = cfg.loreSummary;
 
155
  function calcCritRate(isCharge, stacks = chargeBuffStacks) {
156
  const effStacks = isCharge ? Math.max(1, stacks || 1) : 0;
157
  const base = effStacks >= 2 ? 0.65 : (effStacks === 1 ? 0.40 : 0.15);
158
+ const wp = getBossWeaponBuffs(currentStudent?.game);
159
+ return Math.min(1.0, base + (wp.critRateBonus || 0));
160
  }
161
 
162
  // 同時載入【技藝班專業題庫(陽軀)】與【西域英文單字題庫(陰軀)】與全班錯題池
 
169
  bankName = myBankId;
170
  }
171
 
172
+ // 1. 先平行載入學生本人的技藝題庫與英文單字題庫,建立「本科標準題目白名單 (validVocQSet)」,徹底阻絕跨科目舊錯題污染
173
+ const [vocRes, engRes] = await Promise.allSettled([
174
+ loadBank(myBankId),
175
+ loadEnglishWords()
176
+ ]);
177
+
178
+ if (vocRes.status === 'fulfilled' && vocRes.value && Array.isArray(vocRes.value.questions)) {
179
+ vocBankQuestions = vocRes.value.questions.map(q => ({ ...q, bank: myBankId }));
180
+ }
181
+ if (engRes.status === 'fulfilled' && Array.isArray(engRes.value) && engRes.value.length > 0) {
182
+ const englishWords = engRes.value;
183
+ engBankQuestions = englishWords.map(w => {
184
+ const bq = buildWordQuestion(w, englishWords);
185
+ return {
186
+ q: `請問英文單字【${bq.word}】${bq.pos ? `(${bq.pos})` : ''} 的意思是?`,
187
+ o: bq.options.map(o => o.text),
188
+ a: bq.correctAns,
189
+ bank: 'english',
190
+ tag: '西域單字策題'
191
+ };
192
+ });
193
+ }
194
+
195
+ const validVocQSet = new Set(vocBankQuestions.map(q => q.q));
196
+ const isSameSubjectVocMistake = (m) => {
197
+ if (!m || m.bank === 'english') return false;
198
+ if (m.bank && m.bank !== myBankId && m.bank !== 'default') return false;
199
+ // 若本科題庫已載入,強制核對題幹必須存在於本科標準題庫中(防止轉科或測試帳號殘留之異科錯題混入)
200
+ if (validVocQSet.size > 0 && !validVocQSet.has(m.q)) return false;
201
+ return true;
202
+ };
203
+
204
+ // 2. 個人錯題分流(統一依「累計答對 < 3 次」判定為未精熟,且嚴格核對屬於本人科目)
205
  const isUnmastered = (m) => m && (Number(m.reviewCorrectCount) || 0) < 3 && m.q && Array.isArray(m.o);
206
  const allMyMistakes = Object.values(currentStudent?.game?.mistakes || {}).filter(isUnmastered);
207
 
208
  myVocMistakes = allMyMistakes
209
+ .filter(isSameSubjectVocMistake)
210
  .map(m => ({ ...m, bank: myBankId, mastered: false }));
211
 
212
  myEngMistakes = allMyMistakes
213
  .filter(m => m.bank === 'english')
214
  .map(m => ({ ...m, bank: 'english', mastered: false }));
215
 
216
+ // 3. 全班同袍錯題分流(排除教師與 20 號測試員,且技藝錯題嚴格限定同科目 + 通過本科標準題庫白名單驗證)
217
  peerVocMistakes = [];
218
  peerEngMistakes = [];
219
  try {
 
235
  classVocCounts.push(sVocCnt);
236
  classEngCounts.push(sEngCnt);
237
  classDualCounts.push(sVocCnt + sEngCnt);
238
+
239
+ if (s.uid !== currentUser?.uid) {
240
+ for (const sm of sActive) {
241
+ if (sm.bank === 'english') {
242
+ if (!myEngQSet.has(sm.q) && !seenEngQ.has(sm.q)) {
243
+ seenEngQ.add(sm.q);
244
+ peerEngMistakes.push({ ...sm, bank: 'english', mastered: false, donorName: s.name || `座號${s.seat}` });
245
+ }
246
+ } else if (s.bankId === myBankId && isSameSubjectVocMistake(sm)) {
247
+ if (!myVocQSet.has(sm.q) && !seenVocQ.has(sm.q)) {
248
+ seenVocQ.add(sm.q);
249
+ peerVocMistakes.push({ ...sm, bank: myBankId, mastered: false, donorName: s.name || `座號${s.seat}` });
250
+ }
251
  }
252
  }
253
  }
 
264
  console.warn('[boss] 載入同袍錯題失敗', err);
265
  }
266
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
267
  // 向下相容舊版單一題庫變數
268
  const effClass = { ...(currentClass || {}), worldBoss: worldBossData || currentClass?.worldBoss };
269
  const dailyTheme = getBossDailyQuestionTheme(effClass, todayStr());
 
312
  const yangPct = yangMax > 0 ? Math.max(0, Math.min(100, (yangHp / yangMax) * 100)) : 0;
313
  const yinPct = yinMax > 0 ? Math.max(0, Math.min(100, (yinHp / yinMax) * 100)) : 0;
314
 
315
+ if ($('introYangHpText')) $('introYangHpText').textContent = yangHp <= 0 ? `⛓️ 已鎮壓 (0 / ${yangMax})` : `${yangHp} / ${yangMax} HP`;
316
  if ($('introYangHpBar')) $('introYangHpBar').style.width = `${yangPct}%`;
317
  if ($('introYangCard')) $('introYangCard').classList.toggle('sealed', yangHp <= 0);
 
 
 
 
 
318
 
319
+ if ($('introYinHpText')) $('introYinHpText').textContent = yinHp <= 0 ? `⛓️ 已鎮壓 (0 / ${yinMax})` : `${yinHp} / ${yinMax} HP`;
320
  if ($('introYinHpBar')) $('introYinHpBar').style.width = `${yinPct}%`;
321
  if ($('introYinCard')) $('introYinCard').classList.toggle('sealed', yinHp <= 0);
 
 
 
 
 
322
  } else {
323
  yyBox.classList.add('hidden');
324
  }
325
  }
326
 
 
 
327
  const themeEl = $('introDailyTheme');
328
  if (themeEl) {
329
+ themeEl.classList.add('hidden');
330
+ themeEl.style.display = 'none';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
331
  }
332
 
333
  // 累計個人傷害
 
346
  qual.classList.remove('ok');
347
  }
348
 
349
+ // 顯示討伐成功獎勵(固定兵符 ×6,MVP/最後一擊 +3 共 9 枚)
350
+ const damagesMap = worldBossData?.damages || {};
351
+ const sortedRanks = Object.entries(damagesMap).map(([uid, r]) => ({ uid, dmg: Number(r?.dmg) || 0 })).filter(x => x.dmg > 0).sort((a, b) => b.dmg - a.dmg);
352
+ const isMvpMe = !!(currentUser?.uid && sortedRanks[0]?.uid === currentUser.uid);
353
  const isKillerMe = !!(worldBossData?.killer?.uid && currentUser?.uid && worldBossData.killer.uid === currentUser.uid);
354
+ const rew = calcWorldBossRewards(currentStudent?.progress, currentStudent?.game, currentClass, isKillerMe || isMvpMe);
355
  const cfg = getCurBossCfg();
356
  if ($('rewardTierTag')) {
357
+ $('rewardTierTag').textContent = '全班合力封印・達標全員發放';
 
 
358
  }
359
  if ($('rewardGrainTitle')) $('rewardGrainTitle').textContent = `1 小時產量包 ×${rew.grainHours}`;
360
  if ($('rewardGrainSub')) {
361
  $('rewardGrainSub').textContent = currentStudent
362
  ? `預估可得 +${rew.coins.toLocaleString()} 糧草`
363
+ : `依個人當下產能補給 ${rew.grainHours} 小時糧草`;
364
  }
365
  if ($('rewardBpTitle')) $('rewardBpTitle').textContent = `兵符 ×${rew.baseBp}`;
366
  if ($('rewardBpSub')) {
367
+ $('rewardBpSub').textContent = `全班成功封印全員發放 ${rew.baseBp} 枚兵符`;
 
 
368
  }
369
  if ($('rewardScrollTitle')) $('rewardScrollTitle').textContent = `錦囊包 ×${rew.peekCount}`;
370
  if ($('rewardScrollSub')) $('rewardScrollSub').textContent = `偷看卷 ×${rew.peekCount} + 刪去卷 ×${rew.eliminateCount}`;
 
417
  if ($('introOrdersCount')) {
418
  $('introOrdersCount').textContent = `${ordersLeft} / ${maxOrders}`;
419
  }
420
+ if ($('introMistakeBuffHint')) {
421
+ const wp = getBossWeaponBuffs(currentStudent?.game);
422
+ const baseCritPct = Math.round((0.15 + wp.critRateBonus) * 100);
423
+ $('introMistakeBuffHint').innerHTML = wp.hasAnyWeapon
424
+ ? `⚔️ 已裝備神兵:<b style="color:#4ade80;">${wp.summaryText}</b>(基礎暴擊 ${baseCritPct}%・暴擊傷害 ${wp.critDamage} HP)`
425
+ : '⚔️ 普通命中扣 1 HP・暴擊扣 2 HP(錯題答對滿 3 次即精熟移出)';
426
+ }
427
 
428
+ const cdBanner = $('introCountdownBanner');
429
+ if (cdBanner) {
430
+ if (wbStatus.isCountdown) {
431
+ cdBanner.classList.remove('hidden');
432
+ if ($('introCountdownOpenAt')) {
433
+ $('introCountdownOpenAt').textContent = `${formatOpenAt(wbStatus.openAt)} 準時破印開打`;
434
+ }
435
+ if ($('introCountdownTimer')) {
436
+ $('introCountdownTimer').textContent = `剩餘 ${formatCountdown(wbStatus.countdownMs)}`;
437
+ }
438
+ } else {
439
+ cdBanner.classList.add('hidden');
440
+ }
441
+ }
442
 
443
  const yyBtns = $('introYinYangBtns');
444
  const btn = $('btnStart');
 
446
  yyBtns.classList.remove('hidden');
447
  btn.classList.add('hidden');
448
 
449
+ const setMetaBadge = (elId, text) => {
450
+ const el = $(elId);
451
+ if (!el) return;
452
+ if (text) {
453
+ el.textContent = text;
454
+ el.classList.remove('hidden');
455
+ } else {
456
+ el.textContent = '';
457
+ el.classList.add('hidden');
458
+ }
459
+ };
 
 
 
 
 
 
 
 
460
 
461
  if (wbStatus.isCountdown) {
462
  const cdMsg = `⏳ ${formatOpenAt(wbStatus.openAt)} 開打(剩 ${formatCountdown(wbStatus.countdownMs)})`;
463
+ setMetaBadge('metaStartYang', cdMsg);
464
+ setMetaBadge('metaStartYin', cdMsg);
465
+ setMetaBadge('metaStartDual', cdMsg);
466
+ } else {
467
+ setMetaBadge('metaStartYang', wbStatus.yangSealed ? '⛓️ 陽軀已鎮壓鎖定' : '');
468
+ setMetaBadge('metaStartYin', wbStatus.yinSealed ? '⛓️ 陰軀已鎮壓鎖定' : '');
469
+ setMetaBadge('metaStartDual', isDefeated ? '🏆 陰陽雙軀已封印' : '');
470
  }
471
  const canFight = !isDefeated && !wbStatus.isCountdown && wbStatus.isUnlockedDate && ordersLeft > 0 && !!currentUser;
472
  if ($('btnStartYang')) $('btnStartYang').disabled = !canFight;
 
584
  pushFormatted(q, isEng ? '❄️ 陰軀・西域單字策題' : `🔥 陽軀・${bankName || '學科策題'}`);
585
  }
586
 
587
+ const formatChargeItem = (q, srcLabel) => ({
588
  id: q.id || (activeBank + '_' + (q.n || q.word || '')),
589
  n: q.n,
590
  q: q.q,
 
592
  a: q.a,
593
  bank: activeBank,
594
  side: side,
595
+ tag: isEng ? `❄️ 夷語集氣・${srcLabel}` : `🔥 技藝集氣・${srcLabel}`,
596
  isCharge: true
597
+ });
598
+ const leftoverMy = myPool.map(q => formatChargeItem(q, '個人弱點'));
599
+ const leftoverPeer = peerPool.map(q => formatChargeItem(q, '同袍支援'));
600
+ const leftoverBank = bankPool.map(q => formatChargeItem(q, '題庫策題'));
601
+ const leftover = [...leftoverMy, ...leftoverPeer, ...leftoverBank];
602
 
603
+ return { picked, leftover, leftoverMy, leftoverPeer, leftoverBank };
604
  }
605
 
606
  // ==========================================
 
693
  if (iList.length > 0) combatQuestions.push(iList.shift());
694
  if (yList.length > 0) combatQuestions.push(yList.shift());
695
  }
696
+ // 集氣試煉題池同樣嚴格遵守:個人未出完錯題 -> 同科目同袍錯題 -> 題庫,絕不在個人錯題未出完前混入他人或題庫題目
697
+ chargePool = [
698
+ ...shuffle([...(yangRes.leftoverMy || []), ...(yinRes.leftoverMy || [])]),
699
+ ...shuffle([...(yangRes.leftoverPeer || []), ...(yinRes.leftoverPeer || [])]),
700
+ ...shuffle([...(yangRes.leftoverBank || []), ...(yinRes.leftoverBank || [])]),
701
+ ];
702
  mistakeCount = (myVocMistakes.length + myEngMistakes.length) || simulatedMistakeCount;
703
  }
704
  } else {
 
761
  }
762
 
763
  const critRate = calcCritRate(hasChargeBuff, chargeBuffStacks);
764
+ const wp = getBossWeaponBuffs(currentStudent?.game);
765
+ const wpSuffix = wp.hasAnyWeapon ? `(含${wp.summaryText})` : '';
766
  const crit = $('qCrit');
767
  crit.textContent = hasChargeBuff
768
+ ? `⚡ 集氣蓄力中!暴擊率 ${Math.round(critRate * 100)}%${wpSuffix}`
769
+ : `暴擊率 ${Math.round(critRate * 100)}%${wpSuffix}`;
770
+ crit.classList.toggle('buff', hasChargeBuff || wp.critRateBonus > 0);
771
 
772
  $('qStem').innerHTML =
773
  (q.isCharge ? '<span class="charge-tag">【⚡集氣】</span>' : '') +
 
820
  const critRate = calcCritRate(hasChargeBuff, chargeBuffStacks);
821
  const isCrit = Math.random() < critRate;
822
 
823
+ // 基礎傷害 1 HP,暴擊基礎 2 HP(支援西域商隊神兵:烏茲神鋼提升暴擊率、破甲重弩+1暴傷、突騎破陣弓+50%暴傷)
824
+ const wp = getBossWeaponBuffs(currentStudent?.game);
825
+ const dmg = isCrit ? wp.critDamage : 1;
 
 
 
 
 
826
  const side = q.side === 'yin' ? 'yin' : 'yang';
827
  if (side === 'yin') {
828
  currentYinDamage += dmg;
 
1113
 
1114
  try {
1115
  const isKiller = !!(worldBossData.killer?.uid && currentUser?.uid && worldBossData.killer.uid === currentUser.uid);
1116
+ const damagesObj = worldBossData?.damages || {};
1117
+ const ranking = Object.entries(damagesObj).map(([uid, r]) => ({ uid, dmg: Number(r?.dmg) || 0 })).filter(x => x.dmg > 0).sort((a, b) => b.dmg - a.dmg);
1118
+ const isMvp = !!(currentUser?.uid && ranking[0]?.uid === currentUser.uid);
1119
+ const rew = calcWorldBossRewards(currentStudent.progress, currentStudent.game, currentClass, isKiller || isMvp);
1120
  const cfg = getCurBossCfg();
1121
 
1122
  grantGrain(currentStudent.game, rew.coins);
 
1133
  if (isKiller && cfg.titles?.killer && !currentStudent.game.titles.includes(cfg.titles.killer)) {
1134
  currentStudent.game.titles.push(cfg.titles.killer);
1135
  }
1136
+
 
 
1137
  if (isMvp && cfg.titles?.mvp && !currentStudent.game.titles.includes(cfg.titles.mvp)) {
1138
  currentStudent.game.titles.push(cfg.titles.mvp);
1139
  }
 
1150
  });
1151
  }
1152
 
1153
+ alert(`🎉 恭喜成功領取神獸寶庫!\n🌾 糧草 +${rew.coins.toLocaleString()}(${rew.grainHours}小時產量包)\n🧧 兵符 +${rew.totalBp}${(isKiller || isMvp) ? `(含 MVP/尾刀加碼 +${rew.killerBonusBp})` : ''}\n📜 偷看卷 ×${rew.peekCount}、刪去卷 ×${rew.eliminateCount}\n🏅 獲得榮譽稱號【${cfg.titles.participant}】${isMvp ? ` 及【${cfg.titles.mvp}】` : ''}${isKiller ? ` 及【${cfg.titles.killer}】` : ''}!`);
1154
  renderIntro();
1155
  } catch (e) {
1156
  console.error('領取失敗', e);
js/engine.js CHANGED
@@ -246,6 +246,18 @@ export function normalizeGame(g) {
246
  buys: (m.buys && typeof m.buys === 'object') ? m.buys : {},
247
  };
248
  out.merchantBuffs = (g.merchantBuffs && typeof g.merchantBuffs === 'object') ? { ...g.merchantBuffs } : {};
 
 
 
 
 
 
 
 
 
 
 
 
249
  out.titles = Array.isArray(g.titles) ? [...g.titles] : [];
250
  out.curTitle = g.curTitle || (out.titles.length > 0 ? out.titles[out.titles.length - 1] : null);
251
  out.hasDragonFrame = !!g.hasDragonFrame;
@@ -258,6 +270,39 @@ export function normalizeGame(g) {
258
  return out;
259
  }
260
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
261
  // 取得天機閣今日狀態 (0/1 或 1/1)
262
  export function getTianjiStatus(game, today = todayStr()) {
263
  const isToday = game?.tianjiDate === today;
@@ -834,31 +879,12 @@ export function calcWorldBossRewards(progress, game, classInfo, isKiller = false
834
  const chapters = d.chaptersPassed || 0;
835
  const curProd = Math.max(100, totalProd(safeGame, d));
836
 
837
- let baseBp = 2;
838
- let killerBonusBp = 2;
839
- let grainHours = 2;
840
- let scrollsEach = 1;
841
- let tierLabel = '初階開拓期';
842
-
843
- if (units >= 12 || chapters >= 1) {
844
- baseBp = chapters >= 1 ? 10 : 8;
845
- killerBonusBp = 4;
846
- grainHours = 8;
847
- scrollsEach = 3;
848
- tierLabel = chapters >= 1 ? '王畿決戰期' : '高階霸業期';
849
- } else if (units >= 7) {
850
- baseBp = 6;
851
- killerBonusBp = 3;
852
- grainHours = 6;
853
- scrollsEach = 2;
854
- tierLabel = '中後階爭霸期';
855
- } else if (units >= 4) {
856
- baseBp = 4;
857
- killerBonusBp = 2;
858
- grainHours = 4;
859
- scrollsEach = 2;
860
- tierLabel = '中階拓土期';
861
- }
862
 
863
  const totalBp = baseBp + (isKiller ? killerBonusBp : 0);
864
  const coins = Math.max(2000, Math.round(curProd * 3600 * grainHours));
 
246
  buys: (m.buys && typeof m.buys === 'object') ? m.buys : {},
247
  };
248
  out.merchantBuffs = (g.merchantBuffs && typeof g.merchantBuffs === 'object') ? { ...g.merchantBuffs } : {};
249
+ // ⚔️ 西域商隊討伐神兵(烏茲神鋼/突騎破陣弓/大漠破甲重弩)自動對帳與校準,確保購買紀錄 100% 轉化為世界 Boss 暴擊增益
250
+ const buys = out.merchant.buys || {};
251
+ const uzCount = Math.min(3, Math.max(0, Number(buys.uzSteel) || 0));
252
+ if (uzCount > 0) {
253
+ out.merchantBuffs.bossCritRate = Math.max(Number(out.merchantBuffs.bossCritRate) || 0, Math.round(uzCount * 0.05 * 100) / 100);
254
+ }
255
+ if ((Number(buys.bow) || 0) > 0) {
256
+ out.merchantBuffs.bossCritDmg = Math.max(Number(out.merchantBuffs.bossCritDmg) || 0, 0.5);
257
+ }
258
+ if ((Number(buys.crossbow) || 0) > 0) {
259
+ out.merchantBuffs.bossCritFlat = Math.max(Number(out.merchantBuffs.bossCritFlat) || 0, 1);
260
+ }
261
  out.titles = Array.isArray(g.titles) ? [...g.titles] : [];
262
  out.curTitle = g.curTitle || (out.titles.length > 0 ? out.titles[out.titles.length - 1] : null);
263
  out.hasDragonFrame = !!g.hasDragonFrame;
 
270
  return out;
271
  }
272
 
273
+ /**
274
+ * 取得學生在西域商隊購買之世界 Boss 討伐神兵加成明細
275
+ * 同時檢查 game.merchantBuffs 與 game.merchant.buys,確保舊存檔或即時購買皆 100% 生效
276
+ */
277
+ export function getBossWeaponBuffs(game) {
278
+ const g = game || {};
279
+ const buffs = g.merchantBuffs || {};
280
+ const buys = g.merchant?.buys || {};
281
+ const uzCountFromBuys = Math.min(3, Math.max(0, Number(buys.uzSteel) || 0));
282
+ const critRateBonus = Math.min(0.5, Math.max(Number(buffs.bossCritRate) || 0, Math.round(uzCountFromBuys * 0.05 * 100) / 100));
283
+ const uzCount = Math.max(uzCountFromBuys, Math.round(critRateBonus / 0.05));
284
+ const hasBow = (Number(buys.bow) || 0) > 0 || (Number(buffs.bossCritDmg) || 0) > 0;
285
+ const critDmgBonus = hasBow ? Math.max(Number(buffs.bossCritDmg) || 0, 0.5) : 0;
286
+ const hasCrossbow = (Number(buys.crossbow) || 0) > 0 || (Number(buffs.bossCritFlat) || 0) > 0;
287
+ const critFlatBonus = hasCrossbow ? Math.max(Number(buffs.bossCritFlat) || 0, 1) : 0;
288
+ const critDamage = Math.round((2 + critFlatBonus) * (1 + critDmgBonus));
289
+ const tags = [];
290
+ if (critRateBonus > 0) tags.push(`⚔️烏茲神鋼+${Math.round(critRateBonus * 100)}%暴擊`);
291
+ if (hasCrossbow) tags.push(`🎯重弩+${critFlatBonus}暴傷`);
292
+ if (hasBow) tags.push(`🏹破陣弓+${Math.round(critDmgBonus * 100)}%暴傷`);
293
+ return {
294
+ uzCount,
295
+ hasBow,
296
+ hasCrossbow,
297
+ critRateBonus,
298
+ critDmgBonus,
299
+ critFlatBonus,
300
+ critDamage,
301
+ hasAnyWeapon: tags.length > 0,
302
+ summaryText: tags.join('・')
303
+ };
304
+ }
305
+
306
  // 取得天機閣今日狀態 (0/1 或 1/1)
307
  export function getTianjiStatus(game, today = todayStr()) {
308
  const isToday = game?.tianjiDate === today;
 
879
  const chapters = d.chaptersPassed || 0;
880
  const curProd = Math.max(100, totalProd(safeGame, d));
881
 
882
+ // 當前班級進度已達第 8 單元,全服統一發放固定 6 枚兵符,MVP/最後一擊額外加碼 +3 枚(共 9 枚)
883
+ const baseBp = 6;
884
+ const killerBonusBp = 3;
885
+ const grainHours = 6;
886
+ const scrollsEach = 2;
887
+ const tierLabel = '中後階爭霸期';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
888
 
889
  const totalBp = baseBp + (isKiller ? killerBonusBp : 0);
890
  const coins = Math.max(2000, Math.round(curProd * 3600 * grainHours));
js/game.js CHANGED
@@ -1229,7 +1229,7 @@ function renderBuild() {
1229
  era2ActionBtn = `<span class="badge" style="background:linear-gradient(135deg, #f59e0b, #d97706); color:#fff; font-weight:800; padding:6px 10px; border-radius:6px; box-shadow:0 2px 8px rgba(245,158,11,0.3);">🌟 第二紀元・基底重鑄</span>`;
1230
  } else if (b10Built || st.star >= 5) {
1231
  era2ActionBtn = `
1232
- <button class="btn btn-era2 ${era2Info.canUpgrade ? 'pulse' : ''}" data-bid="${b.id}" ${era2Info.canUpgrade ? '' : 'disabled'} title="${esc(era2Info.lockReason)}">
1233
  <span>${era2Info.canUpgrade ? `✨ 昇華【${era2Info.era2Name}】` : `🔒 飛升:${era2Info.era2Name}`}</span>
1234
  <small class="num"><img src="assets/icon_tally.jpg" class="res-mini-icon" alt="兵符">${ERA2_TALLY_COST}</small>
1235
  </button>
@@ -1346,12 +1346,21 @@ function renderBuild() {
1346
  // 第二紀元昇華綁定
1347
  $$('.btn-era2').forEach(btn => bind(btn, 'click', () => {
1348
  const ps = checkConstructionStatus(classInfo);
1349
- if (!ps.allowed) return toast(ps.reason, 'warn', 4500);
1350
 
1351
  const id = btn.dataset.bid;
1352
  const bDef = BUILDINGS.find(x => x.id === id);
1353
  if (!bDef) return;
1354
 
 
 
 
 
 
 
 
 
 
1355
  const res = evolveTownToEra2(bDef.id, game, progress);
1356
  if (res.ok) {
1357
  toast(`✨ 九州同慶!【${bDef.name}】基底重鑄昇華為第二紀元【${res.townName}】!秒產核爆躍升,王者歸來!`, 'success', 6000);
@@ -1404,10 +1413,17 @@ function updateBuildBtns() {
1404
  const id = btn.dataset.bid;
1405
  if (!id) return;
1406
  const info = getEra2UpgradeInfo(id, game, progress);
1407
- const dis = !ps.allowed || !info.canUpgrade;
1408
- if (btn.disabled !== dis) btn.disabled = dis;
1409
  btn.setAttribute('title', ps.allowed ? (info.lockReason || '') : ps.reason);
1410
  });
 
 
 
 
 
 
 
1411
 
1412
  // 即時更新地圖內置戰略面板按鈕狀態
1413
  const inMapLv = $('#btnInMapLvup');
 
1229
  era2ActionBtn = `<span class="badge" style="background:linear-gradient(135deg, #f59e0b, #d97706); color:#fff; font-weight:800; padding:6px 10px; border-radius:6px; box-shadow:0 2px 8px rgba(245,158,11,0.3);">🌟 第二紀元・基底重鑄</span>`;
1230
  } else if (b10Built || st.star >= 5) {
1231
  era2ActionBtn = `
1232
+ <button type="button" class="btn btn-era2 ${era2Info.canUpgrade ? 'pulse' : 'locked-action'}" data-bid="${b.id}" title="${esc(era2Info.lockReason)}">
1233
  <span>${era2Info.canUpgrade ? `✨ 昇華【${era2Info.era2Name}】` : `🔒 飛升:${era2Info.era2Name}`}</span>
1234
  <small class="num"><img src="assets/icon_tally.jpg" class="res-mini-icon" alt="兵符">${ERA2_TALLY_COST}</small>
1235
  </button>
 
1346
  // 第二紀元昇華綁定
1347
  $$('.btn-era2').forEach(btn => bind(btn, 'click', () => {
1348
  const ps = checkConstructionStatus(classInfo);
1349
+ if (!ps.allowed) return toast(`🌙 課後休整管制中:${ps.reason}`, 'warn', 4500);
1350
 
1351
  const id = btn.dataset.bid;
1352
  const bDef = BUILDINGS.find(x => x.id === id);
1353
  if (!bDef) return;
1354
 
1355
+ const info = getEra2UpgradeInfo(bDef.id, game, progress);
1356
+ if (!info.canUpgrade) {
1357
+ toast(`🔒 尚未達成飛升條件:${info.lockReason}`, 'info', 4000);
1358
+ if (!info.isUnlocked && typeof showEra2IntroModal === 'function') {
1359
+ showEra2IntroModal();
1360
+ }
1361
+ return;
1362
+ }
1363
+
1364
  const res = evolveTownToEra2(bDef.id, game, progress);
1365
  if (res.ok) {
1366
  toast(`✨ 九州同慶!【${bDef.name}】基底重鑄昇華為第二紀元【${res.townName}】!秒產核爆躍升,王者歸來!`, 'success', 6000);
 
1413
  const id = btn.dataset.bid;
1414
  if (!id) return;
1415
  const info = getEra2UpgradeInfo(id, game, progress);
1416
+ btn.classList.toggle('btn-paused', !ps.allowed);
1417
+ btn.classList.toggle('locked-action', !info.canUpgrade);
1418
  btn.setAttribute('title', ps.allowed ? (info.lockReason || '') : ps.reason);
1419
  });
1420
+ const inMapEra2 = $('#btnInMapEra2');
1421
+ if (inMapEra2 && inMapEra2.dataset.bid) {
1422
+ const info = getEra2UpgradeInfo(inMapEra2.dataset.bid, game, progress);
1423
+ inMapEra2.classList.toggle('btn-paused', !ps.allowed);
1424
+ inMapEra2.classList.toggle('locked-action', !info.canUpgrade);
1425
+ inMapEra2.classList.toggle('pulse', ps.allowed && info.canUpgrade);
1426
+ }
1427
 
1428
  // 即時更新地圖內置戰略面板按鈕狀態
1429
  const inMapLv = $('#btnInMapLvup');
js/map.js CHANGED
@@ -461,7 +461,7 @@ export function openWorldBossModal() {
461
  return;
462
  }
463
 
464
- if (!status.unlocked) {
465
  // 尚未破印(或處於預告剪影模式):展示神秘剪影情報與戰備預告(比照饕餮預告方式)
466
  const annId = bossCfg.id === 'qiongqi' ? 'update_20261105_qiongqi' : 'update_20261027_worldboss';
467
  const contentHtml = `
@@ -502,13 +502,13 @@ export function openWorldBossModal() {
502
  </div>
503
 
504
  <div style="background:var(--bg-2); border:1px solid var(--line); border-radius:12px; padding:12px 14px; margin-bottom:14px;">
505
- <div style="font-weight:800; color:#38bdf8; margin-bottom:6px; font-size:13px;">🎁 討伐成功獎勵(依個人進度【${rew.tierLabel}】動態提升):</div>
506
  <div style="display:grid; grid-template-columns:1fr 1fr; gap:8px; font-size:12px;">
507
  <div style="padding:6px 10px; background:var(--bg-1); border-radius:8px; border:1px solid var(--line);">
508
  🌾 <b>全軍糧草產量 ${rew.grainHours} 小時包</b>
509
  </div>
510
  <div style="padding:6px 10px; background:var(--bg-1); border-radius:8px; border:1px solid var(--line);">
511
- 🧧 <b>兵符 ×${rew.baseBp}(尾刀額外 +${rew.killerBonusBp})</b>
512
  </div>
513
  <div style="padding:6px 10px; background:var(--bg-1); border-radius:8px; border:1px solid var(--line);">
514
  📜 <b>錦囊包(偷看卷×${rew.peekCount}、刪去卷×${rew.eliminateCount})</b>
@@ -588,11 +588,18 @@ export function renderInMapTownPanel() {
588
  panel.style.left = 'auto';
589
  }
590
 
591
- if (isBottomHalf) {
 
 
 
 
 
 
 
592
  // 偏下方城池(如柴桑水寨、百草藥谷、平原稻鄉):面板往上提,確保按鈕與所有內容不被地圖底緣遮擋
593
- panel.style.top = `clamp(4%, calc(${py}% - 140px), 42%)`;
594
  } else {
595
- panel.style.top = `clamp(4%, calc(${py}% - 30px), 48%)`;
596
  }
597
  panel.style.bottom = 'auto';
598
 
@@ -759,8 +766,8 @@ export function renderInMapTownPanel() {
759
  ? '★5 滿星已達標!消耗 25 兵符即可完成昇華,基底時代重鑄並更換第二紀元傳世手辦!'
760
  : `飛升前置:${era2Info.lockReason}`}
761
  </div>
762
- <button class="btn btn-inmap-era2 ${!pauseStatus.allowed ? 'btn-paused' : ''} ${era2Info.canUpgrade ? 'pulse' : ''}" id="btnInMapEra2" data-bid="${b.id}" ${era2Info.canUpgrade && pauseStatus.allowed ? '' : 'disabled'} title="${!pauseStatus.allowed ? esc(pauseStatus.reason) : esc(era2Info.lockReason)}" style="width:100%; margin:0;">
763
- <span>${era2Info.canUpgrade ? `✨ 消耗 25 兵符・昇華為【${era2Info.era2Name}】!` : (era2Info.lockReason || '尚未滿足飛升條件')}</span>
764
  <small class="num"><img src="assets/icon_tally.jpg" class="res-mini-icon" alt="兵符">${ERA2_TALLY_COST}</small>
765
  </button>
766
  </div>
@@ -840,11 +847,20 @@ export function renderInMapTownPanel() {
840
  }
841
  });
842
 
843
- // 專屬第二紀元昇華事件
844
  bind($('#btnInMapEra2'), 'click', (e) => {
845
  e.stopPropagation();
846
  const ps = checkConstructionStatus(classInfo);
847
- if (!ps.allowed) return toast(ps.reason, 'warn', 4500);
 
 
 
 
 
 
 
 
 
848
 
849
  const res = evolveTownToEra2(b.id, game, progress);
850
  if (res.ok) {
 
461
  return;
462
  }
463
 
464
+ if (status.isPreviewMode) {
465
  // 尚未破印(或處於預告剪影模式):展示神秘剪影情報與戰備預告(比照饕餮預告方式)
466
  const annId = bossCfg.id === 'qiongqi' ? 'update_20261105_qiongqi' : 'update_20261027_worldboss';
467
  const contentHtml = `
 
502
  </div>
503
 
504
  <div style="background:var(--bg-2); border:1px solid var(--line); border-radius:12px; padding:12px 14px; margin-bottom:14px;">
505
+ <div style="font-weight:800; color:#38bdf8; margin-bottom:6px; font-size:13px;">🎁 討伐成功全服獎勵:</div>
506
  <div style="display:grid; grid-template-columns:1fr 1fr; gap:8px; font-size:12px;">
507
  <div style="padding:6px 10px; background:var(--bg-1); border-radius:8px; border:1px solid var(--line);">
508
  🌾 <b>全軍糧草產量 ${rew.grainHours} 小時包</b>
509
  </div>
510
  <div style="padding:6px 10px; background:var(--bg-1); border-radius:8px; border:1px solid var(--line);">
511
+ 🧧 <b>兵符 ×${rew.baseBp}(MVP/尾刀 +${rew.killerBonusBp} 共 ${rew.baseBp + rew.killerBonusBp} 枚)</b>
512
  </div>
513
  <div style="padding:6px 10px; background:var(--bg-1); border-radius:8px; border:1px solid var(--line);">
514
  📜 <b>錦囊包(偷看卷×${rew.peekCount}、刪去卷×${rew.eliminateCount})</b>
 
588
  panel.style.left = 'auto';
589
  }
590
 
591
+ const era2StatusForPos = getEra2Status(game, progress);
592
+ const hasEra2Banner = isCaptured && (era2StatusForPos.b10Built || (st.star || 0) >= 5 || !!st.era2);
593
+ if (hasEra2Banner) {
594
+ // 當顯示第二紀元飛升橫幅時,面板高度較高,強制靠上或貼齊安全區,避免平板螢幕底部裁切或遮擋按鈕
595
+ panel.style.top = isBottomHalf
596
+ ? `clamp(8px, calc(${py}% - 260px), 12%)`
597
+ : `clamp(8px, calc(${py}% - 40px), 16%)`;
598
+ } else if (isBottomHalf) {
599
  // 偏下方城池(如柴桑水寨、百草藥谷、平原稻鄉):面板往上提,確保按鈕與所有內容不被地圖底緣遮擋
600
+ panel.style.top = `clamp(8px, calc(${py}% - 150px), 36%)`;
601
  } else {
602
+ panel.style.top = `clamp(8px, calc(${py}% - 30px), 44%)`;
603
  }
604
  panel.style.bottom = 'auto';
605
 
 
766
  ? '★5 滿星已達標!消耗 25 兵符即可完成昇華,基底時代重鑄並更換第二紀元傳世手辦!'
767
  : `飛升前置:${era2Info.lockReason}`}
768
  </div>
769
+ <button type="button" class="btn btn-inmap-era2 ${!pauseStatus.allowed ? 'btn-paused' : ''} ${era2Info.canUpgrade ? 'pulse' : 'locked-action'}" id="btnInMapEra2" data-bid="${b.id}" title="${!pauseStatus.allowed ? esc(pauseStatus.reason) : esc(era2Info.lockReason)}" style="width:100%; margin:0;">
770
+ <span>${!pauseStatus.allowed ? `🌙 課後休整中・暫停飛升` : (era2Info.canUpgrade ? `✨ 消耗 25 兵符・昇華為【${era2Info.era2Name}】!` : `${era2Info.lockReason || '尚未滿足飛升條件'}(點擊查看誓約)`)}</span>
771
  <small class="num"><img src="assets/icon_tally.jpg" class="res-mini-icon" alt="兵符">${ERA2_TALLY_COST}</small>
772
  </button>
773
  </div>
 
847
  }
848
  });
849
 
850
+ // 專屬第二紀元昇華事件(支援平板觸控點選:若尚未達標則彈出說明或提示,不阻斷點擊回饋)
851
  bind($('#btnInMapEra2'), 'click', (e) => {
852
  e.stopPropagation();
853
  const ps = checkConstructionStatus(classInfo);
854
+ if (!ps.allowed) return toast(`🌙 課後休整管制中:${ps.reason}`, 'warn', 4500);
855
+
856
+ const info = getEra2UpgradeInfo(b.id, game, progress);
857
+ if (!info.canUpgrade) {
858
+ toast(`🔒 尚未達成飛升條件:${info.lockReason}`, 'info', 4000);
859
+ if (!info.isUnlocked && typeof window.showEra2IntroModal === 'function') {
860
+ window.showEra2IntroModal();
861
+ }
862
+ return;
863
+ }
864
 
865
  const res = evolveTownToEra2(b.id, game, progress);
866
  if (res.ok) {
tools/verify-integrity.mjs CHANGED
@@ -34,6 +34,7 @@ import {
34
  evolveTownToEra2,
35
  computeQuizReward,
36
  buildingProd,
 
37
  } from '../js/engine.js';
38
  import {
39
  getMerchantDayInfo,
@@ -299,6 +300,19 @@ const nowTs = Date.now();
299
  shopGame.lastTick = nowTs - 1800 * 1000;
300
  const adv = advance(shopGame, dShop, nowTs, { offline: true });
301
  assert.ok(adv.offlineMult > 1, '離線護產香囊 (offlineMult) 必須在離線 advance() 中生效');
 
 
 
 
 
 
 
 
 
 
 
 
 
302
  ok(`西域集市全 ${MERCHANT.items.length} 項商品效果、限購與引擎連動檢驗通過`);
303
 
304
  // ----------------------------------------------------------------------------
@@ -372,10 +386,12 @@ for (const [key, cfg] of Object.entries(WORLD_BOSS_ROSTER)) {
372
  }
373
  }
374
  const rTier1 = calcWorldBossRewards({ u1: { best: 90 }, u2: { best: 90 }, u3: { best: 90 } }, newGame(), {}, false);
375
- assert.equal(rTier1.baseBp, 2, '通關 3 單元應給予 2 枚兵符');
 
 
376
  const rTier2 = calcWorldBossRewards({ u1: { best: 90 }, u2: { best: 90 }, u3: { best: 90 }, u4: { best: 90 } }, newGame(), {}, true);
377
- assert.equal(rTier2.baseBp, 4, '通關 4 單元基礎應給予 4 枚兵符');
378
- assert.equal(rTier2.totalBp, 6, '通關 4 單元且尾刀應給予 4+2=6 枚兵符');
379
  ok('世界 Boss【饕餮/窮奇】圖資與依進度動態獎勵公式檢驗通過');
380
 
381
  // ----------------------------------------------------------------------------
 
34
  evolveTownToEra2,
35
  computeQuizReward,
36
  buildingProd,
37
+ getBossWeaponBuffs,
38
  } from '../js/engine.js';
39
  import {
40
  getMerchantDayInfo,
 
300
  shopGame.lastTick = nowTs - 1800 * 1000;
301
  const adv = advance(shopGame, dShop, nowTs, { offline: true });
302
  assert.ok(adv.offlineMult > 1, '離線護產香囊 (offlineMult) 必須在離線 advance() 中生效');
303
+
304
+ // 驗證西域商隊世界 Boss 討伐神兵(烏茲神鋼 / 突騎破陣弓 / 大漠破甲重弩)對帳與暴擊傷害計算
305
+ const wpShop = getBossWeaponBuffs(shopGame);
306
+ assert.equal(wpShop.uzCount, 3, '購買 3 把西域烏茲神鋼後 uzCount 應為 3');
307
+ assert.equal(wpShop.critRateBonus, 0.15, '購買 3 把西域烏茲神鋼應提升 +15% 世界 Boss 暴擊率');
308
+ assert.equal(wpShop.hasCrossbow, true, '購買大漠破甲重弩後 hasCrossbow 應為 true');
309
+ assert.equal(wpShop.hasBow, true, '購買突騎破陣弓後 hasBow 應為 true');
310
+ assert.equal(wpShop.critDamage, 5, '同時裝備破甲重弩(+1)與破陣弓(+50%)時,暴擊傷害應為 Math.round((2+1)*1.5) = 5 HP');
311
+
312
+ const legacyBuysOnlyGame = normalizeGame({ merchant: { buys: { uzSteel: 2, crossbow: 1 } } });
313
+ assert.equal(legacyBuysOnlyGame.merchantBuffs.bossCritRate, 0.1, 'normalizeGame 必須從 merchant.buys.uzSteel 自動回填 bossCritRate');
314
+ assert.equal(legacyBuysOnlyGame.merchantBuffs.bossCritFlat, 1, 'normalizeGame 必須從 merchant.buys.crossbow 自動回填 bossCritFlat');
315
+ assert.equal(getBossWeaponBuffs(legacyBuysOnlyGame).critDamage, 3, '僅裝備破甲重弩時暴擊傷害應為 3 HP');
316
  ok(`西域集市全 ${MERCHANT.items.length} 項商品效果、限購與引擎連動檢驗通過`);
317
 
318
  // ----------------------------------------------------------------------------
 
386
  }
387
  }
388
  const rTier1 = calcWorldBossRewards({ u1: { best: 90 }, u2: { best: 90 }, u3: { best: 90 } }, newGame(), {}, false);
389
+ assert.equal(rTier1.baseBp, 6, '世界 Boss 討伐成功基礎應統一給予 6 枚兵符');
390
+ assert.equal(rTier1.killerBonusBp, 3, '世界 Boss MVP/尾刀應統一加碼 +3 枚兵符');
391
+ assert.equal(rTier1.totalBp, 6, '一般參與者總計應獲得 6 枚兵符');
392
  const rTier2 = calcWorldBossRewards({ u1: { best: 90 }, u2: { best: 90 }, u3: { best: 90 }, u4: { best: 90 } }, newGame(), {}, true);
393
+ assert.equal(rTier2.baseBp, 6, '世界 Boss 基礎應統一給予 6 枚兵符');
394
+ assert.equal(rTier2.totalBp, 9, 'MVP 或尾刀應給予 6+3=9 枚兵符');
395
  ok('世界 Boss【饕餮/窮奇】圖資與依進度動態獎勵公式檢驗通過');
396
 
397
  // ----------------------------------------------------------------------------