From 97f5d5f0484afc9a8c604af5fbffbcd8034ec717 Mon Sep 17 00:00:00 2001 From: luying Date: Wed, 29 Sep 2021 13:47:18 +0800 Subject: [PATCH] =?UTF-8?q?=E8=BF=9C=E5=BE=81=EF=BC=9A=E5=AF=B9=E6=89=8B?= =?UTF-8?q?=E5=B1=9E=E6=80=A7=E9=80=BB=E8=BE=91=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- game-server/app/services/pvpService.ts | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/game-server/app/services/pvpService.ts b/game-server/app/services/pvpService.ts index ab85070db..13d65937a 100644 --- a/game-server/app/services/pvpService.ts +++ b/game-server/app/services/pvpService.ts @@ -519,11 +519,19 @@ export function getRobotAttribute(mainAttrs: { id: number, val: number }[], enem newAttribute.setLv(lv); newAttribute.setByWarJson(subAttrs); // 次级属性 let subAttrCe = newAttribute.calSubAttrCeAndReduce() * enemyCount; - let mainAttrCe = ce * ratio > subAttrCe? ce * ratio - subAttrCe: 0; - newAttribute.setByWarJson(mainAttrs, mainAttrCe / enemyCe); - let attrArr = newAttribute.getReduceAttributesToString(); - let newCe = newAttribute.calCelAndReduce(); - return { attribute: attrArr, ce: newCe }; + if(ce * ratio > subAttrCe) { + let mainAttrCe = ce * ratio - subAttrCe; + newAttribute.setByWarJson(mainAttrs, mainAttrCe / enemyCe); + let attrArr = newAttribute.getReduceAttributesToString(); + let newCe = newAttribute.calCelAndReduce(); + return { attribute: attrArr, ce: newCe }; + } else { + newAttribute = new AttributeCal(); + newAttribute.setByWarJson(mainAttrs, ce * ratio / enemyCe); + let attrArr = newAttribute.getReduceAttributesToString(); + let newCe = newAttribute.calCelAndReduce(); + return { attribute: attrArr, ce: newCe }; + } } /**