fix: 修复天赋属性加成不生效及全局数据同步问题
修复 TalComp 中永久属性加成类型转换错误,导致天赋属性未正确应用 在 HeroAttrsComp 中添加属性变化后的全局数据同步调用 在 SingletonModuleComp 中确保英雄数据更新后触发 VM 响应 添加 GlobalAttrChange 事件枚举用于后续属性变更监听
This commit is contained in:
@@ -104,6 +104,7 @@ export class HeroAttrsComp extends ecs.Comp {
|
||||
chance: 1, // 必中
|
||||
};
|
||||
this.addBuff(buffConf);
|
||||
smc.updateHeroInfo(this); // 确保同步到全局数据
|
||||
oops.gui.toast(attrCard.desc);
|
||||
}
|
||||
}
|
||||
@@ -306,6 +307,7 @@ export class HeroAttrsComp extends ecs.Comp {
|
||||
|
||||
// 重新计算受影响的属性
|
||||
this.recalculateSingleAttr(attrIndex);
|
||||
smc.updateHeroInfo(this); // 确保同步到全局数据
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -279,7 +279,12 @@ export class TalComp extends ecs.Comp {
|
||||
heroAttrs.addValueTal(talent.uuid, talent.attrs, talent.vType, talent.value + talent.value_add);
|
||||
break;
|
||||
case TalEffet.ATTR: //永久属性
|
||||
let b:BuffConf={buff:Attrs[TalAttrs[talent.attrs]],BType:talent.vType,value:talent.value,time:0, chance:100, }
|
||||
// 修正:强制类型转换为 number (Attrs 是数字枚举)
|
||||
let attrIndex = talent.attrs as unknown as number;
|
||||
// 如果 TalAttrs 存在且需要映射,请取消注释下一行
|
||||
// attrIndex = Attrs[TalAttrs[talent.attrs]];
|
||||
|
||||
let b:BuffConf={buff:attrIndex, BType:talent.vType, value:talent.value + talent.value_add, time:0, chance:100 }
|
||||
heroAttrs.addBuff(b);
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user