伤害计算 需要统一
This commit is contained in:
@@ -45,6 +45,8 @@ export class HeroViewComp extends CCComp {
|
||||
is_boss:boolean = false;
|
||||
is_big_boss:boolean = false;
|
||||
is_master:boolean =false;
|
||||
is_friend:boolean =false;
|
||||
is_kalami:boolean =false;
|
||||
ap_u:number=0;
|
||||
ap_ur:number=0;
|
||||
hp_up:number=0;
|
||||
@@ -82,11 +84,22 @@ export class HeroViewComp extends CCComp {
|
||||
Friend_alive_cd:Timer=new Timer(10)
|
||||
double_dead:boolean=false
|
||||
double_atked:boolean=false
|
||||
DEBUFF_BURN: Array<{burn: number, count: number}> = []
|
||||
BUFF_DEFS: Array<{value: number, count: number}> = []
|
||||
BUFF_ATKS: Array<{value: number, count: number}> = []
|
||||
BUFF_CDS: Array<{value: number, count: number}> = []
|
||||
DEBUFF_BURNS: Array<{value: number, count: number}> = []
|
||||
DEBUFF_DEATKS: Array<{value: number, count: number}> = []
|
||||
DEBUFF_DECDS: Array<{value: number, count: number}> = []
|
||||
|
||||
DEBUFF_SLOW: number = 0;
|
||||
DEBUFF_FROST: number = 0;
|
||||
DEBUFF_STUN: number = 0;
|
||||
BUFF_DEF: Array<{def: number, count: number}> = []
|
||||
|
||||
VM_TYPE:any={
|
||||
ALL:0,
|
||||
HP:1,
|
||||
OTHER:2,
|
||||
}
|
||||
private damageQueue: Array<{
|
||||
damage: number,
|
||||
isCrit: boolean,
|
||||
@@ -119,6 +132,13 @@ export class HeroViewComp extends CCComp {
|
||||
}
|
||||
/* 显示角色血量 */
|
||||
this.node.getChildByName("top").getChildByName("hp").active = true;
|
||||
if(!this.is_master&&this.fac==FacSet.HERO){
|
||||
this.is_friend=true
|
||||
}
|
||||
if(this.fac==FacSet.MON&&!this.is_boss&&!this.is_big_boss){
|
||||
this.is_kalami=true
|
||||
}
|
||||
|
||||
}
|
||||
update(dt: number){
|
||||
if(!smc.mission.play||smc.mission.pause) return
|
||||
@@ -165,6 +185,9 @@ export class HeroViewComp extends CCComp {
|
||||
get isActive() {
|
||||
return this.ent.has(HeroViewComp) && this.node?.isValid;
|
||||
}
|
||||
|
||||
|
||||
|
||||
hide_info(){
|
||||
this.node.getChildByName("top").getChildByName("ihp").active = false;
|
||||
this.node.getChildByName("top").getChildByName("iap").active = false;
|
||||
@@ -203,6 +226,7 @@ export class HeroViewComp extends CCComp {
|
||||
this.ap += Math.floor(ap/100*this.ap);
|
||||
}
|
||||
this.BUFFCOMP.update_info_ap()
|
||||
this.BUFFCOMP.vmdata_update(this.VM_TYPE.OTHER)
|
||||
}
|
||||
|
||||
de_ap(ap: number,is_num:boolean=true){
|
||||
@@ -213,6 +237,7 @@ export class HeroViewComp extends CCComp {
|
||||
this.ap -= Math.floor(ap/100*this.ap);
|
||||
}
|
||||
this.BUFFCOMP.update_info_ap()
|
||||
this.BUFFCOMP.vmdata_update(this.VM_TYPE.OTHER)
|
||||
}
|
||||
|
||||
add_hp_max(hp: number=0,is_num:boolean=true){
|
||||
@@ -235,6 +260,7 @@ export class HeroViewComp extends CCComp {
|
||||
this.hp_max -= Math.floor(hp/100*this.hp_max);
|
||||
}
|
||||
this.BUFFCOMP.update_info_hp()
|
||||
this.BUFFCOMP.vmdata_update(this.VM_TYPE.HP)
|
||||
}
|
||||
|
||||
add_hp(hp: number = 0,is_num:boolean=true) {
|
||||
@@ -248,6 +274,7 @@ export class HeroViewComp extends CCComp {
|
||||
this.hp = this.hp_max;
|
||||
}
|
||||
this.BUFFCOMP.tooltip(2,hp.toFixed(0));
|
||||
this.BUFFCOMP.vmdata_update(this.VM_TYPE.HP)
|
||||
}
|
||||
|
||||
|
||||
@@ -301,17 +328,6 @@ export class HeroViewComp extends CCComp {
|
||||
}
|
||||
|
||||
|
||||
do_change(){
|
||||
this.BUFFCOMP.update_info_ap()
|
||||
this.BUFFCOMP.update_info_hp()
|
||||
this.BUFFCOMP.update_info_lv()
|
||||
}
|
||||
|
||||
do_update(){
|
||||
this.BUFFCOMP.update_info_ap()
|
||||
this.BUFFCOMP.update_info_hp()
|
||||
this.BUFFCOMP.update_info_lv()
|
||||
}
|
||||
|
||||
|
||||
do_dead(){
|
||||
@@ -327,7 +343,7 @@ export class HeroViewComp extends CCComp {
|
||||
add_debuff(type:number,deV:number,deC:number,){
|
||||
switch(type){
|
||||
case DebuffAttr.BURN:
|
||||
this.DEBUFF_BURN.push({burn:deV,count:deC})
|
||||
this.DEBUFF_BURNS.push({value:deV,count:deC})
|
||||
break
|
||||
case DebuffAttr.SLOW:
|
||||
this.DEBUFF_SLOW+=deV
|
||||
@@ -342,7 +358,7 @@ export class HeroViewComp extends CCComp {
|
||||
this.is_stop=true
|
||||
break
|
||||
case DebuffAttr.DECD:
|
||||
this.cd-=deV
|
||||
this.DEBUFF_DECDS.push({value:deV,count:deC})
|
||||
break
|
||||
case DebuffAttr.DEHP:
|
||||
this.hp_max-=deV
|
||||
@@ -368,7 +384,7 @@ export class HeroViewComp extends CCComp {
|
||||
add_buff(buff:number,count:number,type:number){
|
||||
switch(type){
|
||||
case BuffAttr.DEF:
|
||||
this.BUFF_DEF.push({def:buff,count:count})
|
||||
this.BUFF_DEFS.push({value:buff,count:count})
|
||||
break
|
||||
}
|
||||
}
|
||||
@@ -400,6 +416,7 @@ export class HeroViewComp extends CCComp {
|
||||
}
|
||||
}
|
||||
this.BUFFCOMP.update_info_hp()
|
||||
this.BUFFCOMP.vmdata_update(this.VM_TYPE.HP)
|
||||
this.showDamage(damage, is_crit);
|
||||
|
||||
}
|
||||
@@ -408,28 +425,40 @@ export class HeroViewComp extends CCComp {
|
||||
let damage = 0;
|
||||
let Burn = 0;
|
||||
let def = 0;
|
||||
for(let i=0;i<this.DEBUFF_BURN.length;i++){
|
||||
Burn+=this.DEBUFF_BURN[i].burn
|
||||
this.DEBUFF_BURN[i].count-=1
|
||||
if(this.DEBUFF_BURN[i].count<=0){
|
||||
this.DEBUFF_BURN.splice(i,1)
|
||||
for(let i=0;i<this.DEBUFF_BURNS.length;i++){
|
||||
Burn+=this.DEBUFF_BURNS[i].value
|
||||
this.DEBUFF_BURNS[i].count-=1
|
||||
if(this.DEBUFF_BURNS[i].count<=0){
|
||||
this.DEBUFF_BURNS.splice(i,1)
|
||||
}
|
||||
}
|
||||
for(let i=0;i<this.BUFF_DEF.length;i++){
|
||||
def+=this.BUFF_DEF[i].def
|
||||
this.BUFF_DEF[i].count-=1
|
||||
if(this.BUFF_DEF[i].count<=0){
|
||||
this.BUFF_DEF.splice(i,1)
|
||||
for(let i=0;i<this.BUFF_DEFS.length;i++){
|
||||
def+=this.BUFF_DEFS[i].value
|
||||
this.BUFF_DEFS[i].count-=1
|
||||
if(this.BUFF_DEFS[i].count<=0){
|
||||
this.BUFF_DEFS.splice(i,1)
|
||||
}
|
||||
}
|
||||
if(this.fac == FacSet.HERO ){
|
||||
damage=remainingDamage*(100-(this.FIGHTCON.hero_buff.DEF+def)+(this.FIGHTCON.hero_debuff.BURN+Burn))/100
|
||||
}
|
||||
if(this.fac == FacSet.MON){
|
||||
damage=remainingDamage*(100-(this.FIGHTCON.enemy_buff.DEF+def)+(this.FIGHTCON.enemy_debuff.BURN+Burn))/100
|
||||
}
|
||||
let buff_key=null
|
||||
if(this.is_master) {buff_key="hero"}
|
||||
if(this.is_friend) {buff_key="friend"}
|
||||
if(this.is_boss) {buff_key="enemy"}
|
||||
if(this.is_kalami) {buff_key="enemy"}
|
||||
if(buff_key==null) return
|
||||
let debuff=this.FIGHTCON[buff_key+"_debuff"]
|
||||
let buff=this.FIGHTCON[buff_key+"_buff"]
|
||||
damage=remainingDamage*(100-(buff.DEF+def)+(debuff.BURN+Burn))/100
|
||||
|
||||
return Math.floor(damage)
|
||||
}
|
||||
count_debuff(){
|
||||
|
||||
}
|
||||
|
||||
count_buff(){
|
||||
|
||||
}
|
||||
|
||||
check_shield(){
|
||||
if(this.shield>0){
|
||||
this.shield -= 1
|
||||
|
||||
Reference in New Issue
Block a user