From 958a030075657416067a1eece6c1f2bc7455a720 Mon Sep 17 00:00:00 2001 From: panw Date: Sun, 4 Jan 2026 16:12:53 +0800 Subject: [PATCH] =?UTF-8?q?refactor(hero):=20=E4=BF=AE=E6=94=B9TalComp?= =?UTF-8?q?=E4=B8=AD=E5=B1=9E=E6=80=A7=E6=95=88=E6=9E=9C=E5=A4=84=E7=90=86?= =?UTF-8?q?=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 将永久属性效果的处理从直接修改属性值改为添加buff配置,提高代码可维护性和一致性 --- assets/script/game/hero/TalComp.ts | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/assets/script/game/hero/TalComp.ts b/assets/script/game/hero/TalComp.ts index 08709189..dd777d4f 100644 --- a/assets/script/game/hero/TalComp.ts +++ b/assets/script/game/hero/TalComp.ts @@ -1,5 +1,7 @@ +import { basename } from "path/win32"; import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS"; -import { BType } from "../common/config/HeroAttrs"; +import { Attrs, BType } from "../common/config/HeroAttrs"; +import { BuffConf } from "../common/config/SkillSet"; import { TalAttrs, talConf, TalEffet, TalTarget, TriType} from "../common/config/TalSet"; import { HeroAttrsComp } from "./HeroAttrsComp"; import { HeroViewComp } from "./HeroViewComp"; @@ -229,11 +231,12 @@ export class TalComp extends ecs.Comp { case TalEffet.C_MSKILL: heroAttrs.addCountTal(TalEffet.C_MSKILL, talent.value + talent.value_add); break; - case TalEffet.BUFF: + case TalEffet.BUFF: //临时buff heroAttrs.addValueTal(talent.uuid, talent.attrs, talent.vType, talent.value + talent.value_add); break; - case TalEffet.ATTR: - heroAttrs.addValueTal(talent.uuid, talent.attrs, talent.vType, talent.value + talent.value_add); + case TalEffet.ATTR: //永久属性 + let b:BuffConf={buff:Attrs[TalAttrs[talent.attrs]],BType:talent.vType,value:talent.value,time:0, chance:100, } + heroAttrs.addBuff(b); break; } }