From d5a5cfc270668b0643d2478eecce40d639c1e677 Mon Sep 17 00:00:00 2001 From: luying Date: Mon, 16 Nov 2020 09:56:53 +0800 Subject: [PATCH] =?UTF-8?q?fix=20bug=20=E4=BF=AE=E5=A4=8D=E8=AE=A1?= =?UTF-8?q?=E7=AE=97=E6=9C=80=E5=BC=BA5=E4=BA=BA=E6=88=98=E5=8A=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/servers/battle/handler/dailyBattleHandler.ts | 1 + .../servers/battle/handler/dungeonBattleHandler.ts | 1 + shared/db/Role.ts | 4 +--- shared/pubUtils/actor.ts | 11 ++++++++--- web-server/app/service/Auth.ts | 2 +- 5 files changed, 12 insertions(+), 7 deletions(-) diff --git a/game-server/app/servers/battle/handler/dailyBattleHandler.ts b/game-server/app/servers/battle/handler/dailyBattleHandler.ts index 00943a03c..506f8e2f0 100644 --- a/game-server/app/servers/battle/handler/dailyBattleHandler.ts +++ b/game-server/app/servers/battle/handler/dailyBattleHandler.ts @@ -66,6 +66,7 @@ export class DailyBattleHandler { // 购买每日次数 async buyNum(msg: { type: number, count: number }, session: BackendSession) { let {type, count} = msg; + if(count < 0) return resResult(STATUS.WRONG_PARMS); const roleId = session.get('roleId'); const dicDaily = getGamedata('dic_zyz_daily'); diff --git a/game-server/app/servers/battle/handler/dungeonBattleHandler.ts b/game-server/app/servers/battle/handler/dungeonBattleHandler.ts index 30f70f66a..f83745db2 100644 --- a/game-server/app/servers/battle/handler/dungeonBattleHandler.ts +++ b/game-server/app/servers/battle/handler/dungeonBattleHandler.ts @@ -32,6 +32,7 @@ export class DungeonBattleHandler { // 购买每日次数 async buyNum(msg: { count: number }, session: BackendSession) { let { count } = msg; + if(count < 0) return resResult(STATUS.WRONG_PARMS); const roleId = session.get('roleId'); let { dungeonCnt = 0, dungeonBuyCnt = 0, dungeonRefTime } = await RoleModel.findByRoleId(roleId); let curTime = new Date(); diff --git a/shared/db/Role.ts b/shared/db/Role.ts index 5a29f70e9..3cd6ba815 100644 --- a/shared/db/Role.ts +++ b/shared/db/Role.ts @@ -340,11 +340,9 @@ export default class Role extends BaseModel { if(topFive.length < 5) { // 不满5人 topFive.push({hid, ce}); } else if(topFive.length == 5){ - if(ce > topFive[topFive.length - 1].ce) { // 跻身最强6人 + if(ce > topFive[topFive.length - 1].ce) { // 跻身最强5人 topFive.pop(); topFive.push({hid, ce}); - } else { - topFive[index].ce = ce; } } else { topFive.splice(5, topFive.length - 5); diff --git a/shared/pubUtils/actor.ts b/shared/pubUtils/actor.ts index 92a95edc5..e1acae469 100644 --- a/shared/pubUtils/actor.ts +++ b/shared/pubUtils/actor.ts @@ -1,5 +1,6 @@ import { getHeroInfoById, getStarRatio, getHeroSkillById, getSeidById, getOlySeidByType, getGoodById } from "./gamedata"; import { ABI_TYPE, SEID_TYPE } from "../consts/abilityConst"; +import { EXPRESSION } from '../consts/consts'; export default class Actor { private hid: number = 0; @@ -257,7 +258,6 @@ export default class Actor { calculateCE() { // 武将 - const ceGongshi = '1*hp+2*atk+2*matk+2*def+2*mdef+2*agi+2*luk+1*hit+1*cri+1*flee+1*antCri+1.75*damageIncrease+1.75*damageDecrease+3.5*defIngnore+3.5*bloodSuck' let hp = this.getRealAbility(ABI_TYPE.ABI_HP); console.log(this.hid, 'hp', hp); let atk = this.getRealAbility(ABI_TYPE.ABI_ATK); console.log(this.hid, 'atk', atk); let matk = this.getRealAbility(ABI_TYPE.ABI_MATK); console.log(this.hid, 'matk', matk); @@ -274,7 +274,13 @@ export default class Actor { let damageDecrease = this.getRealAbility(ABI_TYPE.ABI_DAMAGE_DECREASE); console.log(this.hid, 'damageDecrease', damageDecrease); let defIngnore = this.getRealAbility(ABI_TYPE.ABI_DEF_IGNORE); console.log(this.hid, 'defIngnore', defIngnore); let bloodSuck = this.getRealAbility(ABI_TYPE.ABI_BLOOD_SUCK); console.log(this.hid, 'bloodSuck', bloodSuck); - let ce = eval(ceGongshi); console.log(this.hid, 'ce', ce); + let ce = 0; + try { + ce = eval(EXPRESSION.CE); + } catch(e) { + console.error('expression wrong'); + } + console.log(this.hid, 'ce', ce); // 装备 for(let equip of this.equips) { @@ -285,7 +291,6 @@ export default class Actor { } } - console.log('ce2', ce) return Math.floor(ce); } diff --git a/web-server/app/service/Auth.ts b/web-server/app/service/Auth.ts index 14a776d5e..28bdb5ce9 100644 --- a/web-server/app/service/Auth.ts +++ b/web-server/app/service/Auth.ts @@ -150,7 +150,7 @@ export default class Auth extends Service { hid: hid, hName: dicHero.name, seqId, - star: dicHero.star, + star: dicHero.quality, lv: 1, ce: 100 }