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