refactor(skill): 重构命中次数计算逻辑,移除冗余字段
- 将命中次数计算从 SkillView 移至 Skill 初始化,统一计算逻辑 - 移除 SkillConfig 接口中的 hit 字段,使用 hit_count 统一表示可命中次数 - 更新注释说明,hit_count 表示可命中次数而非攻击目标数量 - 清理 SkillView 中冗余的命中次数初始化代码 - 调整技能配置数据,移除所有 hit 字段值
This commit is contained in:
@@ -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(() => {
|
||||
|
||||
Reference in New Issue
Block a user