This commit is contained in:
2025-07-29 23:55:49 +08:00
parent 16195f4cb4
commit a4ebf3c651
4 changed files with 152 additions and 85 deletions

View File

@@ -59,6 +59,7 @@ export class HeroViewComp extends CCComp {
ap_base:number=0;
// atk_speed: number = 1;
cd: number = 1.3; /**攻击速度 攻击间隔 */
buff_cd:number=0;
dis: number = 80;
at: number = 0; /** 冷却时间 */
atk_skill:number=0;
@@ -103,6 +104,7 @@ export class HeroViewComp extends CCComp {
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; //眩晕
@@ -111,7 +113,23 @@ export class HeroViewComp extends CCComp {
DEBUFF_COUNT:number=0; //debuff 持续次数
DEBUFF_UP:number=0; //debuff 概率提升
TALENT:any={
[BuffAttr.ATK]:0,
[BuffAttr.CRITICAL]:0,
[BuffAttr.CRITICAL_DMG]:0,
[BuffAttr.DODGE]:0,
[BuffAttr.DEBUFF_COUNT]:0,
[BuffAttr.HP]:0,
[BuffAttr.DEF]:0,
[BuffAttr.PUNCTURE]:0,
[BuffAttr.ATK_CD]:0,
[BuffAttr.SKILL_CD]:0,
[BuffAttr.FROST_RATIO]:0,
[BuffAttr.KNOCKBACK]:0,
[BuffAttr.STUN_RATTO]:0,
[BuffAttr.REFLECT]:0,
[BuffAttr.LIFESTEAL]:0,
}
private damageQueue: Array<{
@@ -150,6 +168,7 @@ export class HeroViewComp extends CCComp {
this.node.getChildByName("top").getChildByName("hp").active = true;
}
update(dt: number){
if(!smc.mission.play||smc.mission.pause) return
// if(this.is_dead) {
@@ -218,11 +237,33 @@ export class HeroViewComp extends CCComp {
// this.BUFFCOMP.tooltip(TooltipTypes.defup,def.toFixed(0));
}
add_speed(cd: number){
this.cd -=this.cd*cd/100
if(this.is_master) this.BUFFCOMP.vmdata_update()
this.buff_cd+=cd
this.count_cd()
// this.BUFFCOMP.tooltip(TooltipTypes.speedup,speed.toFixed(0));
}
check_cd(){
return this.cd/((this.buff_cd+this.TALENT[BuffAttr.ATK_CD])/100+1)
}
count_cd(){
this.cd=this.check_cd()
if(this.is_master) {
this.BUFFCOMP.vmdata_update();
}
}
check_ap(){
return Math.floor(this.ap_base*(100+this.buff_ap+this.TALENT[BuffAttr.ATK])/100)
}
count_ap(){
this.ap=this.check_ap()
if(this.is_master) {
this.BUFFCOMP.vmdata_update();
oops.message.dispatchEvent(GameEvent.APChange,{is_master:this.is_master,fac:this.fac})
}
}
add_ap(ap: number,is_num:boolean=true){
// console.log("[HeroViewComp]:add_ap add:",ap,this.ap)
if(is_num){
@@ -230,15 +271,9 @@ export class HeroViewComp extends CCComp {
}else{
this.buff_ap += Math.floor(ap);
}
let diff=Math.floor(this.ap_base*(100+this.buff_ap)/100)-this.ap
this.ap = Math.floor(this.ap_base*(100+this.buff_ap)/100)
let diff=this.check_ap()-this.ap
this.count_ap()
// this.BUFFCOMP.tooltip(TooltipTypes.apup,diff.toFixed(0));
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){
@@ -248,12 +283,8 @@ export class HeroViewComp extends CCComp {
}else{
this.buff_ap -= Math.floor(ap/100*this.ap);
}
let diff=Math.floor(this.ap_base*(100+this.buff_ap)/100)-this.ap
this.ap = Math.floor(this.ap_base*(100+this.buff_ap)/100)
// this.BUFFCOMP.tooltip(TooltipTypes.apup,diff.toFixed(0));
if(this.is_master) this.BUFFCOMP.vmdata_update()
let diff=this.check_ap()-this.ap
this.count_ap()
}
add_hp_max(hp: number=0,is_num:boolean=false){