From 354f242930e6cb6cd61dff372e66035f8250a925 Mon Sep 17 00:00:00 2001 From: walkpan Date: Sun, 22 Mar 2026 19:09:02 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E9=87=8D=E6=9E=84buff=E7=B3=BB?= =?UTF-8?q?=E7=BB=9F=EF=BC=8C=E7=A7=BB=E9=99=A4=E9=A2=84=E5=AE=9A=E4=B9=89?= =?UTF-8?q?buff=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 将SkillConfig.buffs字段改为直接存储BuffConf对象数组 - 移除预定义的BuffsList和相关导入引用 - 简化SCastSystem中buff应用逻辑,直接使用配置对象 - 移除CardComp中Buff/Debuff类型的图标获取逻辑 - 简化HeroAttrsComp调试日志,移除buff名称显示 --- assets/script/game/common/config/SkillSet.ts | 27 +------------------- assets/script/game/hero/HeroAttrsComp.ts | 2 +- assets/script/game/hero/SCastSystem.ts | 13 ++++------ assets/script/game/map/CardComp.ts | 5 +--- assets/script/game/skill/SkillView.ts | 2 +- 5 files changed, 9 insertions(+), 40 deletions(-) diff --git a/assets/script/game/common/config/SkillSet.ts b/assets/script/game/common/config/SkillSet.ts index 7bc6a3fe..8e2239a4 100644 --- a/assets/script/game/common/config/SkillSet.ts +++ b/assets/script/game/common/config/SkillSet.ts @@ -144,7 +144,7 @@ export interface SkillConfig { crt?:number, // 额外暴击率 frz?:number, // 额外冰冻概率 bck?:number, // 额外击退概率 - buffs:BuffConf[], // 对施法者的buff配置列表(Buff UUID 列表) + buffs:BuffConf[], // 对目标应用的 buff 配置列表 call_hero?:number, // 召唤技能召唤英雄id(可选) info:string, // 技能描述 } @@ -314,28 +314,3 @@ export const SkillSet: Record = { }; - -// ==================== 预定义 Buff 列表 ==================== -// 使用 ID 作为 Key,方便在技能配置中引用或作为模板 -export const BuffsList: Record = { - 1001: { uuid: 1001, name: "攻击提升", icon: "10001", buff: Attrs.ap, value: 2, info: "攻击力+2" }, - 1002: { uuid: 1002, name: "攻击提升", icon: "10002", buff: Attrs.ap, value: 5, info: "攻击力+5" }, - 1003: { uuid: 1003, name: "攻击提升", icon: "10002", buff: Attrs.ap, value: 10, info: "攻击力+10" }, - 1004: { uuid: 1004, name: "攻击提升", icon: "10002", buff: Attrs.ap, value: 15, info: "攻击力+15" }, - 1005: { uuid: 1005, name: "攻击提升", icon: "10002", buff: Attrs.ap, value: 20, info: "攻击力+20" }, - 1006: { uuid: 1006, name: "攻击提升", icon: "10002", buff: Attrs.ap, value: 25, info: "攻击力+25" }, - 1007: { uuid: 1007, name: "攻击提升", icon: "10002", buff: Attrs.ap, value: 30, info: "攻击力+30" }, - 1008: { uuid: 1008, name: "攻击提升", icon: "10002", buff: Attrs.ap, value: 35, info: "攻击力+35" }, - 1009: { uuid: 1009, name: "攻击提升", icon: "10002", buff: Attrs.ap, value: 40, info: "攻击力+40" }, - 1010: { uuid: 1010, name: "攻击提升", icon: "10002", buff: Attrs.ap, value: 45, info: "攻击力+45" }, - 1101: { uuid: 1101, name: "生命上限提升", icon: "10101", buff: Attrs.hp_max, value: 10, info: "最大生命值+10" }, - 1102: { uuid: 1102, name: "生命上限提升", icon: "10101", buff: Attrs.hp_max, value: 20, info: "最大生命值+20" }, - 1103: { uuid: 1103, name: "生命上限提升", icon: "10101", buff: Attrs.hp_max, value: 30, info: "最大生命值+30" }, - 1104: { uuid: 1104, name: "生命上限提升", icon: "10101", buff: Attrs.hp_max, value: 40, info: "最大生命值+40" }, - 1105: { uuid: 1105, name: "生命上限提升", icon: "10101", buff: Attrs.hp_max, value: 50, info: "最大生命值+50" }, - 1106: { uuid: 1106, name: "生命上限提升", icon: "10101", buff: Attrs.hp_max, value: 60, info: "最大生命值+60" }, - 1107: { uuid: 1107, name: "生命上限提升", icon: "10101", buff: Attrs.hp_max, value: 70, info: "最大生命值+70" }, - 1108: { uuid: 1108, name: "生命上限提升", icon: "10101", buff: Attrs.hp_max, value: 80, info: "最大生命值+80" }, - 1109: { uuid: 1109, name: "生命上限提升", icon: "10101", buff: Attrs.hp_max, value: 90, info: "最大生命值+90" }, - 1110: { uuid: 1110, name: "生命上限提升", icon: "10101", buff: Attrs.hp_max, value: 100, info: "最大生命值+100" }, -}; diff --git a/assets/script/game/hero/HeroAttrsComp.ts b/assets/script/game/hero/HeroAttrsComp.ts index 675f6b6e..9f1420ae 100644 --- a/assets/script/game/hero/HeroAttrsComp.ts +++ b/assets/script/game/hero/HeroAttrsComp.ts @@ -125,7 +125,7 @@ export class HeroAttrsComp extends ecs.Comp { addBuff(buffConf: BuffConf) { this.applyAttrChange(buffConf.buff, buffConf.value); if (this.debugMode) { - mLogger.log(this.debugMode, 'HeroAttrs', `添加属性: ${buffConf.name}, 属性:${buffConf.buff}, 值:${buffConf.value}`); + mLogger.log(this.debugMode, 'HeroAttrs', `属性:${buffConf.buff}, 值:${buffConf.value}`); } } diff --git a/assets/script/game/hero/SCastSystem.ts b/assets/script/game/hero/SCastSystem.ts index 8801d3a2..0fe3d549 100644 --- a/assets/script/game/hero/SCastSystem.ts +++ b/assets/script/game/hero/SCastSystem.ts @@ -2,7 +2,7 @@ import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ec import { Vec3 } from "cc"; import { HeroAttrsComp } from "./HeroAttrsComp"; import { HeroViewComp } from "./HeroViewComp"; -import { BuffsList, DTType, SkillConfig, SkillKind, SkillSet, TGroup } from "../common/config/SkillSet"; +import { DTType, SkillConfig, SkillKind, SkillSet, TGroup } from "../common/config/SkillSet"; import { Skill } from "../skill/Skill"; import { smc } from "../common/SingletonModuleComp"; import { GameConst } from "../common/config/GameConst"; @@ -150,13 +150,10 @@ export class SCastSystem extends ecs.ComblockSystem implements ecs.ISystemUpdate if (!target.ent) continue; const model = target.ent.get(HeroAttrsComp); if (!model || model.is_dead) continue; - if (config.buffs) { - for (const buffId of config.buffs) { - const buffConf = BuffsList[buffId]; - if (buffConf) { - model.addBuff(buffConf); - } - } + if (!config.buffs || config.buffs.length === 0) continue; + for (const buffConf of config.buffs) { + if (!buffConf) continue; + model.addBuff(buffConf); } } } diff --git a/assets/script/game/map/CardComp.ts b/assets/script/game/map/CardComp.ts index b0185463..61d72746 100644 --- a/assets/script/game/map/CardComp.ts +++ b/assets/script/game/map/CardComp.ts @@ -5,7 +5,7 @@ import { CCComp } from "../../../../extensions/oops-plugin-framework/assets/modu import { CardConfig, CardType, SpecialCardList } from "../common/config/CardSet"; import { CardUseComp } from "./CardUseComp"; import { HeroInfo } from "../common/config/heroSet"; -import { BuffsList, SkillSet } from "../common/config/SkillSet"; +import { SkillSet } from "../common/config/SkillSet"; @@ -425,9 +425,6 @@ export class CardComp extends CCComp { if (type === CardType.Skill) { return SkillSet[uuid]?.icon || `${uuid}`; } - if (type === CardType.Buff || type === CardType.Debuff) { - return BuffsList[uuid]?.icon || `${uuid}`; - } if (type === CardType.Hero) { return HeroInfo[uuid]?.icon || `${uuid}`; } diff --git a/assets/script/game/skill/SkillView.ts b/assets/script/game/skill/SkillView.ts index 863517b5..7b7ec974 100644 --- a/assets/script/game/skill/SkillView.ts +++ b/assets/script/game/skill/SkillView.ts @@ -2,7 +2,7 @@ import { _decorator, Animation, CCInteger, Collider2D, Contact2DType, UITransfor import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS"; import { CCComp } from "../../../../extensions/oops-plugin-framework/assets/module/common/CCComp"; import { HeroViewComp } from "../hero/HeroViewComp"; -import { BuffsList, DTType, EType, RType, SkillConfig, SkillSet } from "../common/config/SkillSet"; +import { EType, SkillConfig, SkillSet } from "../common/config/SkillSet"; import { SDataCom } from "./SDataCom"; import { HeroAttrsComp } from "../hero/HeroAttrsComp"; import { DamageQueueHelper } from "../hero/DamageQueueComp";