From 2010e2adc5d1c21189e5b788e97b7ccd30409d3e Mon Sep 17 00:00:00 2001 From: walkpan Date: Mon, 6 Apr 2026 22:03:52 +0800 Subject: [PATCH] =?UTF-8?q?refactor(card):=20=E5=90=88=E5=B9=B6=E6=8A=80?= =?UTF-8?q?=E8=83=BD=E5=8D=A1=E9=85=8D=E7=BD=AE=E5=88=B0=E7=BB=9F=E4=B8=80?= =?UTF-8?q?=E5=8D=A1=E7=89=87=E6=B1=A0=E5=B9=B6=E6=9B=B4=E6=96=B0=E5=B1=9E?= =?UTF-8?q?=E6=80=A7=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 移除独立的 SkillCardList 配置,将技能卡属性直接集成到 CardPoolList - 更新 SkillBoxComp 和 CardComp 中技能卡配置的获取方式,改为从 CardPoolList 查找 - 统一技能卡属性命名(如 is_inst 替代 is_instant),提升配置一致性 --- assets/script/game/common/config/CardSet.ts | 41 ++++++++------------- assets/script/game/map/CardComp.ts | 4 +- assets/script/game/map/SkillBoxComp.ts | 12 +++--- 3 files changed, 24 insertions(+), 33 deletions(-) diff --git a/assets/script/game/common/config/CardSet.ts b/assets/script/game/common/config/CardSet.ts index 15fa4c5c..c5e83465 100644 --- a/assets/script/game/common/config/CardSet.ts +++ b/assets/script/game/common/config/CardSet.ts @@ -36,6 +36,14 @@ export interface CardConfig { pool_lv: CardLV hero_lv?: number card_lv?:number + + // 技能卡扩展属性 + name?: string // 卡牌名称 + info?: string // 卡牌描述信息 + is_inst?: boolean // 是否即时起效 + t_times?: number // 触发次数 + t_inv?: number // 触发间隔(秒) + d_rds?: number // 持续回合数 } export const CardsUpSet: Record = { 1: 50, @@ -81,14 +89,14 @@ export const CardPoolList: CardConfig[] = [ { uuid: 5304, type: CardType.Hero, cost: 3, weight: 25, pool_lv: 5, kind: CKind.Hero, hero_lv: 1 }, // 技能卡牌 (以增益/辅助为主,因为在备战期没有敌人) - { uuid: 6401, type: CardType.Skill, cost: 2, weight: 20, pool_lv: 1, kind: CKind.Skill, card_lv: 1 }, // 单体攻击 - { uuid: 6402, type: CardType.Skill, cost: 2, weight: 20, pool_lv: 1, kind: CKind.Skill, card_lv: 1 }, // 单体生命 - { uuid: 6403, type: CardType.Skill, cost: 3, weight: 20, pool_lv: 2, kind: CKind.Skill, card_lv: 1 }, // 单体全能 - { uuid: 6404, type: CardType.Skill, cost: 4, weight: 20, pool_lv: 3, kind: CKind.Skill, card_lv: 1 }, // 群体攻击 - { uuid: 6405, type: CardType.Skill, cost: 4, weight: 20, pool_lv: 3, kind: CKind.Skill, card_lv: 1 }, // 群体生命 - { uuid: 6406, type: CardType.Skill, cost: 5, weight: 20, pool_lv: 4, kind: CKind.Skill, card_lv: 1 }, // 群体全能 - { uuid: 6304, type: CardType.Skill, cost: 3, weight: 20, pool_lv: 2, kind: CKind.Skill, card_lv: 1 }, // 群体治疗 - { uuid: 6305, type: CardType.Skill, cost: 4, weight: 20, pool_lv: 4, kind: CKind.Skill, card_lv: 1 }, // 群体护盾 + { uuid: 6401, type: CardType.Skill, cost: 2, weight: 20, pool_lv: 1, kind: CKind.Skill, card_lv: 1, name: "单体攻击", info: "随机1个友方+5攻击", is_inst: true, t_times: 1, t_inv: 0, d_rds: 1 }, + { uuid: 6402, type: CardType.Skill, cost: 2, weight: 20, pool_lv: 1, kind: CKind.Skill, card_lv: 1, name: "单体生命", info: "随机1个友方+20最大生命值", is_inst: true, t_times: 1, t_inv: 0, d_rds: 1 }, + { uuid: 6403, type: CardType.Skill, cost: 3, weight: 20, pool_lv: 2, kind: CKind.Skill, card_lv: 1, name: "单体全能", info: "随机1个友方+2攻击,+10最大生命值", is_inst: true, t_times: 1, t_inv: 0, d_rds: 1 }, + { uuid: 6404, type: CardType.Skill, cost: 4, weight: 20, pool_lv: 3, kind: CKind.Skill, card_lv: 1, name: "群体攻击", info: "随机3个友方+2攻击", is_inst: true, t_times: 1, t_inv: 0, d_rds: 1 }, + { uuid: 6405, type: CardType.Skill, cost: 4, weight: 20, pool_lv: 3, kind: CKind.Skill, card_lv: 1, name: "群体生命", info: "随机3个友方+10最大生命值", is_inst: true, t_times: 1, t_inv: 0, d_rds: 1 }, + { uuid: 6406, type: CardType.Skill, cost: 5, weight: 20, pool_lv: 4, kind: CKind.Skill, card_lv: 1, name: "群体全能", info: "为随机3个友方单位增加攻击力和生命上限", is_inst: true, t_times: 1, t_inv: 0, d_rds: 1 }, + { uuid: 6304, type: CardType.Skill, cost: 3, weight: 20, pool_lv: 2, kind: CKind.Skill, card_lv: 1, name: "神圣治疗", info: "恢复场上随机3个友方单位的生命值", is_inst: true, t_times: 1, t_inv: 0, d_rds: 1 }, + { uuid: 6305, type: CardType.Skill, cost: 4, weight: 20, pool_lv: 4, kind: CKind.Skill, card_lv: 1, name: "群体护盾", info: "随机3个友方获得2次伤害免疫", is_inst: true, t_times: 1, t_inv: 0, d_rds: 1 }, { uuid: 7001, type: CardType.SpecialUpgrade, cost: 6, weight: 16, pool_lv: 1 ,kind: CKind.Card }, { uuid: 7002, type: CardType.SpecialUpgrade, cost: 6, weight: 14, pool_lv: 2 ,kind: CKind.Card }, @@ -120,23 +128,6 @@ export interface SpecialRefreshCardConfig extends CardConfig { refreshHeroType: SpecialRefreshHeroType } -/** 技能卡牌配置补充 */ -export interface SkillCardConfig extends CardConfig { - name: string - info: string -} - -export const SkillCardList: Record = { - 6401: { uuid: 6401, type: CardType.Skill, cost: 2, weight: 20, pool_lv: 1, kind: CKind.Skill, card_lv: 1, name: "单体攻击", info: "随机1个友方+5攻击" }, - 6402: { uuid: 6402, type: CardType.Skill, cost: 2, weight: 20, pool_lv: 1, kind: CKind.Skill, card_lv: 1, name: "单体生命", info: "随机1个友方+20最大生命值" }, - 6403: { uuid: 6403, type: CardType.Skill, cost: 3, weight: 20, pool_lv: 2, kind: CKind.Skill, card_lv: 1, name: "单体全能", info: "随机1个友方+2攻击,+10最大生命值" }, - 6404: { uuid: 6404, type: CardType.Skill, cost: 4, weight: 20, pool_lv: 3, kind: CKind.Skill, card_lv: 1, name: "群体攻击", info: "随机3个友方+2攻击" }, - 6405: { uuid: 6405, type: CardType.Skill, cost: 4, weight: 20, pool_lv: 3, kind: CKind.Skill, card_lv: 1, name: "群体生命", info: "随机3个友方+10最大生命值" }, - 6406: { uuid: 6406, type: CardType.Skill, cost: 5, weight: 20, pool_lv: 4, kind: CKind.Skill, card_lv: 1, name: "群体全能", info: "为随机3个友方单位增加攻击力和生命上限" }, - 6304: { uuid: 6304, type: CardType.Skill, cost: 3, weight: 20, pool_lv: 2, kind: CKind.Skill, card_lv: 1, name: "神圣治疗", info: "恢复场上随机3个友方单位的生命值" }, - 6305: { uuid: 6305, type: CardType.Skill, cost: 4, weight: 20, pool_lv: 4, kind: CKind.Skill, card_lv: 1, name: "群体护盾", info: "随机3个友方获得2次伤害免疫" }, -} - /** 功能卡定义表 */ diff --git a/assets/script/game/map/CardComp.ts b/assets/script/game/map/CardComp.ts index fbf37bea..16c4bf23 100644 --- a/assets/script/game/map/CardComp.ts +++ b/assets/script/game/map/CardComp.ts @@ -2,7 +2,7 @@ import { mLogger } from "../common/Logger"; import { _decorator, Animation, AnimationClip, EventTouch, Label, Node, NodeEventType, Sprite, SpriteAtlas, Tween, tween, UIOpacity, Vec3, resources, Light } from "cc"; import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS"; import { CCComp } from "../../../../extensions/oops-plugin-framework/assets/module/common/CCComp"; -import { CardConfig, CardType, SpecialRefreshCardList, SpecialUpgradeCardList, CKind, SkillCardList } from "../common/config/CardSet"; +import { CardConfig, CardType, SpecialRefreshCardList, SpecialUpgradeCardList, CKind, CardPoolList } from "../common/config/CardSet"; import { HeroInfo } from "../common/config/heroSet"; import { SkillSet } from "../common/config/SkillSet"; import { GameEvent } from "../common/config/GameEvent"; @@ -426,7 +426,7 @@ export class CardComp extends CCComp { this.info_node.getChildByName("hp").getChildByName("val").getComponent(Label).string = `${(hero?.hp ?? 0) * heroLv}`; }else if(this.card_type===CardType.Skill){ const skill = SkillSet[this.card_uuid]; - const skillCard = SkillCardList[this.card_uuid]; + const skillCard = CardPoolList.find(c => c.uuid === this.card_uuid); const card_lv = Math.max(1, Math.floor(this.cardData.card_lv ?? 1)); const spSuffix = card_lv >= 2 ? "★".repeat(card_lv - 1) : ""; this.setLabel(this.name_node, `${spSuffix}${skillCard?.name || skill?.name || ""}${spSuffix}`); diff --git a/assets/script/game/map/SkillBoxComp.ts b/assets/script/game/map/SkillBoxComp.ts index 79545eef..6cb5f5b4 100644 --- a/assets/script/game/map/SkillBoxComp.ts +++ b/assets/script/game/map/SkillBoxComp.ts @@ -2,7 +2,7 @@ import { mLogger } from "../common/Logger"; import { _decorator, Node, Prefab, Sprite, Label, Vec3, resources, SpriteAtlas } from "cc"; import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS"; import { CCComp } from "../../../../extensions/oops-plugin-framework/assets/module/common/CCComp"; -import { SkillCardList } from "../common/config/CardSet"; +import { CardPoolList } from "../common/config/CardSet"; import { SkillSet } from "../common/config/SkillSet"; import { oops } from "db://oops-framework/core/Oops"; import { GameEvent } from "../common/config/GameEvent"; @@ -50,12 +50,12 @@ export class SkillBoxComp extends CCComp { this.s_uuid = uuid; this.card_lv = card_lv; - const config = SkillCardList[uuid]; + const config = CardPoolList.find(c => c.uuid === uuid); if (config) { - this.is_instant = config.is_instant ?? true; - this.trigger_times = config.trigger_times ?? 1; - this.trigger_interval = config.trigger_interval ?? 0; - this.duration_rounds = config.duration_rounds ?? 1; + this.is_instant = config.is_inst ?? true; + this.trigger_times = config.t_times ?? 1; + this.trigger_interval = config.t_inv ?? 0; + this.duration_rounds = config.d_rds ?? 1; } this.current_round = 0;