战力:修复bug

This commit is contained in:
luying
2022-03-30 21:19:08 +08:00
parent 22b42fd5d6
commit b4ac87d8f5
5 changed files with 31 additions and 16 deletions
@@ -356,7 +356,7 @@ export class EquipHandler {
// 目标镶嵌上 // 目标镶嵌上
let curJewel = await JewelModel.putOnOrOff(seqId, hid, ePlaceId); let curJewel = await JewelModel.putOnOrOff(seqId, hid, ePlaceId);
let { newEplace, updatedEplace } = updateEplace(oldEplace, ePlaceId, { jewel: seqId }); let { newEplace, updatedEplace } = updateEplace(oldEplace, ePlaceId, { jewel: seqId });
await calculateCeWithHero(HERO_SYSTEM_TYPE.EQUIP_JEWEL, roleId, serverId, sid, hid, { ePlace: newEplace }, { ePlaceIds: [ePlaceId], jewels: [curJewel] }); await calculateCeWithHero(HERO_SYSTEM_TYPE.EQUIP_JEWEL, roleId, serverId, sid, hid, { ePlace: newEplace }, { ePlaceId, jewel: curJewel });
await checkTaskInPutJewel(serverId, roleId, sid, oldEplace, newEplace, ePlaceId, originJewel, curJewel); await checkTaskInPutJewel(serverId, roleId, sid, oldEplace, newEplace, ePlaceId, originJewel, curJewel);
let curHero = { let curHero = {
@@ -384,7 +384,7 @@ export class EquipHandler {
let curJewel = await JewelModel.putOnOrOff(curEquip.jewel, 0, 0); let curJewel = await JewelModel.putOnOrOff(curEquip.jewel, 0, 0);
let { newEplace, updatedEplace } = updateEplace(oldEplace, ePlaceId, { jewel: 0 }); let { newEplace, updatedEplace } = updateEplace(oldEplace, ePlaceId, { jewel: 0 });
await calculateCeWithHero(HERO_SYSTEM_TYPE.EQUIP_JEWEL, roleId, serverId, sid, hid, { ePlace: newEplace }, { ePlaceIds: [ePlaceId], jewels: [] }); await calculateCeWithHero(HERO_SYSTEM_TYPE.EQUIP_JEWEL, roleId, serverId, sid, hid, { ePlace: newEplace }, { ePlaceId, jewel: null });
await checkTaskInPutJewel(serverId, roleId, sid, oldEplace, newEplace, ePlaceId, null, curJewel); await checkTaskInPutJewel(serverId, roleId, sid, oldEplace, newEplace, ePlaceId, null, curJewel);
let curHero = { let curHero = {
+9 -6
View File
@@ -246,7 +246,7 @@ export class CalCe {
for(let { lv, seid } of dicHeroTalent.level) { for(let { lv, seid } of dicHeroTalent.level) {
if(level >= lv) { if(level >= lv) {
if(!seids.has(id)) seids.set(id, []); if(!seids.has(id)) seids.set(id, []);
seids.get(id).push(seid); seids.get(id).push(seid, 0);
} }
} }
} }
@@ -382,13 +382,15 @@ export class CalCe {
// 神像相关 // 神像相关
public setTeraph(teraphs: Teraph[]) { public setTeraph(teraphs: Teraph[]) {
this.data.clearRoleAttr('teraph'); this.data.clearRoleAttr('teraph');
let teraphOfAttrId = new Map<number, number>(); let teraphOfAttrId = new Map<number, number>();
for(let teraph of teraphs) { for(let teraph of teraphs) {
for(let [attrId, value] of teraph.attr) { // 主属性
addToMap(teraphOfAttrId, attrId, value);
}
let dicTeraph = getTeraph(teraph.id, teraph.grade); let dicTeraph = getTeraph(teraph.id, teraph.grade);
for(let [attrId, value] of teraph.attr) { // 主属性
let basic = dicTeraph.basicAttrValue.get(attrId)||0;
addToMap(teraphOfAttrId, attrId, value + basic);
}
for(let [attrId, value] of dicTeraph.assiAttrValue) { // 次属性 for(let [attrId, value] of dicTeraph.assiAttrValue) { // 次属性
addToMap(teraphOfAttrId, attrId, value); addToMap(teraphOfAttrId, attrId, value);
} }
@@ -445,7 +447,8 @@ export class CalCe {
} }
// console.log('effectList', JSON.stringify(effectList)); // console.log('effectList', JSON.stringify(effectList));
for (let { type, gainValueArr: [ability, value] } of effectList) { for (let { type, id, gainValueArr: [ability, value] } of effectList) {
// console.log('##### addToMap type', type, 'id', id, 'ability', ability, 'value', value)
if (type == SEID_TYPE.FIX) { // 加值 if (type == SEID_TYPE.FIX) { // 加值
addToMap(fixUp, ability, value); addToMap(fixUp, ability, value);
} else if (type == SEID_TYPE.MAIN_RATIO||type == SEID_TYPE.MAIN_RATIO_2) { // 主属性加百分比 } else if (type == SEID_TYPE.MAIN_RATIO||type == SEID_TYPE.MAIN_RATIO_2) { // 主属性加百分比
@@ -454,7 +457,7 @@ export class CalCe {
} }
} else if (type == SEID_TYPE.SUB_RATIO||type == SEID_TYPE.SUB_RATIO_2) { // 次级属性加百分比 } else if (type == SEID_TYPE.SUB_RATIO||type == SEID_TYPE.SUB_RATIO_2) { // 次级属性加百分比
if(!ABI_TYPE_MAIN.includes(ability)) { if(!ABI_TYPE_MAIN.includes(ability)) {
addToMap(ratioUp, ability, value * 100); addToMap(ratioUp, ability, value);
} }
} }
+3 -3
View File
@@ -189,9 +189,9 @@ export async function checkTaskInEquipLvUp(serverId: number, roleId: string, sid
export async function checkTaskInPutJewel(serverId: number, roleId: string, sid: string, oldEplace: EPlace[], newEplace: EPlace[], ePlaceId: number, originJewel: JewelType, curJewel: JewelType) { export async function checkTaskInPutJewel(serverId: number, roleId: string, sid: string, oldEplace: EPlace[], newEplace: EPlace[], ePlaceId: number, originJewel: JewelType, curJewel: JewelType) {
let { oldEquip, newEquip } = getEquipById(oldEplace, newEplace, ePlaceId); let { oldEquip, newEquip } = getEquipById(oldEplace, newEplace, ePlaceId);
let task = new CheckTask(serverId, roleId); let task = new CheckTask(serverId, roleId);
task.setParam(TASK_TYPE.EQUIP_PUT_JEWEL, { oldEquip, newEplace, jewels: [originJewel, curJewel ] }); task.setParam(TASK_TYPE.EQUIP_PUT_JEWEL, { oldEquip, newEquip, jewels: [originJewel, curJewel ] });
task.setParam(TASK_TYPE.EQUIP_PUT_JEWEL_CNT, { oldEquip, newEquip }); task.setParam(TASK_TYPE.EQUIP_PUT_JEWEL_CNT, { oldEquip, newEquip });
task.setParam(TASK_TYPE.EQUIP_JEWEL_RANDSE_CNT, { oldEquip, newEplace, jewels: [originJewel, curJewel ] }); task.setParam(TASK_TYPE.EQUIP_JEWEL_RANDSE_CNT, { oldEquip, newEquip, jewels: [originJewel, curJewel ] });
await task.saveAndPush(sid); await task.saveAndPush(sid);
} }
@@ -202,7 +202,7 @@ export async function checkTaskInPutStone(serverId: number, roleId: string, sid:
task.setParam(TASK_TYPE.EQUIP_PUT_STONE_CNT, { oldEquip, newEquip }); task.setParam(TASK_TYPE.EQUIP_PUT_STONE_CNT, { oldEquip, newEquip });
task.setParam(TASK_TYPE.EQUIP_STONE_CNT, { oldEquip, newEquip }); task.setParam(TASK_TYPE.EQUIP_STONE_CNT, { oldEquip, newEquip });
task.setParam(TASK_TYPE.EQUIP_STONE_CNT_LV, { oldEquip, newEquip }); task.setParam(TASK_TYPE.EQUIP_STONE_CNT_LV, { oldEquip, newEquip });
task.setParam(TASK_TYPE.EQUIP_JEWEL_RANDSE_CNT, { oldEquip, newEplace, jewels: [jewel ] }); task.setParam(TASK_TYPE.EQUIP_JEWEL_RANDSE_CNT, { oldEquip, newEquip, jewels: [jewel ] });
await task.saveAndPush(sid); await task.saveAndPush(sid);
} }
@@ -36,7 +36,7 @@ export function loadRandomEffectPool() {
arr.forEach(o => { arr.forEach(o => {
o.rate = parseRate(o.count); o.rate = parseRate(o.count);
o.gainValueArr = parseNumberList(o.gainvalue); o.gainValueArr = parseNumberList(o.gainValue);
dicRandomEffectPool.set(o.id, o); dicRandomEffectPool.set(o.id, o);
dicRandomEffectPoolByGroupAndLv.set(`${o.group}_${o.level}`, o.id); dicRandomEffectPoolByGroupAndLv.set(`${o.group}_${o.level}`, o.id);
}); });
+16 -4
View File
@@ -23,6 +23,7 @@ export interface DicTeraph {
readonly upMaterial:Array<RewardInter>; readonly upMaterial:Array<RewardInter>;
readonly assiAttrValue:Map<number, number>; // 次级属性 readonly assiAttrValue:Map<number, number>; // 次级属性
readonly basicAttrValue:Map<number, number>; // 主属性
readonly upGradeMaterial:Array<RewardInter>; readonly upGradeMaterial:Array<RewardInter>;
} }
export const dicTeraph = new Map<string, DicTeraph>(); export const dicTeraph = new Map<string, DicTeraph>();
@@ -42,6 +43,7 @@ export function loadTeraph() {
criEffect: true, criEffect: true,
upMaterial: true, upMaterial: true,
assiAttrValue: true, assiAttrValue: true,
basicAttrValue: true,
upGradeMaterial: true, upGradeMaterial: true,
} }
@@ -51,6 +53,7 @@ export function loadTeraph() {
o.upMaterial = parseGoodStr(o.upMaterial); o.upMaterial = parseGoodStr(o.upMaterial);
o.mainAttrMax = parseMainAttrMax(o); o.mainAttrMax = parseMainAttrMax(o);
o.mainAttrUp = parseMainAttrUp(o); o.mainAttrUp = parseMainAttrUp(o);
o.basicAttrValue = parseBasicAttr(o);
dicTeraph.set(o.index + '_' + o.grade, _.pick(o, Object.keys(DicTeraphKeys))); dicTeraph.set(o.index + '_' + o.grade, _.pick(o, Object.keys(DicTeraphKeys)));
}); });
@@ -72,10 +75,10 @@ function parseAttr(str: string) {
function parseMainAttrMax(elem) { function parseMainAttrMax(elem) {
let result = new Map<number, number>(); let result = new Map<number, number>();
result.set(ABI_TYPE.ABI_HP, elem.hpMax); result.set(ABI_TYPE.ABI_HP, elem.hpMax - elem.hpBasis);
result.set(ABI_TYPE.ABI_ATK, elem.atkMax); result.set(ABI_TYPE.ABI_ATK, elem.atkMax - elem.atkBasis);
result.set(ABI_TYPE.ABI_DEF, elem.defMax); result.set(ABI_TYPE.ABI_DEF, elem.defMax - elem.defBasis);
result.set(ABI_TYPE.ABI_MDEF, elem.mdefMax); result.set(ABI_TYPE.ABI_MDEF, elem.mdefMax - elem.mdefBasis);
return result return result
} }
@@ -87,3 +90,12 @@ function parseMainAttrUp(elem) {
result.set(ABI_TYPE.ABI_MDEF, elem.mdefUp); result.set(ABI_TYPE.ABI_MDEF, elem.mdefUp);
return result return result
} }
function parseBasicAttr(elem) {
let result = new Map<number, number>();
result.set(ABI_TYPE.ABI_HP, elem.hpBasis);
result.set(ABI_TYPE.ABI_ATK, elem.atkBasis);
result.set(ABI_TYPE.ABI_DEF, elem.defBasis);
result.set(ABI_TYPE.ABI_MDEF, elem.mdefBasis);
return result
}