From 50936dce1da24c678e22c93d166ca8b83bbf7565 Mon Sep 17 00:00:00 2001 From: walkpan Date: Thu, 19 Mar 2026 18:49:19 +0800 Subject: [PATCH] =?UTF-8?q?refactor(=E6=8A=80=E8=83=BD/=E8=8B=B1=E9=9B=84)?= =?UTF-8?q?:=20=E9=87=8D=E6=9E=84=E7=A7=BB=E5=8A=A8=E7=BB=93=E6=9D=9F?= =?UTF-8?q?=E6=A3=80=E6=B5=8B=E5=92=8C=E5=86=B0=E5=86=BB=E7=8A=B6=E6=80=81?= =?UTF-8?q?=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 移除移动结束类型中的距离结束检测,仅保留碰撞结束 - 删除 HeroViewComp 中未使用的 mp_add 和 playIntervalEffect 方法 - 简化 HeroAttrsComp 中冰冻状态判断逻辑,移除 in_frost 字段 - 在 HeroBuffSystem 中添加定时器自动减少冰冻剩余时间 --- assets/script/game/hero/HeroAttrsComp.ts | 26 +++++++++---------- assets/script/game/hero/HeroViewComp.ts | 33 ------------------------ assets/script/game/skill/SMoveSystem.ts | 1 - 3 files changed, 13 insertions(+), 47 deletions(-) diff --git a/assets/script/game/hero/HeroAttrsComp.ts b/assets/script/game/hero/HeroAttrsComp.ts index e1fc04b3..bf189c8b 100644 --- a/assets/script/game/hero/HeroAttrsComp.ts +++ b/assets/script/game/hero/HeroAttrsComp.ts @@ -3,6 +3,7 @@ import { Attrs } from "../common/config/HeroAttrs"; import { BuffConf } from "../common/config/SkillSet"; import { HeroDisVal, HType } from "../common/config/heroSet"; import { mLogger } from "../common/Logger"; +import { Timer } from "db://oops-framework/core/common/timer/Timer"; @ecs.register('HeroAttrs') export class HeroAttrsComp extends ecs.Comp { public debugMode: boolean = false; @@ -88,7 +89,6 @@ export class HeroAttrsComp extends ecs.Comp { * 从 HeroInfo 读取初始配置,建立属性系统 */ initAttrs() { - this.in_frost = false; this.frost_end_time = 0; } /*******************基础属性管理********************/ @@ -182,17 +182,7 @@ export class HeroAttrsComp extends ecs.Comp { } } isFrost(): boolean { - if (!this.in_frost) return false; - if (this.frost_end_time <= 0) { - this.in_frost = false; - return false; - } - if (Date.now() / 1000 >= this.frost_end_time) { - this.in_frost = false; - this.frost_end_time = 0; - return false; - } - return true; + return this.frost_end_time > 0 } triggerAtkCD() { this.a_cd = 0; @@ -272,7 +262,6 @@ export class HeroAttrsComp extends ecs.Comp { this.wfuny = 0; this.boom = false; - this.in_frost = false; this.frost_end_time = 0; // 重置技能距离缓存 @@ -309,11 +298,22 @@ export class HeroAttrsComp extends ecs.Comp { @ecs.register('HeroBuffSystem') export class HeroBuffSystem extends ecs.ComblockSystem implements ecs.ISystemUpdate { + private timer =new Timer(0.2) filter(): ecs.IMatcher { return ecs.allOf(HeroAttrsComp); } update(e: ecs.Entity): void { + if(this.timer.update(this.dt)){ + const attrsComp = e.get(HeroAttrsComp); + if(attrsComp.frost_end_time > 0){ + attrsComp.frost_end_time -= 0.2; + if(attrsComp.frost_end_time <= 0){ + attrsComp.frost_end_time = 0; + } + } + + } void e; } } diff --git a/assets/script/game/hero/HeroViewComp.ts b/assets/script/game/hero/HeroViewComp.ts index ea10d6c7..fa457c41 100644 --- a/assets/script/game/hero/HeroViewComp.ts +++ b/assets/script/game/hero/HeroViewComp.ts @@ -385,39 +385,6 @@ export class HeroViewComp extends CCComp { this.lastBarUpdateTime = Date.now() / 1000; } - mp_add(mp: number = 0) { - // ✅ 仅显示提示,不调用 mp_show() - this.hp_tip(TooltipTypes.addmp, mp.toFixed(0)); - this.lastBarUpdateTime = Date.now() / 1000; - } - - playIntervalEffect(attr: Attrs, value: number, s_uuid: number) { - if (!this.node || !this.node.isValid) return; - this.lastBarUpdateTime = Date.now() / 1000; - if (attr === Attrs.hp) { - if (value > 0) { - this.heathed(); - this.hp_tip(TooltipTypes.health, value.toFixed(0), s_uuid); - } else if (value < 0) { - this.activateTopBar(); - this.playHpBarShake(); - this.in_atked("atked", this.model?.fac == FacSet.HERO ? 1 : -1); - this.hp_tip(TooltipTypes.life, Math.abs(value).toFixed(0), s_uuid); - } - return; - } - if (attr === Attrs.shield) { - if (this.model && this.model.shield > 0) { - this.show_shield(this.model.shield, this.model.shield_max); - } - this.hp_tip(TooltipTypes.health, Math.abs(value).toFixed(0), s_uuid); - return; - } - if (attr === Attrs.IN_FROST && value > 0) { - this.in_iced(0.3); - return; - } - } alive(){ // 重置复活标记 - 必须最先重置,否则status_change会被拦截 diff --git a/assets/script/game/skill/SMoveSystem.ts b/assets/script/game/skill/SMoveSystem.ts index 9d866c95..8851ffb8 100644 --- a/assets/script/game/skill/SMoveSystem.ts +++ b/assets/script/game/skill/SMoveSystem.ts @@ -168,7 +168,6 @@ export class SMoveSystem extends ecs.ComblockSystem implements ecs.ISystemUpdate if (moveComp.isCompleted && moveComp.autoDestroy) { // 根据结束类型决定是否销毁 if ( - moveComp.endType === EType.distanceEnd || moveComp.endType === EType.collision ) { skillView.close_collider();