技能系统 初步搭建,下步 伤害系统
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { Vec3, _decorator , v3,Collider2D,Contact2DType,Label,RigidBody2D ,Node,Prefab,instantiate,ProgressBar, Component, Material, Sprite, math, clamp, Game, tween} from "cc";
|
||||
import { Vec3, _decorator , v3,Collider2D,Contact2DType,Label ,Node,Prefab,instantiate,ProgressBar, Component, Material, Sprite, math, clamp, Game, tween} from "cc";
|
||||
import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
|
||||
import { CCComp } from "../../../../extensions/oops-plugin-framework/assets/module/common/CCComp";
|
||||
import { HeroSpine } from "./HeroSpine";
|
||||
@@ -7,15 +7,16 @@ import { BoxSet, GameSet } from "../common/config/BoxSet";
|
||||
import { smc } from "../common/SingletonModuleComp";
|
||||
import { Skill } from "../skills/Skill";
|
||||
import { Timer } from "../../../../extensions/oops-plugin-framework/assets/core/common/timer/Timer";
|
||||
import { SkillCom } from "../skills/SkillCom";
|
||||
import { SkillSet, SkTG, SkType } from "../common/config/SkillSet";
|
||||
import { SkillSet, TargetGroup, TargetType } from "../common/config/SkillSet";
|
||||
import { RandomManager } from "../../../../extensions/oops-plugin-framework/assets/core/common/random/RandomManager";
|
||||
import { HeroSet } from "../common/config/heroSet";
|
||||
import { BuffComp } from "./BuffComp";
|
||||
import { MonModelComp } from "./MonModelComp";
|
||||
import { getMonsterDrops, MonsterType } from "../common/config/RewardSet";
|
||||
import { HeroSkillsComp } from "../skill/heroSkillsComp";
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
|
||||
/** 角色显示组件 */
|
||||
@ccclass('HeroViewComp') // 定义为 Cocos Creator 组件
|
||||
@ecs.register('HeroView', false) // 定义为 ECS 组件
|
||||
@@ -49,11 +50,10 @@ export class HeroViewComp extends CCComp {
|
||||
|
||||
hp: number = 100; /** 血量 */
|
||||
hp_max: number = 100; /** 最大血量 */
|
||||
rhp_max: number = 100;
|
||||
hp_speed: number = 0; //每秒回复量
|
||||
|
||||
pw: number = 0; /**能量**/
|
||||
pwm: number = 15; /** 能量最大值 */
|
||||
pw: number = 0; // 当前能量值
|
||||
pwm: number = 100; // 最大能量值
|
||||
pws: number = 1; //能量回复速度每0.1秒回复量
|
||||
apw:number=0;
|
||||
uapw:number=0;
|
||||
@@ -78,7 +78,6 @@ export class HeroViewComp extends CCComp {
|
||||
dexp:number=0; //死亡经验 */
|
||||
|
||||
ap: number = 10; /**攻击力 */
|
||||
ap_max: number = 0;
|
||||
ap_buff: number = 0;
|
||||
ap_buffs:any = [];
|
||||
// atk_speed: number = 1;
|
||||
@@ -87,14 +86,11 @@ export class HeroViewComp extends CCComp {
|
||||
at: number = 0; /** 冷却时间 */
|
||||
|
||||
def: number = 0; //防御
|
||||
def_max: number = 0;
|
||||
vun: number = 0; //易伤
|
||||
|
||||
crit: number = 0; //暴击率
|
||||
crit_max: number = 0;
|
||||
crit_add: number = 0;//暴击伤害加成
|
||||
dodge: number = 10; //闪避率
|
||||
dodge_max: number = 10; //闪避率
|
||||
|
||||
|
||||
shield:number = 0; //护盾,免伤1次减1
|
||||
@@ -139,9 +135,7 @@ export class HeroViewComp extends CCComp {
|
||||
if (this.pwt.update(dt)) {
|
||||
this.pw+=this.pws
|
||||
}
|
||||
this.check_power()
|
||||
this.check_atk_counts()
|
||||
this.check_mission_buff()
|
||||
this.hp_show()
|
||||
if(this.ice_cd > 0){
|
||||
this.ice_cd -=dt;
|
||||
@@ -153,34 +147,21 @@ export class HeroViewComp extends CCComp {
|
||||
}
|
||||
this.at += dt;
|
||||
this.in_stop(dt);
|
||||
this.in_atk(dt);
|
||||
|
||||
}
|
||||
|
||||
hp_show(){
|
||||
let hp_progress= this.hp/this.rhp_max;
|
||||
let hp_progress= this.hp/this.hp_max;
|
||||
this.node.getChildByName("top").getChildByName("hp").getComponent(ProgressBar)!.progress = hp_progress;
|
||||
if(this.is_boss) return
|
||||
if(this.hp == this.rhp_max){
|
||||
if(this.hp == this.hp_max){
|
||||
this.node.getChildByName("top").getChildByName("hp").active = false;
|
||||
} else{
|
||||
this.node.getChildByName("top").getChildByName("hp").active = true;
|
||||
}
|
||||
}
|
||||
//移动
|
||||
check_mission_buff(){
|
||||
this.ap_max=(100+smc.vmdata.mission.ap)/100*this.ap
|
||||
this.crit_max=(100+smc.vmdata.mission.crit)/100*this.crit
|
||||
this.def_max=(100+smc.vmdata.mission.def)/100*this.def
|
||||
this.dodge_max=(100+smc.vmdata.mission.dodge)/100*this.dodge
|
||||
this.rhp_max=(100+smc.vmdata.mission.hp)/100*this.hp_max
|
||||
if(this.box_group == BoxSet.MONSTER){
|
||||
this.ap_max=(100+smc.vmdata.mission.map)/100*this.ap
|
||||
this.crit_max=(100+smc.vmdata.mission.mcrit)/100*this.crit
|
||||
this.def_max=(100+smc.vmdata.mission.mdef)/100*this.def
|
||||
this.dodge_max=(100+smc.vmdata.mission.mdodge)/100*this.dodge
|
||||
this.rhp_max=(100+smc.vmdata.mission.mhp)/100*this.hp_max
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//状态切换
|
||||
status_change(type:string){
|
||||
@@ -210,7 +191,7 @@ export class HeroViewComp extends CCComp {
|
||||
this.hp_less(l_hp,skill.is_crit);
|
||||
}
|
||||
check_less(ap:number,is_crit:boolean,crit_add:number=0){
|
||||
let d=this.def_max/ap
|
||||
let d=this.def/ap
|
||||
if(d > 1) d = 1
|
||||
let l_hp=ap*(1-d*GameSet.DEF_RATE) //防御最高减免伤害比率计算
|
||||
if(is_crit){
|
||||
@@ -228,50 +209,50 @@ export class HeroViewComp extends CCComp {
|
||||
* @param l_hp - 可选参数,表示英雄的当前生命值,默认为0
|
||||
*/
|
||||
check_debuff(skill:any,l_hp:number=0){
|
||||
// console.log(this.hero_name+this.uuid+": skillname: "+skill.s_name+" :check_debuff "+skill.debuff);
|
||||
if(skill.debuff == 0) return
|
||||
let num=RandomManager.instance.getRandomInt(0,100)
|
||||
switch (skill.debuff){
|
||||
case 1:
|
||||
// console.log(this.hero_name+":"+this.uuid+"冰冻触判断: i="+num+":rate="+skill.rate);
|
||||
if(num > skill.depb) return
|
||||
// console.log(this.hero_name+":"+this.uuid+"冰冻触成功: i="+num+":debtime="+skill.debtime);
|
||||
this.ice_cd = skill.debtime
|
||||
this.BUFFCOMP.in_iced(skill.debtime)
|
||||
break;
|
||||
case 2:
|
||||
if(num > skill.depb) return
|
||||
// console.log(this.hero_name+":"+this.uuid+"debuff触发成功: i="+num+":debtime="+skill.debtime+":l_hp="+l_hp);
|
||||
this.BUFFCOMP.in_fired(skill.debtime,l_hp*skill.derate/100)
|
||||
break;
|
||||
case 3:
|
||||
if(num > skill.depb) return
|
||||
this.yun_cd = skill.debtime
|
||||
this.BUFFCOMP.in_yun(skill.debtime)
|
||||
break;
|
||||
case 4:
|
||||
if(num > skill.depb) return
|
||||
this.BUFFCOMP.buff_get("deap")
|
||||
this.ap = this.ap-Math.floor(l_hp*skill.derate/100)
|
||||
break;
|
||||
case 5:
|
||||
if(num > skill.depb) return
|
||||
break;
|
||||
case 6:
|
||||
if(num > skill.depb) return
|
||||
break;
|
||||
case 7:
|
||||
if(num > skill.depb) return
|
||||
break;
|
||||
case 8:
|
||||
if(num > skill.depb) return
|
||||
if(this.node.position.x > 300||this.node.position.x < -300) return
|
||||
tween(this.node).to( 0.1,
|
||||
{ position: new Vec3(this.node.position.x-this.scale*50,this.node.position.y) },
|
||||
{ }
|
||||
).start();
|
||||
break;
|
||||
}
|
||||
// // console.log(this.hero_name+this.uuid+": skillname: "+skill.s_name+" :check_debuff "+skill.debuff);
|
||||
// if(skill.debuff == 0) return
|
||||
// let num=RandomManager.instance.getRandomInt(0,100)
|
||||
// switch (skill.debuff){
|
||||
// case 1:
|
||||
// // console.log(this.hero_name+":"+this.uuid+"冰冻触判断: i="+num+":rate="+skill.rate);
|
||||
// if(num > skill.depb) return
|
||||
// // console.log(this.hero_name+":"+this.uuid+"冰冻触成功: i="+num+":debtime="+skill.debtime);
|
||||
// this.ice_cd = skill.debtime
|
||||
// this.BUFFCOMP.in_iced(skill.debtime)
|
||||
// break;
|
||||
// case 2:
|
||||
// if(num > skill.depb) return
|
||||
// // console.log(this.hero_name+":"+this.uuid+"debuff触发成功: i="+num+":debtime="+skill.debtime+":l_hp="+l_hp);
|
||||
// this.BUFFCOMP.in_fired(skill.debtime,l_hp*skill.derate/100)
|
||||
// break;
|
||||
// case 3:
|
||||
// if(num > skill.depb) return
|
||||
// this.yun_cd = skill.debtime
|
||||
// this.BUFFCOMP.in_yun(skill.debtime)
|
||||
// break;
|
||||
// case 4:
|
||||
// if(num > skill.depb) return
|
||||
// this.BUFFCOMP.buff_get("deap")
|
||||
// this.ap = this.ap-Math.floor(l_hp*skill.derate/100)
|
||||
// break;
|
||||
// case 5:
|
||||
// if(num > skill.depb) return
|
||||
// break;
|
||||
// case 6:
|
||||
// if(num > skill.depb) return
|
||||
// break;
|
||||
// case 7:
|
||||
// if(num > skill.depb) return
|
||||
// break;
|
||||
// case 8:
|
||||
// if(num > skill.depb) return
|
||||
// if(this.node.position.x > 300||this.node.position.x < -300) return
|
||||
// tween(this.node).to( 0.1,
|
||||
// { position: new Vec3(this.node.position.x-this.scale*50,this.node.position.y) },
|
||||
// { }
|
||||
// ).start();
|
||||
// break;
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
@@ -280,14 +261,14 @@ export class HeroViewComp extends CCComp {
|
||||
/**
|
||||
* 检查是否触发暴击,并执行相应的暴击效果。
|
||||
* @returns {boolean} 如果触发暴击则返回 true,否则返回 false。
|
||||
* 该方法首先通过 RandomManager 获取一个随机数,如果该随机数小于当前暴击最大值(crit_max),
|
||||
* 该方法首先通过 RandomManager 获取一个随机数,如果该随机数小于当前暴击最大值(crit),
|
||||
* 则触发暴击效果,包括显示暴击提示、增加暴击计数、增加暴击经验以及增加暴击威力。
|
||||
* 如果未触发暴击,则直接返回 false。
|
||||
*/
|
||||
check_crit():boolean
|
||||
{
|
||||
let i = RandomManager.instance.getRandomInt(0,100,3)
|
||||
if(i < this.crit_max){
|
||||
if(i < this.crit){
|
||||
// this.BUFFCOMP.tooltip(5,"*会心一击*");
|
||||
this.crit_count += 1
|
||||
this.exp_add(this.cexp) // 暴击经验
|
||||
@@ -306,8 +287,8 @@ export class HeroViewComp extends CCComp {
|
||||
check_dodge():boolean
|
||||
{
|
||||
let i = RandomManager.instance.getRandomInt(0,100,3)
|
||||
if(this.dodge_max > GameSet.DODGE_MAX) this.dodge_max = GameSet.DODGE_MAX
|
||||
if(i < this.dodge_max){
|
||||
if(this.dodge > GameSet.DODGE_MAX) this.dodge = GameSet.DODGE_MAX
|
||||
if(i < this.dodge){
|
||||
// console.log("闪避触发: i="+i+":dodge="+dodge);
|
||||
this.BUFFCOMP.tooltip(5,"闪避");
|
||||
this.exp_add(this.doexp) // 闪避经验
|
||||
@@ -370,28 +351,7 @@ export class HeroViewComp extends CCComp {
|
||||
// }
|
||||
// }
|
||||
}
|
||||
in_atk(dt: number) {
|
||||
if(this.at >= this.cd){
|
||||
if(this.is_atking){
|
||||
this.at = 0;
|
||||
this.atk_count++
|
||||
this.exp_add(this.aexp) //攻击经验
|
||||
this.power_add(this.apw)
|
||||
// console.log("cd:"+this.cd);
|
||||
this.as.atk();
|
||||
}
|
||||
}
|
||||
}
|
||||
//能量判断
|
||||
check_power(){
|
||||
if(this.pw >= this.pwm){
|
||||
this.pw = 0
|
||||
this.BUFFCOMP.max_show()
|
||||
return true
|
||||
}else{
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
//使用max_skill
|
||||
do_skill(skill:number){
|
||||
// this.at = 0; //共享普攻攻击cd
|
||||
@@ -402,194 +362,12 @@ export class HeroViewComp extends CCComp {
|
||||
this.BUFFCOMP.show_do_buff(SkillSet[skill].fname)
|
||||
},0.1)
|
||||
}
|
||||
switch (SkillSet[skill].tg) {
|
||||
case SkTG.self: //自己
|
||||
this.do_add_buff(this.node.getComponent(HeroViewComp),skill)
|
||||
break;
|
||||
case SkTG.friend: //伙伴
|
||||
if(this.box_group == BoxSet.HERO) this.check_other_hero_buff(skill)
|
||||
if(this.box_group == BoxSet.MONSTER) this.check_other_mon_buff(skill)
|
||||
break;
|
||||
case SkTG.team: //自己和伙伴
|
||||
this.do_all_buff(skill)
|
||||
break;
|
||||
case SkTG.enemy: //敌人
|
||||
this.shoot_enemy(skill)
|
||||
break;
|
||||
case SkTG.all: //敌人和自己
|
||||
this.do_add_buff(this.node.getComponent(HeroViewComp),skill)
|
||||
this.shoot_enemy(skill)
|
||||
break;
|
||||
}
|
||||
}
|
||||
shoot_enemy(sk:number,y:number=0,x:number=0){
|
||||
// console.log("mon shoot_enemy");
|
||||
let skill = ecs.getEntity<Skill>(Skill);
|
||||
let t_pos=v3(smc.mon_front_x,BoxSet.GAME_LINE) //最前排目标
|
||||
if(this.box_group==BoxSet.MONSTER){
|
||||
t_pos=v3(smc.hero_front_x,BoxSet.GAME_LINE)
|
||||
}
|
||||
switch(SkillSet[sk].type){
|
||||
case SkType.leastHealth: //血量最少单体
|
||||
t_pos=this.check_heros().l_hero.node.position
|
||||
if(this.box_group==BoxSet.MONSTER) t_pos=this.check_mons().l_hero.node.position
|
||||
break;
|
||||
case SkType.highestHealth: //血量最多单体
|
||||
t_pos=this.check_heros().m_hero.node.position
|
||||
if(this.box_group==BoxSet.MONSTER) t_pos=this.check_mons().m_hero.node.position
|
||||
break;
|
||||
case SkType.backRow: //最后排
|
||||
t_pos=v3(smc.mon_back_x,BoxSet.GAME_LINE)
|
||||
if(this.box_group==BoxSet.MONSTER){
|
||||
t_pos=v3(smc.hero_back_x,BoxSet.GAME_LINE)
|
||||
}
|
||||
break;
|
||||
}
|
||||
let pos =this.node.position
|
||||
let is_crit=this.check_crit()
|
||||
this.to_console(this.scale+this.hero_name+"使用技能:"+sk+SkillSet[sk].name+" pos:"+pos+" t_pos:"+t_pos+" box:"+this.box_group,);
|
||||
skill.load(pos,this.box_group,this.node,sk,this.ap_max,t_pos,is_crit,this.crit_add,this.rhp_max);
|
||||
|
||||
}
|
||||
check_heros(){
|
||||
let heros:any = ecs.query(ecs.allOf(HeroModelComp));
|
||||
let l_hp:number=0
|
||||
let h_hp:number=9999999999
|
||||
let right_x:number=360
|
||||
let left_x:number=-360
|
||||
let f_hero:any= null
|
||||
let b_hero:any= null
|
||||
let l_hero:any= null
|
||||
let m_hero:any= null
|
||||
let r_hero:any= null
|
||||
let i = RandomManager.instance.getRandomInt(0,heros.length-1,3)
|
||||
while(!heros[i].HeroView){
|
||||
i = RandomManager.instance.getRandomInt(0,heros.length-1,3)
|
||||
if(!heros[i].HeroView.in_grave){
|
||||
r_hero= heros[i].HeroView
|
||||
break
|
||||
}
|
||||
}
|
||||
for (let i = 0; i < heros.length; i++) {
|
||||
let hero:any = heros[i].HeroView;
|
||||
if (hero.in_grave) continue
|
||||
if((hero.rhp_max-hero.hp) > l_hp){
|
||||
l_hp = (hero.rhp_max-hero.hp)
|
||||
l_hero = hero
|
||||
}
|
||||
if((hero.rhp_max-hero.hp) < h_hp){
|
||||
h_hp = (hero.rhp_max-hero.hp)
|
||||
m_hero = hero
|
||||
}
|
||||
if(hero.node.position.x > left_x){
|
||||
left_x = hero.node.position.x
|
||||
f_hero = hero
|
||||
}
|
||||
if(hero.node.position.x < right_x){
|
||||
right_x = hero.node.position.x
|
||||
b_hero = hero
|
||||
}
|
||||
}
|
||||
return {l_hero,m_hero,f_hero,b_hero,r_hero}
|
||||
}
|
||||
check_mons(){
|
||||
let heros:any=ecs.query(ecs.allOf(MonModelComp))
|
||||
let l_hp:number=0
|
||||
let h_hp:number=9999999999
|
||||
let right_x:number=360
|
||||
let left_x:number=-360
|
||||
let f_hero:any= null
|
||||
let b_hero:any= null
|
||||
let l_hero:any= null
|
||||
let m_hero:any= null
|
||||
let r_hero:any= null
|
||||
let i = RandomManager.instance.getRandomInt(0,heros.length-1,3)
|
||||
while(!heros[i].HeroView){
|
||||
i = RandomManager.instance.getRandomInt(0,heros.length-1,3)
|
||||
if(!heros[i].HeroView.in_grave){
|
||||
r_hero= heros[i].HeroView
|
||||
break
|
||||
}
|
||||
}
|
||||
for (let i = 0; i < heros.length; i++) {
|
||||
let hero:any = heros[i].HeroView;
|
||||
if (hero.in_grave) continue
|
||||
if((hero.rhp_max-hero.hp) > l_hp){
|
||||
l_hp = (hero.rhp_max-hero.hp)
|
||||
l_hero = hero
|
||||
}
|
||||
if((hero.rhp_max-hero.hp) < h_hp){
|
||||
h_hp = (hero.rhp_max-hero.hp)
|
||||
m_hero = hero
|
||||
}
|
||||
if(hero.node.position.x < right_x){
|
||||
right_x = hero.node.position.x
|
||||
f_hero = hero
|
||||
}
|
||||
if(hero.node.position.x > left_x){
|
||||
left_x = hero.node.position.x
|
||||
b_hero = hero
|
||||
}
|
||||
}
|
||||
return {l_hero,m_hero,f_hero,b_hero,r_hero}
|
||||
}
|
||||
check_other_hero_buff(skill:number){
|
||||
switch(SkillSet[skill].type){
|
||||
case SkType.random:
|
||||
this.do_add_buff(this.check_heros().r_hero,skill)
|
||||
break;
|
||||
case SkType.leastHealth: //血量最少单体
|
||||
this.do_add_buff(this.check_heros().l_hero,skill)
|
||||
break;
|
||||
case SkType.highestHealth: //血量最多单体
|
||||
this.do_add_buff(this.check_heros().m_hero,skill)
|
||||
break;
|
||||
case SkType.frontRow: //最前排
|
||||
this.do_add_buff(this.check_heros().f_hero,skill)
|
||||
break;
|
||||
case SkType.backRow: //最后排
|
||||
this.do_add_buff(this.check_heros().b_hero,skill)
|
||||
break;
|
||||
}
|
||||
}
|
||||
check_other_mon_buff(skill:number){
|
||||
switch(SkillSet[skill].type){
|
||||
case SkType.random:
|
||||
this.do_add_buff(this.check_mons().r_hero,skill)
|
||||
break;
|
||||
case SkType.leastHealth: //血量最少单体
|
||||
this.do_add_buff(this.check_mons().l_hero,skill)
|
||||
break;
|
||||
case SkType.highestHealth: //血量最多单体
|
||||
this.do_add_buff(this.check_mons().m_hero,skill)
|
||||
break;
|
||||
case SkType.frontRow: //最前排
|
||||
this.do_add_buff(this.check_mons().f_hero,skill)
|
||||
break;
|
||||
case SkType.backRow: //最后排
|
||||
this.do_add_buff(this.check_mons().b_hero,skill)
|
||||
break;
|
||||
}
|
||||
}
|
||||
do_all_buff(sk:number){
|
||||
let skill = ecs.getEntity<Skill>(Skill);
|
||||
let pos=v3(0,0)
|
||||
let t_pos = pos
|
||||
// this.to_console("to_all_buff:"+sk)
|
||||
let is_crit=this.check_crit()
|
||||
skill.load(pos,this.box_group,this.node,sk,this.ap_max,t_pos,is_crit,this.crit_add,this.rhp_max);
|
||||
// this.to_console("使用buff:"+sk+" t_pos:"+t_pos+" box:"+this.box_group);
|
||||
shoot_enemy(sk:number,y:number=0,x:number=0){
|
||||
// console.log("mon shoot_enemy");
|
||||
}
|
||||
|
||||
do_add_buff(hero:any,sk:number){
|
||||
let skill = ecs.getEntity<Skill>(Skill);
|
||||
let t_pos=hero.node.position
|
||||
let pos = this.node.position
|
||||
// this.to_console("do_add_buff:"+hero.hero_name+" "+sk);
|
||||
let is_crit=this.check_crit()
|
||||
skill.load(pos,this.box_group,this.node,sk,this.ap_max,t_pos,is_crit,this.crit_add,this.rhp_max);
|
||||
// this.to_console(this.scale+this.hero_name+"使用buff:"+sk+SkillSet[sk].name+" t_pos:"+t_pos+" box:"+this.box_group,);
|
||||
}
|
||||
|
||||
exp_add(exp:number=0){
|
||||
if(this.box_group==BoxSet.HERO){
|
||||
@@ -658,18 +436,18 @@ export class HeroViewComp extends CCComp {
|
||||
}
|
||||
add_hp_max(hprate: number=0){
|
||||
this.BUFFCOMP.buff_get("hp")
|
||||
this.hp_max += Math.floor(hprate/100*this.rhp_max) ;
|
||||
this.hp_max += Math.floor(hprate/100*this.hp_max) ;
|
||||
this.add_hp2(hprate)
|
||||
}
|
||||
de_hp_max(hprate: number=0){
|
||||
this.BUFFCOMP.buff_get("dehp")
|
||||
this.hp_max -= Math.floor(hprate/100*this.rhp_max) ;
|
||||
this.hp_max -= Math.floor(hprate/100*this.hp_max) ;
|
||||
}
|
||||
add_hp(hp: number = 0) {
|
||||
this.BUFFCOMP.heathed();
|
||||
this.hp+=Math.floor(hp);
|
||||
if(this.hp > this.rhp_max){
|
||||
this.hp = this.rhp_max;
|
||||
if(this.hp > this.hp_max){
|
||||
this.hp = this.hp_max;
|
||||
}
|
||||
this.BUFFCOMP.tooltip(2,hp.toFixed(0));
|
||||
}
|
||||
@@ -686,8 +464,8 @@ export class HeroViewComp extends CCComp {
|
||||
}else{
|
||||
this.BUFFCOMP.tooltip(1,hp.toFixed(0),250);
|
||||
}
|
||||
if(this.hp > this.rhp_max){
|
||||
this.hp = this.rhp_max;
|
||||
if(this.hp > this.hp_max){
|
||||
this.hp = this.hp_max;
|
||||
}
|
||||
if(this.hp <= 0){
|
||||
this.dead();
|
||||
@@ -759,6 +537,7 @@ export class HeroViewComp extends CCComp {
|
||||
to_alive(){
|
||||
let pos =v3(HeroSet.StartPos[this.type],this.node.position.y,this.node.position.z)
|
||||
this.node.setPosition(pos)
|
||||
this.revive()
|
||||
}
|
||||
|
||||
to_console(value:any,value2:any=null,value3:any=null){
|
||||
@@ -769,4 +548,13 @@ export class HeroViewComp extends CCComp {
|
||||
this.node.destroy();
|
||||
}
|
||||
|
||||
playSkillEffect() {
|
||||
this.as.max()
|
||||
}
|
||||
|
||||
public revive() {
|
||||
this.hp = this.hp_max;
|
||||
const skills = this.ent.get(HeroSkillsComp);
|
||||
skills.resetAllCooldowns();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user