信息展示 继续
This commit is contained in:
@@ -8,6 +8,7 @@ import { BuffGet } from '../skills/BuffGet';
|
||||
import { HeroViewComp } from './HeroViewComp';
|
||||
import { FightConComp } from '../map/FightConComp';
|
||||
import { BuffAttr, DebuffAttr } from '../common/config/SkillSet';
|
||||
import { GameEvent } from '../common/config/GameEvent';
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
@ccclass('BuffComp')
|
||||
@@ -35,6 +36,9 @@ export class BuffComp extends Component {
|
||||
speek_time:number=0;
|
||||
HeroView:HeroViewComp=null!
|
||||
FIGHTCON:FightConComp=null!
|
||||
protected onLoad(): void {
|
||||
oops.message.on(GameEvent.UpdateVMData,this.to_update_vmdata,this)
|
||||
}
|
||||
start() {
|
||||
this.info_init()
|
||||
}
|
||||
@@ -53,9 +57,11 @@ export class BuffComp extends Component {
|
||||
this.top_node.getChildByName("ihp").active=false
|
||||
this.top_node.getChildByName("iap").active=false
|
||||
|
||||
this.vmdata_update(this.HeroView.VM_TYPE.ALL)
|
||||
this.vmdata_update()
|
||||
}
|
||||
to_update_vmdata(){
|
||||
this.vmdata_update(false)
|
||||
}
|
||||
|
||||
update(deltaTime: number) {
|
||||
if(smc.mission.pause) return
|
||||
this.hp_show()
|
||||
@@ -69,6 +75,7 @@ export class BuffComp extends Component {
|
||||
this.node.getChildByName("buff").active = false;
|
||||
}
|
||||
this.in_speek(deltaTime)
|
||||
// this.vmdata_update()
|
||||
}
|
||||
hp_show(){
|
||||
// if(this.node.getComponent(HeroViewComp).fac == 0) return
|
||||
@@ -83,47 +90,44 @@ export class BuffComp extends Component {
|
||||
this.node.getChildByName("shielded").active=val
|
||||
}
|
||||
|
||||
vmdata_update(data_type:string){
|
||||
let target_key=null
|
||||
let buff_key=null
|
||||
if(this.HeroView.is_master) {target_key="hero";buff_key="hero"}
|
||||
if(this.HeroView.is_friend) {target_key="friend";buff_key="friend"}
|
||||
if(this.HeroView.is_boss) {target_key="boss";buff_key="enemy"}
|
||||
if(target_key==null) return
|
||||
|
||||
switch(data_type){
|
||||
case this.HeroView.VM_TYPE.ALL:
|
||||
smc.vmdata[target_key].hp=this.HeroView.hp
|
||||
smc.vmdata[target_key].hp_max=this.HeroView.hp_max
|
||||
smc.vmdata[target_key].ap=this.HeroView.ap
|
||||
break
|
||||
case this.HeroView.VM_TYPE.HP:
|
||||
smc.vmdata[target_key].hp=this.HeroView.hp
|
||||
smc.vmdata[target_key].hp_max=this.HeroView.hp_max
|
||||
break
|
||||
case this.HeroView.VM_TYPE.OTHER:
|
||||
let view_atk = 0 //临时buff
|
||||
for(let i=0;i<this.HeroView.BUFF_ATKS.length;i++){
|
||||
view_atk += this.HeroView.BUFF_ATKS[i].value
|
||||
}
|
||||
let view_deatk = 0 //临时debuff
|
||||
for(let i=0;i<this.HeroView.DEBUFF_DEATKS.length;i++){
|
||||
view_deatk += this.HeroView.DEBUFF_DEATKS[i].value
|
||||
}
|
||||
|
||||
let buff=this.FIGHTCON[buff_key+"_buff"]
|
||||
vmdata_update(is_hp:boolean=false){
|
||||
console.log("[BuffComp]:vmdata_update",is_hp)
|
||||
let buff=null
|
||||
let info= null
|
||||
if(!this.HeroView) return
|
||||
if(this.HeroView.is_master) {info=smc.vmdata.hero;buff=this.FIGHTCON.hero_buff}
|
||||
if(this.HeroView.is_friend) {info=smc.vmdata.friend;buff=this.FIGHTCON.friend_buff}
|
||||
if(this.HeroView.is_boss) {info=smc.vmdata.boss;buff=this.FIGHTCON.enemy_buff}
|
||||
//if(this.HeroView.is_kalami) {target_key="enemy";buff_key="enemy"} 不显示小怪
|
||||
if(info==null) return
|
||||
let view_atk = 0 //临时buff
|
||||
let view_deatk = 0 //临时debuff
|
||||
if(is_hp){
|
||||
info.hp=this.HeroView.hp
|
||||
info.hp_max=this.HeroView.hp_max*(100+buff.HP)/100
|
||||
info.hp_buff=buff.HP
|
||||
}else{
|
||||
info.hp=this.HeroView.hp
|
||||
info.hp_max=this.HeroView.hp_max*(100+buff.HP)/100
|
||||
info.hp_buff=buff.HP
|
||||
for(let i=0;i<this.HeroView.BUFF_ATKS.length;i++){
|
||||
view_atk += this.HeroView.BUFF_ATKS[i].value
|
||||
}
|
||||
|
||||
|
||||
smc.vmdata[target_key].ap=this.HeroView.ap
|
||||
smc.vmdata[target_key].equip_ap=buff.ATK
|
||||
smc.vmdata[target_key].buff_ap=view_atk
|
||||
smc.vmdata[target_key].debuff_ap=view_deatk
|
||||
smc.vmdata[target_key].damage=this.HeroView.ap*(100+buff.ATK)/100*(100+view_atk-view_deatk)/100
|
||||
|
||||
|
||||
|
||||
break
|
||||
for(let i=0;i<this.HeroView.DEBUFF_DEATKS.length;i++){
|
||||
view_deatk += this.HeroView.DEBUFF_DEATKS[i].value
|
||||
}
|
||||
info.ap=this.HeroView.ap
|
||||
info.equip_ap=buff.ATK
|
||||
info.buff_ap=view_atk
|
||||
info.debuff_ap=view_deatk
|
||||
info.damage=this.HeroView.ap*(100+buff.ATK)/100*(100+view_atk-view_deatk)/100
|
||||
info.crit=this.HeroView.crit+buff.CRITICAL
|
||||
info.crit_d=this.HeroView.crit_d+buff.CRITICAL_DMG
|
||||
info.dod=this.HeroView.dod+buff.DODGE
|
||||
info.def=this.HeroView.def+buff.DEF
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
update_info_hp(){
|
||||
|
||||
Reference in New Issue
Block a user