战力:pvp远征匹配系数修改

This commit is contained in:
luying
2021-03-10 15:34:38 +08:00
parent 831661ec66
commit b822337b82
3 changed files with 52 additions and 12 deletions

View File

@@ -1,5 +1,5 @@
import { prop } from '@typegoose/typegoose';
import { HERO_CE_RATIO, getAtrrNameById, CE_CONST, HERO_SUB_ATTR_RATIO } from '../../consts';
import { HERO_CE_RATIO, getAtrrNameById, CE_CONST, HERO_SUB_ATTR_RATIO, ABI_TYPE_MAIN } from '../../consts';
import { reduceCe } from '../../pubUtils/util';
// hero表内属性基础格式
@@ -80,6 +80,8 @@ export class Attribute {
ap: number = 0;
@prop({ required: false })
damageCri: number = 0;
@prop({ required: false })
ce?: number = 0;
setByDbData(roleAttrs: CeAttrDataRole[], heroAttrs: CeAttrData[]) {
for(let { id, fixUp: roleFix, ratioUp: roleRatio } of roleAttrs) {
@@ -108,7 +110,11 @@ export class Attribute {
setByWarJson( attributes: {id: number, val: number}[], ratio: number = 1) {
for(let {id, val} of attributes) {
let attrName = getAtrrNameById(id);
if(attrName in this) this[attrName] = Math.floor(val * ratio * HERO_CE_RATIO * HERO_CE_RATIO);
if(ABI_TYPE_MAIN.includes(id)) {
if(attrName in this) this[attrName] = Math.floor(val * ratio * HERO_CE_RATIO * HERO_CE_RATIO);
} else {
if(attrName in this) this[attrName] = Math.floor(val * HERO_CE_RATIO * HERO_CE_RATIO);
}
}
}