feat(game): 技能基础框架基本搭建完成,下步遇到再完善

- 调整了英雄角色top.prefab节点结构和组件关联,优化层级关系和属性值
- 修改pow、mpb等子节点的组件及位置,提升表现效果
- 更新技能atk_fires.prefab增加了ReadyLoop、SkillTime等新属性
- 调整攻击技能atk_s1.prefab的运行类型及相关时间与计数参数
- 修正atk_s1.prefab目标覆盖配置,完善prefab实例结构
- 精简atk_s_1.prefab的子节点引用,去除冗余id链接,简化资源结构
This commit is contained in:
2025-10-19 15:16:39 +08:00
parent 6d5c768a30
commit 6571eb2ef0
14 changed files with 661 additions and 402 deletions

View File

@@ -1,8 +1,8 @@
import { _decorator, Animation, CCBoolean, Collider2D, Contact2DType, Tween, v3, Vec3 } from "cc";
import { _decorator, Animation, CCBoolean, Collider2D, Contact2DType, Tween, UITransform, v3, Vec3 } from "cc";
import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
import { CCComp } from "../../../../extensions/oops-plugin-framework/assets/module/common/CCComp";
import { BezierMove } from "../BezierMove/BezierMove";
import { DTType, EType, SkillSet, SType } from "../common/config/SkillSet";
import { Attrs, DTType, EType, SkillSet, SType } from "../common/config/SkillSet";
import { BoxSet, FacSet } from "../common/config/BoxSet";
import { HeroViewComp } from "../hero/HeroViewComp";
import { GameEvent } from "../common/config/GameEvent";
@@ -28,6 +28,7 @@ export class AtkConCom extends CCComp {
run_time:number = 0;
// 战斗相关运行时数据
Attrs:any=null
hit_count:number = 0;
// 组件引用
anim:Animation=null;
tweenInstance:Tween<any> = null;
@@ -133,29 +134,16 @@ export class AtkConCom extends CCComp {
// if(this.hit_count > 0&&!is_range) this.ap=this.ap*(50+this.puncture_damage)/100 // 穿刺后 伤害减半,过滤范围伤害
if(target == null) return;
if (!this.Config) return;
// let ap=this.ap
// if(this.hit_count > 0 &&!is_range ){
// ap=ap*(50+this.puncture_damage)/100
// }
// target.do_atked(ap,this.caster_crit,this.caster_crit_d,
// this.burn_count,this.burn_value,
// this.stun_time,this.stun_ratio,
// this.frost_time,this.frost_ratio,
// this.Config.AtkedType
// ) // ap 及暴击 属性已经在skill.ts 处理
// // console.log("[SkillCom]:single_damage t:tp:rtp",this.node.position,this.targetPos,target.node.position)
// if(this.Config.debuff>0){
// let debuff=this.Config
// let dev=debuff.deV*(100+this.debuff_value)/100
// let deR=debuff.deR+this.debuff_up
// dev=Math.round(dev*100)/100
// let deC=debuff.deC+this.debuff_count //dec只作为次数叠加
// // //console.log("[SkillCom]:debuff",this.Config.name,debuff.debuff,deUP.deV,deUP.deC)
// target.add_debuff(debuff.debuff,dev,deC,deR)
// }
// this.hit_count++
// // console.log("[SkillCom]:碰撞次数:技能次数:穿刺次数",this.hit_count,this.Config.hit,this.puncture)
// if(this.hit_count>=(this.Config.hit+this.puncture)&&(this.Config.DTType!=DTType.range)&&(this.Config.EType!=EType.animationEnd)&&(this.Config.EType!=EType.timeEnd)) this.is_destroy=true // 技能命中次数
let damage=Math.floor(this.Attrs[Attrs.AP]*(SkillSet[this.s_uuid].ap/100))
if(this.hit_count > 0 &&!is_range ){
let Percentage=Math.pow((50+this.Attrs[Attrs.PUNCTURE_DMG])/100, this.hit_count)
damage=damage*Percentage
}
target.do_atked(damage,this.Attrs,this.s_uuid) // ap 及暴击 属性已经在skill.ts 处理
// console.log("[SkillCom]:single_damage t:tp:rtp",this.node.position,this.targetPos,target.node.position)
this.hit_count++
// console.log("[SkillCom]:碰撞次数:技能次数:穿刺次数",this.hit_count,this.Config.hit,this.puncture)
if(this.hit_count>=(this.Config.hit+this.Attrs[Attrs.PUNCTURE])&&(this.Config.DTType!=DTType.range)&&(this.Config.EType!=EType.animationEnd)&&(this.Config.EType!=EType.timeEnd)) this.is_destroy=true // 技能命中次数
}
update(deltaTime: number) {
// 确保配置已初始化(处理 update 可能先于 start 执行的情况)
@@ -181,7 +169,50 @@ export class AtkConCom extends CCComp {
this.toDestroy();
}
public atk(args:any){
let dis=this.node.getComponent(UITransform).width/2
let targetsInRange: HeroViewComp[] = []
// 收集范围内所有敌方目标
ecs.query(ecs.allOf(HeroViewComp)).some(e => {
const view = e.get(HeroViewComp);
if(view.fac!=this.fac) {
const distance = Math.abs(this.node.position.x - view.node.position.x);
if(distance <= dis) {
targetsInRange.push(view);
}
}
});
// 根据配置的hit_num决定攻击模式
const hitNum = SkillSet[this.s_uuid].hit_num || 0;
if(hitNum > 0) {
// 限制目标数量按距离排序选择最近的N个目标
if(targetsInRange.length > 0) {
// 按距离排序(从近到远)
targetsInRange.sort((a, b) => {
const distanceA = Math.abs(this.node.position.x - a.node.position.x);
const distanceB = Math.abs(this.node.position.x - b.node.position.x);
return distanceA - distanceB;
});
// 限制目标数量
const maxTargets = Math.min(hitNum, targetsInRange.length);
const selectedTargets = targetsInRange.slice(0, maxTargets);
selectedTargets.forEach(target => {
this.single_damage(target, false);
});
}
} else {
// 范围伤害:对所有范围内目标造成伤害
if(targetsInRange.length > 0) {
targetsInRange.forEach(target => {
this.single_damage(target, false);
});
}
}
}
toDestroy() {
if(this.is_destroy){
if (this.ent) {

View File

@@ -1,4 +1,4 @@
import { _decorator, CCBoolean, CCInteger, instantiate, Node, Prefab, v3, Vec3 } from "cc";
import { _decorator, CCBoolean, CCFloat, CCInteger, instantiate, Node, Prefab, v3, Vec3 } from "cc";
import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
import { CCComp } from "../../../../extensions/oops-plugin-framework/assets/module/common/CCComp";
import { HeroViewComp } from "../hero/HeroViewComp";
@@ -17,23 +17,29 @@ export class SkillViewCom extends CCComp {
atkPrefab: Prefab = null!
@property
hasReady: boolean = false;
@property
ReadyLoop: boolean = false // 预备是否循环
@property({ type: CCFloat })
SkillTime: number = 0 // 技能控制存续时间时间
@property({ type: CCFloat })
ReadyTime: number = 0 // 技能前摇时间
@property({ type: CCInteger })
ReadyTime: number = 0
@property({ type: CCInteger })
runType: number = 0
runType: number = 0 //技能运行类型 0-线性 1-贝塞尔 2-开始位置固定 3-目标位置固定
@property({ type: CCInteger })
ready_y: number = 0
@property({ type: CCInteger })
atk_x: number = 0
@property({ type: CCInteger })
atk_y: number = 0
@property({ type: CCInteger })
s_count:number=1;
@property({ type: CCFloat })
s_interval:number=0.2;
endTime: number = 0;
readyFinish: boolean = false;
caster:HeroViewComp=null!;
s_uuid:number=0;
s_count:number=1;
s_interval:number=0.2;
s_cd:number=0;
scale: number = 0;
cName:string="";
@@ -60,7 +66,7 @@ export class SkillViewCom extends CCComp {
}
doEnd(dt: number) {
this.endTime += dt
if(this.endTime >= SkillSet[this.s_uuid].in) {
if(this.endTime >= this.SkillTime) {
this.ent.destroy()
}
}