2 Commits

Author SHA1 Message Date
panw
9ddf5b99c5 refactor: 调整卡牌等级逻辑,新增基础池等级字段
1. 新增base_pool_lv字段存储英雄初始池等级
2. 替换多处直接使用pool_lv的逻辑,优先使用base_pool_lv
3. 移除预制体中废弃的pool_lv_node节点
2026-05-28 10:04:39 +08:00
panw
f7f6c57b56 refactor(map): 优化英雄列表排序和英雄等级展示逻辑
1. 新增英雄列表按pool_lv升序排序的逻辑
2. 从cardData中获取英雄等级替代直接读取HeroInfo,优化数据读取方式
2026-05-28 09:59:33 +08:00
9 changed files with 19 additions and 15 deletions

View File

@@ -3453,12 +3453,7 @@
"BG_node": {
"__id__": 2
},
"pool_lv_node": {
"__id__": 172
},
"lvl_node": {
"__id__": 187
},
"lvl_node": null,
"_id": ""
},
{

View File

@@ -53,6 +53,7 @@ export interface CardConfig {
pool_lv: CardLV
hero_lv?: number
card_lv?:number
base_pool_lv?: number
// 技能卡扩展属性
name?: string // 卡牌名称
@@ -116,7 +117,8 @@ HeroList.forEach(uuid => {
weight: baseWeight,
pool_lv: pLv as CardLV,
kind: CKind.Hero,
hero_lv: targetHeroLv
hero_lv: targetHeroLv,
base_pool_lv: basePoolLv
});
}
});

View File

@@ -111,6 +111,7 @@ export class Hero extends ecs.Entity {
model.hero_name = hero.name;
model.lv = hero_lv;
model.pool_lv = pool_lv;
model.base_pool_lv = hero.pool_lv ?? 1;
model.type = hero.type;
model.fac = FacSet.HERO;
model.dis = hero.dis ?? 720;

View File

@@ -20,6 +20,7 @@ export class HeroAttrsComp extends ecs.Comp {
hero_name: string = "hero";
lv: number = 1;
pool_lv: number = 1;
base_pool_lv: number = 1;
type: number = 0; // 0近战 1远程 2辅助
fac: number = 0; // 0:hero 1:monster
// ==================== 基础属性(有初始值) ====================

View File

@@ -548,7 +548,7 @@ export class CardComp extends CCComp {
this.isLongPressed = true;
const heroUuid = this.card_uuid;
const heroLv = Math.max(1, this.cardData.hero_lv ?? 1);
const poolLv = Math.max(1, this.cardData.pool_lv ?? 1);
const poolLv = Math.max(1, this.cardData.base_pool_lv ?? this.cardData.pool_lv ?? 1);
oops.gui.remove(UIID.HInfo);
oops.gui.open(UIID.HInfo, { heroUuid, heroLv, poolLv });
}
@@ -607,10 +607,11 @@ export class CardComp extends CCComp {
const kindName = CKind[this.cardData.kind];
if (this.BG_node) {
const bgLv = this.cardData.base_pool_lv ?? this.cardData.pool_lv;
this.BG_node.children.forEach(child => {
child.active = (child.name === kindName);
const bg = child.getComponent(CardBgComp);
if (bg) child.active ? bg.apply(this.cardData.pool_lv) : bg.clear();
if (bg) child.active ? bg.apply(bgLv) : bg.clear();
});
}
@@ -678,9 +679,8 @@ export class CardComp extends CCComp {
}
if(this.card_type===CardType.Hero){
// 英雄卡:显示英雄名 + AP/HP
const hero = HeroInfo[this.card_uuid];
const heroLv = Math.max(1, hero?.lv);
const heroLv = Math.max(1, this.cardData.hero_lv ?? hero?.lv ?? 1);
this.setLabel(this.name_node, `${hero?.name || ""}`);
if (this.lvl_node) {
this.lvl_node.string = `Lv.${heroLv}`;

View File

@@ -220,10 +220,11 @@ export class CardLiteComp extends CCComp {
const kindName = CKind[this.cardData.kind];
if (this.BG_node) {
const bgLv = this.cardData.base_pool_lv ?? this.cardData.pool_lv;
this.BG_node.children.forEach(child => {
child.active = (child.name === kindName);
const bg = child.getComponent(CardBgComp);
if (bg) child.active ? bg.apply(this.cardData.pool_lv) : bg.clear();
if (bg) child.active ? bg.apply(bgLv) : bg.clear();
});
}

View File

@@ -275,7 +275,7 @@ export class HInfoComp extends CCComp {
this.BG_node.children.forEach(child => {
child.active = (child.name === kindName);
const bg = child.getComponent(CardBgComp);
if (bg) child.active ? bg.apply(this.model.pool_lv ?? 1) : bg.clear();
if (bg) child.active ? bg.apply(this.model.base_pool_lv ?? this.model.pool_lv ?? 1) : bg.clear();
});
}

View File

@@ -115,7 +115,11 @@ export class HerosListComp extends CCComp {
this.cards_node.removeAllChildren()
for (const uuid of HeroList) {
const sorted = [...HeroList].sort((a, b) => {
return (HeroInfo[a]?.pool_lv ?? 1) - (HeroInfo[b]?.pool_lv ?? 1);
});
for (const uuid of sorted) {
const hero = HeroInfo[uuid]
if (!hero) continue

View File

@@ -189,7 +189,7 @@ export class VictoryComp extends CCComp {
if (hbNode) hbNode.active = false;
// ---- 卡牌等级标识 ----
const cardLvStr = `lv${mvp.pool_lv || 1}`;
const cardLvStr = `lv${mvp.base_pool_lv || mvp.pool_lv || 1}`;
if (lv_node) {
lv_node.children.forEach(child => {
if (child.name === "light") {