refactor(技能/英雄): 重构移动结束检测和冰冻状态逻辑
- 移除移动结束类型中的距离结束检测,仅保留碰撞结束 - 删除 HeroViewComp 中未使用的 mp_add 和 playIntervalEffect 方法 - 简化 HeroAttrsComp 中冰冻状态判断逻辑,移除 in_frost 字段 - 在 HeroBuffSystem 中添加定时器自动减少冰冻剩余时间
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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会被拦截
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user