feat: 引入英雄等级提升机制并重构卡牌等级字段

- 将卡牌配置中的 `lv` 字段重命名为 `pool_lv` 以明确表示池等级
- 新增英雄等级提升概率机制,高池等级抽卡有概率获得高英雄等级卡牌
- 更新相关组件以适配新的字段名和英雄等级逻辑
- 修复事件 payload 中 `card_lv` 到 `pool_lv` 的字段映射
This commit is contained in:
panw
2026-04-02 17:01:33 +08:00
parent 781e88e2d7
commit a63360f493
5 changed files with 466 additions and 806 deletions

View File

@@ -192,8 +192,8 @@ export class CardComp extends CCComp {
cancel: false,
reason: "",
uuid: this.cardData.uuid,
hero_lv: this.cardData.hero_lv,
card_lv: this.cardData.card_lv
hero_lv: this.cardData.hero_lv ?? 1,
card_lv: this.cardData.pool_lv ?? 1
};
oops.message.dispatchEvent(GameEvent.UseHeroCard, guard);
if (guard.cancel) {
@@ -383,14 +383,15 @@ export class CardComp extends CCComp {
});
}
const cardLvStr = `lv${this.cardData.lv}`;
const cardLvStr = `lv${this.cardData.pool_lv}`;
if (this.BG_node) {
this.BG_node.children.forEach(child => {
child.active = (child.name === cardLvStr);
});
}
const isHighLevel = (this.cardData.hero_lv ?? 0) > 1 || (this.cardData.card_lv ?? 0) > 1;
const card_lv_val = this.cardData.card_lv ?? 1;
const isHighLevel = (this.cardData.hero_lv ?? 0) > 1 || card_lv_val > 1;
if (this.HF_node) this.HF_node.active = isHighLevel;
if (this.NF_node) this.NF_node.active = !isHighLevel;
@@ -413,7 +414,7 @@ export class CardComp extends CCComp {
const specialCard = this.card_type === CardType.SpecialUpgrade
? SpecialUpgradeCardList[this.card_uuid]
: SpecialRefreshCardList[this.card_uuid];
this.setLabel(this.name_node, `${specialCard?.name || ""}Lv.${this.cardData.lv}`);
this.setLabel(this.name_node, `${specialCard?.name || ""}Lv.${this.cardData.pool_lv}`);
this.info_node.active = false;
this.oinfo_node.active = true;
this.oinfo_node.getChildByName("info").getComponent(Label).string = `${specialCard?.info || ""}`;

View File

@@ -234,7 +234,7 @@ export class MissionCardComp extends CCComp {
if (current >= heroMax) {
const heroUuid = Number(payload?.uuid ?? 0);
const heroLv = Math.max(1, Math.floor(Number(payload?.hero_lv ?? 1)));
const cardLv = Math.max(1, Math.floor(Number(payload?.card_lv ?? 1)));
const cardLv = Math.max(1, Math.floor(Number(payload?.pool_lv ?? 1)));
if (this.canUseHeroCardByMerge(heroUuid, heroLv)) {
payload.cancel = false;
payload.reason = "";

View File

@@ -87,7 +87,7 @@ export class MissionHeroCompComp extends CCComp {
const payload = args ?? event;
const uuid = Number(payload?.uuid ?? 1001);
const hero_lv = Math.max(1, Number(payload?.hero_lv ?? 1));
const card_lv = Math.max(1, Number(payload?.card_lv ?? 1));
const card_lv = Math.max(1, Number(payload?.pool_lv ?? 1));
this.summon_queue.push({ uuid, hero_lv, card_lv });
this.processSummonQueue();
}