++护盾技能
This commit is contained in:
@@ -195,6 +195,7 @@ export class HeroViewComp extends CCComp {
|
||||
|
||||
add_shield(shield:number){
|
||||
this.shield =shield
|
||||
if(this.shield>6) this.shield=6
|
||||
if(this.shield>0) this.BUFFCOMP.show_shield(true)
|
||||
}
|
||||
// add_cd(cd: number){
|
||||
@@ -255,19 +256,30 @@ export class HeroViewComp extends CCComp {
|
||||
|
||||
add_hp(hp: number = 0,is_num:boolean=true) {
|
||||
this.BUFFCOMP.heathed();
|
||||
let real_hp=0
|
||||
let hp_max=Math.floor(this.hp_max*(100+this.buff_hp)/100)
|
||||
let lost_hp=hp_max-this.hp
|
||||
if(is_num){
|
||||
this.hp+=Math.floor(hp);
|
||||
if(lost_hp > hp){
|
||||
real_hp=Math.floor(hp);
|
||||
}else{
|
||||
real_hp=lost_hp;
|
||||
}
|
||||
}else{
|
||||
this.hp+=Math.floor(hp/100*this.hp_max);
|
||||
if(lost_hp > hp/100*hp_max){
|
||||
real_hp=Math.floor(hp/100*hp_max);
|
||||
}else{
|
||||
real_hp=lost_hp;
|
||||
}
|
||||
}
|
||||
if(this.hp > this.hp_max){
|
||||
this.hp = this.hp_max;
|
||||
if(real_hp > 0){
|
||||
this.hp+=real_hp;
|
||||
this.BUFFCOMP.tooltip(TooltipTypes.health,real_hp.toFixed(0));
|
||||
}
|
||||
this.BUFFCOMP.tooltip(TooltipTypes.health,hp.toFixed(0));
|
||||
this.BUFFCOMP.vmdata_update(true)
|
||||
}
|
||||
|
||||
|
||||
|
||||
/** 静止时间 */
|
||||
in_stop (dt: number) {
|
||||
if(this.stop_cd > 0){
|
||||
|
||||
@@ -87,7 +87,7 @@ export class SkillConComp extends CCComp {
|
||||
target = this.node.position
|
||||
break
|
||||
case TGroup.Team: //所有友方
|
||||
|
||||
target = this.selectTeamFront()
|
||||
break
|
||||
case TGroup.All: //所有单位
|
||||
|
||||
@@ -164,7 +164,22 @@ export class SkillConComp extends CCComp {
|
||||
pos=v3(this.get_front(entities),0)
|
||||
return pos
|
||||
}
|
||||
|
||||
private selectTeamFront(){
|
||||
let pos=this.node.position
|
||||
let entities=null
|
||||
if(this.HeroView.fac==FacSet.HERO){
|
||||
entities=ecs.query(ecs.allOf(HeroModelComp))
|
||||
}else{
|
||||
entities=ecs.query(ecs.allOf(MonModelComp))
|
||||
}
|
||||
if(entities.length==0){
|
||||
return pos
|
||||
}
|
||||
let keyPos = this.HeroView.fac==FacSet.HERO ?
|
||||
Math.max(...entities.map(e => e.get(HeroViewComp).node.position.x)) :
|
||||
Math.min(...entities.map(e => e.get(HeroViewComp).node.position.x));
|
||||
return v3(keyPos,20)
|
||||
}
|
||||
private selectAllyTargets( ): Vec3 {
|
||||
// 敌方最前排是x坐标最大的+50,我方最前排是x坐标最小的+50,若目标不存在,敌人 取320/2,我方取-320/2
|
||||
let kp=0
|
||||
|
||||
Reference in New Issue
Block a user