必杀技和卡牌技能 签到 skillconcomp,统一执行
This commit is contained in:
@@ -156,34 +156,13 @@ export const Quality={
|
||||
ORANGE:5,
|
||||
}
|
||||
|
||||
export const SuperCardsList=[3001,3002,3101,3102,3103,3104,3105,3106];
|
||||
export const SuperCardsList=[3101,3102,3103];
|
||||
export const SuperCards={
|
||||
3001:{uuid:3001,name:"附魔宝典",quality:Quality.WHITE,path:"3001",CTarget:CTarget.MASTER,type:SuperCardsType.SPECIAL,value1:1,value2:0,value3:0,
|
||||
info:"攻击触发提高英雄/伙伴属性的效果,额外添加+1攻击力"},
|
||||
3002:{uuid:3002,name:"附魔宝典",quality:Quality.WHITE,path:"3002",CTarget:CTarget.MASTER,type:SuperCardsType.SPECIAL,value1:1,value2:0,value3:0,
|
||||
info:"攻击触发高英雄/伙伴属性的效果,额外添加+1生命值"},
|
||||
3101:{uuid:3101,name:"陨石术",quality:Quality.GREEN,path:"3101",CTarget:CTarget.ENEMY,type:SuperCardsType.AOE,value1:SkillSet[6029].uuid,value2:10,value3:0,
|
||||
|
||||
3101:{uuid:3101,name:"陨石爆",quality:Quality.GREEN,path:"3101",CTarget:CTarget.ENEMY,type:SuperCardsType.AOE,value1:SkillSet[6032].uuid,value2:10,value3:0,
|
||||
info:"召唤大量火球攻击敌人,每个火球对敌人造成英雄攻击力的300%伤害"},
|
||||
3102:{uuid:3102,name:"冰刺",quality:Quality.BLUE,path:"3102",CTarget:CTarget.ENEMY,type:SuperCardsType.AOE,value1:SkillSet[6027].uuid,value2:10,value3:0,
|
||||
3102:{uuid:3102,name:"龙卷群",quality:Quality.BLUE,path:"3104",CTarget:CTarget.ENEMY,type:SuperCardsType.AOE,value1:SkillSet[6033].uuid,value2:10,value3:0,
|
||||
info:"召唤大量火球攻击敌人,每个火球对敌人造成英雄攻击力的300%伤害"},
|
||||
3103:{uuid:3103,name:"潮汐",quality:Quality.BLUE,path:"3103",CTarget:CTarget.ENEMY,type:SuperCardsType.AOE,value1:SkillSet[6028].uuid,value2:10,value3:0,
|
||||
3103:{uuid:3103,name:"大海啸",quality:Quality.PURPLE,path:"3105",CTarget:CTarget.ENEMY,type:SuperCardsType.AOE,value1:SkillSet[6034].uuid,value2:10,value3:0,
|
||||
info:"召唤大量火球攻击敌人,每个火球对敌人造成英雄攻击力的300%伤害"},
|
||||
3104:{uuid:3104,name:"龙卷风",quality:Quality.BLUE,path:"3104",CTarget:CTarget.ENEMY,type:SuperCardsType.AOE,value1:SkillSet[6023].uuid,value2:10,value3:0,
|
||||
info:"召唤大量火球攻击敌人,每个火球对敌人造成英雄攻击力的300%伤害"},
|
||||
3105:{uuid:3105,name:"火球风暴",quality:Quality.PURPLE,path:"3105",CTarget:CTarget.ENEMY,type:SuperCardsType.AOE,value1:SkillSet[6022].uuid,value2:10,value3:0,
|
||||
info:"召唤大量火球攻击敌人,每个火球对敌人造成英雄攻击力的300%伤害"},
|
||||
3106:{uuid:3106,name:"冰雨",quality:Quality.PURPLE,path:"3106",CTarget:CTarget.ENEMY,type:SuperCardsType.AOE,value1:SkillSet[6020].uuid,value2:3,value3:0,
|
||||
info:"召唤大量火球攻击敌人,每个火球对敌人造成英雄攻击力的300%伤害"},
|
||||
3201:{uuid:3201,name:"极速充能",quality:Quality.WHITE,path:"3201",CTarget:CTarget.ALLY,type:SuperCardsType.BUFF,value1:10,value2:100,value3:0,
|
||||
info:"你的英雄/伙伴接下来的10次普通攻击速度提升100%"},
|
||||
3301:{uuid:3301,name:"冰霜风暴",quality:Quality.WHITE,path:"3301",CTarget:CTarget.ENEMY,type:SuperCardsType.DEBUFF,value1:30,value2:10,value3:0,
|
||||
info:"场上敌人获得30%的易伤,(下10次伤害) 易伤:伤害提升30%"},
|
||||
3401:{uuid:3401,name:"升级奖励",quality:Quality.WHITE,path:"3401",CTarget:CTarget.ENEMY,type:SuperCardsType.LEVELUP,value1:1,value2:0,value3:0,
|
||||
info:"升级后奖励"},
|
||||
3402:{uuid:3402,name:"升级奖励",quality:Quality.WHITE,path:"3402",CTarget:CTarget.ENEMY,type:SuperCardsType.LEVELUP,value1:1,value2:0,value3:0,
|
||||
info:"升级后奖励"},
|
||||
3403:{uuid:3403,name:"升级奖励",quality:Quality.WHITE,path:"3403",CTarget:CTarget.ENEMY,type:SuperCardsType.LEVELUP,value1:1,value2:0,value3:0,
|
||||
info:"升级后奖励"},
|
||||
3404:{uuid:3404,name:"升级奖励",quality:Quality.WHITE,path:"3404",CTarget:CTarget.ENEMY,type:SuperCardsType.LEVELUP,value1:1,value2:0,value3:0,
|
||||
info:"升级后奖励"},
|
||||
}
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.23",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "b7e16305-7610-4d81-a60b-040fbbce4b72",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.23",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "4493de4e-44b0-45a1-9d0b-3043d50cc417",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"ver": "1.0.2",
|
||||
"importer": "text",
|
||||
"imported": true,
|
||||
"uuid": "65b38842-3a45-44b0-b756-068a4d799715",
|
||||
"files": [
|
||||
".json"
|
||||
],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
||||
9
assets/script/game/common/config/TestEnhancement.ts.meta
Normal file
9
assets/script/game/common/config/TestEnhancement.ts.meta
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.23",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "75f5e9aa-9f71-47b9-b878-545adb08a0c9",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
||||
@@ -12,6 +12,7 @@ import { FightConComp } from '../map/FightConComp';
|
||||
import { MonModelComp } from './MonModelComp';
|
||||
import { HeroModelComp } from './HeroModelComp';
|
||||
import { FightSet } from '../common/config/Mission';
|
||||
import { MasterModelComp } from './MasterModel';
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
@ccclass('SkillCon')
|
||||
@@ -22,6 +23,14 @@ export class SkillConComp extends CCComp {
|
||||
HeroEntity:any=null;
|
||||
private _timers: { [key: string]: number } = {};
|
||||
private _damageQueue: Array<{ timer: number; callback: () => void }> = [];
|
||||
|
||||
aoe_queues:any[]=[] // 范围伤害技能执行队列
|
||||
private aoe_timers: Map<number, number> = new Map(); // 每个技能的独立计时器
|
||||
private readonly AOE_INTERVAL: number = 0.4; // 执行间隔,单位秒
|
||||
private skill_id_counter: number = 0; // 技能ID计数器
|
||||
aoe_target_pos:Vec3=new Vec3(180,0,0)
|
||||
|
||||
|
||||
init(): void {
|
||||
oops.message.on(GameEvent.FightEnd, this.clear_timer, this);
|
||||
}
|
||||
@@ -30,6 +39,8 @@ export class SkillConComp extends CCComp {
|
||||
this.FIGHTCON=this.node.parent.getComponent(FightConComp)
|
||||
// console.log(this.HeroView.uuid+"=>"+this.HeroView.hero_name+"=> SkillConComp onLoad")
|
||||
this.on(GameEvent.CastHeroSkill,this.cast_master_skill,this)
|
||||
oops.message.on(GameEvent.MaxSkill,this.use_max_skill,this)
|
||||
|
||||
}
|
||||
start() {
|
||||
// console.log(this.HeroView.uuid+"=>"+this.HeroView.hero_name+"=> SkillConComp start")
|
||||
@@ -52,6 +63,34 @@ export class SkillConComp extends CCComp {
|
||||
this.HeroView.friend_count_atk_count()
|
||||
this.HeroView.at = 0;
|
||||
}
|
||||
if (this.aoe_queues.length > 0) {
|
||||
console.log("[FightConComp]:aoe_queues:",this.aoe_queues)
|
||||
|
||||
// 遍历所有必杀技技能,更新它们的计时器
|
||||
for (let i = this.aoe_queues.length - 1; i >= 0; i--) {
|
||||
let skill = this.aoe_queues[i];
|
||||
let timer = this.aoe_timers.get(skill.id) || 0;
|
||||
|
||||
timer += dt;
|
||||
this.aoe_timers.set(skill.id, timer);
|
||||
|
||||
// 检查是否到达执行间隔
|
||||
if (timer >= this.AOE_INTERVAL) {
|
||||
// 重置计时器
|
||||
this.aoe_timers.set(skill.id, 0);
|
||||
|
||||
// 执行技能
|
||||
this.aoe_skill_execute(skill);
|
||||
skill.count--;
|
||||
|
||||
// 如果技能执行完毕,从队列中移除
|
||||
if (skill.count <= 0) {
|
||||
this.aoe_queues.splice(i, 1);
|
||||
this.aoe_timers.delete(skill.id);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
cast_master_skill(e:string,uuid:any){
|
||||
@@ -70,6 +109,20 @@ export class SkillConComp extends CCComp {
|
||||
|
||||
}
|
||||
|
||||
use_max_skill(e:GameEvent,data:any){
|
||||
if(!this.HeroView) return
|
||||
if(!this.HeroView.is_master) return
|
||||
console.log("[SkillConComp]:use_max_skill:",data)
|
||||
this.skill_id_counter++;
|
||||
this.aoe_queues.push({
|
||||
id: this.skill_id_counter,
|
||||
s_uuid:data.uuid,
|
||||
count:SkillSet[data.uuid].maxC,
|
||||
damage:0})
|
||||
// 初始化该技能的计时器
|
||||
this.aoe_timers.set(this.skill_id_counter, 0);
|
||||
}
|
||||
|
||||
private doSkill(config: typeof SkillSet[keyof typeof SkillSet],is_wfuny:boolean=false,dmg:number=0) {
|
||||
// 添加节点有效性检查
|
||||
if (!this.node || !this.node.isValid || !this.HeroView || !this.HeroView.node || !this.HeroView.node.isValid) {
|
||||
@@ -196,6 +249,43 @@ export class SkillConComp extends CCComp {
|
||||
return pos
|
||||
}
|
||||
|
||||
private aoe_skill_execute(data:any){
|
||||
let skill=ecs.getEntity<Skill>(Skill)
|
||||
let master = ecs.query(ecs.allOf(MasterModelComp))
|
||||
|
||||
// 检查必要参数
|
||||
if (!master || master.length === 0) {
|
||||
console.error("[FightConComp] 未找到主角实体");
|
||||
return;
|
||||
}
|
||||
|
||||
let masterView = master[0].get(HeroViewComp);
|
||||
if (!masterView) {
|
||||
console.error("[FightConComp] 主角视图组件获取失败");
|
||||
return;
|
||||
}
|
||||
|
||||
let angle=0
|
||||
let targets = this.pickRandomTarget(data.count)
|
||||
let target_pos= new Vec3(0,0,0)
|
||||
if(targets.length==0){
|
||||
target_pos=this.aoe_target_pos
|
||||
}else{
|
||||
target_pos= new Vec3(targets[0].get(HeroViewComp).node.position.x,0,0)
|
||||
}
|
||||
let start_pos=new Vec3(-280,50,0)
|
||||
// console.log("[Skill]:node=>",start_pos)
|
||||
skill.load(
|
||||
start_pos,
|
||||
this.node.parent,
|
||||
data.s_uuid,
|
||||
target_pos,
|
||||
masterView,
|
||||
angle,
|
||||
data.damage
|
||||
);
|
||||
}
|
||||
|
||||
/** 随机选择目标 */
|
||||
private pickRandomTarget(count: number): ecs.Entity[] {
|
||||
let entities:any=null
|
||||
@@ -255,6 +345,9 @@ export class SkillConComp extends CCComp {
|
||||
}
|
||||
reset() {
|
||||
this.clear_timer();
|
||||
this.aoe_queues = [] // 清空技能队列
|
||||
this.aoe_timers = new Map(); // 重置计时器
|
||||
this.skill_id_counter = 0; // 重置技能ID计数器
|
||||
}
|
||||
|
||||
onDestroy() {
|
||||
|
||||
@@ -41,13 +41,9 @@ export class FightConComp extends Component {
|
||||
card_hp_add:number=0 //卡牌特效 攻击提高生命值效果 额外添加值
|
||||
|
||||
|
||||
aoe_queues:any[]=[] // 范围伤害技能执行队列
|
||||
private aoe_timers: Map<number, number> = new Map(); // 每个技能的独立计时器
|
||||
private readonly AOE_INTERVAL: number = 0.4; // 执行间隔,单位秒
|
||||
private skill_id_counter: number = 0; // 技能ID计数器
|
||||
|
||||
|
||||
aoe_pos:Vec3=new Vec3(-280,20,0)
|
||||
aoe_target_pos:Vec3=new Vec3(180,0,0)
|
||||
buff_pos:Vec3=new Vec3(-280,100,0)
|
||||
debuff_pos:Vec3=new Vec3(-280,100,0)
|
||||
|
||||
@@ -57,7 +53,6 @@ export class FightConComp extends Component {
|
||||
oops.message.on(GameEvent.FightReady,this.fight_ready,this)
|
||||
oops.message.on(GameEvent.ChangeATK_EQUIP_SPECIAL_ATTR,this.change_equip_special_attr,this)
|
||||
oops.message.on(GameEvent.UseSpecialCard,this.use_special_card,this)
|
||||
oops.message.on(GameEvent.MaxSkill,this.use_max_skill,this)
|
||||
|
||||
}
|
||||
protected start(): void {
|
||||
@@ -131,14 +126,7 @@ export class FightConComp extends Component {
|
||||
}
|
||||
break
|
||||
case SuperCardsType.AOE:
|
||||
this.skill_id_counter++;
|
||||
this.aoe_queues.push({
|
||||
id: this.skill_id_counter,
|
||||
s_uuid:SuperCards[data.uuid].value1,
|
||||
count:SuperCards[data.uuid].value2,
|
||||
damage:SuperCards[data.uuid].value3})
|
||||
// 初始化该技能的计时器
|
||||
this.aoe_timers.set(this.skill_id_counter, 0);
|
||||
oops.message.dispatchEvent(GameEvent.MaxSkill,{uuid:SuperCards[data.uuid].value1})
|
||||
break
|
||||
case SuperCardsType.BUFF:
|
||||
|
||||
@@ -147,53 +135,8 @@ export class FightConComp extends Component {
|
||||
break
|
||||
}
|
||||
}
|
||||
use_max_skill(e:GameEvent,data:any){
|
||||
console.log("[FightConComp]:use_max_skill:",data)
|
||||
this.skill_id_counter++;
|
||||
this.aoe_queues.push({
|
||||
id: this.skill_id_counter,
|
||||
s_uuid:data.uuid,
|
||||
count:SkillSet[data.uuid].maxC,
|
||||
damage:0})
|
||||
// 初始化该技能的计时器
|
||||
this.aoe_timers.set(this.skill_id_counter, 0);
|
||||
}
|
||||
private aoe_skill_execute(data:any){
|
||||
let skill=ecs.getEntity<Skill>(Skill)
|
||||
let master = ecs.query(ecs.allOf(MasterModelComp))
|
||||
|
||||
// 检查必要参数
|
||||
if (!master || master.length === 0) {
|
||||
console.error("[FightConComp] 未找到主角实体");
|
||||
return;
|
||||
}
|
||||
|
||||
let masterView = master[0].get(HeroViewComp);
|
||||
if (!masterView) {
|
||||
console.error("[FightConComp] 主角视图组件获取失败");
|
||||
return;
|
||||
}
|
||||
|
||||
let angle=0
|
||||
let targets = this.pickRandomTarget(data.count)
|
||||
let target_pos= new Vec3(0,0,0)
|
||||
if(targets.length==0){
|
||||
target_pos=this.aoe_target_pos
|
||||
}else{
|
||||
target_pos= new Vec3(targets[0].get(HeroViewComp).node.position.x,0,0)
|
||||
}
|
||||
let start_pos=new Vec3(-280,50,0)
|
||||
// console.log("[Skill]:node=>",start_pos)
|
||||
skill.load(
|
||||
start_pos,
|
||||
this.node,
|
||||
data.s_uuid,
|
||||
target_pos,
|
||||
masterView,
|
||||
angle,
|
||||
data.damage
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// /** 随机选择目标 */
|
||||
@@ -222,42 +165,9 @@ export class FightConComp extends Component {
|
||||
this.friend_get_master_equip=0
|
||||
this.card_atk_add=0
|
||||
this.card_hp_add=0
|
||||
this.aoe_queues = [] // 清空技能队列
|
||||
this.aoe_timers = new Map(); // 重置计时器
|
||||
this.skill_id_counter = 0; // 重置技能ID计数器
|
||||
|
||||
}
|
||||
|
||||
// update(deltaTime: number) {
|
||||
// // 并行执行多个技能
|
||||
// if (this.aoe_queues.length > 0) {
|
||||
// console.log("[FightConComp]:aoe_queues:",this.aoe_queues)
|
||||
|
||||
// // 遍历所有技能,更新它们的计时器
|
||||
// for (let i = this.aoe_queues.length - 1; i >= 0; i--) {
|
||||
// let skill = this.aoe_queues[i];
|
||||
// let timer = this.aoe_timers.get(skill.id) || 0;
|
||||
|
||||
// timer += deltaTime;
|
||||
// this.aoe_timers.set(skill.id, timer);
|
||||
|
||||
// // 检查是否到达执行间隔
|
||||
// if (timer >= this.AOE_INTERVAL) {
|
||||
// // 重置计时器
|
||||
// this.aoe_timers.set(skill.id, 0);
|
||||
|
||||
// // 执行技能
|
||||
// this.aoe_skill_execute(skill);
|
||||
// skill.count--;
|
||||
|
||||
// // 如果技能执行完毕,从队列中移除
|
||||
// if (skill.count <= 0) {
|
||||
// this.aoe_queues.splice(i, 1);
|
||||
// this.aoe_timers.delete(skill.id);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user