From 6a11bfb1700247c33dd010a897a42756a429121b Mon Sep 17 00:00:00 2001 From: luying Date: Thu, 24 Dec 2020 11:35:00 +0800 Subject: [PATCH] =?UTF-8?q?fix=E6=AD=A6=E5=B0=86=E5=8D=87=E7=BA=A7?= =?UTF-8?q?=E5=88=B0=E8=B7=9D=E7=A6=BB=E6=9C=80=E9=AB=98=E4=B8=8D=E6=BB=A1?= =?UTF-8?q?5=E7=BA=A7=E6=97=B6=E5=8D=87=E7=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- game-server/app/servers/role/handler/heroHandler.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/game-server/app/servers/role/handler/heroHandler.ts b/game-server/app/servers/role/handler/heroHandler.ts index 3a1b49531..1ab1e8d38 100644 --- a/game-server/app/servers/role/handler/heroHandler.ts +++ b/game-server/app/servers/role/handler/heroHandler.ts @@ -100,7 +100,9 @@ export class HeroHandler { if(!hero) return resResult(STATUS.ROLE_HERO_NOT_EXISTS); let {lv: playerLv} = await RoleModel.findByRoleId(roleId); let {lv: oldLv, exp: oldExp} = hero; - if(oldLv + addLv > playerLv ) return resResult(STATUS.ROLE_HERO_LV_OVER); + if(oldLv >= playerLv ) return resResult(STATUS.ROLE_HERO_LV_OVER); + if(oldLv + addLv > playerLv ) addLv = playerLv - oldLv; + let nextExp = getHeroExpByLv(oldLv + addLv - 1); let needExp = nextExp - oldExp; let newExp = oldExp;