feat(武将): 重生体验优化 ca13e8be3 至 4ee246e78

This commit is contained in:
luying
2023-08-29 16:29:19 +08:00
parent 878d80f069
commit 820bfe170a
8 changed files with 155 additions and 9 deletions
@@ -63,6 +63,15 @@ export async function calculateCeWithHero(type: HERO_SYSTEM_TYPE, roleId: string
return { heroes, curHero, curRole }
}
export async function calculateCeWithHeroes(type: HERO_SYSTEM_TYPE, roleId: string, serverId: number, sid: string, heroUpdate: HeroUpdate[], param: Param = {}) {
let heroUpdates = new Map<number, HeroUpdate>();
for(let val of heroUpdate){
heroUpdates.set(val.hid, val);
}
let { heroes, curRole } = await calculateCes(type, roleId, serverId, sid, heroUpdates, param.roleUpdate||{}, param.roleIncUpdate||{}, param);
return { heroes, curRole }
}
export async function calculateCeWithRole(type: HERO_SYSTEM_TYPE, roleId: string, serverId: number, sid: string, roleUpdate: RoleUpdate, param: Param = {}) {
let { heroes, curRole } = await calculateCes(type, roleId, serverId, sid, new Map(), roleUpdate, {}, param);
return { heroes, curRole };
@@ -352,6 +361,8 @@ export async function calculateCes(type: HERO_SYSTEM_TYPE, roleId: string, serve
calCe.setEquipSuit(hid, skinId, ePlace);
calCe.setScroll(hid, scrollStar, scrollQuality, scrollColorStar);
}
calCe.setTitle(role.title);
calCe.setTeraph(role.teraphs);
@@ -447,6 +458,33 @@ export async function calculateCes(type: HERO_SYSTEM_TYPE, roleId: string, serve
break;
}
case HERO_SYSTEM_TYPE.REBORN_CAL: // 42. 重生
{
let hids = [];
let { jewels, heroes, artifacts } = param;
for (let { hid, skinId, lv, quality, star, starStage, colorStar, colorStarStage, job, jobStage, connections, skins, scrollStar, scrollQuality, scrollColorStar, ePlace } of heroes) {
calCe.setHeroBase(hid, skinId);
calCe.setHeroLv(hid, lv);
calCe.setHeroStar(hid, job, quality, star, starStage, colorStar, colorStarStage);
calCe.setJob(hid, job, jobStage);
calCe.setConnection(hid, connections);
calCe.setTalent(hid, skins);
for (let { id, equipId, star, starStage, quality, qualityStage, lv: equipLv, stones, jewel } of ePlace) {
calCe.setEquipQuality(hid, id, equipId, quality, qualityStage);
calCe.setEquipStrength(hid, id, equipId, equipLv);
calCe.setEquipStar(hid, id, equipId, star, starStage);
let curJewel = jewels.find(cur => cur.seqId == jewel);
calCe.setJewel(hid, id, stones, curJewel);
calCe.setStone(hid, id, stones);
}
let artifact = artifacts.find(cur => cur.hid == hid);
if (artifact) calCe.setPutArtifact(hid, skinId, job, artifact);
calCe.setEquipSuit(hid, skinId, ePlace);
hids.push(hid);
}
ceChangeTxt.push(`重生武将重新计算, 重生武将hids:${hids}`);
break;
}
}
let { heroCe, roleInc } = calCe.getCeInc(); // 计算战力,获得有变化的武将战力
let changeHids: number[] = [];