mirror of
https://github.com/setube/ogame-vue-ts.git
synced 2026-05-12 16:05:12 +08:00
fix: 优化NPC冷却与成长平衡及多语言提示
为NPC初始化和数据迁移时增加侦查/攻击冷却的随机延迟,避免所有NPC同时行动。调整NPC成长难度参数,降低前期NPC威胁,提升平滑度。修正多语言包中侦查被发现提示内容。优化舰队警报弹窗滚动体验。
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user