feat(地图): 根据主角属性倾向调整任务卡牌权重
在获取任务卡牌选项时,查询主角已拥有的永久属性Buff,将对应属性的卡牌权重提高一倍,使卡牌选择更符合角色成长方向。
This commit is contained in:
@@ -259,9 +259,21 @@ export class MissionCardComp extends CCComp {
|
||||
* @param forcedType 强制类型 (可选)
|
||||
*/
|
||||
fetchCards(level: number, forcedType?: CardType){
|
||||
// 获取主角已有的属性倾向 (已拥有的永久属性Buff)
|
||||
let preferredAttrs: number[] = [];
|
||||
// @ts-ignore
|
||||
const entities = ecs.query(ecs.allOf(HeroMasterComp));
|
||||
if (entities.length > 0) {
|
||||
const role = entities[0];
|
||||
const heroAttrs = role.get(HeroAttrsComp);
|
||||
if (heroAttrs && heroAttrs.BUFFS) {
|
||||
preferredAttrs = Object.keys(heroAttrs.BUFFS).map(Number);
|
||||
}
|
||||
}
|
||||
|
||||
// 使用 CardSet 的 getCardOptions 获取卡牌
|
||||
// 这里我们要获取 4 张卡牌
|
||||
const options = getCardOptions(level, 4, [], forcedType);
|
||||
const options = getCardOptions(level, 4, [], forcedType, preferredAttrs);
|
||||
mLogger.log(this.debugMode, 'MissionCard', `[MissionCard] 获取到的卡牌选项: ${JSON.stringify(options)}`);
|
||||
// 更新卡片数据
|
||||
if (options.length > 0) this.updateCardData(1, options[0]);
|
||||
|
||||
Reference in New Issue
Block a user