crt 改为crit

This commit is contained in:
2025-06-24 21:08:46 +08:00
parent 4ef2855e49
commit 766c1f8176
12 changed files with 11211 additions and 7154 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -39,6 +39,31 @@ export class SingletonModuleComp extends ecs.Comp {
mission_data:{ mission_data:{
}, },
hero_info:{
hp:0,
ap:0,
def:0,
crit:0,
dod:0,
equip_ap:0,
buff_ap:0,
debuff_ap:0,
},
friend_info:{
hp:0,
ap:0,
equip_ap:0,
buff_ap:0,
debuff_ap:0,
},
boss_info:{
hp:0,
ap:0,
equip_ap:0,
buff_ap:0,
debuff_ap:0,
},
}; };
vmAdd() { vmAdd() {
this.vmdata.mission_data=MissionData this.vmdata.mission_data=MissionData

View File

@@ -64,89 +64,89 @@ export const MonSet = {
} }
export const HeroInfo = { export const HeroInfo = {
5001:{uuid:5001,name:"神圣守护",path:"k2", lv:1,kind:1,type:0,hp:50,ap:10,dis:700,a_cd:3,quality:HeroQuality.BLUE, 5001:{uuid:5001,name:"神圣守护",path:"k2", lv:1,kind:1,type:0,hp:50,ap:10,dis:700,a_cd:3,quality:HeroQuality.BLUE,
crt:5,crt_d:0,crt_no:false,dod:0,dod_no:false,speed:50,skills:[6001],info:"说明"}, crit:5,crit_d:0,crit_no:false,dod:0,dod_no:false,speed:50,skills:[6001],info:"说明"},
5002:{uuid:5002,name:"幻影剑豪",path:"k1", lv:1,kind:2,type:0,hp:50,ap:10,dis:700,a_cd:3,quality:HeroQuality.BLUE, 5002:{uuid:5002,name:"幻影剑豪",path:"k1", lv:1,kind:2,type:0,hp:50,ap:10,dis:700,a_cd:3,quality:HeroQuality.BLUE,
crt:5,crt_d:0,crt_no:false,dod:0,dod_no:false,speed:50,skills:[6001],info:"说明"}, crit:5,crit_d:0,crit_no:false,dod:0,dod_no:false,speed:50,skills:[6001],info:"说明"},
5003:{uuid:5003,name:"战争领主",path:"k5", lv:1,kind:2,type:0,hp:50,ap:10,dis:700,a_cd:3,quality:HeroQuality.BLUE, 5003:{uuid:5003,name:"战争领主",path:"k5", lv:1,kind:2,type:0,hp:50,ap:10,dis:700,a_cd:3,quality:HeroQuality.BLUE,
crt:5,crt_d:0,crt_no:false,dod:0,dod_no:false,speed:50,skills:[6001],info:"说明"}, crit:5,crit_d:0,crit_no:false,dod:0,dod_no:false,speed:50,skills:[6001],info:"说明"},
5004:{uuid:5004,name:"混沌法师",path:"zh1", lv:1,kind:2,type:2,hp:50,ap:10,dis:700,a_cd:3.5,quality:HeroQuality.BLUE, 5004:{uuid:5004,name:"混沌法师",path:"zh1", lv:1,kind:2,type:2,hp:50,ap:10,dis:700,a_cd:3.5,quality:HeroQuality.BLUE,
crt:5,crt_d:0,crt_no:false,dod:0,dod_no:false,speed:50,skills:[6001],info:"说明"}, crit:5,crit_d:0,crit_no:false,dod:0,dod_no:false,speed:50,skills:[6001],info:"说明"},
5005:{uuid:5005,name:"火焰法师",path:"zh2", lv:1,kind:2,type:2,hp:50,ap:15,dis:700,a_cd:3.5,quality:HeroQuality.BLUE, 5005:{uuid:5005,name:"火焰法师",path:"zh2", lv:1,kind:2,type:2,hp:50,ap:15,dis:700,a_cd:3.5,quality:HeroQuality.BLUE,
crt:5,crt_d:0,crt_no:false,dod:0,dod_no:false,speed:50,skills:[6001],info:"说明"}, crit:5,crit_d:0,crit_no:false,dod:0,dod_no:false,speed:50,skills:[6001],info:"说明"},
5006:{uuid:5006,name:"风暴精灵",path:"m4", lv:1,kind:2,type:2,hp:50,ap:15,dis:700,a_cd:3.5,quality:HeroQuality.BLUE, 5006:{uuid:5006,name:"风暴精灵",path:"m4", lv:1,kind:2,type:2,hp:50,ap:15,dis:700,a_cd:3.5,quality:HeroQuality.BLUE,
crt:5,crt_d:0,crt_no:false,dod:0,dod_no:false,speed:50,skills:[6001],info:"说明"}, crit:5,crit_d:0,crit_no:false,dod:0,dod_no:false,speed:50,skills:[6001],info:"说明"},
5008:{uuid:5008,name:"战争祭祀",path:"d2", lv:1,kind:2,type:2,hp:50,ap:10,dis:700,a_cd:3.5,quality:HeroQuality.BLUE, 5008:{uuid:5008,name:"战争祭祀",path:"d2", lv:1,kind:2,type:2,hp:50,ap:10,dis:700,a_cd:3.5,quality:HeroQuality.BLUE,
crt:5,crt_d:0,crt_no:false,dod:0,dod_no:false,speed:50,skills:[6001],info:"说明"}, crit:5,crit_d:0,crit_no:false,dod:0,dod_no:false,speed:50,skills:[6001],info:"说明"},
5009:{uuid:5009,name:"暴风射手",path:"a5", lv:1,kind:2,type:1,hp:50,ap:15,dis:700,a_cd:3.2,quality:HeroQuality.BLUE, 5009:{uuid:5009,name:"暴风射手",path:"a5", lv:1,kind:2,type:1,hp:50,ap:15,dis:700,a_cd:3.2,quality:HeroQuality.BLUE,
crt:5,crt_d:0,crt_no:false,dod:0,dod_no:false,speed:50,skills:[6002],info:"说明"}, crit:5,crit_d:0,crit_no:false,dod:0,dod_no:false,speed:50,skills:[6002],info:"说明"},
5010:{uuid:5010,name:"苍穹射手",path:"a3", lv:1,kind:1,type:1,hp:50,ap:15,dis:700,a_cd:3.2,quality:HeroQuality.BLUE, 5010:{uuid:5010,name:"苍穹射手",path:"a3", lv:1,kind:1,type:1,hp:50,ap:15,dis:700,a_cd:3.2,quality:HeroQuality.BLUE,
crt:5,crt_d:0,crt_no:false,dod:0,dod_no:false,speed:50,skills:[6002],info:"说明"}, crit:5,crit_d:0,crit_no:false,dod:0,dod_no:false,speed:50,skills:[6002],info:"说明"},
5011:{uuid:5011,name:"幽灵射手",path:"a4", lv:1,kind:2,type:1,hp:50,ap:15,dis:700,a_cd:3.2,quality:HeroQuality.BLUE, 5011:{uuid:5011,name:"幽灵射手",path:"a4", lv:1,kind:2,type:1,hp:50,ap:15,dis:700,a_cd:3.2,quality:HeroQuality.BLUE,
crt:5,crt_d:0,crt_no:false,dod:0,dod_no:false,speed:50,skills:[6002],info:"说明"}, crit:5,crit_d:0,crit_no:false,dod:0,dod_no:false,speed:50,skills:[6002],info:"说明"},
//怪物 //怪物
5201:{uuid:5201,name:"兽人战士",path:"mor1", lv:1,kind:1,type:0,hp:200,ap:5,dis:400,a_cd:3,quality:HeroQuality.WHITE, 5201:{uuid:5201,name:"兽人战士",path:"mor1", lv:1,kind:1,type:0,hp:200,ap:5,dis:400,a_cd:3,quality:HeroQuality.WHITE,
crt:5,crt_d:0,crt_no:false,dod:0,dod_no:false,speed:50,skills:[6001],info:"说明"}, crit:5,crit_d:0,crit_no:false,dod:0,dod_no:false,speed:50,skills:[6001],info:"说明"},
5202:{uuid:5202,name:"兽人刺客",path:"mor2", lv:1,kind:1,type:0,hp:200,ap:5,dis:400,a_cd:3,quality:HeroQuality.WHITE, 5202:{uuid:5202,name:"兽人刺客",path:"mor2", lv:1,kind:1,type:0,hp:200,ap:5,dis:400,a_cd:3,quality:HeroQuality.WHITE,
crt:5,crt_d:0,crt_no:false,dod:0,dod_no:false,speed:50,skills:[6001],info:"说明"}, crit:5,crit_d:0,crit_no:false,dod:0,dod_no:false,speed:50,skills:[6001],info:"说明"},
5203:{uuid:5203,name:"兽人护卫",path:"mor3", lv:1,kind:1,type:1,hp:200,ap:5,dis:400,a_cd:3.2,quality:HeroQuality.WHITE, 5203:{uuid:5203,name:"兽人护卫",path:"mor3", lv:1,kind:1,type:1,hp:200,ap:5,dis:400,a_cd:3.2,quality:HeroQuality.WHITE,
crt:5,crt_d:0,crt_no:false,dod:0,dod_no:false,speed:50,skills:[6001],info:"说明"}, crit:5,crit_d:0,crit_no:false,dod:0,dod_no:false,speed:50,skills:[6001],info:"说明"},
5204:{uuid:5204,name:"石卫", path:"mgem1",lv:1,kind:1,type:0,hp:200,ap:5,dis:400,a_cd:3,quality:HeroQuality.WHITE, 5204:{uuid:5204,name:"石卫", path:"mgem1",lv:1,kind:1,type:0,hp:200,ap:5,dis:400,a_cd:3,quality:HeroQuality.WHITE,
crt:5,crt_d:0,crt_no:false,dod:0,dod_no:false,speed:50,skills:[6001],info:"说明"}, crit:5,crit_d:0,crit_no:false,dod:0,dod_no:false,speed:50,skills:[6001],info:"说明"},
5205:{uuid:5205,name:"土卫", path:"mgem2",lv:1,kind:1,type:0,hp:200,ap:5,dis:400,a_cd:3,quality:HeroQuality.WHITE, 5205:{uuid:5205,name:"土卫", path:"mgem2",lv:1,kind:1,type:0,hp:200,ap:5,dis:400,a_cd:3,quality:HeroQuality.WHITE,
crt:5,crt_d:0,crt_no:false,dod:0,dod_no:false,speed:50,skills:[6001],info:"说明"}, crit:5,crit_d:0,crit_no:false,dod:0,dod_no:false,speed:50,skills:[6001],info:"说明"},
5206:{uuid:5206,name:"树人", path:"mgem3",lv:1,kind:1,type:0,hp:200,ap:5,dis:400,a_cd:3,quality:HeroQuality.WHITE, 5206:{uuid:5206,name:"树人", path:"mgem3",lv:1,kind:1,type:0,hp:200,ap:5,dis:400,a_cd:3,quality:HeroQuality.WHITE,
crt:5,crt_d:0,crt_no:false,dod:0,dod_no:false,speed:50,skills:[6001],info:"说明"}, crit:5,crit_d:0,crit_no:false,dod:0,dod_no:false,speed:50,skills:[6001],info:"说明"},
5216:{uuid:5216,name:"元素1", path:"my1", lv:2,kind:1,type:2,hp:200,ap:5,dis:400,a_cd:3.5,quality:HeroQuality.WHITE, 5216:{uuid:5216,name:"元素1", path:"my1", lv:2,kind:1,type:2,hp:200,ap:5,dis:400,a_cd:3.5,quality:HeroQuality.WHITE,
crt:5,crt_d:0,crt_no:false,dod:0,dod_no:false,speed:50,skills:[6001],info:"说明"}, crit:5,crit_d:0,crit_no:false,dod:0,dod_no:false,speed:50,skills:[6001],info:"说明"},
5217:{uuid:5217,name:"元素2", path:"my2", lv:2,kind:1,type:2,hp:200,ap:5,dis:400,a_cd:3.5,quality:HeroQuality.WHITE, 5217:{uuid:5217,name:"元素2", path:"my2", lv:2,kind:1,type:2,hp:200,ap:5,dis:400,a_cd:3.5,quality:HeroQuality.WHITE,
crt:5,crt_d:0,crt_no:false,dod:0,dod_no:false,speed:50,skills:[6001],info:"说明"}, crit:5,crit_d:0,crit_no:false,dod:0,dod_no:false,speed:50,skills:[6001],info:"说明"},
5218:{uuid:5218,name:"元素3", path:"my3", lv:2,kind:1,type:2,hp:200,ap:5,dis:400,a_cd:3.5,quality:HeroQuality.WHITE, 5218:{uuid:5218,name:"元素3", path:"my3", lv:2,kind:1,type:2,hp:200,ap:5,dis:400,a_cd:3.5,quality:HeroQuality.WHITE,
crt:5,crt_d:0,crt_no:false,dod:0,dod_no:false,speed:50,skills:[6001],info:"说明"}, crit:5,crit_d:0,crit_no:false,dod:0,dod_no:false,speed:50,skills:[6001],info:"说明"},
5219:{uuid:5219,name:"牛头战士",path:"mn1", lv:2,kind:1,type:0,hp:200,ap:5,dis:400,a_cd:3,quality:HeroQuality.WHITE, 5219:{uuid:5219,name:"牛头战士",path:"mn1", lv:2,kind:1,type:0,hp:200,ap:5,dis:400,a_cd:3,quality:HeroQuality.WHITE,
crt:5,crt_d:0,crt_no:false,dod:0,dod_no:false,speed:50,skills:[6001],info:"说明"}, crit:5,crit_d:0,crit_no:false,dod:0,dod_no:false,speed:50,skills:[6001],info:"说明"},
5220:{uuid:5220,name:"牛头战士",path:"mn2", lv:1,kind:1,type:1,hp:200,ap:5,dis:400,a_cd:3.2,quality:HeroQuality.WHITE, 5220:{uuid:5220,name:"牛头战士",path:"mn2", lv:1,kind:1,type:1,hp:200,ap:5,dis:400,a_cd:3.2,quality:HeroQuality.WHITE,
crt:5,crt_d:0,crt_no:false,dod:0,dod_no:false,speed:50,skills:[6001],info:"说明"}, crit:5,crit_d:0,crit_no:false,dod:0,dod_no:false,speed:50,skills:[6001],info:"说明"},
5221:{uuid:5221,name:"牛头战士",path:"mn3", lv:1,kind:1,type:0,hp:200,ap:5,dis:400,a_cd:3,quality:HeroQuality.WHITE, 5221:{uuid:5221,name:"牛头战士",path:"mn3", lv:1,kind:1,type:0,hp:200,ap:5,dis:400,a_cd:3,quality:HeroQuality.WHITE,
crt:5,crt_d:0,crt_no:false,dod:0,dod_no:false,speed:50,skills:[6001],info:"说明"}, crit:5,crit_d:0,crit_no:false,dod:0,dod_no:false,speed:50,skills:[6001],info:"说明"},
5222:{uuid:5222,name:"独眼巨人",path:"md1", lv:1,kind:1,type:0,hp:200,ap:5,dis:400,a_cd:3,quality:HeroQuality.WHITE, 5222:{uuid:5222,name:"独眼巨人",path:"md1", lv:1,kind:1,type:0,hp:200,ap:5,dis:400,a_cd:3,quality:HeroQuality.WHITE,
crt:5,crt_d:0,crt_no:false,dod:0,dod_no:false,speed:50,skills:[6001],info:"说明"}, crit:5,crit_d:0,crit_no:false,dod:0,dod_no:false,speed:50,skills:[6001],info:"说明"},
5223:{uuid:5223,name:"独眼巨人",path:"md2", lv:1,kind:1,type:0,hp:200,ap:5,dis:400,a_cd:3,quality:HeroQuality.WHITE, 5223:{uuid:5223,name:"独眼巨人",path:"md2", lv:1,kind:1,type:0,hp:200,ap:5,dis:400,a_cd:3,quality:HeroQuality.WHITE,
crt:5,crt_d:0,crt_no:false,dod:0,dod_no:false,speed:50,skills:[6001],info:"说明"}, crit:5,crit_d:0,crit_no:false,dod:0,dod_no:false,speed:50,skills:[6001],info:"说明"},
5224:{uuid:5224,name:"独眼巨人",path:"md3", lv:1,kind:1,type:1,hp:200,ap:5,dis:400,a_cd:3.2,quality:HeroQuality.WHITE, 5224:{uuid:5224,name:"独眼巨人",path:"md3", lv:1,kind:1,type:1,hp:200,ap:5,dis:400,a_cd:3.2,quality:HeroQuality.WHITE,
crt:5,crt_d:0,crt_no:false,dod:0,dod_no:false,speed:50,skills:[6001],info:"说明"}, crit:5,crit_d:0,crit_no:false,dod:0,dod_no:false,speed:50,skills:[6001],info:"说明"},
5225:{uuid:5225,name:"精英独眼",path:"md4", lv:1,kind:1,type:2,hp:200,ap:5,dis:400,a_cd:3,quality:HeroQuality.WHITE, 5225:{uuid:5225,name:"精英独眼",path:"md4", lv:1,kind:1,type:2,hp:200,ap:5,dis:400,a_cd:3,quality:HeroQuality.WHITE,
crt:5,crt_d:0,crt_no:false,dod:0,dod_no:false,speed:50,skills:[6001],info:"说明"}, crit:5,crit_d:0,crit_no:false,dod:0,dod_no:false,speed:50,skills:[6001],info:"说明"},
5226:{uuid:5226,name:"精英牛头",path:"mn4", lv:1,kind:1,type:2,hp:200,ap:5,dis:400,a_cd:3,quality:HeroQuality.WHITE, 5226:{uuid:5226,name:"精英牛头",path:"mn4", lv:1,kind:1,type:2,hp:200,ap:5,dis:400,a_cd:3,quality:HeroQuality.WHITE,
crt:5,crt_d:0,crt_no:false,dod:0,dod_no:false,speed:50,skills:[6001],info:"说明"}, crit:5,crit_d:0,crit_no:false,dod:0,dod_no:false,speed:50,skills:[6001],info:"说明"},
5227:{uuid:5227,name:"精英兽人",path:"mor4", lv:1,kind:1,type:2,hp:200,ap:5,dis:400,a_cd:3,quality:HeroQuality.WHITE, 5227:{uuid:5227,name:"精英兽人",path:"mor4", lv:1,kind:1,type:2,hp:200,ap:5,dis:400,a_cd:3,quality:HeroQuality.WHITE,
crt:5,crt_d:0,crt_no:false,dod:0,dod_no:false,speed:50,skills:[6001],info:"说明"} crit:5,crit_d:0,crit_no:false,dod:0,dod_no:false,speed:50,skills:[6001],info:"说明"}
}; };

View File

@@ -56,7 +56,7 @@ export class Hero extends ecs.Entity {
} }
/** 加载角色 */ /** 加载角色 */
load(pos: Vec3 = Vec3.ZERO,scale:number = 1,uuid:number=1001,info:any={ap:0,hp:0,lv:1,crt:0,crt_d:0,dod:0,dod_no:false,crt_no:false},fight_pos:number=1) { load(pos: Vec3 = Vec3.ZERO,scale:number = 1,uuid:number=1001,info:any={ap:0,hp:0,lv:1,crit:0,crit_d:0,dod:0,dod_no:false,crit_no:false},fight_pos:number=1) {
// console.log("英雄加载:",uuid,pos,scale,info) // console.log("英雄加载:",uuid,pos,scale,info)
scale = 1 scale = 1
let box_group=BoxSet.HERO let box_group=BoxSet.HERO
@@ -78,7 +78,7 @@ export class Hero extends ecs.Entity {
console.log("[Hero]:friend",hv) console.log("[Hero]:friend",hv)
} }
hero_init(uuid:number=1001,node:Node,info:any={ap:0,hp:0,lv:1,crt:0,crt_d:0,dod:0,dod_no:false,crt_no:false}) { hero_init(uuid:number=1001,node:Node,info:any={ap:0,hp:0,lv:1,crit:0,crit_d:0,dod:0,dod_no:false,crit_no:false}) {
var hv = node.getComponent(HeroViewComp)!; var hv = node.getComponent(HeroViewComp)!;
let hero= HeroInfo[uuid] // 共用英雄数据 let hero= HeroInfo[uuid] // 共用英雄数据
hv.scale = 1; hv.scale = 1;
@@ -93,11 +93,11 @@ export class Hero extends ecs.Entity {
hv.cd = hero.a_cd hv.cd = hero.a_cd
hv.hp= hv.hp_max =hero.hp+info.hp hv.hp= hv.hp_max =hero.hp+info.hp
hv.ap = hero.ap+info.ap; hv.ap = hero.ap+info.ap;
hv.crt=hero.crt+info.crt hv.crit=hero.crit+info.crit
hv.crt_d=hero.crt_d+info.crt_d hv.crit_d=hero.crit_d+info.crit_d
hv.dod=hero.dod+info.dod hv.dod=hero.dod+info.dod
hv.dod_no=info.dod_no hv.dod_no=info.dod_no
hv.crt_no=info.crt_no hv.crit_no=info.crit_no
hv.atk_skill=hero.skills[0] hv.atk_skill=hero.skills[0]
return hv return hv
} }

View File

@@ -64,9 +64,9 @@ export class HeroViewComp extends CCComp {
dod: number = 10; //闪避率 dod: number = 10; //闪避率
dod_no:boolean=false; dod_no:boolean=false;
crt:number=0; //暴击率 crit:number=0; //暴击率
crt_no:boolean=false; //暴击免疫 crit_no:boolean=false; //暴击免疫
crt_d:number=0; //暴击伤害 crit_d:number=0; //暴击伤害
shield:number = 0; //护盾,免伤1次减1 shield:number = 0; //护盾,免伤1次减1
speed: number = 100; /** 角色移动速度 */ speed: number = 100; /** 角色移动速度 */
@@ -373,17 +373,17 @@ export class HeroViewComp extends CCComp {
} }
} }
do_atked(remainingDamage:number,crt:number=0,crt_d:number=0){ do_atked(remainingDamage:number,crit:number=0,crit_d:number=0){
this.do_atked_trigger() this.do_atked_trigger()
if(this.check_shield()) return if(this.check_shield()) return
if(this.check_dodge()) return if(this.check_dodge()) return
let is_crit = this.check_crit(crt) let is_crit = this.check_crit(crit)
if(this == null) return; if(this == null) return;
let damage = this.count_damage(remainingDamage) let damage = this.count_damage(remainingDamage)
if(is_crit) { if(is_crit) {
damage = Math.floor(damage * (1 + (FightSet.CRIT_DAMAGE+crt_d)/100)) damage = Math.floor(damage * (1 + (FightSet.CRIT_DAMAGE+crit_d)/100))
} }
this.hp -= damage; this.hp -= damage;
if(this.hp <= 0) { if(this.hp <= 0) {
@@ -454,16 +454,16 @@ export class HeroViewComp extends CCComp {
return false return false
} }
check_crit(crt:number=0){ check_crit(crit:number=0){
if(this.crt_no) return false if(this.crit_no) return false
if(crt > 0){ if(crit > 0){
let random = Math.random()*100 let random = Math.random()*100
if(random < crt) { if(random < crit) {
console.log("[HeroViewComp]:crit",crt,random) console.log("[HeroViewComp]:crit",crit,random)
return true return true
} }
} }
console.log("[HeroViewComp]:crit",crt) console.log("[HeroViewComp]:crit",crit)
return false return false
} }
// dead(){ // dead(){

View File

@@ -67,11 +67,11 @@ export class Monster extends ecs.Entity {
hv.hp= hv.hp_max =hero.hp; hv.hp= hv.hp_max =hero.hp;
hv.ap = hero.ap; hv.ap = hero.ap;
hv.cd = hero.a_cd hv.cd = hero.a_cd
hv.crt=hero.crt hv.crit=hero.crit
hv.crt_d=hero.crt_d hv.crit_d=hero.crit_d
hv.dod=hero.dod hv.dod=hero.dod
hv.dod_no=hero.dod_no hv.dod_no=hero.dod_no
hv.crt_no=hero.crt_no hv.crit_no=hero.crit_no
hv.atk_skill=hero.skills[0] hv.atk_skill=hero.skills[0]
this.add(hv); this.add(hv);
} }

View File

@@ -0,0 +1,29 @@
import { _decorator } from "cc";
import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
import { CCComp } from "../../../../extensions/oops-plugin-framework/assets/module/common/CCComp";
const { ccclass, property } = _decorator;
/** 视图层对象 */
@ccclass('BarBossCompComp')
@ecs.register('BarBossComp', false)
export class BarBossCompComp extends CCComp {
/** 视图层逻辑代码分离演示 */
start() {
// var entity = this.ent as ecs.Entity; // ecs.Entity 可转为当前模块的具体实体对象
// this.on(ModuleEvent.Cmd, this.onHandler, this);
}
/** 全局消息逻辑处理 */
// private onHandler(event: string, args: any) {
// switch (event) {
// case ModuleEvent.Cmd:
// break;
// }
// }
/** 视图对象通过 ecs.Entity.remove(ModuleViewComp) 删除组件是触发组件处理自定义释放逻辑 */
reset() {
this.node.destroy();
}
}

View File

@@ -0,0 +1,9 @@
{
"ver": "4.0.23",
"importer": "typescript",
"imported": true,
"uuid": "fad26a63-4765-435a-bab6-daf8fa8476e1",
"files": [],
"subMetas": {},
"userData": {}
}

View File

@@ -1,6 +1,11 @@
import { _decorator } from "cc"; import { _decorator, Label, Node, ProgressBar } from "cc";
import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS"; import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
import { CCComp } from "../../../../extensions/oops-plugin-framework/assets/module/common/CCComp"; import { CCComp } from "../../../../extensions/oops-plugin-framework/assets/module/common/CCComp";
import { GameEvent } from "../common/config/GameEvent";
import { HeroViewComp } from "../hero/HeroViewComp";
import { HeroModelComp } from "../hero/HeroModelComp";
import { MasterModelComp } from "../hero/MasterModel";
import { FriendModelComp } from "../hero/FriendModel";
const { ccclass, property } = _decorator; const { ccclass, property } = _decorator;
@@ -8,12 +13,56 @@ const { ccclass, property } = _decorator;
@ccclass('BarCompComp') @ccclass('BarCompComp')
@ecs.register('BarComp', false) @ecs.register('BarComp', false)
export class BarCompComp extends CCComp { export class BarCompComp extends CCComp {
hero_bar:Node = null;
friend_bar:Node = null;
boss_bar:Node = null;
hero:HeroViewComp = null;
friend:HeroViewComp = null;
boss:HeroViewComp = null;
/** 视图层逻辑代码分离演示 */ /** 视图层逻辑代码分离演示 */
protected onLoad(): void {
this.on(GameEvent.FightReady,this.readay,this)
}
start() { start() {
this.hero_bar = this.node.getChildByName("bar");
this.friend_bar = this.node.getChildByName("fbar");
this.boss_bar = this.node.getChildByName("bar");
// var entity = this.ent as ecs.Entity; // ecs.Entity 可转为当前模块的具体实体对象 // var entity = this.ent as ecs.Entity; // ecs.Entity 可转为当前模块的具体实体对象
// this.on(ModuleEvent.Cmd, this.onHandler, this); // this.on(ModuleEvent.Cmd, this.onHandler, this);
} }
private readay(){
this.hero_bar.active = this.get_hero()
this.friend_bar.active = this.get_friend()
}
private get_hero(){
let heros = ecs.query(ecs.allOf(MasterModelComp))
if(heros.length > 0){
this.hero = heros[0].get(HeroViewComp)
return true
}else{
this.hero = null
return false
}
}
private get_friend(){
let friend = ecs.query(ecs.allOf(FriendModelComp))
if(friend.length > 0){
this.friend = friend[0].get(HeroViewComp)
return true
}else{
this.friend = null
return false
}
}
update_bar(){
if(!this.get_hero()) return
let hp_bar = this.hero_bar.getChildByName("hp").getChildByName("bar").getComponent(ProgressBar)
let ap_bar = this.hero_bar.getChildByName("ap").getChildByName("val").getComponent(Label)
let ap =this.hero.ap+"("+this.hero.ap_ur+")"
hp_bar.progress = this.hero.hp/this.hero.hp_max
ap_bar.string = ap.toString()
}
/** 全局消息逻辑处理 */ /** 全局消息逻辑处理 */
// private onHandler(event: string, args: any) { // private onHandler(event: string, args: any) {
// switch (event) { // switch (event) {

View File

@@ -138,7 +138,7 @@ export class MissionHeroCompComp extends CCComp {
} }
get_info_and_remove(fight_pos:number,uuid:number){ get_info_and_remove(fight_pos:number,uuid:number){
let info:any={ap:0,hp:0,lv:1,crt:0,crt_d:0,dod:0,dod_no:false,crt_no:false} let info:any={ap:0,hp:0,lv:1,crit:0,crit_d:0,dod:0,dod_no:false,crit_no:false}
let heros=ecs.query(ecs.allOf(FriendModelComp)) let heros=ecs.query(ecs.allOf(FriendModelComp))
if(heros.length>0){ if(heros.length>0){
let hero = heros[0] let hero = heros[0]
@@ -146,11 +146,11 @@ export class MissionHeroCompComp extends CCComp {
info.ap=hv.ap info.ap=hv.ap
info.hp=hv.hp_max info.hp=hv.hp_max
info.lv=hv.lv info.lv=hv.lv
info.crt=hv.crt info.crit=hv.crit
info.crt_d=hv.crt_d info.crit_d=hv.crit_d
info.dod=hv.dod info.dod=hv.dod
info.dod_no=hv.dod_no info.dod_no=hv.dod_no
info.crt_no=hv.crt_no info.crit_no=hv.crit_no
hero.destroy() hero.destroy()
return info return info

View File

@@ -50,8 +50,8 @@ export class SkillCom extends CCComp {
anim:Animation=null; anim:Animation=null;
tweenInstance:Tween<any> = null; tweenInstance:Tween<any> = null;
t_end_x:number=0; t_end_x:number=0;
caster_crt:number=0; caster_crit:number=0;
caster_crt_d:number=0; caster_crit_d:number=0;
private moveDirection: Vec3 | null = null; // 添加一个属性来存储移动方向 private moveDirection: Vec3 | null = null; // 添加一个属性来存储移动方向
protected onLoad(): void { protected onLoad(): void {
@@ -72,15 +72,15 @@ export class SkillCom extends CCComp {
console.log("[SkillCom]:caster",this.caster) console.log("[SkillCom]:caster",this.caster)
if(this.caster.fac==FacSet.HERO){ if(this.caster.fac==FacSet.HERO){
if(this.caster.is_master){ if(this.caster.is_master){
this.caster_crt = this.caster.crt+this.FIGHTCON.hero_buff.CRITICAL+this.FIGHTCON.hero_debuff.CRITICAL this.caster_crit = this.caster.crit+this.FIGHTCON.hero_buff.CRITICAL+this.FIGHTCON.hero_debuff.CRITICAL
this.caster_crt_d = this.caster.crt_d+this.FIGHTCON.hero_buff.CRITICAL_DMG this.caster_crit_d = this.caster.crit_d+this.FIGHTCON.hero_buff.CRITICAL_DMG
}else{ }else{
this.caster_crt = this.caster.crt+this.FIGHTCON.friend_buff.CRITICAL+this.FIGHTCON.hero_debuff.CRITICAL this.caster_crit = this.caster.crit+this.FIGHTCON.friend_buff.CRITICAL+this.FIGHTCON.hero_debuff.CRITICAL
this.caster_crt_d = this.caster.crt_d+this.FIGHTCON.friend_buff.CRITICAL_DMG this.caster_crit_d = this.caster.crit_d+this.FIGHTCON.friend_buff.CRITICAL_DMG
} }
}else{ }else{
this.caster_crt = this.caster.crt+this.FIGHTCON.enemy_buff.CRITICAL+this.FIGHTCON.enemy_debuff.CRITICAL this.caster_crit = this.caster.crit+this.FIGHTCON.enemy_buff.CRITICAL+this.FIGHTCON.enemy_debuff.CRITICAL
this.caster_crt_d = this.caster.crt_d+this.FIGHTCON.enemy_buff.CRITICAL_DMG this.caster_crit_d = this.caster.crit_d+this.FIGHTCON.enemy_buff.CRITICAL_DMG
} }
let collider = this.getComponent(Collider2D); let collider = this.getComponent(Collider2D);
if(collider) { if(collider) {
@@ -149,17 +149,17 @@ export class SkillCom extends CCComp {
if(view){ if(view){
let dis =Math.abs(this.node.position.x-view.node.position.x) let dis =Math.abs(this.node.position.x-view.node.position.x)
if(dis > SkillSet[this.s_uuid].with) return if(dis > SkillSet[this.s_uuid].with) return
view.do_atked(this.ap,this.caster_crt,this.caster_crt_d) view.do_atked(this.ap,this.caster_crit,this.caster_crit_d)
} }
}); });
} }
//单体伤害 //单体伤害
single_damage(target:HeroViewComp,crt:number=0,crt_d:number=0){ single_damage(target:HeroViewComp,crit:number=0,crit_d:number=0){
this.hit_count++ this.hit_count++
console.log("[SkillCom]:onBeginContact hit_count:",this.hit_count,SkillSet[this.s_uuid].hit) console.log("[SkillCom]:onBeginContact hit_count:",this.hit_count,SkillSet[this.s_uuid].hit)
if(this.hit_count>=SkillSet[this.s_uuid].hit) this.is_destroy=true // 技能命中次数 if(this.hit_count>=SkillSet[this.s_uuid].hit) this.is_destroy=true // 技能命中次数
if(target == null) return; if(target == null) return;
target.do_atked(this.ap,crt,crt_d) target.do_atked(this.ap,crit,crit_d)
if(SkillSet[this.s_uuid].debuff>0){ if(SkillSet[this.s_uuid].debuff>0){
target.add_debuff(SkillSet[this.s_uuid].debuff,SkillSet[this.s_uuid].deV,SkillSet[this.s_uuid].deC) target.add_debuff(SkillSet[this.s_uuid].debuff,SkillSet[this.s_uuid].deV,SkillSet[this.s_uuid].deC)
} }
@@ -170,7 +170,7 @@ export class SkillCom extends CCComp {
let target = oCol.getComponent(HeroViewComp) let target = oCol.getComponent(HeroViewComp)
if(oCol.group!=this.group){ if(oCol.group!=this.group){
if(target == null) return; if(target == null) return;
this.single_damage(target,this.caster_crt,this.caster_crt_d) this.single_damage(target,this.caster_crit,this.caster_crit_d)
// this.ent.destroy() // this.ent.destroy()
} }
} }

View File

@@ -34,8 +34,9 @@
- [x] 广告拿紫色品质, 紫色品质 一定几率出现,出现后 10秒后消失 - [x] 广告拿紫色品质, 紫色品质 一定几率出现,出现后 10秒后消失
- [ ] 装备设定,借助AI,各品质装备 属性相差20% , - [ ] 装备设定,借助AI,各品质装备 属性相差20% ,
- [ ] 添加玩家自主 激活额外boss 按钮,额外boss 有特殊事件 - [ ] 添加玩家自主 激活额外boss 按钮,额外boss 有特殊事件
- [ ] - [ ] 主将信息面板
- [ ] 伙伴信息面板
- [ ] boss信息面板