战力:处理小数点加减

This commit is contained in:
luying
2021-07-29 19:14:44 +08:00
parent 3c4f45bcd0
commit ca959e812f

View File

@@ -4,7 +4,7 @@
import { HERO_SYSTEM_TYPE, ABI_TYPE, HERO_CE_RATIO, HERO_SUB_ATTR_RATIO, LINEUP_NUM } from '../consts';
import { deepCopy, getAllAttrStage, reduceCe } from './util';
import { cal, deepCopy, getAllAttrStage, reduceCe } from './util';
import { HeroModel, HeroType, HeroUpdate } from '../db/Hero';
import { RoleModel, RoleType, RoleUpdate } from '../db/Role';
import { CeAttrData, CeAttrDataRole, Attribute } from '../domain/roleField/attribute';
@@ -400,8 +400,8 @@ function updateRoleAttr(roleAttrs: CeAttrDataRole[], id: number, update: { inc?:
}
if(update.inc) {
let { fixUp, ratioUp } = update.inc;
if(fixUp) curAttr.fixUp += fixUp;
if(ratioUp) curAttr.ratioUp += ratioUp;
if(fixUp) curAttr.fixUp = cal.add(curAttr.fixUp, fixUp);
if(ratioUp) curAttr.ratioUp = cal.add(curAttr.ratioUp, ratioUp);
}
if(update.set) {
let { fixUp, ratioUp } = update.set;