From ad122098a51c23376eee485b57a6d98e376ba120 Mon Sep 17 00:00:00 2001 From: luying Date: Tue, 28 Feb 2023 11:04:16 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9E=20fix(gvg):=20=E5=AE=88=E5=9F=8E?= =?UTF-8?q?=E5=AF=B9=E5=A4=87=E6=88=98=E6=9C=9F=E7=9A=84=E5=8A=A0=E6=88=90?= =?UTF-8?q?=E9=80=BB=E8=BE=91=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- game-server/app/services/gvg/gvgPrepareService.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/game-server/app/services/gvg/gvgPrepareService.ts b/game-server/app/services/gvg/gvgPrepareService.ts index b58d207b7..9643aed1c 100644 --- a/game-server/app/services/gvg/gvgPrepareService.ts +++ b/game-server/app/services/gvg/gvgPrepareService.ts @@ -1,9 +1,9 @@ import { BackendSession } from "pinus"; import { GVG_ACTIVE_TYPE, GVG_ITEM, GVG_RESOURCE_TYPE, GVG_SEED_TYPE, GVG_TECH_TYPE, ITEM_CHANGE_REASON, LEAGUE_JOB, PUSH_ROUTE } from "../../consts"; import { GVGLeagueFarmModel, GVGLeagueFarmType } from "../../db/GVGLeagueFarm"; -import { GVGLeaguePrepareModel, GVGLeaguePrepareType, Tech } from "../../db/GVGLeaguePrepare"; +import { GVGLeaguePrepareModel, Tech } from "../../db/GVGLeaguePrepare"; import { GVGUserDailyDataModel, GVGUserDailyDataType } from "../../db/GVGUserDailyData"; -import { GVGUserDataModel, GVGUserDataType } from "../../db/GVGUserData"; +import { GVGUserDataModel } from "../../db/GVGUserData"; import { GVGUserItemModel } from "../../db/GVGUserItem"; import { LeagueField } from "../../domain/gvgField/returnData"; import { calLeagueLv, gameData, getFieldMaxAddType } from "../../pubUtils/data"; @@ -406,20 +406,20 @@ export function calForestryOutput(farmId: number, result: number, cities: number // 城池加成,多城池取最大加成 function getCitiesAdd(cities: number[], resourceType: number) { - let outputAdds: number[] = [0]; + let outputAdd: number = 0; for(let cityId of cities) { let dicCity = gameData.gvgCity.get(cityId); let dicCityAdd = gameData.gvgCityAdd.get(dicCity?.cityType); if(!dicCity || !dicCityAdd) continue; if(resourceType == GVG_RESOURCE_TYPE.FOOD) { - outputAdds.push(dicCityAdd.foodAdd); + outputAdd += dicCityAdd.foodAdd; } else if (resourceType == GVG_RESOURCE_TYPE.MINERAL) { - outputAdds.push(dicCityAdd.mineralAdd); + outputAdd += dicCityAdd.mineralAdd; } else if (resourceType == GVG_RESOURCE_TYPE.WOOD) { - outputAdds.push(dicCityAdd.woodAdd); + outputAdd += dicCityAdd.woodAdd; } } - return Math.max(...outputAdds); + return outputAdd; } // 科技树加成 叠加