继续完善 装备buff
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
import { _decorator, Component, Node, view, UITransform, Vec3, math, EventHandler, Graphics, Color, TweenEasing, Enum } from 'cc';
|
import { _decorator, Component, Node, view, UITransform, Vec3, math, EventHandler, Graphics, Color, TweenEasing, Enum } from 'cc';
|
||||||
|
import { SkillCom } from '../skills/SkillCom';
|
||||||
const { ccclass, property } = _decorator;
|
const { ccclass, property } = _decorator;
|
||||||
|
|
||||||
// 定义缓动类型枚举
|
// 定义缓动类型枚举
|
||||||
@@ -151,7 +152,11 @@ export class BezierMove extends Component {
|
|||||||
this.node.setPosition(this._endPoint);
|
this.node.setPosition(this._endPoint);
|
||||||
this._isMoving = false;
|
this._isMoving = false;
|
||||||
// 触发移动完成事件
|
// 触发移动完成事件
|
||||||
// EventHandler.emitEvents(this.onMoveComplete, this);
|
console.log("onMoveComplete")
|
||||||
|
let skill=this.node.getComponent(SkillCom)
|
||||||
|
if(skill){
|
||||||
|
skill.doDestroy()
|
||||||
|
}
|
||||||
this._moveEndCallback && this._moveEndCallback.apply(this._moveEndTarget);
|
this._moveEndCallback && this._moveEndCallback.apply(this._moveEndTarget);
|
||||||
// 清除轨迹
|
// 清除轨迹
|
||||||
if (this.showTrajectory && this._graphics) {
|
if (this.showTrajectory && this._graphics) {
|
||||||
|
|||||||
@@ -54,6 +54,10 @@ export enum GameSet {
|
|||||||
AP_UPDATE_RATE=120,
|
AP_UPDATE_RATE=120,
|
||||||
AP_CHANGE_RATE=100,
|
AP_CHANGE_RATE=100,
|
||||||
}
|
}
|
||||||
|
export enum FacSet {
|
||||||
|
HERO=0,
|
||||||
|
MON=1,
|
||||||
|
}
|
||||||
export const ColorSet: { [key: string]: string } = {
|
export const ColorSet: { [key: string]: string } = {
|
||||||
RED: "FF364D",
|
RED: "FF364D",
|
||||||
RED1: "FC1702",
|
RED1: "FC1702",
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import { app } from "electron";
|
import { app } from "electron";
|
||||||
|
import { BuffAttr } from "./SkillSet";
|
||||||
|
|
||||||
// 装备类型
|
// 装备类型
|
||||||
export enum EquipType {
|
export enum EquipType {
|
||||||
@@ -7,18 +8,6 @@ export enum EquipType {
|
|||||||
ACCESSORY = 3 // 饰品
|
ACCESSORY = 3 // 饰品
|
||||||
}
|
}
|
||||||
|
|
||||||
// 基础属性加成
|
|
||||||
export enum EquipAttr {
|
|
||||||
ATK = 1, // 攻击力
|
|
||||||
ATK_COUNT = 2, // 攻击个数
|
|
||||||
ATK_CD = 3, // 攻击速度
|
|
||||||
HP = 4, // 生命值
|
|
||||||
DEF = 5, // 免伤
|
|
||||||
SKILL_DMG = 6, // 技能效果
|
|
||||||
SKILL_CD = 7, // 技能冷却缩减
|
|
||||||
CARD_EFFECT = 8, // 卡牌效果
|
|
||||||
CARD_COUNT = 8, // 卡牌起效次数,每3次多起效一次
|
|
||||||
}
|
|
||||||
//装备属性起效对象
|
//装备属性起效对象
|
||||||
export enum EquipAttrTarget {
|
export enum EquipAttrTarget {
|
||||||
ALL = 0, // 所有
|
ALL = 0, // 所有
|
||||||
@@ -52,7 +41,7 @@ export const accessory_id=[2201,2202,2203,2204,2205,2206,2207,2208,2209,2210,221
|
|||||||
export const equip_list=[2001,2002,2003,2004,2005]
|
export const equip_list=[2001,2002,2003,2004,2005]
|
||||||
// 装备属性加成接口
|
// 装备属性加成接口
|
||||||
export interface EquipAttribute {
|
export interface EquipAttribute {
|
||||||
type: EquipAttr; // 属性类型
|
type: BuffAttr; // 属性类型
|
||||||
value: number; // 属性值
|
value: number; // 属性值
|
||||||
target?: EquipAttrTarget; // 属性作用目标(可选)
|
target?: EquipAttrTarget; // 属性作用目标(可选)
|
||||||
}
|
}
|
||||||
@@ -68,36 +57,36 @@ export interface EquipData {
|
|||||||
export const EquipInfo: { [key: number]: EquipData } = {
|
export const EquipInfo: { [key: number]: EquipData } = {
|
||||||
2001: {uuid: 2001, name: "新手剑", type: EquipType.WEAPON,info:"攻击力增加80%",
|
2001: {uuid: 2001, name: "新手剑", type: EquipType.WEAPON,info:"攻击力增加80%",
|
||||||
attributes: [
|
attributes: [
|
||||||
{ type: EquipAttr.ATK, value: 80, target: EquipAttrTarget.HERO },
|
{ type: BuffAttr.ATK, value: 80, target: EquipAttrTarget.HERO },
|
||||||
{ type: EquipAttr.ATK_CD, value: 30, target: EquipAttrTarget.HERO },
|
{ type: BuffAttr.ATK_CD, value: 30, target: EquipAttrTarget.HERO },
|
||||||
{ type: EquipAttr.ATK_COUNT, value: 1, target: EquipAttrTarget.HERO },
|
{ type: BuffAttr.ATK_COUNT, value: 1, target: EquipAttrTarget.HERO },
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
2002: {uuid: 2002,name: "新手剑2",type: EquipType.WEAPON,info:"攻击速度增加30%",
|
2002: {uuid: 2002,name: "新手剑2",type: EquipType.WEAPON,info:"攻击速度增加30%",
|
||||||
attributes: [
|
attributes: [
|
||||||
{ type: EquipAttr.ATK_CD, value: 30, target: EquipAttrTarget.HERO },
|
{ type: BuffAttr.ATK_CD, value: 30, target: EquipAttrTarget.HERO },
|
||||||
{ type: EquipAttr.ATK_COUNT, value: 1, target: EquipAttrTarget.HERO },
|
{ type: BuffAttr.ATK_COUNT, value: 1, target: EquipAttrTarget.HERO },
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
2003: {uuid: 2003,name: "新手剑3",type: EquipType.WEAPON,info:"攻击次数增加1次",
|
2003: {uuid: 2003,name: "新手剑3",type: EquipType.WEAPON,info:"攻击次数增加1次",
|
||||||
attributes: [
|
attributes: [
|
||||||
{ type: EquipAttr.ATK_COUNT, value: 1, target: EquipAttrTarget.HERO },
|
{ type: BuffAttr.ATK_COUNT, value: 1, target: EquipAttrTarget.HERO },
|
||||||
{ type: EquipAttr.ATK_CD, value: 30, target: EquipAttrTarget.HERO },
|
{ type: BuffAttr.ATK_CD, value: 30, target: EquipAttrTarget.HERO },
|
||||||
{ type: EquipAttr.ATK_COUNT, value: 1, target: EquipAttrTarget.HERO },
|
{ type: BuffAttr.ATK_COUNT, value: 1, target: EquipAttrTarget.HERO },
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
2004: {uuid: 2004,name: "防具1",type: EquipType.ARMOR,info:"生命值增加100%",
|
2004: {uuid: 2004,name: "防具1",type: EquipType.ARMOR,info:"生命值增加100%",
|
||||||
attributes: [
|
attributes: [
|
||||||
{ type: EquipAttr.HP, value: 100, target: EquipAttrTarget.HERO },
|
{ type: BuffAttr.HP, value: 100, target: EquipAttrTarget.HERO },
|
||||||
{ type: EquipAttr.ATK_CD, value: 30, target: EquipAttrTarget.HERO },
|
{ type: BuffAttr.ATK_CD, value: 30, target: EquipAttrTarget.HERO },
|
||||||
{ type: EquipAttr.ATK_COUNT, value: 1, target: EquipAttrTarget.HERO },
|
{ type: BuffAttr.ATK_COUNT, value: 1, target: EquipAttrTarget.HERO },
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
2005: {uuid: 2005,name: "防具2",type: EquipType.ARMOR,info:"免伤增加50%",
|
2005: {uuid: 2005,name: "防具2",type: EquipType.ARMOR,info:"免伤增加50%",
|
||||||
attributes: [
|
attributes: [
|
||||||
{ type: EquipAttr.DEF, value: 50, target: EquipAttrTarget.HERO },
|
{ type: BuffAttr.DEF, value: 50, target: EquipAttrTarget.HERO },
|
||||||
{ type: EquipAttr.ATK_CD, value: 30, target: EquipAttrTarget.HERO },
|
{ type: BuffAttr.ATK_CD, value: 30, target: EquipAttrTarget.HERO },
|
||||||
{ type: EquipAttr.ATK_COUNT, value: 1, target: EquipAttrTarget.HERO },
|
{ type: BuffAttr.ATK_COUNT, value: 1, target: EquipAttrTarget.HERO },
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
|
|
||||||
|
|
||||||
export enum TargetGroup {
|
export enum TargetGroup {
|
||||||
Self = 0, // 自身
|
Self = 0, // 自身
|
||||||
Ally = 1, // 友方单位
|
Ally = 1, // 友方单位
|
||||||
@@ -29,6 +27,7 @@ export enum skRun {
|
|||||||
runing = 0,
|
runing = 0,
|
||||||
dead = 1,
|
dead = 1,
|
||||||
}
|
}
|
||||||
|
|
||||||
//技能释放cd: 0:技能配置的cd,1:HeroViewComp.cd 值,2:HeroViewComp.pw:0值,当HeroViewComppw==HeroViewComp.pwm值是 释放
|
//技能释放cd: 0:技能配置的cd,1:HeroViewComp.cd 值,2:HeroViewComp.pw:0值,当HeroViewComppw==HeroViewComp.pwm值是 释放
|
||||||
export enum CdType {
|
export enum CdType {
|
||||||
SkillCD = 0, // 使用技能配置的cd
|
SkillCD = 0, // 使用技能配置的cd
|
||||||
@@ -37,16 +36,17 @@ export enum CdType {
|
|||||||
AtkCount = 3, // 攻击次数触发
|
AtkCount = 3, // 攻击次数触发
|
||||||
BeAtkCount = 4, // 被攻击次数触发
|
BeAtkCount = 4, // 被攻击次数触发
|
||||||
}
|
}
|
||||||
//技能释放cd: 0:技能配置的cd,1:HeroViewComp.cd 值,2:HeroViewComp.pw:0值,当HeroViewComppw==HeroViewComp.pwm值是 释放
|
|
||||||
|
|
||||||
|
|
||||||
|
//技能释放cd: 0:技能配置的cd,1:HeroViewComp.cd 值,2:HeroViewComp.pw:0值,当HeroViewComppw==HeroViewComp.pwm值是 释放
|
||||||
export enum AnimType {
|
export enum AnimType {
|
||||||
linear = 0, // 直线
|
linear = 0, // 直线
|
||||||
parabolic = 1, // 抛物线 贝塞尔
|
parabolic = 1, // 抛物线 贝塞尔
|
||||||
fixed = 2, // 固定位置
|
fixed = 2, // 固定位置
|
||||||
fixedStart = 3, // 固定在出发点
|
fixedStart = 3, // 固定在出发点
|
||||||
fixedEnd = 4, // 固定在终点
|
fixedEnd = 4, // 固定在终点
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export enum endType {
|
export enum endType {
|
||||||
animationEnd = 0,
|
animationEnd = 0,
|
||||||
timeEnd = 1,
|
timeEnd = 1,
|
||||||
@@ -55,24 +55,59 @@ export enum endType {
|
|||||||
countEnd = 4,
|
countEnd = 4,
|
||||||
}
|
}
|
||||||
|
|
||||||
export enum Debuff {
|
export enum DebuffAttr {
|
||||||
STUN = 1, //眩晕
|
STUN = 1, //眩晕
|
||||||
SILENCE = 2, //沉默
|
SLOW = 2, //减速
|
||||||
FROST = 3, //冰冻
|
FROST = 3, //冰冻
|
||||||
POISON = 4, //中毒
|
BURN = 4, //易伤
|
||||||
BURN = 5, //燃烧
|
DECD = 5, //减cd
|
||||||
BLEED = 6, //流血
|
DEHP = 6, //减hp
|
||||||
SLOW = 7, //减速
|
DEATK = 7, //减atk
|
||||||
SPEED = 8, //加速
|
DEDEF = 8, //减def
|
||||||
|
DECOUNT = 9, //减攻击次数
|
||||||
}
|
}
|
||||||
|
|
||||||
export enum Buff {
|
export const geDebuffNum=()=>{
|
||||||
SHIELD = 1, //护盾
|
return {
|
||||||
HEAL = 2, //治疗
|
STUN:0,
|
||||||
DOUBLE_ATK = 3, //双倍攻击
|
SLOW:0,
|
||||||
THREE_ATK = 4, //三倍攻击
|
FROST:0,
|
||||||
|
BURN:0,
|
||||||
|
DECD:0,
|
||||||
|
DEHP:0,
|
||||||
|
DEATK:0,
|
||||||
|
DEDEF:0,
|
||||||
|
DECOUNT:0,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export enum BuffAttr {
|
||||||
|
ATK = 1, // 攻击力
|
||||||
|
ATK_COUNT = 2, // 攻击个数
|
||||||
|
ATK_CD = 3, // 攻击速度
|
||||||
|
HP = 4, // 生命值
|
||||||
|
DEF = 5, // 免伤
|
||||||
|
SKILL_DMG = 6, // 技能效果
|
||||||
|
SKILL_CD = 7, // 技能冷却缩减
|
||||||
|
CARD_EFFECT = 8, // 卡牌效果
|
||||||
|
CARD_COUNT = 8, // 卡牌起效次数,每3次多起效一次
|
||||||
|
}
|
||||||
|
|
||||||
|
export const getBuffNum=()=>{
|
||||||
|
return {
|
||||||
|
ATK:0, // 攻击力
|
||||||
|
ATK_COUNT:0, // 攻击个数
|
||||||
|
ATK_CD:0, // 攻击速度
|
||||||
|
HP:0, // 生命值
|
||||||
|
DEF:0, // 免伤
|
||||||
|
SKILL_DMG:0, // 技能效果
|
||||||
|
SKILL_CD:0, // 技能冷却缩减
|
||||||
|
CARD_EFFECT:0, // 卡牌效果
|
||||||
|
CARD_COUNT:0, // 卡牌起效次数,每3次多起效一次
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
path: 图片地址
|
path: 图片地址
|
||||||
[debuff] : 0:无,1:冰,2:灼烧,3:眩晕,4:降低攻击,5:降低hp,6:降低防御,7:吸血,8:击退
|
[debuff] : 0:无,1:冰,2:灼烧,3:眩晕,4:降低攻击,5:降低hp,6:降低防御,7:吸血,8:击退
|
||||||
|
|||||||
@@ -48,17 +48,17 @@ export const MonSet = {
|
|||||||
2:{pos:v3(320,-10,0)},
|
2:{pos:v3(320,-10,0)},
|
||||||
}
|
}
|
||||||
export const HeroInfo = {
|
export const HeroInfo = {
|
||||||
5001:{uuid:5001,name:"神圣守护",path:"k2", lv:3,kind:1,type:0,hp:5,ap:10,ap_u:0,ap_ur:0,hp_up:0,dis:700,a_cd:1,speed:50,skills:[6001],tals:"说明"},
|
5001:{uuid:5001,name:"神圣守护",path:"k2", lv:3,kind:1,type:0,hp:50,ap:10,ap_u:0,ap_ur:0,hp_up:0,dis:700,a_cd:1,speed:50,skills:[6001],tals:"说明"},
|
||||||
5002:{uuid:5002,name:"幻影剑豪",path:"k1", lv:3,kind:2,type:0,hp:5,ap:10,ap_u:0,ap_ur:0,hp_up:0,dis:700,a_cd:1,speed:50,skills:[6001],tals:"说明"},
|
5002:{uuid:5002,name:"幻影剑豪",path:"k1", lv:3,kind:2,type:0,hp:50,ap:10,ap_u:0,ap_ur:0,hp_up:0,dis:700,a_cd:1,speed:50,skills:[6001],tals:"说明"},
|
||||||
5003:{uuid:5003,name:"战争领主",path:"k5", lv:3,kind:2,type:0,hp:5,ap:10,ap_u:0,ap_ur:0,hp_up:0,dis:700,a_cd:1,speed:50,skills:[6001],tals:"说明"},
|
5003:{uuid:5003,name:"战争领主",path:"k5", lv:3,kind:2,type:0,hp:50,ap:10,ap_u:0,ap_ur:0,hp_up:0,dis:700,a_cd:1,speed:50,skills:[6001],tals:"说明"},
|
||||||
5004:{uuid:5004,name:"混沌法师",path:"zh1", lv:3,kind:2,type:2,hp:5,ap:10,ap_u:0,ap_ur:0,hp_up:0,dis:700,a_cd:1.5,speed:50,skills:[6001],tals:"说明"},
|
5004:{uuid:5004,name:"混沌法师",path:"zh1", lv:3,kind:2,type:2,hp:50,ap:10,ap_u:0,ap_ur:0,hp_up:0,dis:700,a_cd:1.5,speed:50,skills:[6001],tals:"说明"},
|
||||||
5005:{uuid:5005,name:"火焰法师",path:"zh2", lv:3,kind:2,type:2,hp:5,ap:15,ap_u:0,ap_ur:0,hp_up:0,dis:700,a_cd:1.5,speed:50,skills:[6001],tals:"说明"},
|
5005:{uuid:5005,name:"火焰法师",path:"zh2", lv:3,kind:2,type:2,hp:50,ap:15,ap_u:0,ap_ur:0,hp_up:0,dis:700,a_cd:1.5,speed:50,skills:[6001],tals:"说明"},
|
||||||
5006:{uuid:5006,name:"风暴精灵",path:"m4", lv:3,kind:2,type:2,hp:5,ap:15,ap_u:0,ap_ur:0,hp_up:0,dis:700,a_cd:1.5,speed:50,skills:[6001],tals:"说明"},
|
5006:{uuid:5006,name:"风暴精灵",path:"m4", lv:3,kind:2,type:2,hp:50,ap:15,ap_u:0,ap_ur:0,hp_up:0,dis:700,a_cd:1.5,speed:50,skills:[6001],tals:"说明"},
|
||||||
5007:{uuid:5007,name:"生命圣者",path:"d1", lv:3,kind:2,type:2,hp:5,ap:10,ap_u:0,ap_ur:0,hp_up:0,dis:700,a_cd:1.5,speed:50,skills:[6001],tals:"说明"},
|
5007:{uuid:5007,name:"生命圣者",path:"d1", lv:3,kind:2,type:2,hp:50,ap:10,ap_u:0,ap_ur:0,hp_up:0,dis:700,a_cd:1.5,speed:50,skills:[6001],tals:"说明"},
|
||||||
5008:{uuid:5008,name:"战争祭祀",path:"d2", lv:3,kind:2,type:2,hp:5,ap:10,ap_u:0,ap_ur:0,hp_up:0,dis:700,a_cd:1.5,speed:50,skills:[6001],tals:"说明"},
|
5008:{uuid:5008,name:"战争祭祀",path:"d2", lv:3,kind:2,type:2,hp:50,ap:10,ap_u:0,ap_ur:0,hp_up:0,dis:700,a_cd:1.5,speed:50,skills:[6001],tals:"说明"},
|
||||||
5009:{uuid:5009,name:"暴风射手",path:"a5", lv:3,kind:2,type:1,hp:5,ap:15,ap_u:0,ap_ur:0,hp_up:0,dis:700,a_cd:1.2,speed:50,skills:[6006],tals:"说明"},
|
5009:{uuid:5009,name:"暴风射手",path:"a5", lv:3,kind:2,type:1,hp:50,ap:15,ap_u:0,ap_ur:0,hp_up:0,dis:700,a_cd:1.2,speed:50,skills:[6006],tals:"说明"},
|
||||||
5010:{uuid:5010,name:"苍穹射手",path:"a3", lv:3,kind:1,type:1,hp:5,ap:15,ap_u:0,ap_ur:0,hp_up:0,dis:700,a_cd:1.2,speed:50,skills:[6006],tals:"说明"},
|
5010:{uuid:5010,name:"苍穹射手",path:"a3", lv:3,kind:1,type:1,hp:50,ap:15,ap_u:0,ap_ur:0,hp_up:0,dis:700,a_cd:1.2,speed:50,skills:[6006],tals:"说明"},
|
||||||
5011:{uuid:5011,name:"幽灵射手",path:"a4", lv:3,kind:2,type:1,hp:5,ap:15,ap_u:0,ap_ur:0,hp_up:0,dis:700,a_cd:1.2,speed:50,skills:[6006],tals:"说明"},
|
5011:{uuid:5011,name:"幽灵射手",path:"a4", lv:3,kind:2,type:1,hp:50,ap:15,ap_u:0,ap_ur:0,hp_up:0,dis:700,a_cd:1.2,speed:50,skills:[6006],tals:"说明"},
|
||||||
5201:{uuid:5201,name:"兽人战士",path:"mor1", lv:1,kind:1,type:0,hp:200,ap:1,ap_u:0,ap_ur:0,hp_up:0,dis:400,a_cd:1,speed:50,skills:[6001],tals:"说明"},
|
5201:{uuid:5201,name:"兽人战士",path:"mor1", lv:1,kind:1,type:0,hp:200,ap:1,ap_u:0,ap_ur:0,hp_up:0,dis:400,a_cd:1,speed:50,skills:[6001],tals:"说明"},
|
||||||
5202:{uuid:5202,name:"兽人刺客",path:"mor2", lv:1,kind:1,type:0,hp:200,ap:1,ap_u:0,ap_ur:0,hp_up:0,dis:400,a_cd:1,speed:50,skills:[6001],tals:"说明"},
|
5202:{uuid:5202,name:"兽人刺客",path:"mor2", lv:1,kind:1,type:0,hp:200,ap:1,ap_u:0,ap_ur:0,hp_up:0,dis:400,a_cd:1,speed:50,skills:[6001],tals:"说明"},
|
||||||
5203:{uuid:5203,name:"兽人护卫",path:"mor3", lv:1,kind:1,type:1,hp:200,ap:1,ap_u:0,ap_ur:0,hp_up:0,dis:400,a_cd:1.2,speed:50,skills:[6001],tals:"说明"},
|
5203:{uuid:5203,name:"兽人护卫",path:"mor3", lv:1,kind:1,type:1,hp:200,ap:1,ap_u:0,ap_ur:0,hp_up:0,dis:400,a_cd:1.2,speed:50,skills:[6001],tals:"说明"},
|
||||||
|
|||||||
@@ -28,7 +28,9 @@ export class BattleMoveSystem extends ecs.ComblockSystem implements ecs.ISystemU
|
|||||||
this.updateRenderOrder(e);
|
this.updateRenderOrder(e);
|
||||||
|
|
||||||
// 同步状态
|
// 同步状态
|
||||||
if (!shouldStop&&view.fac==1) {
|
|
||||||
|
// if (!shouldStop&&view.fac==1) { //在攻击范围内停止移动 取消这个判断
|
||||||
|
if(view.fac==1){
|
||||||
if(view.is_stop||view.is_dead) return //停止移动或者死亡不移动
|
if(view.is_stop||view.is_dead) return //停止移动或者死亡不移动
|
||||||
// 计算移动量
|
// 计算移动量
|
||||||
const delta = (view.speed/3) * this.dt * move.direction;
|
const delta = (view.speed/3) * this.dt * move.direction;
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ec
|
|||||||
import { smc } from "../common/SingletonModuleComp";
|
import { smc } from "../common/SingletonModuleComp";
|
||||||
import { HeroModelComp } from "./HeroModelComp";
|
import { HeroModelComp } from "./HeroModelComp";
|
||||||
import { HeroViewComp } from "./HeroViewComp";
|
import { HeroViewComp } from "./HeroViewComp";
|
||||||
import { BoxSet } from "../common/config/BoxSet";
|
import { BoxSet, FacSet } from "../common/config/BoxSet";
|
||||||
import { HeroInfo } from "../common/config/heroSet";
|
import { HeroInfo } from "../common/config/heroSet";
|
||||||
import { BattleMoveComp } from "../common/ecs/position/BattleMoveComp";
|
import { BattleMoveComp } from "../common/ecs/position/BattleMoveComp";
|
||||||
import { SkillConComp } from "./SkillConComp";
|
import { SkillConComp } from "./SkillConComp";
|
||||||
@@ -41,7 +41,7 @@ export class Hero extends ecs.Entity {
|
|||||||
var hv = node.getComponent(HeroViewComp)!;
|
var hv = node.getComponent(HeroViewComp)!;
|
||||||
let hero= HeroInfo[uuid] // 共用英雄数据
|
let hero= HeroInfo[uuid] // 共用英雄数据
|
||||||
hv.scale = 1;
|
hv.scale = 1;
|
||||||
hv.fac = 0;
|
hv.fac = FacSet.HERO;
|
||||||
hv.is_master=true;
|
hv.is_master=true;
|
||||||
hv.type = hero.type;
|
hv.type = hero.type;
|
||||||
hv.box_group = box_group;
|
hv.box_group = box_group;
|
||||||
@@ -75,7 +75,7 @@ export class Hero extends ecs.Entity {
|
|||||||
var hv = node.getComponent(HeroViewComp)!;
|
var hv = node.getComponent(HeroViewComp)!;
|
||||||
let hero= HeroInfo[uuid] // 共用英雄数据
|
let hero= HeroInfo[uuid] // 共用英雄数据
|
||||||
hv.scale = scale;
|
hv.scale = scale;
|
||||||
hv.fac = 0;
|
hv.fac = FacSet.HERO;
|
||||||
hv.fight_pos=fight_pos
|
hv.fight_pos=fight_pos
|
||||||
hv.type = hero.type;
|
hv.type = hero.type;
|
||||||
hv.box_group = box_group;
|
hv.box_group = box_group;
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { oops } from "../../../../extensions/oops-plugin-framework/assets/core/O
|
|||||||
import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
|
import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
|
||||||
import { smc } from "../common/SingletonModuleComp";
|
import { smc } from "../common/SingletonModuleComp";
|
||||||
import { HeroViewComp } from "./HeroViewComp";
|
import { HeroViewComp } from "./HeroViewComp";
|
||||||
import { BoxSet } from "../common/config/BoxSet";
|
import { BoxSet, FacSet } from "../common/config/BoxSet";
|
||||||
import { HeroInfo } from "../common/config/heroSet";
|
import { HeroInfo } from "../common/config/heroSet";
|
||||||
import { MonModelComp } from "./MonModelComp";
|
import { MonModelComp } from "./MonModelComp";
|
||||||
import { BattleMoveComp } from "../common/ecs/position/BattleMoveComp";
|
import { BattleMoveComp } from "../common/ecs/position/BattleMoveComp";
|
||||||
@@ -56,7 +56,7 @@ export class Monster extends ecs.Entity {
|
|||||||
// console.log("hero_init",buff)
|
// console.log("hero_init",buff)
|
||||||
let hero= HeroInfo[uuid] // 共用英雄数据
|
let hero= HeroInfo[uuid] // 共用英雄数据
|
||||||
hv.scale = scale;
|
hv.scale = scale;
|
||||||
hv.fac = 1;
|
hv.fac = FacSet.MON;
|
||||||
hv.type = hero.type;
|
hv.type = hero.type;
|
||||||
hv.is_boss = is_boss;
|
hv.is_boss = is_boss;
|
||||||
hv.box_group = box_group;
|
hv.box_group = box_group;
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import { Skill } from '../skills/Skill';
|
|||||||
import { ecs } from 'db://oops-framework/libs/ecs/ECS';
|
import { ecs } from 'db://oops-framework/libs/ecs/ECS';
|
||||||
import { oops } from 'db://oops-framework/core/Oops';
|
import { oops } from 'db://oops-framework/core/Oops';
|
||||||
import { GameEvent } from '../common/config/GameEvent';
|
import { GameEvent } from '../common/config/GameEvent';
|
||||||
import { BoxSet } from '../common/config/BoxSet';
|
import { BoxSet, FacSet } from '../common/config/BoxSet';
|
||||||
import { smc } from '../common/SingletonModuleComp';
|
import { smc } from '../common/SingletonModuleComp';
|
||||||
import { CCComp } from 'db://oops-framework/module/common/CCComp';
|
import { CCComp } from 'db://oops-framework/module/common/CCComp';
|
||||||
import { FightConComp } from '../map/FightConComp';
|
import { FightConComp } from '../map/FightConComp';
|
||||||
@@ -36,16 +36,27 @@ export class SkillConComp extends CCComp {
|
|||||||
update(dt: number) {
|
update(dt: number) {
|
||||||
if(!smc.mission.play||smc.mission.pause) return
|
if(!smc.mission.play||smc.mission.pause) return
|
||||||
this.HeroView.at += dt;
|
this.HeroView.at += dt;
|
||||||
if (this.HeroView.is_atking &&this.HeroView.at > this.HeroView.cd) {
|
|
||||||
|
let cd = this.HeroView.cd
|
||||||
|
let count=1
|
||||||
|
if(this.HeroView.fac==FacSet.HERO){
|
||||||
|
if(this.HeroView.is_master){
|
||||||
|
count+=this.FIGHTCON.hero.ATK_COUNT+this.FIGHTCON.ally.ATK_COUNT-this.FIGHTCON.hero_debuff.DECOUNT-this.FIGHTCON.ally_debuff.DECOUNT
|
||||||
|
cd=this.HeroView.cd*(100-this.FIGHTCON.hero.ATK_CD-this.FIGHTCON.ally.ATK_CD+this.FIGHTCON.hero_debuff.DECD+this.FIGHTCON.ally_debuff.DECD)/100
|
||||||
|
}else{
|
||||||
|
count+=this.FIGHTCON.friend.ATK_COUNT+this.FIGHTCON.ally.ATK_COUNT-this.FIGHTCON.friend_debuff.DECOUNT-this.FIGHTCON.ally_debuff.DECOUNT
|
||||||
|
cd=this.HeroView.cd*(100-this.FIGHTCON.friend.ATK_CD-this.FIGHTCON.ally.ATK_CD+this.FIGHTCON.friend_debuff.DECD+this.FIGHTCON.ally_debuff.DECD)/100
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
cd=this.HeroView.cd*(100-this.FIGHTCON.enemy.ATK_CD+this.FIGHTCON.enemy_debuff.DECD)/100
|
||||||
|
count+=this.FIGHTCON.enemy.ATK_COUNT-this.FIGHTCON.enemy_debuff.DECOUNT
|
||||||
|
}
|
||||||
|
if(count<1) count=1
|
||||||
|
console.log(this.HeroView.hero_name+(this.HeroView.is_master?"[主]":"[从] 准备释放")+SkillSet[this.HeroView.atk_skill].name+"=>"+"=>cd:"+cd+"=> count:"+count)
|
||||||
|
if (this.HeroView.is_atking &&(this.HeroView.at > cd)) {
|
||||||
const config = SkillSet[this.HeroView.atk_skill];
|
const config = SkillSet[this.HeroView.atk_skill];
|
||||||
if (!config) return;
|
if (!config) return;
|
||||||
let count=1
|
console.log(this.HeroView.hero_name+(this.HeroView.is_master?"[主]":"[从] 释放")+"=>"+config.name+"=>"+count)
|
||||||
if(this.HeroView.is_master){
|
|
||||||
count+=this.FIGHTCON.hero.ATK_COUNT+this.FIGHTCON.ally.ATK_COUNT
|
|
||||||
}else{
|
|
||||||
count+=this.FIGHTCON.friend.ATK_COUNT+this.FIGHTCON.ally.ATK_COUNT
|
|
||||||
}
|
|
||||||
console.log(this.HeroView.hero_name+(this.HeroView.is_master?"[主]":"[从]")+"=>"+config.name+"=>"+count)
|
|
||||||
this.castSkill(config,count);
|
this.castSkill(config,count);
|
||||||
this.HeroView.at = 0;
|
this.HeroView.at = 0;
|
||||||
}
|
}
|
||||||
@@ -121,7 +132,7 @@ export class SkillConComp extends CCComp {
|
|||||||
|
|
||||||
private selectEnemyTargets(config: typeof SkillSet[keyof typeof SkillSet]): ecs.Entity[] {
|
private selectEnemyTargets(config: typeof SkillSet[keyof typeof SkillSet]): ecs.Entity[] {
|
||||||
const team = this.HeroView.fac;
|
const team = this.HeroView.fac;
|
||||||
const isEnemyTeam = team === 0 ? 1 : 0;
|
const isEnemyTeam = team === FacSet.HERO ? FacSet.MON : FacSet.HERO;
|
||||||
const candidates= ecs.query(ecs.allOf(HeroViewComp)).filter(e => e.get(HeroViewComp).fac !== team);
|
const candidates= ecs.query(ecs.allOf(HeroViewComp)).filter(e => e.get(HeroViewComp).fac !== team);
|
||||||
return this.filterFrontRow(candidates, isEnemyTeam);
|
return this.filterFrontRow(candidates, isEnemyTeam);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,8 @@ import { _decorator, Component, Node, resources, Sprite, SpriteAtlas } from 'cc'
|
|||||||
import { oops } from 'db://oops-framework/core/Oops';
|
import { oops } from 'db://oops-framework/core/Oops';
|
||||||
import { GameEvent } from '../common/config/GameEvent';
|
import { GameEvent } from '../common/config/GameEvent';
|
||||||
import { smc } from '../common/SingletonModuleComp';
|
import { smc } from '../common/SingletonModuleComp';
|
||||||
import { EquipInfo, EquipType, EquipAttr, EquipAttrTarget } from '../common/config/Equips';
|
import { EquipInfo, EquipType, EquipAttrTarget} from '../common/config/Equips';
|
||||||
|
import { BuffAttr, getBuffNum } from '../common/config/SkillSet';
|
||||||
const { ccclass, property } = _decorator;
|
const { ccclass, property } = _decorator;
|
||||||
|
|
||||||
@ccclass('EquipsComp')
|
@ccclass('EquipsComp')
|
||||||
@@ -15,50 +16,10 @@ export class EquipsComp extends Component {
|
|||||||
skill3:any=null
|
skill3:any=null
|
||||||
boxs:Node=null
|
boxs:Node=null
|
||||||
attrs:any={
|
attrs:any={
|
||||||
hero:{
|
hero:getBuffNum(),
|
||||||
ATK:0, // 攻击力
|
ally:getBuffNum(),
|
||||||
ATK_COUNT:0, // 攻击个数
|
enemy:getBuffNum(),
|
||||||
ATK_CD:0, // 攻击速度
|
friend:getBuffNum(),
|
||||||
HP:0, // 生命值
|
|
||||||
DEF:0, // 免伤
|
|
||||||
SKILL_DMG:0, // 技能效果
|
|
||||||
SKILL_CD:0, // 技能冷却缩减
|
|
||||||
CARD_EFFECT:0, // 卡牌效果
|
|
||||||
CARD_COUNT:0, // 卡牌起效次数,每3次多起效一次
|
|
||||||
},
|
|
||||||
ally:{
|
|
||||||
ATK:0, // 攻击力
|
|
||||||
ATK_COUNT:0, // 攻击个数
|
|
||||||
ATK_CD:0, // 攻击速度
|
|
||||||
HP:0, // 生命值
|
|
||||||
DEF:0, // 免伤
|
|
||||||
SKILL_DMG:0, // 技能效果
|
|
||||||
SKILL_CD:0, // 技能冷却缩减
|
|
||||||
CARD_EFFECT:0, // 卡牌效果
|
|
||||||
CARD_COUNT:0, // 卡牌起效次数,每3次多起效一次
|
|
||||||
},
|
|
||||||
enemy:{
|
|
||||||
ATK:0, // 攻击力
|
|
||||||
ATK_COUNT:0, // 攻击个数
|
|
||||||
ATK_CD:0, // 攻击速度
|
|
||||||
HP:0, // 生命值
|
|
||||||
DEF:0, // 免伤
|
|
||||||
SKILL_DMG:0, // 技能效果
|
|
||||||
SKILL_CD:0, // 技能冷却缩减
|
|
||||||
CARD_EFFECT:0, // 卡牌效果
|
|
||||||
CARD_COUNT:0, // 卡牌起效次数,每3次多起效一次
|
|
||||||
},
|
|
||||||
friend:{
|
|
||||||
ATK:0, // 攻击力
|
|
||||||
ATK_COUNT:0, // 攻击个数
|
|
||||||
ATK_CD:0, // 攻击速度
|
|
||||||
HP:0, // 生命值
|
|
||||||
DEF:0, // 免伤
|
|
||||||
SKILL_DMG:0, // 技能效果
|
|
||||||
SKILL_CD:0, // 技能冷却缩减
|
|
||||||
CARD_EFFECT:0, // 卡牌效果
|
|
||||||
CARD_COUNT:0, // 卡牌起效次数,每3次多起效一次
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
/** 视图层逻辑代码分离演示 */
|
/** 视图层逻辑代码分离演示 */
|
||||||
onLoad() {
|
onLoad() {
|
||||||
@@ -166,31 +127,31 @@ export class EquipsComp extends Component {
|
|||||||
|
|
||||||
if (targetKey) {
|
if (targetKey) {
|
||||||
switch (attr.type) {
|
switch (attr.type) {
|
||||||
case EquipAttr.ATK:
|
case BuffAttr.ATK:
|
||||||
this.attrs[targetKey].ATK += attr.value;
|
this.attrs[targetKey].ATK += attr.value;
|
||||||
break;
|
break;
|
||||||
case EquipAttr.ATK_COUNT:
|
case BuffAttr.ATK_COUNT:
|
||||||
this.attrs[targetKey].ATK_COUNT += attr.value;
|
this.attrs[targetKey].ATK_COUNT += attr.value;
|
||||||
break;
|
break;
|
||||||
case EquipAttr.ATK_CD:
|
case BuffAttr.ATK_CD:
|
||||||
this.attrs[targetKey].ATK_CD += attr.value;
|
this.attrs[targetKey].ATK_CD += attr.value;
|
||||||
break;
|
break;
|
||||||
case EquipAttr.HP:
|
case BuffAttr.HP:
|
||||||
this.attrs[targetKey].HP += attr.value;
|
this.attrs[targetKey].HP += attr.value;
|
||||||
break;
|
break;
|
||||||
case EquipAttr.DEF:
|
case BuffAttr.DEF:
|
||||||
this.attrs[targetKey].DEF += attr.value;
|
this.attrs[targetKey].DEF += attr.value;
|
||||||
break;
|
break;
|
||||||
case EquipAttr.SKILL_DMG:
|
case BuffAttr.SKILL_DMG:
|
||||||
this.attrs[targetKey].SKILL_DMG += attr.value;
|
this.attrs[targetKey].SKILL_DMG += attr.value;
|
||||||
break;
|
break;
|
||||||
case EquipAttr.SKILL_CD:
|
case BuffAttr.SKILL_CD:
|
||||||
this.attrs[targetKey].SKILL_CD += attr.value;
|
this.attrs[targetKey].SKILL_CD += attr.value;
|
||||||
break;
|
break;
|
||||||
case EquipAttr.CARD_EFFECT:
|
case BuffAttr.CARD_EFFECT:
|
||||||
this.attrs[targetKey].CARD_EFFECT += attr.value;
|
this.attrs[targetKey].CARD_EFFECT += attr.value;
|
||||||
break;
|
break;
|
||||||
case EquipAttr.CARD_COUNT:
|
case BuffAttr.CARD_COUNT:
|
||||||
this.attrs[targetKey].CARD_COUNT += attr.value;
|
this.attrs[targetKey].CARD_COUNT += attr.value;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -202,11 +163,7 @@ export class EquipsComp extends Component {
|
|||||||
|
|
||||||
// 重置所有属性为0
|
// 重置所有属性为0
|
||||||
private reset_attrs() {
|
private reset_attrs() {
|
||||||
Object.keys(this.attrs).forEach(key => {
|
this.attrs.hero=this.attrs.ally=this.attrs.enemy=this.attrs.friend=getBuffNum()
|
||||||
Object.keys(this.attrs[key]).forEach(attrKey => {
|
|
||||||
this.attrs[key][attrKey] = 0;
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 根据目标类型获取对应的key
|
// 根据目标类型获取对应的key
|
||||||
|
|||||||
@@ -1,84 +1,108 @@
|
|||||||
import { _decorator, Component, Node } from 'cc';
|
import { _decorator, Component, Node } from 'cc';
|
||||||
import { oops } from 'db://oops-framework/core/Oops';
|
import { oops } from 'db://oops-framework/core/Oops';
|
||||||
import { GameEvent } from '../common/config/GameEvent';
|
import { GameEvent } from '../common/config/GameEvent';
|
||||||
|
import { geDebuffNum, getBuffNum, BuffAttr, DebuffAttr } from '../common/config/SkillSet';
|
||||||
const { ccclass, property } = _decorator;
|
const { ccclass, property } = _decorator;
|
||||||
|
|
||||||
@ccclass('FightConComp')
|
@ccclass('FightConComp')
|
||||||
export class FightConComp extends Component {
|
export class FightConComp extends Component {
|
||||||
hero:{
|
|
||||||
ATK:0, // 攻击力
|
hero=getBuffNum()
|
||||||
ATK_COUNT:0, // 攻击个数
|
ally=getBuffNum()
|
||||||
ATK_CD:0, // 攻击速度
|
enemy=getBuffNum()
|
||||||
HP:0, // 生命值
|
friend=getBuffNum()
|
||||||
DEF:0, // 免伤
|
hero_debuff=geDebuffNum()
|
||||||
SKILL_DMG:0, // 技能效果
|
ally_debuff=geDebuffNum()
|
||||||
SKILL_CD:0, // 技能冷却缩减
|
enemy_debuff=geDebuffNum()
|
||||||
CARD_EFFECT:0, // 卡牌效果
|
friend_debuff=geDebuffNum()
|
||||||
CARD_COUNT:0, // 卡牌起效次数,每3次多起效一次
|
//注意临时buff和debuff 每种buff的值 必须都一样 多种值 战斗处理复杂 暂时放弃
|
||||||
}
|
temp_hero_buff = this.getInitTempDebuff();
|
||||||
ally:{
|
temp_ally_buff = this.getInitTempDebuff();
|
||||||
ATK:0, // 攻击力
|
temp_enemy_buff = this.getInitTempDebuff();
|
||||||
ATK_COUNT:0, // 攻击个数
|
temp_friend_buff = this.getInitTempDebuff();
|
||||||
ATK_CD:0, // 攻击速度
|
temp_hero_debuff = this.getInitTempBuffDebuff();
|
||||||
HP:0, // 生命值
|
temp_ally_debuff = this.getInitTempBuffDebuff();
|
||||||
DEF:0, // 免伤
|
temp_enemy_debuff = this.getInitTempBuffDebuff();
|
||||||
SKILL_DMG:0, // 技能效果
|
temp_friend_debuff = this.getInitTempBuffDebuff();
|
||||||
SKILL_CD:0, // 技能冷却缩减
|
|
||||||
CARD_EFFECT:0, // 卡牌效果
|
|
||||||
CARD_COUNT:0, // 卡牌起效次数,每3次多起效一次
|
|
||||||
}
|
|
||||||
enemy:{
|
|
||||||
ATK:0, // 攻击力
|
|
||||||
ATK_COUNT:0, // 攻击个数
|
|
||||||
ATK_CD:0, // 攻击速度
|
|
||||||
HP:0, // 生命值
|
|
||||||
DEF:0, // 免伤
|
|
||||||
SKILL_DMG:0, // 技能效果
|
|
||||||
SKILL_CD:0, // 技能冷却缩减
|
|
||||||
CARD_EFFECT:0, // 卡牌效果
|
|
||||||
CARD_COUNT:0, // 卡牌起效次数,每3次多起效一次
|
|
||||||
}
|
|
||||||
friend:{
|
|
||||||
ATK:0, // 攻击力
|
|
||||||
ATK_COUNT:0, // 攻击个数
|
|
||||||
ATK_CD:0, // 攻击速度
|
|
||||||
HP:0, // 生命值
|
|
||||||
DEF:0, // 免伤
|
|
||||||
SKILL_DMG:0, // 技能效果
|
|
||||||
SKILL_CD:0, // 技能冷却缩减
|
|
||||||
CARD_EFFECT:0, // 卡牌效果
|
|
||||||
CARD_COUNT:0, // 卡牌起效次数,每3次多起效一次
|
|
||||||
}
|
|
||||||
|
|
||||||
onLoad(){
|
onLoad(){
|
||||||
// console.log("fight con start")
|
// console.log("fight con start")
|
||||||
oops.message.on(GameEvent.EquipChange,this.equip_change,this)
|
oops.message.on(GameEvent.EquipChange,this.equip_change,this)
|
||||||
oops.message.on(GameEvent.FightReady,this.fight_ready,this)
|
oops.message.on(GameEvent.FightReady,this.fight_ready,this)
|
||||||
}
|
}
|
||||||
|
|
||||||
equip_change(e:GameEvent,equip:any){
|
private equip_change(e:GameEvent,equip:any){
|
||||||
this.hero=equip.hero
|
this.hero=equip.hero
|
||||||
this.ally=equip.ally
|
this.ally=equip.ally
|
||||||
this.enemy=equip.enemy
|
this.enemy=equip.enemy
|
||||||
this.friend=equip.friend
|
this.friend=equip.friend
|
||||||
}
|
}
|
||||||
fight_ready(e:GameEvent){
|
private fight_ready(e:GameEvent){
|
||||||
this.hero=this.ally=this.enemy=this.friend={
|
this.hero=this.ally=this.enemy=this.friend=getBuffNum()
|
||||||
ATK:0, // 攻击力
|
this.hero_debuff=this.ally_debuff=this.enemy_debuff=this.friend_debuff=geDebuffNum()
|
||||||
ATK_COUNT:0, // 攻击个数
|
this.clearAllTempBuffs()
|
||||||
ATK_CD:0, // 攻击速度
|
// console.log("临时英雄buff:",this.temp_hero_buff)
|
||||||
HP:0, // 生命值
|
// console.log("临时英雄debuff:",this.temp_hero_debuff)
|
||||||
DEF:0, // 免伤
|
// console.log("临时全部buff:",this.temp_ally_buff)
|
||||||
SKILL_DMG:0, // 技能效果
|
// console.log("临时全部debuff:",this.temp_ally_debuff)
|
||||||
SKILL_CD:0, // 技能冷却缩减
|
// console.log("临时敌方buff:",this.temp_enemy_buff)
|
||||||
CARD_EFFECT:0, // 卡牌效果
|
// console.log("临时敌方debuff:",this.temp_enemy_debuff)
|
||||||
CARD_COUNT:0, // 卡牌起效次数,每3次多起效一次
|
// console.log("临时友军buff:",this.temp_friend_buff)
|
||||||
|
// console.log("临时友军debuff:",this.temp_friend_debuff)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 添加临时buff
|
||||||
|
addTempBuff(target: 'hero'|'ally'|'enemy'|'friend', buffId: number, value: number, count: number) {
|
||||||
|
const key = `temp_${target}_buff`;
|
||||||
|
if (!this[key][buffId]) {
|
||||||
|
this[key][buffId] = { value, count };
|
||||||
|
} else {
|
||||||
|
this[key][buffId].value += value;
|
||||||
|
this[key][buffId].count += count;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 触发一次buff效果后减少次数
|
||||||
|
triggerTempBuff(target: 'hero'|'ally'|'enemy'|'friend', buffId: number) {
|
||||||
|
const key = `temp_${target}_buff`;
|
||||||
|
if (this[key][buffId]) {
|
||||||
|
this[key][buffId].count -= 1;
|
||||||
|
if (this[key][buffId].count <= 0) {
|
||||||
|
delete this[key][buffId];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 初始化所有buff/debuff为0
|
||||||
|
private getInitTempBuffDebuff() {
|
||||||
|
const obj = {};
|
||||||
|
for (const key in BuffAttr) {
|
||||||
|
if (!isNaN(Number(key))) {
|
||||||
|
obj[Number(key)] = { value: 0, count: 0 };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return obj;
|
||||||
|
}
|
||||||
|
|
||||||
|
private getInitTempDebuff() {
|
||||||
|
const obj = {};
|
||||||
|
for (const key in DebuffAttr) {
|
||||||
|
if (!isNaN(Number(key))) {
|
||||||
|
obj[Number(key)] = { value: 0, count: 0 };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return obj;
|
||||||
|
}
|
||||||
|
|
||||||
|
private clearAllTempBuffs() {
|
||||||
|
this.temp_hero_buff = this.temp_ally_buff = this.temp_enemy_buff = this.temp_friend_buff = this.getInitTempBuffDebuff();
|
||||||
|
this.temp_hero_debuff = this.temp_ally_debuff = this.temp_enemy_debuff = this.temp_friend_debuff = this.getInitTempDebuff();
|
||||||
|
}
|
||||||
|
|
||||||
update(deltaTime: number) {
|
update(deltaTime: number) {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -65,6 +65,7 @@ export class SkillCom extends CCComp {
|
|||||||
// bm.speed=700
|
// bm.speed=700
|
||||||
if(this.group==BoxSet.MONSTER) bm.controlPointSide=-1
|
if(this.group==BoxSet.MONSTER) bm.controlPointSide=-1
|
||||||
bm.moveTo(this.targetPos)
|
bm.moveTo(this.targetPos)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// let dir_x = this.targetPos.x > this.node.position.x ? 1 : -1
|
// let dir_x = this.targetPos.x > this.node.position.x ? 1 : -1
|
||||||
@@ -240,16 +241,25 @@ export class SkillCom extends CCComp {
|
|||||||
|
|
||||||
update(deltaTime: number) {
|
update(deltaTime: number) {
|
||||||
if(smc.mission.pause) return;
|
if(smc.mission.pause) return;
|
||||||
this.toDestroy();
|
if (!this.node || !this.node.isValid) return;
|
||||||
if(this.animType==AnimType.linear) this.startLinearMove(deltaTime);
|
|
||||||
|
|
||||||
|
if(this.animType == AnimType.linear) this.startLinearMove(deltaTime);
|
||||||
|
this.toDestroy();
|
||||||
}
|
}
|
||||||
toDestroy() {
|
toDestroy() {
|
||||||
if(this.is_destroy){
|
if(this.is_destroy){
|
||||||
this.ent.destroy()
|
if (this.ent) {
|
||||||
|
this.ent.destroy();
|
||||||
|
} else {
|
||||||
|
// 如果ent不存在,直接销毁节点
|
||||||
|
if (this.node && this.node.isValid) {
|
||||||
|
this.node.destroy();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
doDestroy(){
|
doDestroy(){
|
||||||
|
console.log("doDestroy")
|
||||||
this.is_destroy=true
|
this.is_destroy=true
|
||||||
}
|
}
|
||||||
/** 视图对象通过 ecs.Entity.remove(ModuleViewComp) 删除组件是触发组件处理自定义释放逻辑 */
|
/** 视图对象通过 ecs.Entity.remove(ModuleViewComp) 删除组件是触发组件处理自定义释放逻辑 */
|
||||||
|
|||||||
Reference in New Issue
Block a user