fix(英雄属性): 修复全局属性加成不生效的问题
调整全局属性加成配置,将攻击力加成值设为1,生命上限加成值设为100,并确保加成仅对英雄生效。在属性初始化时强制重算受全局属性影响的属性,并确保英雄初始状态为满血满蓝。
This commit is contained in:
@@ -144,8 +144,8 @@ export class SingletonModuleComp extends ecs.Comp {
|
|||||||
|
|
||||||
// 全局属性加成 {attrIndex: [value, count]}
|
// 全局属性加成 {attrIndex: [value, count]}
|
||||||
global_attrs: Record<number, [number, number]> = {
|
global_attrs: Record<number, [number, number]> = {
|
||||||
[Attrs.AP]: [1, 100], // 攻击力
|
[Attrs.AP]: [1, 0], // 攻击力
|
||||||
[Attrs.HP_MAX]: [1, 10000], // 生命上限
|
[Attrs.HP_MAX]: [100, 100], // 生命上限
|
||||||
[Attrs.DEF]: [1, 0], // 防御
|
[Attrs.DEF]: [1, 0], // 防御
|
||||||
[Attrs.SPEED]: [1, 0], // 速度
|
[Attrs.SPEED]: [1, 0], // 速度
|
||||||
[Attrs.CRITICAL]: [1, 0], // 暴击率
|
[Attrs.CRITICAL]: [1, 0], // 暴击率
|
||||||
|
|||||||
@@ -213,6 +213,19 @@ export class HeroAttrsComp extends ecs.Comp {
|
|||||||
this.addBuff(buffConf);
|
this.addBuff(buffConf);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 3. 应用全局属性加成 (强制重算受影响的属性)
|
||||||
|
if (this.fac === 0 && smc.global_attrs) {
|
||||||
|
for (const key in smc.global_attrs) {
|
||||||
|
const attrIndex = Number(key);
|
||||||
|
this.recalculateSingleAttr(attrIndex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 4. 初始化状态值 (确保满状态)
|
||||||
|
this.hp = this.Attrs[Attrs.HP_MAX];
|
||||||
|
this.mp = this.Attrs[Attrs.MP_MAX];
|
||||||
|
|
||||||
smc.updateHeroInfo(this);
|
smc.updateHeroInfo(this);
|
||||||
}
|
}
|
||||||
/*******************基础属性管理********************/
|
/*******************基础属性管理********************/
|
||||||
@@ -370,10 +383,13 @@ export class HeroAttrsComp extends ecs.Comp {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 全局属性加成
|
// 全局属性加成 (只对英雄生效,怪物不生效)
|
||||||
if (smc.global_attrs[attrIndex]) {
|
// this.fac === 0 代表英雄 (FacSet.HERO)
|
||||||
|
if (this.fac === 0 && smc.global_attrs && smc.global_attrs[attrIndex]) {
|
||||||
const [val, count] = smc.global_attrs[attrIndex];
|
const [val, count] = smc.global_attrs[attrIndex];
|
||||||
totalRatio += val * count;
|
const globalAdd = val * count;
|
||||||
|
totalRatio += globalAdd;
|
||||||
|
// console.log(`[HeroAttrs] 全局加成: ${this.hero_name} Attr=${attrIndex} Val=${val} Count=${count} Add=${globalAdd}%`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 4. 根据属性类型计算最终值
|
// 4. 根据属性类型计算最终值
|
||||||
|
|||||||
Reference in New Issue
Block a user