refactor(skill): 重构命中次数计算逻辑,移除冗余字段

- 将命中次数计算从 SkillView 移至 Skill 初始化,统一计算逻辑
- 移除 SkillConfig 接口中的 hit 字段,使用 hit_count 统一表示可命中次数
- 更新注释说明,hit_count 表示可命中次数而非攻击目标数量
- 清理 SkillView 中冗余的命中次数初始化代码
- 调整技能配置数据,移除所有 hit 字段值
This commit is contained in:
panw
2026-03-16 10:08:54 +08:00
parent 4e393b48b9
commit d4eeedb2f6
3 changed files with 21 additions and 26 deletions

View File

@@ -182,6 +182,8 @@ export class Skill extends ecs.Entity {
sDataCom.s_uuid=s_uuid
sDataCom.fac=cAttrsComp.fac
sDataCom.ext_dmg=ext_dmg
sDataCom.hit_count = 0
sDataCom.max_hit_count = Math.max(1, config.hit_count + cAttrsComp.puncture)
SView.init();
}

View File

@@ -4,7 +4,6 @@ import { CCComp } from "../../../../extensions/oops-plugin-framework/assets/modu
import { HeroViewComp } from "../hero/HeroViewComp";
import { BuffsList, DTType, EType, RType, SkillConfig, SkillSet } from "../common/config/SkillSet";
import { SDataCom } from "./SDataCom";
import { Attrs } from "../common/config/HeroAttrs";
import { HeroAttrsComp } from "../hero/HeroAttrsComp";
import { DamageQueueHelper } from "../hero/DamageQueueComp";
import { mLogger } from "../common/Logger";
@@ -58,12 +57,6 @@ export class SkillView extends CCComp {
anim.play(anim.defaultClip.name);
}
}
if (this.sData) {
this.sData.hit_count = 0;
const punctureCount = this.sData.Attrs?.[Attrs.puncture] ?? 0;
const baseHitCount = this.SConf?.hit ?? 0;
this.sData.max_hit_count = baseHitCount + punctureCount;
}
}
onBeginContact (seCol: Collider2D, oCol: Collider2D) {
if (!this.sData || !this.SConf) {
@@ -105,6 +98,8 @@ export class SkillView extends CCComp {
}
// //动画帧事件 atk 触发
public atk(args:any){
if(!this.SConf) return;
if(this.SConf.EType==EType.collision) return
if (this.enable_collider_safely()) {
mLogger.log(this.debugMode, 'SkillView', `[SkillView] [${this.SConf?.name}] 开启碰撞检测`);
this.scheduleOnce(() => {