远征:修改机器人模板计算

This commit is contained in:
luying
2021-09-10 15:45:01 +08:00
parent dd70efddbe
commit a6525ef254
11 changed files with 78 additions and 13 deletions
+17 -3
View File
@@ -3,6 +3,7 @@ import { CeAttrDataRole } from '../../db/Role';
import { CeAttrData } from '../../db/Hero';
import { gameData } from '../../pubUtils/data';
import { decodeArrayListStr, reduceCe } from '../../pubUtils/util';
import { ATTRIBUTE } from '../../pubUtils/dicParam';
export class AttributeCal {
attrs: Map<number, number> = new Map<number, number>();
@@ -104,18 +105,31 @@ export class AttributeCal {
}
// 战力计算
public calCe() {
// calType 1-全部 2-只算主属性 3-只算次属性
public calCe(calType: number = 1) {
let ce = gameData.ceRatio.reduce((pre, cur) => {
let { type, val } = cur;
if(ABI_TYPE_MAIN.includes(type)) {
return pre + val * (this.attrs.get(type)|| 0)
if(calType == 3) {
return 0
} else {
return pre + val * (this.attrs.get(type)|| 0)
}
} else {
return pre + val * (this.attrs.get(type)|| 0) * this.lv
if(calType == 2) {
return 0
} else {
return pre + val * (this.attrs.get(type)|| 0) * this.lv / ATTRIBUTE.ATTRIBUTE_POWER_DIVISOR;
}
}
}, 0);
return Math.floor(ce);
}
public calSubAttrCeAndReduce() {
return Math.floor(this.calCe(3) / HERO_CE_RATIO / HERO_CE_RATIO);
}
public calCelAndReduce() {
return Math.floor(this.calCe() / HERO_CE_RATIO / HERO_CE_RATIO);
}