添加技能解锁战力计算
This commit is contained in:
@@ -10,8 +10,8 @@ import { resResult } from '../pubUtils/util';
|
||||
import Hero from '../db/Hero';
|
||||
import { RoleModel } from '../db/Role';
|
||||
import { CeAttrData, CeAttr } from '../db/BaseModel';
|
||||
import { getJobInfoById, getJobByGradeAndClass, getHeroInfoById, getHeroStar, getHeroWake, getFiendShipLevel, getFriendShipById } from '../pubUtils/gamedata';
|
||||
import { getAttrNameByJobStage, getAttrCeRatio, getAtrrNameById, ABI_TYPE_TO_STAGE, ABI_STAGE} from '../consts/abilityConst';
|
||||
import { getJobInfoById, getJobByGradeAndClass, getHeroInfoById, getHeroStar, getHeroWake, getFiendShipLevel, getFriendShipById, getHeroSkillById, getSeidById } from '../pubUtils/gamedata';
|
||||
import { getAttrNameByJobStage, getAttrCeRatio, getAtrrNameById, ABI_TYPE_TO_STAGE, ABI_STAGE, SEID_TYPE, HERO_ATTR} from '../consts/abilityConst';
|
||||
const HERO_CE_RATIO = 100;
|
||||
//战力计算TODO
|
||||
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);
|
||||
}
|
||||
|
||||
addSeidEffect(reIncAttr, addSeidList, removeSeidList); // 处理加值
|
||||
addSeidEffect(hero, reIncAttr, addSeidList, removeSeidList); // 处理加值
|
||||
if(!hero.ceAttr) hero.ceAttr = new CeAttr();
|
||||
for (let attrName in reIncAttr) {
|
||||
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
|
||||
}
|
||||
|
||||
// 解锁技能
|
||||
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;//属性增量可以是多个
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
Reference in New Issue
Block a user