refactor: 调整卡牌等级逻辑,新增基础池等级字段
1. 新增base_pool_lv字段存储英雄初始池等级 2. 替换多处直接使用pool_lv的逻辑,优先使用base_pool_lv 3. 移除预制体中废弃的pool_lv_node节点
This commit is contained in:
@@ -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
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
// ==================== 基础属性(有初始值) ====================
|
||||
|
||||
@@ -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();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -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();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -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();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -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") {
|
||||
|
||||
Reference in New Issue
Block a user