fix(game): 关卡切换时重置HC为200,不带入上一关余量,修复游戏平衡性问题
This commit is contained in:
@@ -58,6 +58,12 @@ export class GameManager {
|
|||||||
// difficulty 保留,不重置
|
// difficulty 保留,不重置
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 重置 HC 到初始值(进入下一关时调用,不带入上一关的余量) */
|
||||||
|
resetHC(): void {
|
||||||
|
this.hc = INITIAL_HC
|
||||||
|
this.onHCChange.forEach(cb => cb(this.hc))
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 扣除 HC,余额不足时返回 false
|
* 扣除 HC,余额不足时返回 false
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -399,6 +399,8 @@ export function createGameScene(PhaserLib: typeof Phaser): typeof Phaser.Scene {
|
|||||||
this.waveManager.clearAllEnemies()
|
this.waveManager.clearAllEnemies()
|
||||||
// 清除上一关所有防御塔
|
// 清除上一关所有防御塔
|
||||||
this.towerManager.clearAllTowers()
|
this.towerManager.clearAllTowers()
|
||||||
|
// 重置 HC:每关重新开始,不带入上关余量
|
||||||
|
this.manager.resetHC()
|
||||||
this.loadMap(ALL_MAPS[nextIndex])
|
this.loadMap(ALL_MAPS[nextIndex])
|
||||||
this.hud.enableWaveButton()
|
this.hud.enableWaveButton()
|
||||||
this.hud.setWaveButtonText('▶ 召唤下一波')
|
this.hud.setWaveButtonText('▶ 召唤下一波')
|
||||||
|
|||||||
@@ -33,7 +33,6 @@ export class MapTransitionModal {
|
|||||||
): void {
|
): void {
|
||||||
const manager = GameManager.getInstance()
|
const manager = GameManager.getInstance()
|
||||||
const kpi = manager.kpi
|
const kpi = manager.kpi
|
||||||
const hcReward = 100
|
|
||||||
|
|
||||||
const overlay = document.createElement('div')
|
const overlay = document.createElement('div')
|
||||||
overlay.id = 'map-transition-overlay'
|
overlay.id = 'map-transition-overlay'
|
||||||
@@ -92,9 +91,9 @@ export class MapTransitionModal {
|
|||||||
`
|
`
|
||||||
card.appendChild(hr)
|
card.appendChild(hr)
|
||||||
|
|
||||||
// KPI & 奖励
|
// KPI & 说明
|
||||||
const statsEl = document.createElement('div')
|
const statsEl = document.createElement('div')
|
||||||
statsEl.innerHTML = `KPI: <span style="color:#34d399">${kpi}%</span> | 获得奖励: <span style="color:#fbbf24">+${hcReward} HC</span>`
|
statsEl.innerHTML = `最终KPI: <span style="color:#34d399">${kpi}%</span> | <span style="color:#94a3b8">HC 将重置为 200</span>`
|
||||||
statsEl.style.cssText = `
|
statsEl.style.cssText = `
|
||||||
font-size: 20px;
|
font-size: 20px;
|
||||||
color: #e2e8f0;
|
color: #e2e8f0;
|
||||||
@@ -129,10 +128,10 @@ export class MapTransitionModal {
|
|||||||
}
|
}
|
||||||
card.appendChild(nextEl)
|
card.appendChild(nextEl)
|
||||||
|
|
||||||
// 倒计时提示
|
// 倒计时提示(HC 重置提醒)
|
||||||
const countdownEl = document.createElement('div')
|
const countdownEl = document.createElement('div')
|
||||||
countdownEl.id = 'mt-countdown'
|
countdownEl.id = 'mt-countdown'
|
||||||
countdownEl.textContent = isFinalMap ? '3秒后返回主菜单...' : '3秒后自动进入下一关...'
|
countdownEl.textContent = isFinalMap ? '3秒后返回主菜单...' : '3秒后进入下一关,HC重置为200...'
|
||||||
countdownEl.style.cssText = `
|
countdownEl.style.cssText = `
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
color: #6b7280;
|
color: #6b7280;
|
||||||
@@ -151,9 +150,6 @@ export class MapTransitionModal {
|
|||||||
document.body.appendChild(overlay)
|
document.body.appendChild(overlay)
|
||||||
this.container = overlay
|
this.container = overlay
|
||||||
|
|
||||||
// 给 HC 奖励
|
|
||||||
manager.addHC(hcReward)
|
|
||||||
|
|
||||||
// 3秒自动触发
|
// 3秒自动触发
|
||||||
let remaining = 3
|
let remaining = 3
|
||||||
const tick = () => {
|
const tick = () => {
|
||||||
@@ -161,7 +157,7 @@ export class MapTransitionModal {
|
|||||||
const el = document.getElementById('mt-countdown')
|
const el = document.getElementById('mt-countdown')
|
||||||
if (el) el.textContent = isFinalMap
|
if (el) el.textContent = isFinalMap
|
||||||
? `${remaining}秒后返回主菜单...`
|
? `${remaining}秒后返回主菜单...`
|
||||||
: `${remaining}秒后自动进入下一关...`
|
: `${remaining}秒后进入下一关,HC重置为200...`
|
||||||
}
|
}
|
||||||
const interval = setInterval(tick, 1000)
|
const interval = setInterval(tick, 1000)
|
||||||
this.autoCloseTimer = setTimeout(() => {
|
this.autoCloseTimer = setTimeout(() => {
|
||||||
|
|||||||
Reference in New Issue
Block a user