✨ feat(武将): 重生体验优化 ca13e8be3 至 4ee246e78
This commit is contained in:
@@ -1864,6 +1864,13 @@ export function checkRouteParam(route: string, msg: any) {
|
||||
if (!checkNaturalNumbers(msg.hid, msg.id)) return false;
|
||||
break;
|
||||
}
|
||||
case "role.heroHandler.heroReborn":
|
||||
{
|
||||
const { originHid, targetHid } = msg;
|
||||
if (originHid == targetHid) return false;
|
||||
if (!checkNaturalNumbers(originHid, targetHid)) return false;
|
||||
break;
|
||||
}
|
||||
case "role.itemHandler.useItem":
|
||||
{
|
||||
if (!checkNaturalNumbers(msg.id, msg.count)) return false;
|
||||
|
||||
@@ -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[] = [];
|
||||
|
||||
@@ -4,10 +4,10 @@ import { DEFAULT_HEROES, LINEUP_NUM, ROLE_SELECT, TALENT_RELATION_TYPE, TERAPH_R
|
||||
import { DicTeraph } from '../pubUtils/dictionary/DicTeraph';
|
||||
import { Teraph, RoleModel, RoleType, RoleUpdate } from '../db/Role';
|
||||
import { SCHOOL } from '../pubUtils/dicParam';
|
||||
import { gameData, getHeroInitTalent, getHeroStarByQuality } from '../pubUtils/data';
|
||||
import { gameData, getEquipByJobClassAndEPlace, getHeroInitTalent, getHeroStarByQuality } from '../pubUtils/data';
|
||||
import { SchoolModel } from '../db/School';
|
||||
import { SclResultInter, SclPosInter, RewardInter, ItemInter } from '../pubUtils/interface';
|
||||
import { Connect, HeroModel, HeroSkin, HeroType, HeroUpdate, Talent } from '../db/Hero';
|
||||
import { Connect, EPlace, HeroModel, HeroSkin, HeroType, HeroUpdate, Talent } from '../db/Hero';
|
||||
import { SkinUpdate } from '../db/Skin';
|
||||
import { Figure } from '../domain/dbGeneral';
|
||||
import { pick } from 'underscore';
|
||||
@@ -390,4 +390,17 @@ export function replaceAuthorBooks(authorBooks: AuthorBookType[], authorBook: Au
|
||||
authorBooks[index] = authorBook;
|
||||
}
|
||||
return authorBooks;
|
||||
}
|
||||
|
||||
|
||||
export function getHeroNewEplace(hero: HeroType, ePlace: EPlace[]) {
|
||||
const dicHero = gameData.hero.get(hero.skinId);
|
||||
let newEplace = [];
|
||||
for (let eP of ePlace) {
|
||||
const dicEquip = getEquipByJobClassAndEPlace(dicHero?.jobClass, eP.id);
|
||||
if (!dicEquip) continue;
|
||||
// const newEquip = new EPlace(eP.id, dicEquip.id);
|
||||
newEplace.push({ ...eP, equipId: dicEquip.id });
|
||||
}
|
||||
return newEplace;
|
||||
}
|
||||
Reference in New Issue
Block a user