修改远征创建记录逻辑
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { getHeroInfoById, getStarRatio, getHeroSkillById, getSeidById, getOlySeidByType, getGoodById } from "./gamedata";
|
||||
import { ABI_TYPE, SEID_TYPE } from "../consts/abilityConst";
|
||||
import { EXPRESSION } from '../consts/consts';
|
||||
import { WAR_JSON_ATTRIBUTE_TYPE, EXPRESSION } from '../consts/consts';
|
||||
|
||||
export default class Actor {
|
||||
private hid: number = 0;
|
||||
@@ -14,7 +14,7 @@ export default class Actor {
|
||||
private seidList:Array<any> = new Array<any>(3);
|
||||
private effectList:Map<number,Array<any> > = new Map<number,Array<any> >();
|
||||
|
||||
constructor(hero: any) { // 从数据库拿到的hero
|
||||
initHero(hero: any) { // 从数据库拿到的hero
|
||||
this.hid = hero.hid;
|
||||
this.lv = hero.lv;
|
||||
this.oldCe = hero.ce;
|
||||
@@ -258,29 +258,13 @@ export default class Actor {
|
||||
|
||||
calculateCE() {
|
||||
// 武将
|
||||
let hp = this.getRealAbility(ABI_TYPE.ABI_HP); console.log(this.hid, 'hp', hp);
|
||||
let atk = this.getRealAbility(ABI_TYPE.ABI_ATK); console.log(this.hid, 'atk', atk);
|
||||
let matk = this.getRealAbility(ABI_TYPE.ABI_MATK); console.log(this.hid, 'matk', matk);
|
||||
let def = this.getRealAbility(ABI_TYPE.ABI_DEF); console.log(this.hid, 'def', def);
|
||||
let mdef = this.getRealAbility(ABI_TYPE.ABI_MDEF); console.log(this.hid, 'mdef', mdef);
|
||||
let agi = this.getRealAbility(ABI_TYPE.ABI_AGI); console.log(this.hid, 'agi', agi);
|
||||
let speed = this.getRealAbility(ABI_TYPE.ABI_SPEED); console.log(this.hid, 'speed', speed);
|
||||
let luk = this.getRealAbility(ABI_TYPE.ABI_LUK); console.log(this.hid, 'luk', luk);
|
||||
let hit = this.getRealAbility(ABI_TYPE.ABI_HIT); console.log(this.hid, 'hit', hit);
|
||||
let cri = this.getRealAbility(ABI_TYPE.ABI_CRI); console.log(this.hid, 'cri', cri);
|
||||
let flee = this.getRealAbility(ABI_TYPE.ABI_FLEE); console.log(this.hid, 'flee', flee);
|
||||
let antCri = this.getRealAbility(ABI_TYPE.ABI_ANT_CRI); console.log(this.hid, 'antCri', antCri);
|
||||
let damageIncrease = this.getRealAbility(ABI_TYPE.ABI_DAMAGE_INCREASE); console.log(this.hid, 'damageIncrease', damageIncrease);
|
||||
let damageDecrease = this.getRealAbility(ABI_TYPE.ABI_DAMAGE_DECREASE); console.log(this.hid, 'damageDecrease', damageDecrease);
|
||||
let defIngnore = this.getRealAbility(ABI_TYPE.ABI_DEF_IGNORE); console.log(this.hid, 'defIngnore', defIngnore);
|
||||
let bloodSuck = this.getRealAbility(ABI_TYPE.ABI_BLOOD_SUCK); console.log(this.hid, 'bloodSuck', bloodSuck);
|
||||
let ce = 0;
|
||||
try {
|
||||
ce = eval(EXPRESSION.CE);
|
||||
} catch(e) {
|
||||
console.error('expression wrong');
|
||||
let json = {hp: 0, atk: 0, matk: 0, def: 0, mdef: 0, agi: 0, speed: 0, luk: 0, hit: 0, cri: 0, flee: 0, antCri: 0, damageIncrease: 0, damageDecrease: 0, defIngnore: 0, bloodSuck: 0};
|
||||
|
||||
for(let i = ABI_TYPE.ABI_HP;i < ABI_TYPE.ABI_MAX;i++){
|
||||
let field = WAR_JSON_ATTRIBUTE_TYPE[i];
|
||||
json[field] = this.getRealAbility(i);
|
||||
}
|
||||
console.log(this.hid, 'ce', ce);
|
||||
let ce = this.calculateCEByExpression(json);
|
||||
|
||||
// 装备
|
||||
for(let equip of this.equips) {
|
||||
@@ -294,6 +278,18 @@ export default class Actor {
|
||||
return Math.floor(ce);
|
||||
}
|
||||
|
||||
calculateCEByExpression(json: {hp:number, atk: number, matk: number, def: number, mdef: number, agi: number, luk: number, hit: number, cri: number, flee: number, antCri: number, damageIncrease: number, damageDecrease: number, defIngnore: number, bloodSuck: number}): number {
|
||||
let {hp, atk, matk, def, mdef, agi, luk, hit, cri, flee, antCri, damageIncrease, damageDecrease, defIngnore, bloodSuck } = json;
|
||||
console.log(JSON.stringify({hp, atk, matk, def, mdef, agi, luk, hit, cri, flee, antCri, damageIncrease, damageDecrease, defIngnore, bloodSuck}));
|
||||
|
||||
let ce = 0;
|
||||
try {
|
||||
ce = eval(EXPRESSION.CE);
|
||||
} catch(e) {
|
||||
console.error('expression wrong');
|
||||
}
|
||||
return ce
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user