fix bug 修复计算最强5人战力

This commit is contained in:
luying
2020-11-16 09:56:53 +08:00
parent ada3cfe849
commit d5a5cfc270
5 changed files with 12 additions and 7 deletions

View File

@@ -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');

View File

@@ -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();

View File

@@ -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);

View File

@@ -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);
}

View File

@@ -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
}