召唤逻辑改变

This commit is contained in:
2025-06-03 16:34:27 +08:00
parent b66c69d925
commit 899613c689
8 changed files with 943 additions and 804 deletions

View File

@@ -28,7 +28,7 @@ export class MissionHeroCompComp extends CCComp {
}
current_hero_uuid:number=0
onLoad(){
this.on(GameEvent.UseHeroCard,this.show_heros_pos,this)
this.on(GameEvent.UseHeroCard,this.call_hero,this)
}
start() {
// this.test_call()
@@ -86,26 +86,28 @@ export class MissionHeroCompComp extends CCComp {
}
}
call_hero(event: string, args: any){
this.node.getChildByName("location").active=false
console.log("call_hero",args)
let fight_pos=args
this.timer.reset()
let hero_list =HeroList
let x=RandomManager.instance.getRandomInt(0,hero_list.length,1)
// let uuid=args.uuid
// console.log("call_hero",uuid)
this.addHero(this.current_hero_uuid,fight_pos)
// this.node.getChildByName("location").active=false
// console.log("call_hero",args)
// let fight_pos=args
// this.timer.reset()
// let hero_list =HeroList
// let x=RandomManager.instance.getRandomInt(0,hero_list.length,1)
// // let uuid=args.uuid
// // console.log("call_hero",uuid)
this.addHero(args.uuid)
}
/** 添加玩家 */
/** 添加英雄 */
private addHero(uuid:number=1001,fight_pos:number=0) {
console.log("call_hero addHero",uuid)
let info:any=this.get_info_and_remove(fight_pos,uuid)
// let info:any={ap:0,hp:0,lv:0}
let hero = ecs.getEntity<Hero>(Hero);
let scale = 1
let pos:Vec3 = this.start_pos[fight_pos].pos;
console.log("hero load0",pos,this.start_pos)
hero.load(pos,scale,uuid,info,fight_pos);
oops.message.dispatchEvent(GameEvent.HeroSelectEnd)
this.current_hero_uuid=0
}
@@ -125,20 +127,16 @@ export class MissionHeroCompComp extends CCComp {
// let s_hp_up = (HeroUpInfo[uuid] || {}).hp_up || 0 //替换 升级的英雄额外替换血量增长值
// info.ap=Math.floor(hv.ap*(AP_UP_RATE+o_ap_rate+s_ap_rate)/100+o_ap+s_ap)
// info.hp=Math.floor(o_hp_up+s_hp_up)
if(hv.hero_uuid === uuid){
info.ap=hv.ap
info.hp=hv.hp_max
info.lv=hv.lv
}else{
this.do_hero_change()
}
info.ap=hv.ap
info.hp=hv.hp_max
info.lv=hv.lv
hero.destroy()
return info
}
}
return info
}
do_hero_change(){
//金币加1
smc.vmdata.mission_data.gold+=1