皮肤:武将、时装表修改
This commit is contained in:
+32
-94
@@ -104,9 +104,6 @@ export async function reCalAllHeroCe(type: number, roleId: string, update: RoleU
|
||||
async function reCalRoleAttr(type: number, heros: Array<HeroType>, role: RoleType, update: RoleUpdate, args: Array<number>) {
|
||||
let { attr: roleAttrs } = role;
|
||||
switch (type) {
|
||||
case HERO_SYSTEM_TYPE.INIT:
|
||||
roleAttrs = calRoleInit(role);
|
||||
break;
|
||||
case HERO_SYSTEM_TYPE.ADD_SKIN:
|
||||
roleAttrs = calHeroAddSkin(role, args);
|
||||
break;
|
||||
@@ -143,9 +140,6 @@ export function calPlayerCe(hero: HeroType, update: HeroUpdate, type: number, ar
|
||||
let removeSeidList = new Array<number>();
|
||||
|
||||
switch (type) {
|
||||
case HERO_SYSTEM_TYPE.INIT:
|
||||
heroAttrs = calHeroInitIncAttr(hero, addSeidList, removeSeidList); // args: 升的星盘
|
||||
break;
|
||||
case HERO_SYSTEM_TYPE.STAR:
|
||||
case HERO_SYSTEM_TYPE.LVUP:
|
||||
case HERO_SYSTEM_TYPE.COLORSTAR:
|
||||
@@ -159,7 +153,7 @@ export function calPlayerCe(hero: HeroType, update: HeroUpdate, type: number, ar
|
||||
heroAttrs = calHeroJobStageUpIncAttr(hero, update, addSeidList, removeSeidList);
|
||||
break;
|
||||
case HERO_SYSTEM_TYPE.SKIN:
|
||||
heroAttrs = calHeroWearSkinIncAttr(hero, args[0], args[1], addSeidList, removeSeidList);
|
||||
heroAttrs = calHeroWearSkinIncAttr(hero, update, addSeidList, removeSeidList);
|
||||
break;
|
||||
case HERO_SYSTEM_TYPE.FAVOUR:
|
||||
heroAttrs = calHeroFavourUpIncAttr(hero, update);
|
||||
@@ -241,41 +235,6 @@ export async function calculatetopLineup(role: RoleType, hid?: number, ce?: numb
|
||||
return { topLineup, topLineupCe };
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {HeroType} hero 武将数据
|
||||
* @param {number[]} addSeidList 用于更新被动
|
||||
* @param {number[]} removeSeidList 用于更新被动
|
||||
*/
|
||||
export function calHeroInitIncAttr(hero: HeroType, addSeidList: Array<number>, removeSeidList: Array<number>) {
|
||||
// try{
|
||||
delete hero._id;
|
||||
let heroAttrs = calHeroStarIncAttr(hero, hero, HERO_SYSTEM_TYPE.INIT, addSeidList, removeSeidList);
|
||||
heroAttrs = calHeroWearSkinIncAttr(hero, gameData.hero.get(hero.hid)?.initialSkin||0, 0, addSeidList, removeSeidList, true);
|
||||
heroAttrs = calHeroJobAttr(hero, hero, addSeidList, removeSeidList);
|
||||
return heroAttrs;
|
||||
// }catch(e) {
|
||||
// console.error(e);
|
||||
// return [];
|
||||
// }
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始全局加成
|
||||
* @param args
|
||||
* @param ceAttr
|
||||
*/
|
||||
function calRoleInit(role: RoleType) {
|
||||
let { attr: roleAttrs, teraphs } = role;
|
||||
delete role._id;
|
||||
roleAttrs = calTitle({...role, title: 0}, role); // 计算初始爵位带来的全局
|
||||
for(let {id} of teraphs) {
|
||||
roleAttrs = calTeraphMainAttr({ ...role, teraphs: [] }, role, id);
|
||||
}
|
||||
role.attr = roleAttrs;
|
||||
return roleAttrs;
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加皮肤全局加成
|
||||
* @param args
|
||||
@@ -304,11 +263,10 @@ function calHeroAddSkin(role: RoleType, skinIds: Array<number>) {
|
||||
* @param {number[]} removeSeidList 用于更新被动
|
||||
*/
|
||||
export function calHeroStarIncAttr(originHero: HeroType, update: HeroUpdate, type: number, addSeidList: Array<number>, removeSeidList: Array<number>) {
|
||||
let isInit = type == HERO_SYSTEM_TYPE.INIT;
|
||||
let { hid, star: originStar, starStage: originStarStage, quality: originQuality, colorStar: originColorStar, colorStarStage: originColorStarStage, attr: heroAttrs, skins, lv: oldLv } = originHero;
|
||||
let { star = originStar, starStage = originStarStage, quality = originQuality, colorStar = originColorStar, colorStarStage = originColorStarStage, lv = oldLv } = update;
|
||||
let { star: originStar, starStage: originStarStage, quality: originQuality, colorStar: originColorStar, colorStarStage: originColorStarStage, attr: heroAttrs, skinId: originSkinId, lv: oldLv } = originHero;
|
||||
let { star = originStar, starStage = originStarStage, quality = originQuality, colorStar = originColorStar, colorStarStage = originColorStarStage, skinId = originSkinId, lv = oldLv } = update;
|
||||
|
||||
const dicHero = gameData.hero.get(hid);
|
||||
const dicHero = gameData.hero.get(skinId);
|
||||
|
||||
const isWake = colorStar > 0; // 是否觉醒,只要激活了觉醒,彩星就会 > 1
|
||||
const isFirstWake = colorStar > 0 && originColorStar <= 0; // 是否是初次觉醒
|
||||
@@ -317,14 +275,11 @@ export function calHeroStarIncAttr(originHero: HeroType, update: HeroUpdate, typ
|
||||
if(starStage == ABI_STAGE.START) star--;
|
||||
if(colorStarStage == ABI_STAGE.START) colorStar--;
|
||||
|
||||
const dicJob = gameData.job.get(dicHero.jobid);
|
||||
const dicStar = isWake ? getHeroWakeByQuality(dicJob.job_class, dicHero.quality, colorStar) : getHeroStarByQuality(dicJob.job_class, quality, star); // 星级表
|
||||
const dicStar = isWake ? getHeroWakeByQuality(dicHero.jobClass, dicHero.quality, colorStar) : getHeroStarByQuality(dicHero.jobClass, quality, star); // 星级表
|
||||
|
||||
|
||||
let stages = new Array<number>(); // 需要升级的阶
|
||||
if (type == HERO_SYSTEM_TYPE.INIT) {
|
||||
stages = getAllAttrStage();
|
||||
} else if (type == HERO_SYSTEM_TYPE.LVUP) {
|
||||
if (type == HERO_SYSTEM_TYPE.LVUP) {
|
||||
stages = getAllAttrStage();
|
||||
} else if (type == HERO_SYSTEM_TYPE.STAR) {
|
||||
let end = isUpStar? ABI_STAGE.END: starStage;
|
||||
@@ -350,6 +305,8 @@ export function calHeroStarIncAttr(originHero: HeroType, update: HeroUpdate, typ
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (type == HERO_SYSTEM_TYPE.SKIN) {
|
||||
stages = getAllAttrStage();
|
||||
}
|
||||
for (let stage of stages) {
|
||||
|
||||
@@ -364,23 +321,19 @@ export function calHeroStarIncAttr(originHero: HeroType, update: HeroUpdate, typ
|
||||
updateHeroAttr(heroAttrs, targetAttrId, { set: { base: newBase } });
|
||||
}
|
||||
|
||||
// 武将被动技能,初始时候还没有皮肤,就先不算被动
|
||||
if(skins.length > 0) {
|
||||
let curSkin = skins.find(cur => cur.enable);
|
||||
let curSeidList = getSeidListOfFashion(curSkin.id, star, colorStar);
|
||||
let preSeidList = getSeidListOfFashion(curSkin.id, isInit ? 0 : originStar, isInit ? 0 : originColorStar);
|
||||
|
||||
curSeidList.forEach((seid, type) => {
|
||||
if (!preSeidList.has(type)) {
|
||||
addSeidList.push(seid, 0);
|
||||
}
|
||||
});
|
||||
preSeidList.forEach((seid, type) => {
|
||||
if (!curSeidList.has(type)) {
|
||||
removeSeidList.push(seid, 0);
|
||||
}
|
||||
});
|
||||
}
|
||||
let curSeidList = getSeidListOfFashion(skinId, star, colorStar);
|
||||
let preSeidList = getSeidListOfFashion(originSkinId, originStar, originColorStar);
|
||||
|
||||
curSeidList.forEach((seid, type) => {
|
||||
if (!preSeidList.has(type)) {
|
||||
addSeidList.push(seid, 0);
|
||||
}
|
||||
});
|
||||
preSeidList.forEach((seid, type) => {
|
||||
if (!curSeidList.has(type)) {
|
||||
removeSeidList.push(seid, 0);
|
||||
}
|
||||
});
|
||||
|
||||
originHero.attr = heroAttrs;
|
||||
return heroAttrs;//属性增量可以是多个
|
||||
@@ -434,16 +387,15 @@ function updateRoleAttr(roleAttrs: CeAttrDataRole[], id: number, update: { inc?:
|
||||
}
|
||||
/**
|
||||
* 获取皮肤上的seid
|
||||
* @param fashionid
|
||||
* @param skinId
|
||||
* @param originStar
|
||||
* @param originColorStar
|
||||
*/
|
||||
function getSeidListOfFashion(fashionid: number, originStar: number, originColorStar: number) {
|
||||
function getSeidListOfFashion(skinId: number, originStar: number, originColorStar: number) {
|
||||
let seidList = new Map<number, number>(); // type => seid
|
||||
if (!gameData.fashion.has(fashionid)) return seidList;
|
||||
let dicHero = gameData.hero.get(skinId);
|
||||
|
||||
let { skillId } = gameData.fashion.get(fashionid);
|
||||
let { starSeidArr, colorStarSeidArr } = gameData.heroSkill.get(skillId);
|
||||
let { starSeidArr, colorStarSeidArr } = gameData.heroSkill.get(dicHero.skill);
|
||||
for (let { star, value, type } of starSeidArr) {
|
||||
if (originStar >= star) {
|
||||
seidList.set(type, value);
|
||||
@@ -558,10 +510,13 @@ export function calHeroJobAttr(originHero: HeroType, hero: HeroUpdate, addSeidLi
|
||||
* @param {number[]} removeSeidList 用于更新被动
|
||||
* @param {boolean} isInit 是否是计算初始战力
|
||||
*/
|
||||
export function calHeroWearSkinIncAttr(originHero: HeroType, wearSkinId: number, pullSkinId: number, addSeidList: number[], removeSeidList: number[], isInit: boolean = false) {
|
||||
let { attr: heroAttrs } = originHero;
|
||||
let addSkin = gameData.fashion.get(wearSkinId);
|
||||
let delSkin = gameData.fashion.get(pullSkinId);
|
||||
export function calHeroWearSkinIncAttr(originHero: HeroType, update: HeroUpdate, addSeidList: number[], removeSeidList: number[]) {
|
||||
let { attr: heroAttrs, skinId: originSkinId } = originHero;
|
||||
let { skinId = originSkinId } = update;
|
||||
calHeroStarIncAttr(originHero, update, HERO_SYSTEM_TYPE.SKIN, addSeidList, removeSeidList);
|
||||
|
||||
let addSkin = gameData.fashionBySkinId.get(skinId);
|
||||
let delSkin = gameData.fashionBySkinId.get(originSkinId);
|
||||
|
||||
if (delSkin) {
|
||||
for (let attr of delSkin.actorAttr) {
|
||||
@@ -573,23 +528,6 @@ export function calHeroWearSkinIncAttr(originHero: HeroType, wearSkinId: number,
|
||||
let fixUp = attr.number * HERO_CE_RATIO;
|
||||
updateHeroAttr(heroAttrs, attr.id, { inc: { fixUp } });
|
||||
}
|
||||
|
||||
if (!isInit) { // 初始的时候,这一段技能在calHeroStarIncAttr里计算了,不用重复算
|
||||
let { star, colorStar } = originHero;
|
||||
|
||||
let curSeidList = getSeidListOfFashion(wearSkinId, star, colorStar);
|
||||
let preSeidList = getSeidListOfFashion(pullSkinId, star, colorStar);
|
||||
curSeidList.forEach((seid, type) => {
|
||||
if (!preSeidList.has(type)) {
|
||||
removeSeidList.push(seid, 0);
|
||||
}
|
||||
});
|
||||
preSeidList.forEach((seid, type) => {
|
||||
if (!curSeidList.has(type)) {
|
||||
addSeidList.push(seid, 0);
|
||||
}
|
||||
});
|
||||
}
|
||||
originHero.attr = heroAttrs;
|
||||
return heroAttrs;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user