fix(map,card): 优化卡牌抽取逻辑,新增去重机制
1. 为drawCardsByRule新增unique参数,实现抽取卡牌不重复 2. 修复 fallback 抽取时的重复问题,优先选择未抽到过的卡牌 3. 修复驻场技能卡的图标显示逻辑,使用FieldSkillSet配置
This commit is contained in:
@@ -906,7 +906,8 @@ export class MissionCardComp extends CCComp {
|
||||
const cards = drawCardsByRule(this.poolLv, {
|
||||
count: 3,
|
||||
type: targetType,
|
||||
wave: currentWave
|
||||
wave: currentWave,
|
||||
unique: true // 保证技能牌不重复
|
||||
});
|
||||
|
||||
if (cards.length >= 3) return cards.slice(0, 3);
|
||||
@@ -915,10 +916,18 @@ export class MissionCardComp extends CCComp {
|
||||
const fallback = drawCardsByRule(this.poolLv, {
|
||||
count: 3,
|
||||
type: targetType,
|
||||
wave: currentWave
|
||||
wave: currentWave,
|
||||
unique: true
|
||||
});
|
||||
if (fallback.length === 0) break;
|
||||
filled.push(fallback[filled.length % fallback.length]);
|
||||
|
||||
// 如果池子数量不足,只能被迫允许重复,但尽量拿没被抽到的
|
||||
const fPick = fallback.find(c => !filled.some(fc => fc.uuid === c.uuid));
|
||||
if (fPick) {
|
||||
filled.push(fPick);
|
||||
} else {
|
||||
filled.push(fallback[filled.length % fallback.length]);
|
||||
}
|
||||
}
|
||||
return filled;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user