This commit is contained in:
2025-07-07 20:23:01 +08:00
parent b642c1d40f
commit aa31ffb0e8
2 changed files with 63 additions and 56 deletions

View File

@@ -54,6 +54,7 @@ export class SkillCom extends CCComp {
caster_crit_d:number=0;
puncture:number=0;
puncture_damage:number=0;
EType:any=null
private moveDirection: Vec3 | null = null; // 添加一个属性来存储移动方向
protected onLoad(): void {
@@ -62,7 +63,7 @@ export class SkillCom extends CCComp {
}
start() {
this.EType=SkillSet[this.s_uuid].EType
this.node.setPosition(this.startPos.x,this.startPos.y,0)
if(this.node.getChildByName('anm')){
this.spine=this.node.getChildByName('anm').getComponent('sp.Skeleton') as sp.Skeleton;
@@ -126,17 +127,17 @@ export class SkillCom extends CCComp {
if(view){
let dis =Math.abs(this.node.position.x-view.node.position.x)
if(dis > SkillSet[this.s_uuid].with) return
this.single_damage(view)
this.single_damage(view,true)
}
});
}
//单体伤害
single_damage(target:HeroViewComp){
single_damage(target:HeroViewComp,is_range:boolean=false){
// console.log("[SkillCom]:onBeginContact hit_count:",this.hit_count,SkillSet[this.s_uuid].hit)
if(this.hit_count > 0) this.ap=this.ap*(50+this.puncture_damage)/100 // 穿刺后 伤害减半
// if(this.hit_count > 0&&!is_range) this.ap=this.ap*(50+this.puncture_damage)/100 // 穿刺后 伤害减半,过滤范围伤害
if(target == null) return;
target.do_atked(this.ap,this.caster_crit,this.caster_crit_d) // ap 及暴击 属性已经在skill.ts 处理
// console.log("[SkillCom]:single_damage",this.ap,this.caster_crit,this.caster_crit_d)
console.log("[SkillCom]:single_damage",this.ap,this.caster_crit,this.caster_crit_d,this.hit_count)
if(SkillSet[this.s_uuid].debuff>0){
let deUP =this.get_debuff() // 因为不是每个技能都需要,debuff的增益在这里处理, ap 及暴击 属性已经在skill.ts 处理
let debuff=SkillSet[this.s_uuid]
@@ -148,7 +149,7 @@ export class SkillCom extends CCComp {
target.add_debuff(debuff.debuff,dev,deC,deR)
}
this.hit_count++
if(this.hit_count>=(SkillSet[this.s_uuid].hit+this.puncture)) this.is_destroy=true // 技能命中次数
if(this.hit_count>=(SkillSet[this.s_uuid].hit+this.puncture)&&(this.EType!=EType.animationEnd&&this.EType!=EType.timeEnd)) this.is_destroy=true // 技能命中次数
}
onBeginContact (seCol: Collider2D, oCol: Collider2D) {
@@ -209,7 +210,7 @@ export class SkillCom extends CCComp {
}
//范围伤害
this.hited_time+=deltaTime
if(this.hited_time>config.hited&&this.hit_count == 0&&(config.EType==EType.animationEnd||config.EType==EType.timeEnd)){
if(this.hited_time>config.hited&&(config.EType==EType.animationEnd||config.EType==EType.timeEnd)){
this.hited_time=0
this.range_damage()
}