feat(gift): 修改宝箱保底机制

This commit is contained in:
liangtongchuan
2023-02-18 18:15:34 +08:00
committed by luying
parent 321d9d15ba
commit 199677e2a4
9 changed files with 1863 additions and 1688 deletions

View File

@@ -118,6 +118,7 @@ import { dicArtifactSeid, loadArtifactSeid } from "./dictionary/DicArtifactSeid"
import { DicArtifact } from "./dictionary/DicArtifact";
import { DicArtifactQuality } from "./dictionary/DicArtifactQuality";
import { dicGiftPackagePlan, loadGiftPackagePlan } from "./dictionary/DicGiftPackagePlan";
import { dicGiftPackageFloor, loadGiftPackageFloor } from "./dictionary/DicGiftPackageFloor";
import { dicGVGPeriod, loadGVGPeriod } from './dictionary/DicGVGPeriod';
import { dicGVGTech, loadGVGTech } from "./dictionary/DicGVGTech";
import { dicGVGItem, loadGVGItem } from "./dictionary/DicGVGItems";
@@ -246,6 +247,7 @@ export const gameData = {
heroTransPiece: new Map<number, number>(),
giftPackage: dicGiftPackage,
giftPackagePlan: dicGiftPackagePlan,
giftPackageFloor: dicGiftPackageFloor,
comBtlLvRange: new Map<number, {min: number, max: number}>(),
recruit: dicRecruit,
rmb: dicRMB,
@@ -1417,6 +1419,7 @@ function loadDatas() {
loadGachaFloor();
loadGiftPackage();
loadGiftPackagePlan();
loadGiftPackageFloor();
loadRecruit();
loadRMB();
loadActivityType();

View File

@@ -0,0 +1,23 @@
// 礼包奖励表
import { readFileAndParse } from '../util';
import { FILENAME } from '../../consts';
// 礼包保底表
export interface DicGiftPackageFloor {
// 唯一id
readonly id: number;
// 触发保底次数
readonly times: number;
// 品质(触发多保底时的优先级覆盖关系)
readonly quality: number;
}
export const dicGiftPackageFloor = new Map<number, DicGiftPackageFloor>(); // floorId => [floor]
export function loadGiftPackageFloor() {
dicGiftPackageFloor.clear();
let arr = readFileAndParse(FILENAME.DIC_GIFT_PACKAGE_FLOOR);
arr.forEach(o => {
dicGiftPackageFloor.set(o.id, o);
});
arr = undefined;
}

View File

@@ -16,10 +16,8 @@ export interface DicGiftPackagePlan {
readonly count: number;
// 权重
readonly weight: number;
// 保底 每floor必出floorCount个提前获取到次数就重置
readonly floorFrequency: number;
// 保底数量
readonly floorCount: number;
// 保底表id
readonly floorId: number;
}
type KeysEnum<T> = { [P in keyof Required<T>]: true };
@@ -30,8 +28,7 @@ const DicGiftPackagePlanKeys: KeysEnum<DicGiftPackagePlan> = {
content: true,
count: true,
weight: true,
floorFrequency: true,
floorCount: true
floorId: true,
}
export const dicGiftPackagePlan = new Map<number, DicGiftPackagePlan[]>(); // packageId => [plan]
@@ -40,14 +37,7 @@ export function loadGiftPackagePlan() {
let arr = readFileAndParse(FILENAME.DIC_GIFT_PACKAGE_PLAN);
arr.forEach(o => {
if(o.floor == '&') {
o.floorFrequency = 0;
o.floorCount = 0;
} else {
let arr = o.floor.split('&');
o.floorFrequency = isNaN(parseInt(arr[0]))? 0: parseInt(arr[0]);
o.floorCount = isNaN(parseInt(arr[1]))? 0: parseInt(arr[1]);
}
o.floorId = o.floor;
if(!dicGiftPackagePlan.has(o.giftPackageId)) {
dicGiftPackagePlan.set(o.giftPackageId, []);
}