This commit is contained in:
2025-08-05 17:25:34 +08:00
parent 3db3cc78eb
commit 6f9529ada2
20 changed files with 3120 additions and 1623 deletions

View File

@@ -24,6 +24,7 @@ const { ccclass, property } = _decorator;
@ecs.register('HeroView', false) // 定义为 ECS 组件
export class HeroViewComp extends CCComp {
BUFFCOMP:BuffComp=null!
atk_heart:boolean=false;
as: HeroSpine = null!
status:String = "idle"
hero_uuid:number = 1001;
@@ -166,7 +167,7 @@ export class HeroViewComp extends CCComp {
start () {
this.as.idle()
this.BUFFCOMP=this.node.getComponent(BuffComp);
// if(this.is_master) this.BUFFCOMP.vmdata_update()
// this.update_vmdata()
/** 方向 */
this.node.setScale(this.scale,1);
this.node.getChildByName("top").setScale(this.scale,1);
@@ -177,7 +178,9 @@ export class HeroViewComp extends CCComp {
this.node.getChildByName("top").getChildByName("hp").active = true;
}
update_vmdata(){
if(this.is_master) this.BUFFCOMP.vmdata_update()
}
update(dt: number){
if(!smc.mission.play||smc.mission.pause) return
// if(this.is_dead) {
@@ -234,70 +237,70 @@ export class HeroViewComp extends CCComp {
change_wfuny(wfuny: number){
this.wfuny+=wfuny
if(this.wfuny<0) this.wfuny=0
// if(this.is_master) this.BUFFCOMP.vmdata_update()
// this.update_vmdata()
}
change_puncture(puncture: number){
this.puncture+=puncture
if(this.puncture<1) this.puncture=1
// if(this.is_master) this.BUFFCOMP.vmdata_update()
// this.update_vmdata()
}
change_puncture_damage(puncture_damage: number){
this.puncture_damage+=puncture_damage
if(this.puncture_damage<0) this.puncture_damage=0
if(this.puncture_damage>80) this.puncture_damage=80
// if(this.is_master) this.BUFFCOMP.vmdata_update()
// this.update_vmdata()
}
change_dodge(dodge: number){
this.dod+=dodge
if(this.dod<0) this.dod=0
if(this.dod>90) this.dod=90
// if(this.is_master) this.BUFFCOMP.vmdata_update()
// this.update_vmdata()
}
change_frost_ratto(frost_ratto: number){
this.frost_ratto+=frost_ratto
if(this.frost_ratto<0) this.frost_ratto=0
if(this.frost_ratto>90) this.frost_ratto=90
// if(this.is_master) this.BUFFCOMP.vmdata_update()
// this.update_vmdata()
}
change_knockback(knockback: number){
this.knockback+=knockback
if(this.knockback<0) this.knockback=0
// if(this.is_master) this.BUFFCOMP.vmdata_update()
// this.update_vmdata()
}
change_stun_ratto(stun_ratto: number){
this.stun_ratto+=stun_ratto
if(this.stun_ratto<0) this.stun_ratto=0
// if(this.is_master) this.BUFFCOMP.vmdata_update()
// this.update_vmdata()
}
change_def(def: number){
this.def+=def
if(this.def>90) this.def=90
if(this.def<0) this.def=0
// if(this.is_master) this.BUFFCOMP.vmdata_update()
// this.update_vmdata()
// this.BUFFCOMP.tooltip(TooltipTypes.defup,def.toFixed(0));
}
change_crit(crit: number){
this.crit+=crit
if(this.crit<0) this.crit=0
// if(this.is_master) this.BUFFCOMP.vmdata_update()
// this.update_vmdata()
}
change_crit_d(crit_d: number){
this.crit_d+=crit_d
if(this.crit_d<0) this.crit_d=0
// if(this.is_master) this.BUFFCOMP.vmdata_update()
// this.update_vmdata()
}
change_reflect(reflect: number){
this.reflect+=reflect
if(this.reflect<0) this.reflect=0
// if(this.is_master) this.BUFFCOMP.vmdata_update()
// this.update_vmdata()
}
change_lifesteal(lifesteal: number){
this.lifesteal+=lifesteal
if(this.lifesteal<0) this.lifesteal=0
// if(this.is_master) this.BUFFCOMP.vmdata_update()
// this.update_vmdata()
}
check_atrr(buff:BuffAttr){
@@ -316,19 +319,17 @@ export class HeroViewComp extends CCComp {
switch(buff){
case BuffAttr.ATK:
this.ap=this.check_atrr(BuffAttr.ATK)
// if(this.is_master) {
// // this.BUFFCOMP.vmdata_update();
// }
// this.update_vmdata()
break
case BuffAttr.ATK_CD:
this.cd=this.check_atrr(BuffAttr.ATK_CD)
// if(this.is_master) this.BUFFCOMP.vmdata_update()
// this.update_vmdata()
break
case BuffAttr.HP:
let diff=this.check_atrr(BuffAttr.HP)-this.hp_max
this.hp_max=this.check_atrr(BuffAttr.HP)
this.hp+=diff
// if(this.is_master) this.BUFFCOMP.vmdata_update(true)
// this.update_vmdata()
break
}
}
@@ -376,7 +377,7 @@ export class HeroViewComp extends CCComp {
//console.log("[HeroViewComp]:de_hp_max de:",hp,this.hp_max)
this.hp_base -= Math.floor(hp) ;
this.count_atrr(BuffAttr.HP)
// if(this.is_master) this.BUFFCOMP.vmdata_update(true)
// this.update_vm
}
add_hp(hp: number = 0,is_num:boolean=true) {
@@ -401,7 +402,7 @@ export class HeroViewComp extends CCComp {
this.hp+=real_hp;
this.BUFFCOMP.tooltip(TooltipTypes.health,real_hp.toFixed(0));
}
// if(this.is_master) this.BUFFCOMP.vmdata_update(true)
// this.update_vm
}
@@ -626,7 +627,7 @@ export class HeroViewComp extends CCComp {
this.ent.destroy();
}
}
// if(this.is_master) this.BUFFCOMP.vmdata_update(true)
// this.update_vm
this.showDamage(damage, is_crit);
}
@@ -781,12 +782,7 @@ export class HeroViewComp extends CCComp {
}
to_update(){
// console.log("[HeroViewComp]:to_update",this.is_master)
// if(!this.is_master) return
// 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)
// oops.message.dispatchEvent(GameEvent.HeroLvUp,{lv:smc.vmdata.hero.lv})
if(this.fac==FacSet.MON) return
this.BUFFCOMP.lv_up()
// this.BUFFCOMP.tooltip(TooltipTypes.lvup)
}