This commit is contained in:
2025-07-21 23:35:11 +08:00
parent a073682615
commit f841c9ec7f
12 changed files with 6107 additions and 4847 deletions

View File

@@ -94,6 +94,7 @@ export class BuffComp extends Component {
let buff=null
let info= null
if(!this.HeroView) return
if(!this.HeroView.is_master) return
if(this.HeroView.fac==FacSet.HERO) {info=smc.vmdata.hero;buff=this.FIGHTCON.hero_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"} 不显示小怪
@@ -104,8 +105,8 @@ export class BuffComp extends Component {
info.hp=this.HeroView.hp
info.hp_buff=buff.HP
info.hp_max=this.HeroView.hp_max*(100+buff.HP)/100
info.exp=this.HeroView.exp
info.next_exp=this.HeroView.next_exp
// info.exp=this.HeroView.exp
// info.next_exp=this.HeroView.next_exp
}else{
info.hp=this.HeroView.hp
info.hp_buff=buff.HP
@@ -118,7 +119,7 @@ export class BuffComp extends Component {
view_deatk += this.HeroView.DEBUFF_DEATKS[i].value
}
info.ap=this.HeroView.ap
info.lv=this.HeroView.lv
// info.lv=this.HeroView.lv
info.cd=Number((this.HeroView.cd*(100-buff.ATK_CD)/100).toFixed(2))
console.log("info.buff.ATK_CD",buff.ATK_CD)
info.equip_ap=buff.ATK

View File

@@ -162,26 +162,7 @@ export class HeroViewComp extends CCComp {
// 处理伤害队列
this.processDamageQueue();
}
use_enhancement(e:GameEvent,data:any){
//console.log("[HeroViewComp]:use_enhancement",data)
if(this.is_master){
switch(data.type){
case EnhancementType.ATTACK:
this.add_ap(data.value)
break
case EnhancementType.ATTACK_SPEED:
this.add_speed(data.value)
break
case EnhancementType.HEALTH:
this.add_hp_max(data.value)
break
case EnhancementType.DEF:
this.add_def(data.value)
break
}
}
}
change_atk(e:GameEvent,data:any){
if(!this.is_master) return
@@ -225,12 +206,13 @@ export class HeroViewComp extends CCComp {
*/
add_def(def: number){
this.def+=def
this.BUFFCOMP.vmdata_update()
if(this.is_master) this.BUFFCOMP.vmdata_update()
// this.BUFFCOMP.tooltip(TooltipTypes.defup,def.toFixed(0));
}
add_speed(cd: number){
this.cd -=this.cd*cd/100
this.BUFFCOMP.vmdata_update()
if(this.is_master) this.BUFFCOMP.vmdata_update()
// this.BUFFCOMP.tooltip(TooltipTypes.speedup,speed.toFixed(0));
}
add_ap(ap: number,is_num:boolean=true){
@@ -240,9 +222,12 @@ export class HeroViewComp extends CCComp {
}else{
this.ap += Math.floor(ap/100*this.ap);
}
this.BUFFCOMP.vmdata_update()
this.BUFFCOMP.tooltip(TooltipTypes.apup,ap.toFixed(0));
oops.message.dispatchEvent(GameEvent.APChange,{is_master:this.is_master,fac:this.fac})
if(this.is_master) {
this.BUFFCOMP.vmdata_update();
oops.message.dispatchEvent(GameEvent.APChange,{is_master:this.is_master,fac:this.fac})
}
}
de_ap(ap: number,is_num:boolean=true){
@@ -252,7 +237,7 @@ export class HeroViewComp extends CCComp {
}else{
this.ap -= Math.floor(ap/100*this.ap);
}
this.BUFFCOMP.vmdata_update()
if(this.is_master) this.BUFFCOMP.vmdata_update()
}
update_hp(e:GameEvent,data:any){
//console.log("[HeroViewComp]:update_hp",data)
@@ -269,7 +254,7 @@ export class HeroViewComp extends CCComp {
add_hp_max(hp: number=0,is_num:boolean=true){
this.hp_max += Math.floor(hp) ;
this.hp += Math.floor(hp*(100+this.buff_hp)/100) ;
this.BUFFCOMP.vmdata_update(true)
if(this.is_master) this.BUFFCOMP.vmdata_update(true)
this.BUFFCOMP.tooltip(TooltipTypes.hpup,hp.toFixed(0));
}
@@ -277,7 +262,7 @@ export class HeroViewComp extends CCComp {
de_hp_max(hp: number=0,is_num:boolean=true){ //最大值 只存在数值添加, 比例通过buff_hp处理
//console.log("[HeroViewComp]:de_hp_max de:",hp,this.hp_max)
this.hp_max -= Math.floor(hp) ;
this.BUFFCOMP.vmdata_update(true)
if(this.is_master) this.BUFFCOMP.vmdata_update(true)
}
add_hp(hp: number = 0,is_num:boolean=true) {
@@ -302,7 +287,7 @@ export class HeroViewComp extends CCComp {
this.hp+=real_hp;
this.BUFFCOMP.tooltip(TooltipTypes.health,real_hp.toFixed(0));
}
this.BUFFCOMP.vmdata_update(true)
if(this.is_master) this.BUFFCOMP.vmdata_update(true)
}
@@ -494,7 +479,7 @@ export class HeroViewComp extends CCComp {
this.ent.destroy();
}
}
this.BUFFCOMP.vmdata_update(true)
if(this.is_master) this.BUFFCOMP.vmdata_update(true)
this.showDamage(damage, is_crit);
}
@@ -646,24 +631,40 @@ export class HeroViewComp extends CCComp {
exp_up(e:any,data:any){
if(this.fac==FacSet.MON) return
//console.log("[HeroViewComp]:经验提高",data.exp)
this.exp+=data.exp
this.next_exp=getUpExp(this.lv)
let diff=this.exp-this.next_exp
if(diff >= 0){
this.exp=diff
//console.log("[HeroViewComp]:exp_up",this.exp,this.next_exp)
oops.message.dispatchEvent(GameEvent.EnhancementSelect)
this.to_update()
smc.vmdata.hero.exp+=data.exp
// smc.vmdata.hero.next_exp=getUpExp(this.lv)
if(smc.vmdata.hero.exp >= smc.vmdata.hero.next_exp){
oops.message.dispatchEvent(GameEvent.CanUpdateLv)
}
this.BUFFCOMP.vmdata_update(true) //简易更新vmdata
}
use_enhancement(e:GameEvent,data:any){
//console.log("[HeroViewComp]:use_enhancement",data)
if(!this.is_master) return
switch(data.type){
case EnhancementType.ATTACK:
this.add_ap(data.value)
break
case EnhancementType.ATTACK_SPEED:
this.add_speed(data.value)
break
case EnhancementType.HEALTH:
this.add_hp_max(data.value)
break
case EnhancementType.DEF:
this.add_def(data.value)
break
}
this.to_update()
}
to_update(){
if(!this.is_master) return
oops.message.dispatchEvent(GameEvent.HeroLvUp,{lv:this.lv})
this.lv+=1
this.next_exp=getUpExp(this.lv)
this.BUFFCOMP.vmdata_update()
// oops.message.dispatchEvent(GameEvent.HeroLvUp,{lv:this.lv})
smc.vmdata.hero.exp = smc.vmdata.hero.exp-smc.vmdata.hero.next_exp
smc.vmdata.hero.lv = smc.vmdata.hero.lv+1
smc.vmdata.hero.next_exp=getUpExp(smc.vmdata.hero.lv)
this.BUFFCOMP.lv_up()
this.BUFFCOMP.tooltip(TooltipTypes.lvup)
//@todo 需要添加 升级动画