继续
This commit is contained in:
@@ -277,10 +277,10 @@ export class HeroViewComp extends CCComp {
|
||||
get_hero_pos(hero:any){
|
||||
let pos =this.skill_pos()
|
||||
let t_pos:Vec3 = v3(720,0)
|
||||
if(!hero.HeroView.node.isValid){
|
||||
if(!hero.node.isValid){
|
||||
return
|
||||
}else{
|
||||
t_pos = v3(hero.HeroView.node.position.x-this.node.position.x,hero.HeroView.node.position.y-(this.node.position.y+pos.y))
|
||||
t_pos = v3(hero.node.position.x-this.node.position.x,hero.node.position.y-(this.node.position.y+pos.y))
|
||||
}
|
||||
|
||||
return {pos,t_pos}
|
||||
@@ -304,32 +304,40 @@ export class HeroViewComp extends CCComp {
|
||||
skill.load(pos,BoxSet.HERO,this.node,this.max_skill_uuid,atk,t_pos);
|
||||
if(smc.skills[s_uuid].hp > 0){ //buff加血
|
||||
let increase_hp=Math.floor(smc.skills[s_uuid].hp*this.atk*this.s_boncus*smc.vm_data.mission.hero.atk)
|
||||
hero.HeroView.add_hp(increase_hp)
|
||||
hero.add_hp(increase_hp)
|
||||
}
|
||||
if(smc.skills[s_uuid].atk > 0){ //buff加攻击
|
||||
let increase_atk=Math.floor(smc.skills[s_uuid].atk*this.atk*this.s_boncus*smc.vm_data.mission.hero.atk)
|
||||
hero.HeroView.add_atk(increase_atk,smc.skills[s_uuid].bsd*this.st_boncus)
|
||||
hero.add_atk(increase_atk,smc.skills[s_uuid].bsd*this.st_boncus)
|
||||
}
|
||||
if(smc.skills[s_uuid].shield > 0){ //buff护盾
|
||||
let increase_shield=Math.floor(smc.skills[s_uuid].shield*this.atk*this.s_boncus*smc.vm_data.mission.hero.atk)
|
||||
hero.HeroView.add_shield(increase_shield,smc.skills[s_uuid].bsd*this.st_boncus)
|
||||
hero.add_shield(increase_shield,smc.skills[s_uuid].bsd*this.st_boncus)
|
||||
}
|
||||
}
|
||||
|
||||
push_least_buff(skill:number){
|
||||
let heros:any = ecs.query(ecs.allOf(HeroModelComp));
|
||||
let least_hp:number=0
|
||||
let t_hero:any= null
|
||||
if (heros.length > 0) {
|
||||
if(smc.skills[skill].type==92){ //随机添加buff
|
||||
|
||||
let i = RandomManager.instance.getRandomInt(0,heros.length-1,3)
|
||||
this.to_add_buff(heros[i],skill)
|
||||
while(!heros[i].HeroView){
|
||||
i = RandomManager.instance.getRandomInt(0,heros.length-1,3)
|
||||
if(heros[i].HeroView){
|
||||
break
|
||||
}
|
||||
}
|
||||
this.to_add_buff(heros[i].HeroView,skill)
|
||||
}else{
|
||||
for (let i = 0; i < heros.length; i++) {
|
||||
let hero = heros[i];
|
||||
if(!hero.HeroView) continue
|
||||
if(!heros[i].HeroView) continue
|
||||
let hero = heros[i].HeroView;
|
||||
if(smc.skills[skill].type==91){ //血量最少单体
|
||||
if((hero.HeroView.hp_max-hero.HeroView.hp) > least_hp){
|
||||
least_hp = (hero.HeroView.hp_max-hero.HeroView.hp)
|
||||
if((hero.hp_max-hero.hp) > least_hp){
|
||||
least_hp = (hero.hp_max-hero.hp)
|
||||
t_hero = hero
|
||||
}
|
||||
}else{ //群体
|
||||
@@ -338,6 +346,11 @@ export class HeroViewComp extends CCComp {
|
||||
|
||||
}
|
||||
if(t_hero){ //血量最少单体
|
||||
let role_hp=smc.Role.RoleView.hp_max-smc.Role.RoleView.hp
|
||||
if(role_hp > least_hp){
|
||||
least_hp = role_hp
|
||||
t_hero = smc.Role.RoleView
|
||||
}
|
||||
this.to_add_buff(t_hero,skill)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user