From 8d71cdd05051e877e9f34c01f12e28dbbec86155 Mon Sep 17 00:00:00 2001 From: pan Date: Thu, 11 Jun 2026 10:11:38 +0800 Subject: [PATCH] =?UTF-8?q?fix(config):=20=E9=99=90=E5=88=B6=E5=8F=AA?= =?UTF-8?q?=E7=94=9F=E6=88=901=E7=BA=A7=E8=8B=B1=E9=9B=84=E5=8D=A1?= =?UTF-8?q?=E7=89=8C=E5=B9=B6=E6=B7=BB=E5=8A=A0=E5=85=9C=E5=BA=95=E9=80=BB?= =?UTF-8?q?=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 新增ONLY_SPAWN_LV1_HERO开关强制只刷1级英雄卡,同时添加空卡池兜底降级逻辑 --- assets/script/game/common/config/CardSet.ts | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/assets/script/game/common/config/CardSet.ts b/assets/script/game/common/config/CardSet.ts index 30522e7b..af194a74 100644 --- a/assets/script/game/common/config/CardSet.ts +++ b/assets/script/game/common/config/CardSet.ts @@ -105,6 +105,14 @@ HeroList.forEach(uuid => { const offset = pLv - basePoolLv; const targetHeroLv = baseHeroLv + offset; + // 【修改开始】永远只刷 lv1 等级的英雄卡牌,不再出现某英雄的 lv2 等级卡牌 + // 设置为 true 则开启该限制。保留原有代码逻辑以便后续有变直接引用。 + const ONLY_SPAWN_LV1_HERO = true; + if (ONLY_SPAWN_LV1_HERO && targetHeroLv > 1) { + break; + } + // 【修改结束】 + // 英雄的最高等级 是MERGE_MAX-1 if (targetHeroLv > FightSet.MERGE_MAX - 1) { break; @@ -304,6 +312,16 @@ export const drawCardsByRule = ( const typeSet = normalizeTypeFilter(options.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) { pool = pool.filter(card => {