属性: fix缩小战力倍数
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { prop } from '@typegoose/typegoose';
|
||||
import { HERO_CE_RATIO, getAtrrNameById, CE_CONST, HERO_SUB_ATTR_RATIO } from '../../consts';
|
||||
import { reduceCe } from '../../pubUtils/util';
|
||||
|
||||
// hero表内属性基础格式
|
||||
export class CeAttrData {
|
||||
@@ -107,7 +108,7 @@ 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);
|
||||
if(attrName in this) this[attrName] = Math.floor(val * ratio * HERO_CE_RATIO * HERO_CE_RATIO);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -115,7 +116,7 @@ export class Attribute {
|
||||
return (heroFix + heroEquip + roleFix) * HERO_CE_RATIO + heroBase * ( HERO_CE_RATIO + heroRatio + roleRatio );
|
||||
}
|
||||
|
||||
private setSubAttrRatio() {
|
||||
private getRealSubAttr() {
|
||||
return {
|
||||
hit: this.hit / HERO_SUB_ATTR_RATIO / HERO_CE_RATIO / HERO_CE_RATIO,
|
||||
cri: this.cri / HERO_SUB_ATTR_RATIO / HERO_CE_RATIO / HERO_CE_RATIO,
|
||||
@@ -128,7 +129,7 @@ export class Attribute {
|
||||
}
|
||||
}
|
||||
|
||||
private setMainAttrRatio() {
|
||||
private getRealMainAttr() {
|
||||
return {
|
||||
hp: this.hp / HERO_CE_RATIO / HERO_CE_RATIO,
|
||||
atk: this.atk / HERO_CE_RATIO / HERO_CE_RATIO,
|
||||
@@ -137,10 +138,30 @@ export class Attribute {
|
||||
}
|
||||
}
|
||||
|
||||
public getReduceAttributes() {
|
||||
let newAttr = new Attribute();
|
||||
newAttr.hp = reduceCe(this.hp);
|
||||
newAttr.atk = reduceCe(this.atk);
|
||||
newAttr.def = reduceCe(this.def);
|
||||
newAttr.mdef = reduceCe(this.mdef);
|
||||
newAttr.speed = reduceCe(this.speed);
|
||||
newAttr.hit = reduceCe(this.hit);
|
||||
newAttr.cri = reduceCe(this.cri);
|
||||
newAttr.flee = reduceCe(this.flee);
|
||||
newAttr.antCri = reduceCe(this.antCri);
|
||||
newAttr.damageIncrease = reduceCe(this.damageIncrease);
|
||||
newAttr.damageDecrease = reduceCe(this.damageDecrease);
|
||||
newAttr.defIngnore = reduceCe(this.defIngnore);
|
||||
newAttr.bloodSuck = reduceCe(this.bloodSuck);
|
||||
newAttr.ap = reduceCe(this.ap);
|
||||
newAttr.damageCri = reduceCe(this.damageCri);
|
||||
return newAttr;
|
||||
}
|
||||
|
||||
// 战力计算
|
||||
public calCe() {
|
||||
let { hp, atk, def, mdef } = this.setMainAttrRatio();
|
||||
let { cri, flee, damageIncrease, damageDecrease, damageCri } = this.setSubAttrRatio();
|
||||
let { hp, atk, def, mdef } = this.getRealMainAttr();
|
||||
let { cri, flee, damageIncrease, damageDecrease, damageCri } = this.getRealSubAttr();
|
||||
let putHit = CE_CONST.PUT_HIT / HERO_SUB_ATTR_RATIO;
|
||||
let putAntCri = CE_CONST.PUT_ANT_CRI / HERO_SUB_ATTR_RATIO;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user