装备技能转变 触发+伙伴死亡 被攻击触发

This commit is contained in:
2025-06-18 10:58:18 +08:00
parent fdfa9cbd37
commit be4543b62e
9 changed files with 305 additions and 74 deletions

View File

@@ -79,6 +79,8 @@ export class HeroViewComp extends CCComp {
speek_time:number = 0;
is_stop_temp:boolean = false;i
Friend_alive_cd:Timer=new Timer(10)
double_dead:boolean=false
double_atked:boolean=false
private damageQueue: Array<{
damage: number,
isCrit: boolean,
@@ -142,15 +144,18 @@ export class HeroViewComp extends CCComp {
}
change_atk(e:GameEvent,data:any){
if(!this.is_master) return
if(data.ice){
this.atk_skill=6001
this.atk_skill=6014
}else if(data.fire){
this.atk_skill=6002
this.atk_skill=6012
}else if(data.wind){
this.atk_skill=6003
this.atk_skill=6016
}else{
this.atk_skill=6001
}
console.log("[HeroViewComp]:change_atk",SkillSet[this.atk_skill].name)
}
get isActive() {
@@ -258,20 +263,8 @@ export class HeroViewComp extends CCComp {
if(this.atk_count< FightSet.ATK_ADD_FRIEND_COUNT) return
if(this.FIGHTCON.atk_add_glod >0) smc.vmdata.mission_data.gold+=this.FIGHTCON.atk_add_glod
this.do_friend_atk_add()
this.do_master_atk_add()
this.atk_count=0
}
friend_count_atk_count(){ //伙伴攻击次数 有装备加成,需要单独处理
if(this.is_master) return
if(this.atk_add_count==0) return
this.atk_count+=1
if(this.atk_count < this.atk_add_count) return
}
do_friend_atk_add(){
let friends=ecs.query(ecs.allOf(FriendModelComp))
friends.forEach(friend=>{
let friend_view=friend.get(HeroViewComp)
if(this.FIGHTCON.atk_add_friend_atk>0) {
@@ -281,8 +274,7 @@ export class HeroViewComp extends CCComp {
friend_view.add_hp_max(this.FIGHTCON.atk_add_friend_hp)
}
})
}
do_master_atk_add(){
let master=ecs.query(ecs.allOf(MasterModelComp))
master.forEach(master=>{
let master_view=master.get(HeroViewComp)
@@ -293,7 +285,18 @@ export class HeroViewComp extends CCComp {
master_view.add_hp_max(this.FIGHTCON.atk_add_master_hp)
}
})
this.atk_count=0
}
friend_count_atk_count(){ //伙伴攻击次数 有装备加成,需要单独处理
if(this.is_master) return
if(this.atk_add_count==0) return
this.atk_count+=1
if(this.atk_count < this.atk_add_count) return
}
do_change(){
this.BUFFCOMP.update_info_ap()
this.BUFFCOMP.update_info_hp()
@@ -308,6 +311,7 @@ export class HeroViewComp extends CCComp {
do_dead(){
this.do_dead_trigger()
this.Friend_alive_cd=new Timer(this.FIGHTCON.friend_alive_cd)
console.log("[HeroViewComp]:角色死亡",this.hero_uuid)
if(this.is_master){
@@ -315,7 +319,9 @@ export class HeroViewComp extends CCComp {
oops.message.dispatchEvent(GameEvent.FightEnd,{victory:false})
}
}
do_atked(remainingDamage:number){
this.do_atked_trigger()
if (this.shield > 0) {
this.shield -= 1
this.BUFFCOMP.tooltip(5,"*吸收*");
@@ -334,7 +340,6 @@ export class HeroViewComp extends CCComp {
this.do_dead()
console.log("[HeroViewComp]:dead,fac => "+(this.fac==FacSet.HERO?"hero":"monster"))
if(this.ent == null) return;
if(this.fac ==FacSet.HERO){
this.to_grave()
}else{
@@ -345,11 +350,32 @@ export class HeroViewComp extends CCComp {
this.showDamage(remainingDamage, true);
}
}
dead(){
this.BUFFCOMP.dead()
this.to_drop()
// dead(){
// this.BUFFCOMP.dead()
// this.to_drop()
// }
do_dead_trigger(){
if(this.is_dead||this.fac==FacSet.MON||this.is_master) return
let count = 1
if(this.double_dead) {
console.log("[HeroViewComp]:double_dead")
count =2
}
for(let i=0;i<count;i++){
console.log("[HeroViewComp]:dead"+i+"次")
}
}
do_atked_trigger(){
if(this.is_dead||this.fac==FacSet.MON||this.is_master) return
let count = 1
if(this.double_atked) {
console.log("[HeroViewComp]:double_atked")
count =2
}
}
to_grave(){
tween(this.node).to(0.5, { position:v3(-900,this.node.position.y+300,0)},{
onComplete: (target?: object) => {