碎片合成bug
This commit is contained in:
@@ -458,27 +458,33 @@ export class EquipHandler {
|
||||
let comJewelMap = {};
|
||||
let ways = [deepCopy(speConsumes)];
|
||||
for (let {id, count} of consumes) {
|
||||
let jewel = getJewelById(id);
|
||||
if (!jewel) {
|
||||
let jewelInfo = getJewelById(id);
|
||||
if (!jewelInfo) {
|
||||
return resResult(STATUS.WRONG_PARMS);
|
||||
}
|
||||
let copyWays = deepCopy(ways);
|
||||
ways = [];
|
||||
count = (count + (comJewelMap[jewel.good_id]||0))/jewel.count;
|
||||
delete comJewelMap[jewel.good_id];
|
||||
let speCount = jewel.specialMaterial.count * count;
|
||||
for (let id of jewel.specialMaterial.ids) {
|
||||
for (let way of copyWays) {
|
||||
let index = _.findIndex(way, {id});
|
||||
if (index && way[index].count >= speCount) {
|
||||
way[index].count = way[index].count - speCount;
|
||||
ways.push(way);
|
||||
|
||||
count = Math.floor((count + (comJewelMap[jewelInfo.good_id]||0))/jewelInfo.count);
|
||||
if (count < 1) {
|
||||
return resResult(STATUS.BATTLE_CONSUMES_NOT_ENOUGH);
|
||||
}
|
||||
let speCount = jewelInfo.specialMaterial.count * count;
|
||||
if (jewelInfo.specialMaterial.ids.length) {
|
||||
let copyWays = deepCopy(ways);
|
||||
ways = [];
|
||||
for (let id of jewelInfo.specialMaterial.ids) {
|
||||
for (let way of copyWays) {
|
||||
let index = _.findIndex(way, {id});
|
||||
if (index && way[index].count >= speCount) {
|
||||
way[index].count = way[index].count - speCount;
|
||||
ways.push(way);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!ways.length)
|
||||
return resResult(STATUS.BATTLE_CONSUMES_NOT_ENOUGH);
|
||||
}
|
||||
if (!ways.length)
|
||||
return resResult(STATUS.WRONG_PARMS);
|
||||
comJewelMap[jewel.nextJewelId] = count + (comJewelMap[jewel.nextJewelId]||0);
|
||||
delete comJewelMap[jewelInfo.good_id];
|
||||
comJewelMap[jewelInfo.nextJewelId] = count + (comJewelMap[jewelInfo.nextJewelId]||0);
|
||||
}
|
||||
if (comJewelMap[jewel] != count || Object.keys(comJewelMap).length != 1)
|
||||
return resResult(STATUS.WRONG_PARMS);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
export const IT_TYPE = {
|
||||
BLUEPRT: 28,
|
||||
JEWEL: 40
|
||||
JEWEL: 42
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { dicHero } from "./dictionary/DicHero";
|
||||
import { dicGoods, blueprt, jewels } from "./dictionary/DicGoods";
|
||||
import { dicGoods, blueprt, dicJewel } from "./dictionary/DicGoods";
|
||||
import { dicBlueprtCompose } from "./dictionary/DicBlueprtCompose";
|
||||
import { dicBlueprtPossibility } from "./dictionary/DicBlueprtPossibility";
|
||||
import { dicDaily } from "./dictionary/DicDaily";
|
||||
@@ -67,7 +67,7 @@ export const gameData = {
|
||||
randomEffectPool: dicRandomEffectPool,
|
||||
strengthenCost: dicStrengthenCost,
|
||||
refine: dicRefine,
|
||||
jewels: jewels,
|
||||
jewels: dicJewel,
|
||||
dicHeroEquip: dicHeroEquip
|
||||
};
|
||||
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
// 物品表
|
||||
import {decodeArrayListStr, readJsonFile, parseReward, parseNumberList, decodeArrayStr} from '../util'
|
||||
import {decodeArrayListStr, readJsonFile, parseReward, parseNumberList, decodeArrayStr, deepCopy} from '../util'
|
||||
import { FILENAME, IT_TYPE, ABI_TYPE } from '../../consts'
|
||||
import { RewardInter } from '../interface';
|
||||
const _ = require('lodash');
|
||||
const underscore = require('underscore');
|
||||
|
||||
export interface SpecialMaterial {
|
||||
readonly ids: number[];
|
||||
@@ -83,10 +84,9 @@ const DicGoodsKeys: KeysEnum<DicGoods> = {
|
||||
count: true,
|
||||
nextJewelId: true,
|
||||
}
|
||||
|
||||
export const dicJewel = new Map<number, DicGoods>();
|
||||
export const dicGoods = new Map<number, DicGoods>();
|
||||
export const blueprt = new Map<number, Array<number>>();
|
||||
export const jewels = new Map<number, DicGoods>();
|
||||
let jewelsMap = {};
|
||||
arr.forEach(o => {
|
||||
o.goodsAbility = parseAbility(o);
|
||||
@@ -103,20 +103,18 @@ arr.forEach(o => {
|
||||
arr.push(o.good_id);
|
||||
blueprt.set(o.quality, arr);
|
||||
} else if (o.itid == IT_TYPE.JEWEL) {
|
||||
jewelsMap[o.good_id] = o;
|
||||
let material = o.composeMaterial[0];
|
||||
if (!!material && !!material.id) {
|
||||
let lastJewel = underscore.findWhere(arr,{good_id:material.id});
|
||||
if (!!lastJewel) {
|
||||
lastJewel.count = material.count;
|
||||
lastJewel.nextJewelId = o.good_id;
|
||||
dicJewel.set(lastJewel.good_id, _.pick(lastJewel, Object.keys(DicGoodsKeys)));
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
for (let key in jewelsMap) {
|
||||
let jewel = jewelsMap[key];
|
||||
let material = jewel.composeMaterial[0];
|
||||
if (!!material && !!material.id) {
|
||||
let nextJewel = jewelsMap[material.id];
|
||||
nextJewel.count = material.count;
|
||||
nextJewel.nextJewelId = material.id;
|
||||
jewels.set(jewel.good_id, _.pick(nextJewel, Object.keys(DicGoodsKeys)));
|
||||
}
|
||||
}
|
||||
jewelsMap = undefined;
|
||||
arr = undefined;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user