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

@@ -148,6 +148,8 @@ export enum Attrs {
SHIELD_UP = 28, //护盾效果提升
BURN = 29, //攻击带易伤
DEBURN = 30, //被攻击易伤
PUNCTURE=31, // 穿刺次数
PUNCTURE_DMG=32, //穿刺伤害加成
}
@@ -191,6 +193,7 @@ export const AttrsType: Record<Attrs, BType> = {
[Attrs.DIS]: BType.VALUE, // 攻击距离 - 数值型
[Attrs.BURN]: BType.VALUE, // 易伤 - 数值型
[Attrs.DEBURN]: BType.VALUE, // 被攻击易伤 - 数值型
[Attrs.PUNCTURE]: BType.VALUE, // 穿刺次数 - 数值型
// ========== 百分比型属性 ==========
[Attrs.CRITICAL]: BType.RATIO, // 暴击率 - 百分比型
@@ -214,6 +217,7 @@ export const AttrsType: Record<Attrs, BType> = {
[Attrs.DBUFF_UP]: BType.RATIO, // debuff效果提升 - 百分比型
[Attrs.SPEED]: BType.RATIO, // 移动速度加成 - 百分比型
[Attrs.SHIELD_UP]: BType.RATIO, // 护盾效果提升 - 百分比型
[Attrs.PUNCTURE_DMG]: BType.RATIO,
};
/**
@@ -384,7 +388,7 @@ export const SkillSet: Record<number, SkillConfig> = {
},
6005: {
uuid:6005,name:"火球术",sp_name:"atk_fires",AtkedType:AtkedType.fire,path:"3039",TGroup:TGroup.Enemy,SType:SType.damage,act:"atk",DTType:DTType.single,
ap:100,cd:5,in:1,t_num:1,hit_num:1,hit:2,hitcd:0.3,speed:720,cost:10,with:90,
ap:100,cd:5,in:1,t_num:1,hit_num:1,hit:2,hitcd:0.3,speed:720,cost:20,with:90,
buffs:[],debuffs:[],info:"召唤大火球攻击前方所有敌人,造成300%攻击的伤害,有一定几率施加灼烧"
},
6006: {

View File

@@ -143,15 +143,15 @@ export const HeroInfo: Record<number, heroInfo> = {
//怪物
5201:{uuid:5201,name:"兽人战士",path:"mo1", fac:FacSet.MON, kind:1,
type:HType.warrior,lv:1,hp:25,mp:100,map:100,def:5,ap:5,dis:90,cd:2,speed:100,skills:[6001,6005],
type:HType.warrior,lv:1,hp:25,mp:100,map:100,def:5,ap:5,dis:90,cd:2,speed:100,skills:[6005],
buff:[],debuff:[],info:"普通怪物-战士型"},
5202:{uuid:5202,name:"兽人刺客",path:"mo1", fac:FacSet.MON, kind:1,
type:HType.remote,lv:1,hp:20,mp:100,map:100,def:5,ap:5,dis:350,cd:1,speed:100,skills:[6001,6005],
type:HType.remote,lv:1,hp:20,mp:100,map:100,def:5,ap:5,dis:350,cd:1,speed:100,skills:[6005],
buff:[],debuff:[],info:"普通怪物-战士型"},
5203:{uuid:5203,name:"兽人护卫",path:"mo3", fac:FacSet.MON, kind:1,
type:HType.warrior,lv:1,hp:25,mp:100,map:100,def:5,ap:5,dis:90,cd:2,speed:100,skills:[6001,6005],
type:HType.warrior,lv:1,hp:25,mp:100,map:100,def:5,ap:5,dis:90,cd:2,speed:100,skills:[6005],
buff:[],debuff:[],info:"普通怪物-战士型"},
// 5204:{uuid:5204,name:"石卫", path:"mo1", fac:FacSet.MON, kind:1,

View File

@@ -91,6 +91,12 @@ export class BuffComp extends Component {
// this.node.getChildByName("top").getChildByName("hp").active = (hp == hp_max) ? false : true;
}
mp_show(mp:number,mp_max:number){
this.node.getChildByName("top").getChildByName("pow").getComponent(ProgressBar).progress = mp/mp_max;
this.scheduleOnce(()=>{
this.node.getChildByName("top").getChildByName("pow").getChildByName("mpb").getComponent(ProgressBar).progress = mp/mp_max;
},0.15)
}
update_info_lv(){

View File

@@ -120,7 +120,7 @@ export class HeroViewComp extends CCComp {
}
/* 显示角色血*/
this.node.getChildByName("top").getChildByName("hp").active = true;
this.BUFFCOMP.show_shield(this.shield,this.Attrs[Attrs.SHIELD_MAX])
this.node.getChildByName("top").getChildByName("pow").active = true;
}
// ==================== BUFF系统初始====================
@@ -494,12 +494,16 @@ export class HeroViewComp extends CCComp {
this.processDamageQueue();
// 更新临时 buff/debuff 时间
this.updateTemporaryBuffsDebuffs(dt);
this.BUFFCOMP.hp_show(this.hp,this.Attrs[Attrs.HP_MAX])
this.BUFFCOMP.mp_show(this.mp,this.Attrs[Attrs.MP_MAX])
this.BUFFCOMP.show_shield(this.shield,this.Attrs[Attrs.SHIELD_MAX])
}
BaseUp(dt:number){
this.mp += HeroUpSet.MP*dt
this.hp += HeroUpSet.HP*dt
if(this.mp > this.Attrs[Attrs.MP_MAX]) this.mp = this.Attrs[Attrs.MP_MAX]
if(this.hp > this.Attrs[Attrs.HP_MAX]) this.hp = this.Attrs[Attrs.HP_MAX]
}
do_fight_end(){
this.as.do_buff()
@@ -587,23 +591,15 @@ export class HeroViewComp extends CCComp {
}
do_atked(remainingDamage:number,
crit:number=0,crit_d:number=0,
burn_count:number=0,burn_value:number=0,
stun_time:number=0,stun_ratio:number=0,
frost_time:number=0,frost_ratio:number=0,
atked_anm:string="atked"
){
do_atked(remainingDamage:number,CAttrs:any,s_uuid:number){
let SConf=SkillSet[s_uuid]
this.do_atked_trigger()
if(this.check_dodge()) return
let is_crit = this.check_crit(crit)
let is_crit = this.check_crit(CAttrs[Attrs.CRITICAL])
if(this == null) return;
let damage = this.count_damage(remainingDamage)
if(is_crit) {
damage = Math.floor(damage * (1 + (FightSet.CRIT_DAMAGE+crit_d)/100))
damage = Math.floor(damage * (1 + (FightSet.CRIT_DAMAGE+CAttrs[Attrs.CRITICAL_DMG])/100))
}
// console.log(this.hero_name+"[HeroViewComp]:heroview :damage|hp|hp_max",damage,this.hp,this.Attrs[BuffAttr.HP_MAX])
damage=this.check_shield(damage)
@@ -625,12 +621,9 @@ export class HeroViewComp extends CCComp {
}
}
// this.update_vm
this.back()
this.showDamage(damage, is_crit,atked_anm);
this.showDamage(damage, is_crit,SConf.AtkedType);
}
//后退
back(){

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()
}
}

View File

@@ -4,6 +4,7 @@ import { CCComp } from "../../../../../extensions/oops-plugin-framework/assets/m
import { HeroViewComp } from "../../hero/HeroViewComp";
import { SkillCom } from "../SkillCom";
import { AtkConCom } from "../../skill/AtkConCom";
import { SkillSet } from "../../common/config/SkillSet";
const { ccclass, property } = _decorator;
@@ -17,53 +18,7 @@ export class AtkComComp extends CCComp {
// this.on(ModuleEvent.Cmd, this.onHandler, this);
}
public atk(args:any){
let scom=this.node.getComponent(SkillCom)
let acom=this.node.getComponent(AtkConCom)
let skill=scom?scom:acom
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!=skill.fac) {
const distance = Math.abs(skill.node.position.x - view.node.position.x);
if(distance <= dis) {
targetsInRange.push(view);
}
}
});
// 根据配置的hit_num决定攻击模式
const hitNum = skill.skillConfig?.hit_num || 0;
if(hitNum > 0) {
// 限制目标数量按距离排序选择最近的N个目标
if(targetsInRange.length > 0) {
// 按距离排序(从近到远)
targetsInRange.sort((a, b) => {
const distanceA = Math.abs(skill.node.position.x - a.node.position.x);
const distanceB = Math.abs(skill.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 => {
skill.single_damage(target, false);
});
}
} else {
// 范围伤害:对所有范围内目标造成伤害
if(targetsInRange.length > 0) {
targetsInRange.forEach(target => {
skill.single_damage(target, false);
});
}
}
}
/** 全局消息逻辑处理 */
// private onHandler(event: string, args: any) {
// switch (event) {