fix: 优化NPC冷却与成长平衡及多语言提示

为NPC初始化和数据迁移时增加侦查/攻击冷却的随机延迟,避免所有NPC同时行动。调整NPC成长难度参数,降低前期NPC威胁,提升平滑度。修正多语言包中侦查被发现提示内容。优化舰队警报弹窗滚动体验。
This commit is contained in:
谦君
2025-12-18 04:41:52 +08:00
parent 2ed15c4782
commit 53d5216e88
11 changed files with 64 additions and 53 deletions

View File

@@ -68,13 +68,18 @@ export const migrateGameData = (): void => {
// 修复NPC数据确保所有必需字段都存在
if (oldData.npcs && Array.isArray(oldData.npcs)) {
const now = Date.now()
oldData.npcs.forEach((npc: NPC) => {
// 确保NPC有必需的时间字段
if (npc.lastSpyTime === undefined) {
npc.lastSpyTime = 0
// 确保NPC有必需的时间字段,并设置随机冷却避免同时行动
if (npc.lastSpyTime === undefined || npc.lastSpyTime === 0) {
// 0-4分钟的随机延迟
const randomSpyOffset = Math.random() * 240 * 1000
npc.lastSpyTime = now - randomSpyOffset
}
if (npc.lastAttackTime === undefined) {
npc.lastAttackTime = 0
if (npc.lastAttackTime === undefined || npc.lastAttackTime === 0) {
// 0-8分钟的随机延迟
const randomAttackOffset = Math.random() * 480 * 1000
npc.lastAttackTime = now - randomAttackOffset
}
// 确保NPC有必需的数组字段
if (!npc.fleetMissions) {