添加技能解锁战力计算
This commit is contained in:
@@ -10,8 +10,8 @@ import { resResult } from '../pubUtils/util';
|
|||||||
import Hero from '../db/Hero';
|
import Hero from '../db/Hero';
|
||||||
import { RoleModel } from '../db/Role';
|
import { RoleModel } from '../db/Role';
|
||||||
import { CeAttrData, CeAttr } from '../db/BaseModel';
|
import { CeAttrData, CeAttr } from '../db/BaseModel';
|
||||||
import { getJobInfoById, getJobByGradeAndClass, getHeroInfoById, getHeroStar, getHeroWake, getFiendShipLevel, getFriendShipById } from '../pubUtils/gamedata';
|
import { getJobInfoById, getJobByGradeAndClass, getHeroInfoById, getHeroStar, getHeroWake, getFiendShipLevel, getFriendShipById, getHeroSkillById, getSeidById } from '../pubUtils/gamedata';
|
||||||
import { getAttrNameByJobStage, getAttrCeRatio, getAtrrNameById, ABI_TYPE_TO_STAGE, ABI_STAGE} from '../consts/abilityConst';
|
import { getAttrNameByJobStage, getAttrCeRatio, getAtrrNameById, ABI_TYPE_TO_STAGE, ABI_STAGE, SEID_TYPE, HERO_ATTR} from '../consts/abilityConst';
|
||||||
const HERO_CE_RATIO = 100;
|
const HERO_CE_RATIO = 100;
|
||||||
//战力计算TODO
|
//战力计算TODO
|
||||||
export function calPlayerCe(hero: any, type: number, args: Array<number>) {
|
export function calPlayerCe(hero: any, type: number, args: Array<number>) {
|
||||||
@@ -28,7 +28,7 @@ export function calPlayerCe(hero: any, type: number, args: Array<number>) {
|
|||||||
reIncAttr = calHeroTrainIncAttr(hero);
|
reIncAttr = calHeroTrainIncAttr(hero);
|
||||||
}
|
}
|
||||||
|
|
||||||
addSeidEffect(reIncAttr, addSeidList, removeSeidList); // 处理加值
|
addSeidEffect(hero, reIncAttr, addSeidList, removeSeidList); // 处理加值
|
||||||
if(!hero.ceAttr) hero.ceAttr = new CeAttr();
|
if(!hero.ceAttr) hero.ceAttr = new CeAttr();
|
||||||
for (let attrName in reIncAttr) {
|
for (let attrName in reIncAttr) {
|
||||||
let originalAttrData: CeAttrData = hero.ceAttr[attrName]||new CeAttrData();
|
let originalAttrData: CeAttrData = hero.ceAttr[attrName]||new CeAttrData();
|
||||||
@@ -95,6 +95,24 @@ export function calHeroStarIncAttr (hero: Hero, args: Array<number>, addSeidList
|
|||||||
res[field] = { base: newBase, ratioUp, fixUp}; // base变动,增量为△base * ratio + 0
|
res[field] = { base: newBase, ratioUp, fixUp}; // base变动,增量为△base * ratio + 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 解锁技能
|
||||||
|
if(dicHero.skill){
|
||||||
|
let {starSeidArr, colorStarSeidArr} = getHeroSkillById(dicHero.skill);
|
||||||
|
if(isWake) {
|
||||||
|
for(let {star, value} of starSeidArr){
|
||||||
|
if(hero.star == star){
|
||||||
|
addSeidList.push(value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
for(let {star, value} of colorStarSeidArr){
|
||||||
|
if(hero.colorStar == star){
|
||||||
|
addSeidList.push(value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return res;//属性增量可以是多个
|
return res;//属性增量可以是多个
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -155,6 +173,41 @@ function getFieldByStage(stage: number, jobid: number) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function addSeidEffect(reIncAttr: CeAttr, addSeidList: Array<number>, removeSeidList: Array<number>) {
|
// 添加技能增加的被动属性
|
||||||
|
function addSeidEffect(hero: Hero, reIncAttr: CeAttr, addSeidList: Array<number>, removeSeidList: Array<number>) {
|
||||||
|
|
||||||
|
let effectList = new Array<any>(); // any: dic_zyz_se表内容
|
||||||
|
for(let seid of addSeidList) {
|
||||||
|
let dicSeid = getSeidById(seid);
|
||||||
|
if(dicSeid && dicSeid.id > 0){
|
||||||
|
addSeid(effectList, dicSeid.id, dicSeid.gainValueArr)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for(let {type, gainValueArr: [ability, value]} of effectList) {
|
||||||
|
if(!reIncAttr[HERO_ATTR[ability]]) {
|
||||||
|
reIncAttr[HERO_ATTR[ability]] = new CeAttrData();
|
||||||
|
}
|
||||||
|
if(type == SEID_TYPE.TYPE101) { // 加值
|
||||||
|
reIncAttr[HERO_ATTR[ability]].ratioUp += value;
|
||||||
|
} else if (type == SEID_TYPE.TYPE102) { // 加百分比
|
||||||
|
reIncAttr[HERO_ATTR[ability]].fixUp += value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取dic_zyz_se内容
|
||||||
|
function addSeid(effectList: Array<any>, seidId:number, seidValue = new Array<number>()){
|
||||||
|
// console.log('addSeidEffect', seidId, seidValue)
|
||||||
|
let curSeid = getSeidById(seidId);
|
||||||
|
if(!curSeid) {console.log("seidId not found:"+seidId);return;}
|
||||||
|
if(!seidValue) seidValue = curSeid.gainValueArr;
|
||||||
|
|
||||||
|
if(curSeid.type === 999){
|
||||||
|
for(let i = 0;i < seidValue.length;i++){
|
||||||
|
addSeid(effectList, seidValue[i]);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
effectList.push(curSeid);
|
||||||
}
|
}
|
||||||
+12
-12
@@ -50,18 +50,18 @@ export default class Actor {
|
|||||||
let dicHero = getHeroInfoById(this.hid);
|
let dicHero = getHeroInfoById(this.hid);
|
||||||
// console.log('updateSkillInfo', dicHero.skill, getHeroSkillById(dicHero.skill))
|
// console.log('updateSkillInfo', dicHero.skill, getHeroSkillById(dicHero.skill))
|
||||||
//被动技能
|
//被动技能
|
||||||
if(dicHero.skill){
|
// if(dicHero.skill){
|
||||||
let {seidLvUpArr} = getHeroSkillById(dicHero.skill);
|
// let {seidLvUpArr} = getHeroSkillById(dicHero.skill);
|
||||||
for(let ii = 0;ii < seidLvUpArr.length;ii+=2){
|
// for(let ii = 0;ii < seidLvUpArr.length;ii+=2){
|
||||||
if(this.lv >= seidLvUpArr[ii + 1]){
|
// if(this.lv >= seidLvUpArr[ii + 1]){
|
||||||
let dicSeid = getSeidById(seidLvUpArr[ii]);
|
// let dicSeid = getSeidById(seidLvUpArr[ii]);
|
||||||
// console.log('updateSkillInfo*', seidLvUpArr[ii], dicSeid)
|
// // console.log('updateSkillInfo*', seidLvUpArr[ii], dicSeid)
|
||||||
if(dicSeid){
|
// if(dicSeid){
|
||||||
this.seidList[Math.floor(ii/2)] = dicSeid;
|
// this.seidList[Math.floor(ii/2)] = dicSeid;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
addSeidEffect(seidId:number, seidValue?:Array<number>){
|
addSeidEffect(seidId:number, seidValue?:Array<number>){
|
||||||
|
|||||||
+16
-14
@@ -170,21 +170,23 @@ function parseHeroSkill() {
|
|||||||
const data = gamedata['jsons'][file] || [];
|
const data = gamedata['jsons'][file] || [];
|
||||||
data.forEach(elem => {
|
data.forEach(elem => {
|
||||||
if (elem && elem.skillid) {
|
if (elem && elem.skillid) {
|
||||||
const seidLvUpArr = new Array<number>();
|
let starSeidArr = new Array<{star: number, value: number}>();
|
||||||
let skillArr = (elem.starSeid as string).split('&');
|
let colorStarSeidArr = new Array<{star: number, value: number}>();
|
||||||
let lvUpArr = (elem.starSkill as string).split('&');
|
|
||||||
|
(elem.starSeid as string).split('|').forEach(cur => {
|
||||||
|
if(cur) {
|
||||||
|
let a = cur.split('&');
|
||||||
|
starSeidArr.push({star: parseInt(a[0]), value: parseInt(a[1])});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
(elem.colorStarSeid as string).split('|').forEach(cur => {
|
||||||
|
if(cur) {
|
||||||
|
let a = cur.split('&');
|
||||||
|
colorStarSeidArr.push({star: parseInt(a[0]), value: parseInt(a[1])});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
for(let i = 0;i < skillArr.length;i++){
|
heroSkillInfo.set(elem.skillid, {starSeidArr, colorStarSeidArr});
|
||||||
if(skillArr[i]==="") continue;
|
|
||||||
seidLvUpArr.push(parseInt(skillArr[i]));
|
|
||||||
if(lvUpArr[i]){
|
|
||||||
seidLvUpArr.push(parseInt(lvUpArr[i]));
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
seidLvUpArr.push(1000);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
heroSkillInfo.set(elem.skillid, {seidLvUpArr});
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user