mirror of
https://github.com/setube/ogame-vue-ts.git
synced 2026-05-12 16:05:12 +08:00
feat: 新增NPC与外交逻辑,优化UI组件结构
重构并精简了部分UI组件,移除冗余弹窗与详情组件,新增NPC相关逻辑(npcBehaviorLogic、npcGrowthLogic、npcStore等)及外交逻辑(diplomaticLogic、DiplomacyView)。完善分页、标签、复选框等通用UI组件。优化战报弹窗,调整README下载链接为相对路径,修复部分国际化内容。
This commit is contained in:
@@ -20,12 +20,31 @@ export const calculateTechnologyCost = (techType: TechnologyType, targetLevel: n
|
||||
|
||||
/**
|
||||
* 计算科技研究时间
|
||||
* @param techType 科技类型
|
||||
* @param currentLevel 当前等级
|
||||
* @param researchSpeedBonus 军官等提供的研究速度加成百分比
|
||||
* @param researchLabLevel 研究实验室等级
|
||||
* @param energyTechLevel 能源技术等级
|
||||
*/
|
||||
export const calculateTechnologyTime = (techType: TechnologyType, currentLevel: number, researchSpeedBonus: number = 0): number => {
|
||||
export const calculateTechnologyTime = (
|
||||
techType: TechnologyType,
|
||||
currentLevel: number,
|
||||
researchSpeedBonus: number = 0,
|
||||
researchLabLevel: number = 1,
|
||||
energyTechLevel: number = 0
|
||||
): number => {
|
||||
const config = TECHNOLOGIES[techType]
|
||||
const baseTime = config.baseTime * Math.pow(config.costMultiplier, currentLevel)
|
||||
|
||||
// 研究实验室和能源技术的加速:研究时间 / (研究实验室等级 × (1 + 能源技术等级))
|
||||
// 研究实验室等级至少为1,防止除以0
|
||||
const labLevel = Math.max(1, researchLabLevel)
|
||||
const techSpeedDivisor = labLevel * (1 + energyTechLevel)
|
||||
|
||||
// 军官等的百分比加成
|
||||
const speedMultiplier = 1 - researchSpeedBonus / 100
|
||||
return Math.floor(baseTime * speedMultiplier)
|
||||
|
||||
return Math.floor((baseTime / techSpeedDivisor) * speedMultiplier)
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user