feat: 实现英雄局外成长系统

1. 新增GameEvent事件枚举HERO_GROWTH_UPDATE
2. 新增英雄局外升级所需碎片配置表
3. 新增英雄局外成长数据持久化与相关工具方法
4. 重构英雄卡片等级逻辑,统一使用局外成长等级
5. 更新英雄设计文档与相关注释
This commit is contained in:
pan
2026-08-17 10:01:42 +08:00
parent d34085aa04
commit 2eb4257dae
8 changed files with 98 additions and 19 deletions

View File

@@ -271,11 +271,14 @@ export class CHeroComp extends CCComp {
});
}
// 等级标签(★ 表示卡牌等级;升级卡显示英雄目标等级)
// 等级标签(★ 表示卡牌等级;升级卡显示英雄目标等级;普通英雄卡显示局外等级
if (this.level_label) {
if (isUpgradeCard) {
const heroLv = Math.max(1, this.cardData.hero_lv ?? 1);
this.level_label.string = heroLv > 1 ? `Lv.${heroLv - 1} -> Lv.${heroLv}` : `Lv.${heroLv}`;
} else if (this.cardData.type === CardType.Hero) {
const heroLv = smc.getHeroOuterLv(this.cardData.uuid);
this.level_label.string = heroLv > 1 ? `Lv.${heroLv}` : "";
} else {
const lv = this.cardData.card_lv ?? 1;
this.level_label.string = lv >= 2 ? "★".repeat(lv - 1) : "";
@@ -581,7 +584,7 @@ export class CHeroComp extends CCComp {
cancel: false,
reason: "",
uuid: this.cardData.uuid,
hero_lv: this.cardData.hero_lv ?? 1,
hero_lv: smc.getHeroOuterLv(this.cardData.uuid),
card_lv: this.cardData.base_card_lv ?? this.cardData.card_lv ?? 1
};
oops.message.dispatchEvent(GameEvent.UseHeroCard, guard);

View File

@@ -289,7 +289,7 @@ export class CardComp extends CCComp {
cancel: false,
reason: "",
uuid: this.cardData.uuid,
hero_lv: this.cardData.hero_lv ?? 1,
hero_lv: smc.getHeroOuterLv(this.cardData.uuid),
card_lv: this.cardData.base_card_lv ?? this.cardData.card_lv ?? 1
};
oops.message.dispatchEvent(GameEvent.UseHeroCard, guard);
@@ -540,7 +540,7 @@ export class CardComp extends CCComp {
const heroUuid = isUpgradeCard
? (this.queryHeroUuidByEid(this.cardData!.target_hero_eid as number) ?? this.card_uuid)
: this.card_uuid;
const heroLv = Math.max(1, this.cardData?.hero_lv ?? 1);
const heroLv = Math.max(1, smc.getHeroOuterLv(heroUuid));
const poolLv = Math.max(1, this.cardData?.base_card_lv ?? this.cardData?.card_lv ?? 1);
oops.gui.remove(UIID.HInfo);
oops.gui.open(UIID.HInfo, { heroUuid, heroLv, poolLv });
@@ -756,7 +756,7 @@ export class CardComp extends CCComp {
if (renderType === CardType.Hero) {
const hero = HeroInfo[renderUuid];
const heroLv = Math.max(1, this.cardData.hero_lv ?? hero?.lv ?? 1);
const heroLv = Math.max(1, smc.getHeroOuterLv(renderUuid) || hero?.lv || 1);
this.setLabel(this.name_node, `${hero?.name || ""}`);
if (this.lvl_node) {
// 升级卡:显示「当前→升级后」;普通英雄卡:显示当前等级。统一使用默认颜色

View File

@@ -132,7 +132,7 @@ export class CardLiteComp extends CCComp {
weight: 25,
card_lv: cardLv,
kind: CKind.Hero,
hero_lv: hero.lv || 1
hero_lv: smc.getHeroOuterLv(hero.uuid)
});
}
}
@@ -231,7 +231,7 @@ export class CardLiteComp extends CCComp {
if (this.card_type === CardType.Hero) {
const hero = HeroInfo[this.card_uuid];
const heroLv = Math.max(1, this.cardData.hero_lv ?? hero?.lv ?? 1);
const heroLv = Math.max(1, smc.getHeroOuterLv(this.card_uuid) || hero?.lv || 1);
this.setLabel(this.name_node, `${hero?.name || ""}`);
if (this.lvl_node) {
this.lvl_node.string = `Lv.${heroLv}`;

View File

@@ -153,7 +153,10 @@ export class MissionHeroComp extends CCComp {
private async call_hero(event: string, args: any) {
const payload = args ?? event;
const uuid = Number(payload?.uuid ?? 1001);
const hero_lv = Math.max(1, Number(payload?.hero_lv ?? 1));
// 局内登场等级统一以局外成长等级为准(升级后登场即为升级后的等级)
// payload.hero_lv 保留作为下限兜底,防止外部显式指定更高等级
const outer_lv = smc.getHeroOuterLv(uuid);
const hero_lv = Math.max(outer_lv, Math.max(1, Number(payload?.hero_lv ?? 1)));
const card_lv = Math.max(1, Number(payload?.card_lv ?? 1));
// 二合一前置校验:同 uuid 已存在且合成后等级会超上限时,直接拒绝