From f6bf60b384031c992fbd1acb98afbe019b2350e3 Mon Sep 17 00:00:00 2001 From: luying Date: Wed, 30 Dec 2020 14:35:45 +0800 Subject: [PATCH] =?UTF-8?q?fix=20=E9=95=87=E5=BF=B5=E5=A1=94=E6=8C=82?= =?UTF-8?q?=E6=9C=BA=E5=A5=96=E5=8A=B1=E6=97=A0=E6=B3=95=E8=8E=B7=E5=8F=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../servers/battle/handler/towerBattleHandler.ts | 2 +- game-server/app/services/battleService.ts | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/game-server/app/servers/battle/handler/towerBattleHandler.ts b/game-server/app/servers/battle/handler/towerBattleHandler.ts index a27f7fa93..28e6b630f 100644 --- a/game-server/app/servers/battle/handler/towerBattleHandler.ts +++ b/game-server/app/servers/battle/handler/towerBattleHandler.ts @@ -91,7 +91,7 @@ export class TowerBattleHandler { let num = HANG_UP_CONSTS.MAX_SPD_UP_CNT - hangUpSpdUpCnt + 1; let nextCostGold = calculateNum(GOLD_COST_RATIO.TOWER_HANG_SPDUP, {num}, 50); - return resResult(STATUS.SUCCESS, {startTime, hangUpPassTime: Math.floor(deltaTime/1000), hangUpSpdUpCnt, nextCostGold, rewards: timeReward.map(cur => {return {id: cur.gid, count: cur.count}})}); + return resResult(STATUS.SUCCESS, {startTime, hangUpPassTime: Math.floor(deltaTime/1000), hangUpSpdUpCnt, nextCostGold, rewards: timeReward}); } async recHangUpRewards(msg: {}, session: BackendSession) { diff --git a/game-server/app/services/battleService.ts b/game-server/app/services/battleService.ts index a36686a3b..bc78c85bf 100644 --- a/game-server/app/services/battleService.ts +++ b/game-server/app/services/battleService.ts @@ -150,16 +150,16 @@ export async function calcuHangUpReward(roleId: string, speedUp = false, speedUp let notReceivedGoods = notReceivedGoodsList.find(cur => cur.cnt == cnt ); goods = notReceivedGoods?notReceivedGoods.goods:[]; } - for(let {gid, count} of baseReward) { + for(let {id, count} of baseReward) { let newCount = cal.mul(count, multi); - let oldGoods = goods.find(cur => cur.gid == gid); + let oldGoods = goods.find(cur => cur.gid == id); if(oldGoods) newCount = cal.add(newCount, oldGoods.count); let roundCount = Math.floor(newCount); if(newCount > roundCount) { - needReceiveGoods.push({gid, count: cal.sub(newCount, roundCount)}); + needReceiveGoods.push({gid: id, count: cal.sub(newCount, roundCount)}); } if(roundCount > 0) { - timeReward.push({gid, count: roundCount}) + timeReward.push({id, count: roundCount}) } } } @@ -170,16 +170,16 @@ export async function calcuHangUpReward(roleId: string, speedUp = false, speedUp let multi = Math.floor(deltaTime / HANG_UP_CONSTS.UNIT_TIME); // 结算奖励的倍数,受最大时间限制 // console.log(deltaTime, multi, baseReward); - for(let {gid, count} of baseReward) { + for(let {id, count} of baseReward) { let newCount = cal.mul(count, multi); - let oldGoods = notReceivedGoods.find(cur => cur.gid == gid); + let oldGoods = notReceivedGoods.find(cur => cur.gid == id); if(oldGoods) newCount = cal.add(newCount, oldGoods.count); let roundCount = Math.floor(newCount); if(newCount > roundCount) { - needReceiveGoods.push({gid, count: cal.sub(newCount, roundCount)}); + needReceiveGoods.push({gid: id, count: cal.sub(newCount, roundCount)}); } if(roundCount > 0) { - timeReward.push({gid, count: roundCount}) + timeReward.push({id, count: roundCount}) } } }