装备:天晶继承
This commit is contained in:
@@ -1,15 +1,36 @@
|
||||
import { getRandEelm, } from '../pubUtils/util';
|
||||
import { EPlace, Stone } from "../db/Hero";
|
||||
import { gameData } from "../pubUtils/data";
|
||||
import { gameData, getRandEffectByGroupAndLevel } from "../pubUtils/data";
|
||||
import { JewelType, RandSe } from '../db/Jewel';
|
||||
import { getJewelRandSe } from '../pubUtils/itemUtils';
|
||||
import { checkActivityTask, checkTask, checkTaskWithEplaces, checkTaskWithEplace } from './taskService';
|
||||
import { TASK_TYPE } from '../consts';
|
||||
import { DicRandomEffectPool } from '../pubUtils/dictionary/DicRandomEffectPool';
|
||||
|
||||
export function getRandSeResult(id: number, randSe: RandSe[]) {
|
||||
let { randomEffect, effectCount } = gameData.jewel.get(id);
|
||||
export function getRandSeResult(id: number, randSe: RandSe[], originSe: RandSe[] = [], originId?: number) {
|
||||
let { randomEffect, effectCount, lv } = gameData.jewel.get(id);
|
||||
|
||||
let chosen = randSe.filter(cur => cur.locked).map(cur => cur.seid); // 上一轮随机出来的
|
||||
|
||||
let newRandSe: RandSe[] = []; // 随机结果
|
||||
let startId = 0;
|
||||
for(let { id, seid } of originSe) {
|
||||
let { lv: oldLv } = gameData.jewel.get(originId);
|
||||
// 替换成高阶
|
||||
let dicRandomEffect = gameData.randomEffectPool.get(seid);
|
||||
let nextRandEffect: DicRandomEffectPool;
|
||||
let targetRandLv = dicRandomEffect.level + lv - oldLv;
|
||||
while(!nextRandEffect) {
|
||||
nextRandEffect = getRandEffectByGroupAndLevel(dicRandomEffect.group, targetRandLv);
|
||||
targetRandLv--;
|
||||
if(targetRandLv < 0) break;
|
||||
}
|
||||
let newSeid = nextRandEffect? nextRandEffect.id: seid;
|
||||
newRandSe.push(getJewelRandSe(id, newSeid));
|
||||
chosen.push(seid);
|
||||
startId++;
|
||||
}
|
||||
|
||||
let randomResult: number[] = getRandEelm(randomEffect.filter(cur => !chosen.includes(cur)), effectCount); // 随机出的结果
|
||||
if(randomResult.length < effectCount) { // 去上轮之后不够,把上轮加入
|
||||
let chosenRandom = getRandEelm(chosen, effectCount - randomResult.length);
|
||||
@@ -20,8 +41,7 @@ export function getRandSeResult(id: number, randSe: RandSe[]) {
|
||||
randomResult.push(...allRandom);
|
||||
}
|
||||
|
||||
let newRandSe: RandSe[] = [];
|
||||
for (let i = 0; i < effectCount; i++) {
|
||||
for (let i = startId; i < effectCount; i++) {
|
||||
if(randSe[i]) {
|
||||
if(randSe[i] && randSe[i].locked) {
|
||||
newRandSe.push(randSe[i]);
|
||||
@@ -196,3 +216,11 @@ function getEquipById(oldEplace: EPlace[], newEplace: EPlace[], eplaceId: number
|
||||
let newEquip = newEplace.find(cur => cur.id == eplaceId)||new EPlace(eplaceId, 0);
|
||||
return { oldEquip, newEquip }
|
||||
}
|
||||
|
||||
|
||||
export function isLocked(randSe: RandSe[]) {
|
||||
for(let { locked } of randSe) {
|
||||
if(locked) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
Reference in New Issue
Block a user