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 }; + } } /**