fix(config): 限制只生成1级英雄卡牌并添加兜底逻辑
新增ONLY_SPAWN_LV1_HERO开关强制只刷1级英雄卡,同时添加空卡池兜底降级逻辑
This commit is contained in:
@@ -105,6 +105,14 @@ HeroList.forEach(uuid => {
|
|||||||
const offset = pLv - basePoolLv;
|
const offset = pLv - basePoolLv;
|
||||||
const targetHeroLv = baseHeroLv + offset;
|
const targetHeroLv = baseHeroLv + offset;
|
||||||
|
|
||||||
|
// 【修改开始】永远只刷 lv1 等级的英雄卡牌,不再出现某英雄的 lv2 等级卡牌
|
||||||
|
// 设置为 true 则开启该限制。保留原有代码逻辑以便后续有变直接引用。
|
||||||
|
const ONLY_SPAWN_LV1_HERO = true;
|
||||||
|
if (ONLY_SPAWN_LV1_HERO && targetHeroLv > 1) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
// 【修改结束】
|
||||||
|
|
||||||
// 英雄的最高等级 是MERGE_MAX-1
|
// 英雄的最高等级 是MERGE_MAX-1
|
||||||
if (targetHeroLv > FightSet.MERGE_MAX - 1) {
|
if (targetHeroLv > FightSet.MERGE_MAX - 1) {
|
||||||
break;
|
break;
|
||||||
@@ -304,6 +312,16 @@ export const drawCardsByRule = (
|
|||||||
const typeSet = normalizeTypeFilter(options.type)
|
const typeSet = normalizeTypeFilter(options.type)
|
||||||
pool = pool.filter(card => typeSet.has(card.type))
|
pool = pool.filter(card => typeSet.has(card.type))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 如果强制筛选后池子为空(比如开启了 ONLY_SPAWN_LV1_HERO 导致没有高等级英雄卡),
|
||||||
|
// 且需要抽取英雄,则兜底降级回 pool_lv 为 1 的卡池,保证系统不会卡死
|
||||||
|
if (pool.length === 0) {
|
||||||
|
pool = CardPoolList.filter(card => card.pool_lv === 1);
|
||||||
|
if (options.type !== undefined) {
|
||||||
|
const typeSet = normalizeTypeFilter(options.type)
|
||||||
|
pool = pool.filter(card => typeSet.has(card.type))
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (options.heroType !== undefined || options.heroLv !== undefined) {
|
if (options.heroType !== undefined || options.heroLv !== undefined) {
|
||||||
pool = pool.filter(card => {
|
pool = pool.filter(card => {
|
||||||
|
|||||||
Reference in New Issue
Block a user