战力:修复切换皮肤后套装属性加错的问题

This commit is contained in:
luying
2022-06-27 13:32:58 +08:00
parent 6e738d62b7
commit 4dcf421ebf
8 changed files with 36 additions and 29 deletions

View File

@@ -58,7 +58,7 @@ export class EquipHandler {
consumes: addConsumeToHero(hero.consumes, dicEquip.composeMaterial),
}
await calculateCeWithHero(HERO_SYSTEM_TYPE.COMPOSE_EQUIP, roleId, serverId, sid, hid, update, { ePlaceId });
await calculateCeWithHero(HERO_SYSTEM_TYPE.COMPOSE_EQUIP, roleId, serverId, sid, hid, update, { ePlaceId, skinId: hero.skinId });
await checkTaskInComposeEquip(serverId, roleId, sid, oldEplace, newEplace);
let curHero = {
@@ -308,9 +308,9 @@ export class EquipHandler {
}
// console.log('### incEquipStarSum', incEquipStarSum)
let { curRole } = await calculateCeWithHero(HERO_SYSTEM_TYPE.EQUIP_STAR, roleId, serverId, sid, hid, update, { ePlaceId, roleIncUpdate: { equipStarSum: incEquipStarSum } });
let { curRole } = await calculateCeWithHero(HERO_SYSTEM_TYPE.EQUIP_STAR, roleId, serverId, sid, hid, update, { ePlaceId, skinId: hero.skinId, roleIncUpdate: { equipStarSum: incEquipStarSum } });
await checkTaskInEquipStarUp(serverId, roleId, sid, oldEplace, newEplace, ePlaceId, hid, isUpStar, curRole.equipStarSum, count);
await checkTaskInEquipStarUp(serverId, roleId, sid, oldEplace, newEplace, ePlaceId, hid, isUpStar, curRole.equipStarSum, count, hero.skinId);
pushEquipStarMax(roleId, roleName, serverId, hid, newEquip, isUpStar);
const curHero = {
@@ -353,7 +353,7 @@ export class EquipHandler {
let canChange = originJewel && checkJewelCanPutOnEquip(originEquip, originJewel);
if(canChange) canSentMineToOrigin = true;
let { newEplace, updatedEplace } = updateEplace(originEplace, ePlaceId, { jewel: canChange? originJewel.seqId: 0 });
await calculateCeWithHero(HERO_SYSTEM_TYPE.EQUIP_JEWEL, roleId, serverId, sid, jewel.hid, { ePlace: newEplace }, { ePlaceId, jewel: canChange? originJewel: null });
await calculateCeWithHero(HERO_SYSTEM_TYPE.EQUIP_JEWEL, roleId, serverId, sid, jewel.hid, { ePlace: newEplace }, { ePlaceId, jewel: canChange? originJewel: null, skinId: originHero.skinId });
await checkTaskInPutJewel(serverId, roleId, sid, originEplace, newEplace, ePlaceId, jewel, canChange? originJewel:null);
originHeroResult = { hid: originHero.hid, ePlace: updatedEplace };
@@ -366,7 +366,7 @@ export class EquipHandler {
// 目标镶嵌上
let curJewel = await JewelModel.putOnOrOff(seqId, hid, ePlaceId);
let { newEplace, updatedEplace } = updateEplace(oldEplace, ePlaceId, { jewel: seqId });
await calculateCeWithHero(HERO_SYSTEM_TYPE.EQUIP_JEWEL, roleId, serverId, sid, hid, { ePlace: newEplace }, { ePlaceId, jewel: curJewel });
await calculateCeWithHero(HERO_SYSTEM_TYPE.EQUIP_JEWEL, roleId, serverId, sid, hid, { ePlace: newEplace }, { ePlaceId, jewel: curJewel, skinId: hero.skinId });
await checkTaskInPutJewel(serverId, roleId, sid, oldEplace, newEplace, ePlaceId, originJewel, curJewel);
let curHero = {
@@ -394,7 +394,7 @@ export class EquipHandler {
let curJewel = await JewelModel.putOnOrOff(curEquip.jewel, 0, 0);
let { newEplace, updatedEplace } = updateEplace(oldEplace, ePlaceId, { jewel: 0 });
await calculateCeWithHero(HERO_SYSTEM_TYPE.EQUIP_JEWEL, roleId, serverId, sid, hid, { ePlace: newEplace }, { ePlaceId, jewel: null });
await calculateCeWithHero(HERO_SYSTEM_TYPE.EQUIP_JEWEL, roleId, serverId, sid, hid, { ePlace: newEplace }, { ePlaceId, jewel: null, skinId: hero.skinId });
await checkTaskInPutJewel(serverId, roleId, sid, oldEplace, newEplace, ePlaceId, null, curJewel);
let curHero = {
@@ -447,7 +447,7 @@ export class EquipHandler {
ePlace: newEplace,
consumes: updateConsumes,
}
await calculateCeWithHero(HERO_SYSTEM_TYPE.EQUIP_STONE, roleId, serverId, sid, hid, update, { ePlaceId, jewel });
await calculateCeWithHero(HERO_SYSTEM_TYPE.EQUIP_STONE, roleId, serverId, sid, hid, update, { ePlaceId, jewel, skinId: hero.skinId });
await checkTaskInPutStone(serverId, roleId, sid, oldEplace, newEplace, ePlaceId, jewel);
let curHero = {
@@ -567,7 +567,7 @@ export class EquipHandler {
// 更新战力
if(hid > 0) {
const hero = await HeroModel.findByHidAndRole(hid, roleId);
await calculateCeWithHero(HERO_SYSTEM_TYPE.JEWEL_RESET_RANDSE, roleId, serverId, sid, hid, { ePlace: hero.ePlace }, { ePlaceId, jewel: newJewel });
await calculateCeWithHero(HERO_SYSTEM_TYPE.JEWEL_RESET_RANDSE, roleId, serverId, sid, hid, { ePlace: hero.ePlace }, { ePlaceId, jewel: newJewel, skinId: hero.skinId });
}
await checkTaskInEquipReset(serverId, roleId, sid);
@@ -649,7 +649,7 @@ export class EquipHandler {
// 更新战力
if(isSuccess && hid > 0) {
const hero = await HeroModel.findByHidAndRole(hid, roleId);
await calculateCeWithHero(HERO_SYSTEM_TYPE.JEWEL_QUENCH, roleId, serverId, sid, hid, { ePlace: hero.ePlace }, { ePlaceId, jewel: newJewel });
await calculateCeWithHero(HERO_SYSTEM_TYPE.JEWEL_QUENCH, roleId, serverId, sid, hid, { ePlace: hero.ePlace }, { ePlaceId, jewel: newJewel, skinId: hero.skinId });
}
await checkTaskInEquipQuench(serverId, roleId, sid, isSuccess);
@@ -771,7 +771,7 @@ export class EquipHandler {
// 更新战力
if(targetJewel.hid > 0) {
const hero = await HeroModel.findByHidAndRole(targetJewel.hid, roleId);
await calculateCeWithHero(HERO_SYSTEM_TYPE.JEWEL_RESET_RANDSE, roleId, serverId, sid, targetJewel.hid, { ePlace: hero.ePlace }, { ePlaceId: targetJewel.ePlaceId, jewel: newJewel });
await calculateCeWithHero(HERO_SYSTEM_TYPE.JEWEL_RESET_RANDSE, roleId, serverId, sid, targetJewel.hid, { ePlace: hero.ePlace }, { ePlaceId: targetJewel.ePlaceId, jewel: newJewel, skinId: hero.skinId });
}

View File

@@ -115,15 +115,17 @@ export async function calculateCes(type: HERO_SYSTEM_TYPE, roleId: string, serve
}
case HERO_SYSTEM_TYPE.SKIN: // 7. 穿皮肤
{
let { hero: { quality, star, starStage, colorStar, colorStarStage } } = param;
let { hero: { quality, star, starStage, colorStar, colorStarStage, jobStage } } = param;
for(let [hid, { skinId, job, ePlace, skins }] of heroUpdates) {
calCe.setHeroBase(hid, skinId);
calCe.setHeroStar(hid, job, quality, star, starStage, colorStar, colorStarStage);
calCe.setJob(hid, job, jobStage);
for(let { id, equipId, quality, qualityStage, lv, star, starStage } of ePlace) {
calCe.setEquipQuality(hid, id, equipId, quality, qualityStage);
calCe.setEquipStrength(hid, id, equipId, lv);
calCe.setEquipStar(hid, id, equipId, star, starStage);
}
calCe.setEquipSuit(hid, skinId, ePlace);
calCe.setTalent(hid, skins);
}
break;
@@ -185,7 +187,7 @@ export async function calculateCes(type: HERO_SYSTEM_TYPE, roleId: string, serve
}
case HERO_SYSTEM_TYPE.COMPOSE_EQUIP: // 21. 合成装备
{
let { ePlaceId } = param;
let { ePlaceId, skinId } = param;
for(let [hid, { ePlace = [] }] of heroUpdates) {
for(let { id, equipId, quality, qualityStage, lv, star, starStage } of ePlace) {
if(ePlaceId == id) {
@@ -194,7 +196,7 @@ export async function calculateCes(type: HERO_SYSTEM_TYPE, roleId: string, serve
calCe.setEquipStar(hid, id, equipId, star, starStage);
}
}
calCe.setEquipSuit(hid, ePlace);
calCe.setEquipSuit(hid, skinId, ePlace);
}
break;
}
@@ -224,14 +226,14 @@ export async function calculateCes(type: HERO_SYSTEM_TYPE, roleId: string, serve
}
case HERO_SYSTEM_TYPE.EQUIP_STAR: // 24. 装备升星
{
let { ePlaceId } = param;
let { ePlaceId, skinId } = param;
for(let [hid, { ePlace = [] }] of heroUpdates) {
for(let { id, equipId, star, starStage } of ePlace) {
if(ePlaceId == id) {
calCe.setEquipStar(hid, id, equipId, star, starStage);
}
}
calCe.setEquipSuit(hid, ePlace);
calCe.setEquipSuit(hid, skinId, ePlace);
}
break;
}
@@ -239,20 +241,20 @@ export async function calculateCes(type: HERO_SYSTEM_TYPE, roleId: string, serve
case HERO_SYSTEM_TYPE.JEWEL_RESET_RANDSE: // 27. 洗练
case HERO_SYSTEM_TYPE.JEWEL_QUENCH: // 28. 淬炼
{
let { ePlaceId, jewel: curJewel } = param;
let { ePlaceId, jewel: curJewel, skinId } = param;
for(let [hid, { ePlace = [] }] of heroUpdates) {
for(let { id, stones } of ePlace) {
if(ePlaceId == id) {
calCe.setJewel(hid, id, stones, curJewel);
}
}
calCe.setEquipSuit(hid, ePlace);
calCe.setEquipSuit(hid, skinId, ePlace);
}
break;
}
case HERO_SYSTEM_TYPE.EQUIP_STONE: // 26. 装备地玉
{
let { ePlaceId, jewel: curJewel } = param;
let { ePlaceId, jewel: curJewel, skinId } = param;
for(let [hid, { ePlace = [] }] of heroUpdates) {
for(let { id, stones } of ePlace) {
if(ePlaceId == id) {
@@ -260,7 +262,7 @@ export async function calculateCes(type: HERO_SYSTEM_TYPE, roleId: string, serve
calCe.setJewel(hid, id, stones, curJewel);
}
}
calCe.setEquipSuit(hid, ePlace);
calCe.setEquipSuit(hid, skinId, ePlace);
}
break;
}

View File

@@ -340,9 +340,9 @@ export class CalCe {
}
// 装备套装
public setEquipSuit(hid: number, ePlace: EPlace[]) {
public setEquipSuit(hid: number, skinId: number, ePlace: EPlace[]) {
this.data.clearHeroAttrByHid(hid, 'equipSuit');
let dicEquipSuit = getEquipSuitByHero(hid);
let dicEquipSuit = getEquipSuitByHero(skinId);
let suitStars: number[] = [];
for(let equipId of dicEquipSuit.equips) {
let equip = ePlace.find(cur => cur.equipId == equipId);

View File

@@ -1008,8 +1008,8 @@ export class CheckSingleTask {
}
case TASK_TYPE.EQUIP_SUIT_SEID_NUM: // 92. x名武将激活X条套装属性
{
let { oldEplace, newEplace, hid } = param;
let dicEquipSuit = getEquipSuitByHero(hid);
let { oldEplace, newEplace, skinId } = param;
let dicEquipSuit = getEquipSuitByHero(skinId);
let oldSuitStars: number[] = [], newSuitStars: number[] = [];
for(let equipId of dicEquipSuit.equips) {
let oldEquip = oldEplace.find(cur => cur.equipId == equipId);

View File

@@ -262,12 +262,12 @@ export async function checkTaskInPutStone(serverId: number, roleId: string, sid:
await task.saveAndPush(sid);
}
export async function checkTaskInEquipStarUp(serverId: number, roleId: string, sid: string, oldEplace: EPlace[], newEplace: EPlace[], ePlaceId: number, hid: number, isUpStar: boolean, equipStarSum: number, count: number) {
export async function checkTaskInEquipStarUp(serverId: number, roleId: string, sid: string, oldEplace: EPlace[], newEplace: EPlace[], ePlaceId: number, hid: number, isUpStar: boolean, equipStarSum: number, count: number, skinId: number) {
let task = new CheckTask(serverId, roleId);
if(isUpStar) {
let { oldEquip, newEquip } = getEquipById(oldEplace, newEplace, ePlaceId);
task.setParam(TASK_TYPE.EQUIP_STAR_UP_TO, { oldEquip, newEquip });
task.setParam(TASK_TYPE.EQUIP_SUIT_SEID_NUM, { oldEplace, newEplace, ePlaceId, hid });
task.setParam(TASK_TYPE.EQUIP_SUIT_SEID_NUM, { oldEplace, newEplace, ePlaceId, skinId });
}
task.setParam(TASK_TYPE.EQUIP_STAR_UP_CNT, { hid, ePlaceId, count });
task.setParam(TASK_TYPE.EQUIP_STAR_UP_CNT_SUM, { count });

View File

@@ -50,6 +50,7 @@ export class TaskParamInter {
oldEquip?: EPlace; // 原装备栏(一个)
newEquip?: EPlace; // 新装备栏(一个)
jewels?: JewelType[]; // 天晶石
skinId?: number; // 皮肤id
skipTower?: boolean;
debugInfo?: {condition: number};

View File

@@ -909,8 +909,8 @@ export function getEquipStarAttrByStage(equipId: number, star: number, starStage
}
}
export function getEquipSuitByHero(hid: number) {
let dicHero = gameData.hero.get(hid);
export function getEquipSuitByHero(skinId: number) {
let dicHero = gameData.hero.get(skinId);
let equipSuitId = gameData.equipSuitByJobClass.get(dicHero.jobClass);
return gameData.equipSuit.get(equipSuitId);
}

View File

@@ -35,7 +35,7 @@ export function loadTitle() {
arr.forEach(o => {
o.mainAttrValue = parseMainAttr(o);
o.assiAttrValue = parseAttr(o.assiAttrValue);
o.assiAttrValue = parseAttr(o.pdi, o.mdi, o.assiAttrValue);
o.material = parseGoodStr(o.material);
dicTitle.set(o.id, _.pick(o, Object.keys(DicTitleKeys)));
});
@@ -43,7 +43,7 @@ export function loadTitle() {
arr = undefined;
}
function parseAttr(str: string) {
function parseAttr(pdi: number, mdi: number, str: string) {
let result = new Map<number, number>();
if(!str) return result;
let decodeArr = decodeArrayListStr(str);
@@ -53,6 +53,10 @@ function parseAttr(str: string) {
}
result.set(parseInt(id), parseInt(value));
}
result.set(ABI_TYPE.ABI_PHYSICAL_DAMAGE_INCREASE, pdi);
result.set(ABI_TYPE.ABI_MAGIC_DAMAGE_INCREASE, mdi);
return result
}