refactor(MissionHeroComp): 移除闲置的驻场技能总加成计算方法
This commit is contained in:
@@ -6,6 +6,7 @@ import { FacSet, FightSet } from "../common/config/GameSet";
|
||||
import { FieldSkillSet, FieldSkillType } from "../common/config/SkillSet";
|
||||
import { smc } from "../common/SingletonModuleComp";
|
||||
import { TalentConfig, TalentType } from "../common/config/TalentSet";
|
||||
import { FieldSkillHelper } from "./FieldSkillHelper";
|
||||
@ecs.register('HeroAttrs')
|
||||
export class HeroAttrsComp extends ecs.Comp {
|
||||
public debugMode: boolean = false;
|
||||
@@ -203,7 +204,7 @@ export class HeroAttrsComp extends ecs.Comp {
|
||||
|
||||
/** 将驻场配置值统一换算成百分比数值,兼容 0.2 和 20 两种写法。 */
|
||||
private getFieldPercentValue(type: FieldSkillType): number {
|
||||
const rawValue = HeroAttrsComp.getFieldSkillTotalValue(type);
|
||||
const rawValue = FieldSkillHelper.getFieldSkillTotalValue(type);
|
||||
if (Math.abs(rawValue) <= HeroAttrsComp.percentRateThreshold) {
|
||||
return rawValue * 100;
|
||||
}
|
||||
@@ -340,24 +341,7 @@ export class HeroAttrsComp extends ecs.Comp {
|
||||
this.dirty_shield = false;
|
||||
}
|
||||
|
||||
/** 获取指定驻场技能类型的总加成值(只计算存活的英雄) */
|
||||
public static getFieldSkillTotalValue(type: FieldSkillType): number {
|
||||
let total = 0;
|
||||
ecs.query(ecs.allOf(HeroAttrsComp)).forEach((entity: ecs.Entity) => {
|
||||
const model = entity.get(HeroAttrsComp);
|
||||
if (!model || model.is_dead || model.fac !== FacSet.HERO) return;
|
||||
const heroConfig = HeroInfo[model.hero_uuid];
|
||||
if (heroConfig && heroConfig.field) {
|
||||
for (const skillUuid of heroConfig.field) {
|
||||
const skillConfig = FieldSkillSet[skillUuid];
|
||||
if (skillConfig && skillConfig.type === type) {
|
||||
total += skillConfig.value;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
return total;
|
||||
}
|
||||
|
||||
|
||||
/** 获取指定天赋的加成数值 */
|
||||
public static getTalentValue(talentId: TalentType): number {
|
||||
|
||||
Reference in New Issue
Block a user