装备:镶嵌或卸载地玉石
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { mergeSameGoods, getRandEelm, getRandValueByMinMax } from '../pubUtils/util';
|
||||
import { EquipModel, RandMain, RandSe } from "../db/Equip";
|
||||
import { EPlace, HeroModel, HeroType } from "../db/Hero";
|
||||
import { EPlace, HeroModel, HeroType, Stone } from "../db/Hero";
|
||||
import { getGoodById, gameData, getQuenchGradeByValue, getQuenchConsume, getQuenchByQualityAndGrade } from "../pubUtils/data";
|
||||
import { calPlayerCeAndSave } from "./playerCeService";
|
||||
import { CONSUME_TYPE, HERO_SYSTEM_TYPE, ITID, TASK_TYPE } from "../consts";
|
||||
@@ -200,6 +200,23 @@ export function calEquipCe(goodsAbility: Map<number, number>, randMain: RandMain
|
||||
return ce
|
||||
}
|
||||
|
||||
export function updateStone(origin: Stone[], id: number, target: number) {
|
||||
let newStones: Stone[] = [];
|
||||
let hasTarget = false;
|
||||
for(let stone of origin) {
|
||||
if(stone.id == id) {
|
||||
newStones.push({ id, stone: target });
|
||||
hasTarget = true;
|
||||
} else {
|
||||
newStones.push(stone);
|
||||
}
|
||||
}
|
||||
if(!hasTarget) {
|
||||
newStones.push({ id, stone: target });
|
||||
}
|
||||
return newStones;
|
||||
}
|
||||
|
||||
export function updateEplace(eplace: EPlace[], eplaceId: number, update: Partial<EPlace>) {
|
||||
let newEplace: EPlace[] = [];
|
||||
let updatedEplace: Partial<EPlace>[] = [];
|
||||
@@ -241,4 +258,15 @@ export function checkJewelCanPutOnEquip(equip: EPlace, jewel: JewelType) {
|
||||
let dicEquipQualityExtra = gameData.equipQualityExtra.get(equip.quality);
|
||||
if(!dicEquipQualityExtra || dicEquipQualityExtra.jewelCnt == 0) return false;
|
||||
return true
|
||||
}
|
||||
|
||||
export function checkStoneCanPutOnEquip(equip: EPlace, id: number, stone: number) {
|
||||
if(stone == 0) return true; // 卸载
|
||||
// 位置是否满足
|
||||
let dicStone = gameData.stone.get(stone);
|
||||
if(!dicStone || dicStone.eplaceId != equip.id) return false;
|
||||
// 品质是否满足
|
||||
let dicEquipQualityExtra = gameData.equipQualityExtra.get(equip.quality);
|
||||
if(!dicEquipQualityExtra || dicEquipQualityExtra.stoneCnt < id) return false;
|
||||
return true;
|
||||
}
|
||||
Reference in New Issue
Block a user