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
+1 -3
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);
+8 -3
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);
}