mirror of
https://github.com/setube/ogame-vue-ts.git
synced 2026-05-11 23:45:11 +08:00
refactor(视图): 提取导弹发射井容量计算逻辑
将导弹发射井容量计算从 GMView.vue 中提取到专用逻辑模块 简化防御设置中的导弹数量分配逻辑,统一使用提取的函数
This commit is contained in:
@@ -318,6 +318,7 @@
|
||||
import * as npcBehaviorLogic from '@/logic/npcBehaviorLogic'
|
||||
import * as publicLogic from '@/logic/publicLogic'
|
||||
import { calculateMaxFleetStorage } from '@/logic/fleetStorageLogic'
|
||||
import { calculateMissileSiloCapacity } from '@/logic/shipLogic'
|
||||
import { Home, Trash2 } from 'lucide-vue-next'
|
||||
|
||||
// --- 预设系统 ---
|
||||
@@ -569,17 +570,13 @@
|
||||
})
|
||||
} else if (section.tabValue === 'defense') {
|
||||
if (!selectedPlanet.value) return
|
||||
const siloLevel = selectedPlanet.value.buildings[BuildingType.MissileSilo] || 0
|
||||
const missileCapacity = siloLevel * 10
|
||||
const halfCapacity = missileCapacity / 2
|
||||
|
||||
const missileCapacity = calculateMissileSiloCapacity(selectedPlanet.value.buildings)
|
||||
const defaultMissileCount = Math.floor(missileCapacity / 2)
|
||||
|
||||
section.items.forEach((item: string) => {
|
||||
if (item === DefenseType.AntiBallisticMissile) {
|
||||
// 反弹道导弹占用1个空间,分配一半容量
|
||||
section.setValue(item, Math.floor(halfCapacity))
|
||||
} else if (item === DefenseType.InterplanetaryMissile) {
|
||||
// 星际导弹占用1个空间,分配一半容量
|
||||
section.setValue(item, Math.floor(halfCapacity))
|
||||
// 两种导弹都占用1格空间,默认各分配一半容量
|
||||
if (item === DefenseType.AntiBallisticMissile || item === DefenseType.InterplanetaryMissile) {
|
||||
section.setValue(item, defaultMissileCount)
|
||||
} else {
|
||||
section.setValue(item, 10000)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user