From f1e17dfa4e3840fa6ad51b55739729d02772055f Mon Sep 17 00:00:00 2001 From: luying Date: Wed, 25 May 2022 14:44:18 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=BB=E6=88=90=EF=BC=9A=E5=A3=B0=E6=9C=9B?= =?UTF-8?q?=E6=BA=A2=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/servers/role/handler/heroHandler.ts | 15 ++++++--------- shared/consts/statusCode.ts | 2 +- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/game-server/app/servers/role/handler/heroHandler.ts b/game-server/app/servers/role/handler/heroHandler.ts index 39e758cb7..d9f93b5fa 100644 --- a/game-server/app/servers/role/handler/heroHandler.ts +++ b/game-server/app/servers/role/handler/heroHandler.ts @@ -498,15 +498,12 @@ export class HeroHandler { for (let { id, count } of originalConsumes) { let dicGoods = gameData.goods.get(id); if (!dicGoods) return resResult(STATUS.DIC_DATA_NOT_FOUND); - let _count = Math.ceil(needExp / dicGoods.value); - if (_count < count) { - material.push({ id, count: _count }); - newExp += dicGoods.value * _count; - break; - } else { - material.push({ id, count }); - newExp += dicGoods.value * count; - } + let needCount = Math.ceil(needExp / dicGoods.value); + if(needCount <= 0) break; + if(needCount > count) needCount = count; + material.push({ id, count: needCount }); + newExp += dicGoods.value * needCount; + needExp -= dicGoods.value * count; } if (newExp == oldExp) { diff --git a/shared/consts/statusCode.ts b/shared/consts/statusCode.ts index 417870e2a..902746498 100644 --- a/shared/consts/statusCode.ts +++ b/shared/consts/statusCode.ts @@ -292,7 +292,7 @@ export const STATUS = { HERO_CONECTION_IS_MAX_LEVEL: { code: 30306, simStr: '羁绊已达到最大等级' }, HERO_CONECTION_IS_NOT_EXIT: { code: 30307, simStr: '羁绊不存在' }, ROLE_SHORT_HERO_CONECTION: { code: 30308, simStr: '未拥有羁绊武将' }, - HERO_FAVOUR_LEVEL_REACH_MAXT: { code: 30309, simStr: '武将好感等级以达到最大' }, + HERO_FAVOUR_LEVEL_REACH_MAXT: { code: 30309, simStr: '武将好感等级已达到最大' }, HERO_JOB_REACH_MAX_STAGE: { code: 30310, simStr: '武将已达到最大的职业阶级' }, TALENT_HAS_UNLOCKED: { code: 30311, simStr: '该天赋已经解锁' }, TALENT_CONDITION_NOT_FIT: { code: 30312, simStr: '天赋解锁条件未达成' },