refactor(hero): 移除怒气值相关属性和逻辑,修改hp显示逻辑

移除英雄属性组件中的怒气值(pow)属性及相关配置
删除英雄视图组件中怒气值显示和使用的逻辑
简化资源管理,移除不再使用的代码
This commit is contained in:
2025-11-25 16:35:35 +08:00
parent 3edc69deff
commit b73d756106
3 changed files with 13 additions and 31 deletions

View File

@@ -31,7 +31,6 @@ export class HeroAttrsComp extends ecs.Comp {
// ==================== 动态属性值 ====================
hp: number = 100; // 当前血量
mp: number = 100; // 当前魔法值
pow: number = 0; // 当前怒气值
shield: number = 0; // 当前护盾
Attrs: any = []; // 最终属性数组经过Buff计算后
NeAttrs: any = []; // 负面状态数组
@@ -150,6 +149,8 @@ export class HeroAttrsComp extends ecs.Comp {
this.recalculateSingleAttr(attrIndex);
}
// ==================== 属性计算系统 ====================
/**
* 重新计算单个属性

View File

@@ -31,8 +31,6 @@ export class HeroViewComp extends CCComp {
status:String = "idle"
scale: number = 1; // 显示方向
box_group:number = BoxSet.HERO; // 碰撞组
usePower:boolean = false;
useMp:boolean = false;
realDeadTime:number=10
deadCD:number=0
// 血条显示相关
@@ -89,10 +87,7 @@ export class HeroViewComp extends CCComp {
// }
/* 显示角色血*/
this.top_node.getChildByName("hp").active = true;
this.usePower=HeroInfo[this.model.hero_uuid].type==HType.warrior||HeroInfo[this.model.hero_uuid].type==HType.assassin;
this.useMp=HeroInfo[this.model.hero_uuid].type==HType.mage||HeroInfo[this.model.hero_uuid].type==HType.remote||HeroInfo[this.model.hero_uuid].type==HType.support;
this.top_node.getChildByName("pow").active = this.usePower;
this.top_node.getChildByName("mp").active = this.useMp;
this.top_node.getChildByName("mp").active = true;
// 初始隐藏血条(被攻击后才显示)
this.top_node.active = false;
}
@@ -140,9 +135,9 @@ export class HeroViewComp extends CCComp {
this.processDamageQueue(); // 伤害数字显示队列
// ✅ 更新 UI 显示(数据由 HeroAttrSystem 更新)
// 移除了每帧调用的 hp_show改为仅在需要时调用
this.hp_show(this.model.hp, this.model.Attrs[Attrs.HP_MAX]);
if(this.useMp) this.mp_show(this.model.mp, this.model.Attrs[Attrs.MP_MAX]);
if(this.usePower) this.pow_show(this.model.pow, this.model.Attrs[Attrs.POW_MAX]);
this.mp_show(this.model.mp, this.model.Attrs[Attrs.MP_MAX]);
this.show_shield(this.model.shield, this.model.Attrs[Attrs.SHIELD_MAX]);
}
@@ -297,9 +292,10 @@ export class HeroViewComp extends CCComp {
health(hp: number = 0, is_num:boolean=true) {
// 生命值更新由 Model 层处理,这里只负责视图表现
this.heathed();
if(this.model) {
this.hp_show(hp, this.model.Attrs[Attrs.HP_MAX]);
}
this.hp_tip(TooltipTypes.health, hp.toFixed(0));
this.top_node.active=true
this.hp_show(this.model.hp, this.model.Attrs[Attrs.HP_MAX]);
}
alive(){
@@ -390,19 +386,8 @@ export class HeroViewComp extends CCComp {
}
// 伤害计算和战斗逻辑已迁移到 HeroBattleSystem
/** 死亡触发器(预留,用于天赋/特殊效果) */
do_dead_trigger(){
if(!this.model || this.model.is_dead || this.model.fac === FacSet.MON) return;
// 预留:天赋触发、复活检查等
}
/** 受击触发器(预留,用于天赋/特殊效果) */
do_atked_trigger(){
if(!this.model || this.model.is_dead || this.model.fac === FacSet.MON) return;
// 预留:反击、护盾触发等
}
/** 调试日志(已禁用) */
to_console(value:any, value2:any=null, value3:any=null){
@@ -415,7 +400,7 @@ export class HeroViewComp extends CCComp {
switch(skill.act){
case "max":
this.as.max()
this.tooltip(TooltipTypes.skill, skill.name, skill_id)
this.tooltip(TooltipTypes.skill, skill.name)
break
case "atk":
this.as.atk()
@@ -458,9 +443,9 @@ export class HeroViewComp extends CCComp {
this.hp_show(this.model.hp, this.model.Attrs[Attrs.HP_MAX]);
this.in_atked(anm, this.model.fac==FacSet.HERO?1:-1);
if (isCrit) {
this.hp_tip(TooltipTypes.crit, damage.toFixed(0), damage);
this.hp_tip(TooltipTypes.crit, damage.toFixed(0));
} else {
this.hp_tip(TooltipTypes.life, damage.toFixed(0), damage);
this.hp_tip(TooltipTypes.life, damage.toFixed(0));
}
}
reset() {