feat(card): add wave filter for skill card draws
1. 新增卡牌配置wave字段,标记技能卡可抽取的波次 2. 重构抽卡逻辑,新增drawCardsByRule规则支持按波次过滤技能卡 3. 优化任务面板的技能卡抽取逻辑,使用新的抽卡规则获取对应波次的技能卡 4. 更新示例技能卡牌配置,添加wave和overrides配置示例
This commit is contained in:
@@ -778,12 +778,22 @@ export class MissionCardComp extends CCComp {
|
||||
|
||||
private buildSkillDrawCards(): CardConfig[] {
|
||||
const targetType = CardType.Skill;
|
||||
const cards = getCardsByLv(this.poolLv, targetType);
|
||||
const currentWave = this.getCurrentWave();
|
||||
// 使用明确规则的 drawCardsByRule,指定只要 3 张技能卡,并且过滤对应 wave
|
||||
const cards = drawCardsByRule(this.poolLv, {
|
||||
count: 3,
|
||||
type: targetType,
|
||||
wave: currentWave
|
||||
});
|
||||
|
||||
if (cards.length >= 3) return cards.slice(0, 3);
|
||||
const filled = [...cards];
|
||||
while (filled.length < 3) {
|
||||
const fallback = getCardsByLv(this.poolLv, targetType);
|
||||
const fallback = drawCardsByRule(this.poolLv, {
|
||||
count: 3,
|
||||
type: targetType,
|
||||
wave: currentWave
|
||||
});
|
||||
if (fallback.length === 0) break;
|
||||
filled.push(fallback[filled.length % fallback.length]);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user