战力:修改战力公式
This commit is contained in:
@@ -38,6 +38,11 @@ export class CeAttrDataRole {
|
||||
export class AttributeCal {
|
||||
attrs: Map<number, number> = new Map<number, number>();
|
||||
ce?: number = 0;
|
||||
lv: number = 1;
|
||||
|
||||
public setLv(lv: number) {
|
||||
this.lv = lv;
|
||||
}
|
||||
|
||||
public setByDbData(roleAttrs: CeAttrDataRole[], heroAttrs: CeAttrData[]) {
|
||||
for(let { id, fixUp: roleFix, ratioUp: roleRatio } of roleAttrs) {
|
||||
@@ -61,7 +66,7 @@ export class AttributeCal {
|
||||
}
|
||||
}
|
||||
|
||||
public setByWarJson( attributes: {id: number, val: number}[], ratio: number = 1) {
|
||||
public setByWarJson(attributes: {id: number, val: number}[], ratio: number = 1) {
|
||||
for(let {id, val} of attributes) {
|
||||
if(ABI_TYPE_MAIN.includes(id)) {
|
||||
this.attrs.set(id, Math.floor(val * ratio * HERO_CE_RATIO * HERO_CE_RATIO));
|
||||
@@ -133,7 +138,11 @@ export class AttributeCal {
|
||||
public calCe() {
|
||||
let ce = gameData.ceRatio.reduce((pre, cur) => {
|
||||
let { type, val } = cur;
|
||||
return pre + val * (this.attrs.get(type)|| 0)
|
||||
if(ABI_TYPE_MAIN.includes(type)) {
|
||||
return pre + val * (this.attrs.get(type)|| 0)
|
||||
} else {
|
||||
return pre + val * (this.attrs.get(type)|| 0) * this.lv
|
||||
}
|
||||
}, 0);
|
||||
return Math.floor(ce);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user