改了 好多
This commit is contained in:
@@ -10,6 +10,7 @@ import { HeroViewComp } from "../hero/HeroViewComp";
|
||||
import { oops } from "db://oops-framework/core/Oops";
|
||||
import { HeroPos } from "../common/config/heroSet";
|
||||
import { FightSet } from "../common/config/Mission";
|
||||
import { FriendModelComp } from "../hero/FriendModel";
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
/** 视图层对象 */
|
||||
@@ -21,7 +22,7 @@ export class MissionHeroCompComp extends CCComp {
|
||||
Friend_is_dead:boolean=false
|
||||
current_hero_uuid:number=0
|
||||
onLoad(){
|
||||
this.on(GameEvent.UseHeroCard,this.call_friend,this)
|
||||
this.on(GameEvent.UseHeroCard,this.call_hero,this)
|
||||
this.on(GameEvent.ChangeATK_EQUIP_SPECIAL_ATTR,this.change_equip_qpecial_attr,this)
|
||||
this.on(GameEvent.FightReady,this.fight_ready,this)
|
||||
|
||||
@@ -113,21 +114,20 @@ 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(args.uuid)
|
||||
// }
|
||||
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(args.uuid)
|
||||
}
|
||||
|
||||
/** 添加英雄 */
|
||||
private addHero(uuid:number=1001,freind_pos:number=0) {
|
||||
console.log("call_hero addHero",uuid)
|
||||
private addHero(uuid:number=1001,freind_pos:number=1) {
|
||||
let info:any=this.get_info_and_remove(freind_pos,uuid)
|
||||
// let info:any={ap:0,hp:0,lv:0}
|
||||
let hero = ecs.getEntity<Hero>(Hero);
|
||||
@@ -138,27 +138,22 @@ export class MissionHeroCompComp extends CCComp {
|
||||
}
|
||||
|
||||
get_info_and_remove(fight_pos:number,uuid:number){
|
||||
let info:any={ap:0,hp:0,lv:0}
|
||||
let heros=ecs.query(ecs.allOf(HeroModelComp))
|
||||
for(let hero of heros){
|
||||
let info:any={ap:0,hp:0,lv:1,crt:0,crt_d:0,dod:0,dod_no:false,crt_no:false}
|
||||
let heros=ecs.query(ecs.allOf(FriendModelComp))
|
||||
if(heros.length>0){
|
||||
let hero = heros[0]
|
||||
let hv = hero.get(HeroViewComp)
|
||||
if(hv.fight_pos==fight_pos&&!hv.is_master){
|
||||
// let AP_UP_RATE = hv.hero_uuid === uuid ? FightSet.AP_UPDATE_RATE : FightSet.AP_CHANGE_RATE;
|
||||
// let heroUpData = HeroUpInfo[hv.hero_uuid] || {}
|
||||
// let o_ap_rate = heroUpData.ap_up_rate || 0 //被替换 升级的英雄额外被替换攻击增长比率
|
||||
// let o_ap = heroUpData.ap_up || 0 //被替换 升级的英雄额外被替换攻击增长值
|
||||
// let s_ap_rate = (HeroUpInfo[uuid] || {}).ap_up_rate || 0 //替换 升级的英雄额外替换攻击增长比率
|
||||
// let s_ap = (HeroUpInfo[uuid] || {}).ap_up || 0 //替换 升级的英雄额外替换攻击增长值
|
||||
// let o_hp_up = heroUpData.hp_up || 0 //被替换 升级的英雄额外被替换血量增长值
|
||||
// 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)
|
||||
info.ap=hv.ap
|
||||
info.hp=hv.hp_max
|
||||
info.lv=hv.lv
|
||||
hero.destroy()
|
||||
return info
|
||||
}
|
||||
info.ap=hv.ap
|
||||
info.hp=hv.hp_max
|
||||
info.lv=hv.lv
|
||||
info.crt=hv.crt
|
||||
info.crt_d=hv.crt_d
|
||||
info.dod=hv.dod
|
||||
info.dod_no=hv.dod_no
|
||||
info.crt_no=hv.crt_no
|
||||
hero.destroy()
|
||||
return info
|
||||
|
||||
}
|
||||
return info
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user