全局:属性修改
This commit is contained in:
@@ -1,8 +1,5 @@
|
||||
// 关卡表
|
||||
import {decodeArrayListStr, readWarJsonFileList} from '../util'
|
||||
import { ABI_TYPE } from '../../consts';
|
||||
import { Attributes } from '../interface';
|
||||
|
||||
|
||||
export interface DicWarJson {
|
||||
|
||||
@@ -33,7 +30,7 @@ export interface DicWarJson {
|
||||
// 角色使用的AI类型
|
||||
readonly initial_ai: number;
|
||||
// 属性
|
||||
readonly attribute: Attributes;
|
||||
readonly attribute: {id: number, val: number}[];
|
||||
// 武将技能
|
||||
readonly skill: string;
|
||||
// 武将被动技能
|
||||
@@ -63,55 +60,15 @@ readWarJsonFileList().forEach(str => {
|
||||
dicWarJson.set(warid, warjson);
|
||||
})
|
||||
|
||||
function parseAttribute(str: string) {
|
||||
|
||||
let attribute: Attributes = {};
|
||||
if(!str) return attribute;
|
||||
|
||||
let arr = decodeArrayListStr(str);
|
||||
for(let [id, value] of arr) {
|
||||
if(isNaN(parseInt(id)) || isNaN(parseInt(value))) {
|
||||
export function parseAttribute(str: string) {
|
||||
let result = new Array<{ id: number, val: number }>();
|
||||
if (!str) return result;
|
||||
let decodeArr = decodeArrayListStr(str);
|
||||
for (let [id, val] of decodeArr) {
|
||||
if (isNaN(parseInt(id)) || isNaN(parseInt(val))) {
|
||||
throw new Error('data table format wrong');
|
||||
}
|
||||
let _id = parseInt(id), _value = parseInt(value);
|
||||
switch(_id) {
|
||||
case ABI_TYPE.ABI_HP:
|
||||
attribute.hp = _value; break;
|
||||
case ABI_TYPE.ABI_ATK:
|
||||
attribute.atk = _value; break;
|
||||
case ABI_TYPE.ABI_MATK:
|
||||
attribute.matk = _value; break;
|
||||
case ABI_TYPE.ABI_DEF:
|
||||
attribute.def = _value; break;
|
||||
case ABI_TYPE.ABI_MDEF:
|
||||
attribute.mdef = _value; break;
|
||||
case ABI_TYPE.ABI_AGI:
|
||||
attribute.agi = _value; break;
|
||||
case ABI_TYPE.ABI_LUK:
|
||||
attribute.luk = _value; break;
|
||||
case ABI_TYPE.ABI_SPEED:
|
||||
attribute.speed = _value; break;
|
||||
case ABI_TYPE.ABI_HIT:
|
||||
attribute.hit = _value; break;
|
||||
case ABI_TYPE.ABI_CRI:
|
||||
attribute.cri = _value; break;
|
||||
case ABI_TYPE.ABI_FLEE:
|
||||
attribute.flee = _value; break;
|
||||
case ABI_TYPE.ABI_ANT_CRI:
|
||||
attribute.antCri = _value; break;
|
||||
case ABI_TYPE.ABI_DAMAGE_INCREASE:
|
||||
attribute.damageIncrease = _value; break;
|
||||
case ABI_TYPE.ABI_DAMAGE_DECREASE:
|
||||
attribute.damageDecrease = _value; break;
|
||||
case ABI_TYPE.ABI_DEF_IGNORE:
|
||||
attribute.defIngnore = _value; break;
|
||||
case ABI_TYPE.ABI_BLOOD_SUCK:
|
||||
attribute.bloodSuck = _value; break;
|
||||
case ABI_TYPE.ABI_AP:
|
||||
attribute.ap = _value; break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
result.push({ id: parseInt(id), val: parseInt(val) });
|
||||
}
|
||||
return attribute
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user