增益 再全面完善下
This commit is contained in:
@@ -50,22 +50,25 @@ export class HeroViewComp extends CCComp {
|
||||
|
||||
hp: number = 100; /** 血量 */
|
||||
hp_max: number = 100; /** 最大血量 */
|
||||
buff_hp:number=0;
|
||||
hp_buff:number=0;
|
||||
hp_base:number=0;
|
||||
|
||||
pwt:Timer = new Timer(1); //计时器
|
||||
ap: number = 10; /**攻击力 */
|
||||
buff_ap:number=0;
|
||||
ap_buff:number=0;
|
||||
ap_base:number=0;
|
||||
// atk_speed: number = 1;
|
||||
cd_base:number=1.3;
|
||||
cd: number = 1.3; /**攻击速度 攻击间隔 */
|
||||
buff_cd:number=0;
|
||||
cd_buff:number=0;
|
||||
dis: number = 80;
|
||||
at: number = 0; /** 冷却时间 */
|
||||
atk_skill:number=0;
|
||||
puncture:number=0; //穿刺敌人伤害后方敌人个数
|
||||
puncture_damage:number=0; //后伤害加成
|
||||
def: number = 0; //防御
|
||||
def_base:number=0;
|
||||
def_buff:number=0;
|
||||
vun: number = 0; //易伤
|
||||
burn_count:number=0; //易伤次数
|
||||
burn_value:number=0; //易伤值
|
||||
@@ -235,24 +238,24 @@ export class HeroViewComp extends CCComp {
|
||||
* @param ap 要增加的攻击。
|
||||
*/
|
||||
add_def(def: number){
|
||||
this.def+=def
|
||||
this.def_base+=def
|
||||
this.count_atrr(BuffAttr.DEF)
|
||||
|
||||
// this.BUFFCOMP.tooltip(TooltipTypes.defup,def.toFixed(0));
|
||||
}
|
||||
|
||||
check_atrr(buff:BuffAttr){
|
||||
switch(buff){
|
||||
case BuffAttr.ATK:
|
||||
return Math.floor(this.ap_base*(100+this.buff_ap+this.TALENT[BuffAttr.ATK])/100)
|
||||
return Math.floor(this.ap*(100+this.ap+this.TALENT[BuffAttr.ATK])/100)
|
||||
case BuffAttr.ATK_CD:
|
||||
return this.cd/((this.buff_cd+this.TALENT[BuffAttr.ATK_CD])/100+1)
|
||||
return this.cd_base/((this.cd_buff+this.TALENT[BuffAttr.ATK_CD])/100+1)
|
||||
case BuffAttr.HP:
|
||||
return Math.floor(this.hp_base*(100+this.buff_hp+this.TALENT[BuffAttr.HP])/100)
|
||||
return Math.floor(this.hp_base*(100+this.hp_buff+this.TALENT[BuffAttr.HP])/100)
|
||||
case BuffAttr.DEF:
|
||||
return this.def+this.TALENT[BuffAttr.DEF]
|
||||
return this.def_base+this.def_buff+this.TALENT[BuffAttr.DEF]
|
||||
}
|
||||
}
|
||||
|
||||
count_atrr(buff:BuffAttr){
|
||||
switch(buff){
|
||||
case BuffAttr.ATK:
|
||||
@@ -264,6 +267,7 @@ export class HeroViewComp extends CCComp {
|
||||
break
|
||||
case BuffAttr.ATK_CD:
|
||||
this.cd=this.check_atrr(BuffAttr.ATK_CD)
|
||||
if(this.is_master) this.BUFFCOMP.vmdata_update()
|
||||
break
|
||||
case BuffAttr.HP:
|
||||
this.hp_max=this.check_atrr(BuffAttr.HP)
|
||||
@@ -279,7 +283,7 @@ export class HeroViewComp extends CCComp {
|
||||
|
||||
|
||||
add_speed(cd: number){
|
||||
this.buff_cd+=cd
|
||||
this.cd_buff+=cd
|
||||
this.count_atrr(BuffAttr.ATK_CD)
|
||||
// this.BUFFCOMP.tooltip(TooltipTypes.speedup,speed.toFixed(0));
|
||||
}
|
||||
@@ -288,9 +292,9 @@ export class HeroViewComp extends CCComp {
|
||||
add_ap(ap: number,is_num:boolean=true){
|
||||
// console.log("[HeroViewComp]:add_ap add:",ap,this.ap)
|
||||
if(is_num){
|
||||
this.ap_base += Math.floor(ap);
|
||||
this.ap += Math.floor(ap);
|
||||
}else{
|
||||
this.buff_ap += Math.floor(ap);
|
||||
this.ap += Math.floor(ap);
|
||||
}
|
||||
let diff=this.check_atrr(BuffAttr.ATK)-this.ap
|
||||
this.count_atrr(BuffAttr.ATK)
|
||||
@@ -300,9 +304,9 @@ export class HeroViewComp extends CCComp {
|
||||
de_ap(ap: number,is_num:boolean=true){
|
||||
//console.log("[HeroViewComp]:de_ap de:",ap,this.ap)
|
||||
if(is_num){
|
||||
this.ap_base -= Math.floor(ap);
|
||||
this.ap -= Math.floor(ap);
|
||||
}else{
|
||||
this.buff_ap -= Math.floor(ap/100*this.ap);
|
||||
this.ap -= Math.floor(ap/100*this.ap);
|
||||
}
|
||||
let diff=this.check_atrr(BuffAttr.ATK)-this.ap
|
||||
this.count_atrr(BuffAttr.ATK)
|
||||
@@ -313,7 +317,7 @@ export class HeroViewComp extends CCComp {
|
||||
if(is_num){
|
||||
this.hp_base += Math.floor(hp) ;
|
||||
}else{
|
||||
this.buff_hp+=hp
|
||||
this.hp_buff+=hp
|
||||
}
|
||||
let diff=this.check_atrr(BuffAttr.HP)-this.hp_max
|
||||
this.count_atrr(BuffAttr.HP)
|
||||
@@ -321,7 +325,7 @@ export class HeroViewComp extends CCComp {
|
||||
// this.BUFFCOMP.tooltip(TooltipTypes.hpup,diff.toFixed(0));
|
||||
}
|
||||
|
||||
de_hp_max(hp: number=0,is_num:boolean=true){ //最大值 只存在数值添加, 比例通过buff_hp处理
|
||||
de_hp_max(hp: number=0,is_num:boolean=true){ //最大值 只存在数值添加, 比例通过hp_buff处理
|
||||
//console.log("[HeroViewComp]:de_hp_max de:",hp,this.hp_max)
|
||||
this.hp_base -= Math.floor(hp) ;
|
||||
let diff=this.check_atrr(BuffAttr.HP)-this.hp_max
|
||||
@@ -333,7 +337,7 @@ 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 hp_max=Math.floor(this.hp_max*(100+this.hp_buff)/100)
|
||||
let lost_hp=hp_max-this.hp
|
||||
if(is_num){
|
||||
if(lost_hp > hp){
|
||||
@@ -687,7 +691,7 @@ export class HeroViewComp extends CCComp {
|
||||
}
|
||||
// to_alive(){
|
||||
// this.is_dead=false
|
||||
// this.hp=this.hp_max*(100+this.buff_hp)/100
|
||||
// this.hp=this.hp_max*(100+this.hp_buff)/100
|
||||
// this.BUFFCOMP.vmdata_update(true)
|
||||
// this.node.setPosition(HeroPos[this.fight_pos].pos)
|
||||
// this.BUFFCOMP.heathed()
|
||||
|
||||
Reference in New Issue
Block a user