From b17de4a2acff1e257d1e9e59315302bc31f81b50 Mon Sep 17 00:00:00 2001 From: panw Date: Tue, 22 Jul 2025 16:42:42 +0800 Subject: [PATCH] =?UTF-8?q?FightConComp=20=E7=9A=84=E6=95=88=E7=94=A8?= =?UTF-8?q?=E5=B7=B2=E7=BB=8F=E5=8F=96=E6=B6=88=EF=BC=8C=E4=B8=8B=E4=B8=80?= =?UTF-8?q?=E6=AD=A5=20=E8=BF=9B=E4=B8=80=E6=AD=A5=20=E7=B2=BE=E7=AE=80?= =?UTF-8?q?=EF=BC=8C=E5=8E=BB=E6=8E=89=E4=B8=B4=E6=97=B6=20buff=20debuff?= =?UTF-8?q?=20=E5=9B=A0=E4=B8=BA=E6=9C=AC=E8=BA=AB=E5=B0=B1=E6=98=AF=20?= =?UTF-8?q?=E5=BD=93=E5=B1=80=E6=B8=B8=E6=88=8F=20=E6=B2=A1=E5=BF=85?= =?UTF-8?q?=E8=A6=81=E5=8A=A0=E9=9B=B6=E6=97=B6debuff=20=E7=9B=B4=E6=8E=A5?= =?UTF-8?q?=E5=BD=93=E5=B1=80=E6=B0=B8=E4=B9=85debuff?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assets/script/game/hero/BuffComp.ts | 40 +++++++++-------------- assets/script/game/hero/HeroViewComp.ts | 42 ++++++++++--------------- assets/script/game/hero/SkillConComp.ts | 29 +++++------------ assets/script/game/skills/Skill.ts | 34 +++++++------------- assets/script/game/skills/SkillCom.ts | 24 +++----------- 5 files changed, 55 insertions(+), 114 deletions(-) diff --git a/assets/script/game/hero/BuffComp.ts b/assets/script/game/hero/BuffComp.ts index 677cc595..e3f0eb2b 100644 --- a/assets/script/game/hero/BuffComp.ts +++ b/assets/script/game/hero/BuffComp.ts @@ -4,12 +4,8 @@ import { ecs } from 'db://oops-framework/libs/ecs/ECS'; import { Tooltip } from '../skills/Tooltip'; import { timedCom } from '../skills/timedCom'; import { smc } from '../common/SingletonModuleComp'; -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'; -import { FacSet } from '../common/config/BoxSet'; const { ccclass, property } = _decorator; @ccclass('BuffComp') @@ -36,7 +32,6 @@ export class BuffComp extends Component { wind_cd:number=0; speek_time:number=0; HeroView:HeroViewComp=null! - FIGHTCON:FightConComp=null! hp_bar:any=null protected onLoad(): void { oops.message.on(GameEvent.UpdateVMData,this.to_update_vmdata,this) @@ -47,7 +42,6 @@ export class BuffComp extends Component { info_init(){ this.HeroView=this.node.getComponent(HeroViewComp) - this.FIGHTCON=this.node.parent.getComponent(FightConComp) this.top_node = this.node.getChildByName("top"); let hp_y=this.node.getComponent(UITransform).height+20 this.top_node.setPosition(0,hp_y,0) @@ -91,26 +85,20 @@ export class BuffComp extends Component { vmdata_update(is_hp:boolean=false){ // console.log("[BuffComp]:to_update_vmdata:"+this.HeroView.hero_name) - 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"} 不显示小怪 + info=smc.vmdata.hero if(info==null) return let view_atk = 0 //临时buff let view_deatk = 0 //临时debuff if(is_hp){ 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.hp_max=this.HeroView.hp_max }else{ info.hp=this.HeroView.hp - info.hp_buff=buff.HP - info.hp_max=this.HeroView.hp_max*(100+buff.HP)/100 + info.hp_max=this.HeroView.hp_max + for(let i=0;i = [] //防御提升 BUFF_ATKS: Array<{value: number, count: number}> = [] //攻击提升 @@ -105,6 +107,10 @@ export class HeroViewComp extends CCComp { DEBUFF_FROST: number = 0; //冰冻 DEBUFF_STUN: number = 0; //眩晕 + DEBUFF_VALUE:number=0; //debuff 增益值 + DEBUFF_COUNT:number=0; //debuff 持续次数 + DEBUFF_UP:number=0; //debuff 概率提升 + private damageQueue: Array<{ damage: number, isCrit: boolean, @@ -117,7 +123,6 @@ export class HeroViewComp extends CCComp { onLoad() { this.as = this.getComponent(HeroSpine); - this.FIGHTCON=this.node.parent.getComponent(FightConComp); //console.log("[HeroViewComp]:hero view comp ",this.FIGHTCON) this.on(GameEvent.ChangeATK_EQUIP_SPECIAL_ATTR,this.change_atk,this) this.on(GameEvent.EXPUP,this.exp_up,this) @@ -311,17 +316,16 @@ export class HeroViewComp extends CCComp { if(!this.is_master) return this.atk_count+=1 if(this.atk_count< FightSet.ATK_ADD_COUNT) return - if(this.FIGHTCON.atk_add_glod >0) smc.vmdata.mission_data.gold+=this.FIGHTCON.atk_add_glod let master=ecs.query(ecs.allOf(MasterModelComp)) master.forEach(master=>{ let master_view=master.get(HeroViewComp) - if(this.FIGHTCON.atk_add_master_atk>0) { - master_view.add_ap(this.FIGHTCON.atk_add_master_atk) + if(this.atk_add_master_atk>0) { + master_view.add_ap(this.atk_add_master_atk,true) } - if(this.FIGHTCON.atk_add_master_hp>0) { - master_view.add_hp_max(this.FIGHTCON.atk_add_master_hp) + if(this.atk_add_master_hp>0) { + master_view.add_hp_max(this.atk_add_master_hp,true) } }) @@ -349,22 +353,13 @@ export class HeroViewComp extends CCComp { } - get_buff(){ - let buff=null - if(this.fac==FacSet.HERO) buff=this.FIGHTCON.hero_buff - if(this.is_boss) buff=this.FIGHTCON.enemy_buff - if(this.is_kalami) buff=this.FIGHTCON.enemy_buff - if(buff==null) return - return buff - } + get_debuff(){ } add_debuff(type:number,deV:number,deC:number,deR:number){ let DEBUFF_DOWN=0 - let buff_debuff_down=0 - let buff=this.get_buff() - if(buff!==null) buff_debuff_down=buff.DEBUFF_DOWN + for(let i=0;i"+this.HeroView.hero_name+"=> SkillConComp onLoad") this.on(GameEvent.CastHeroSkill,this.cast_master_skill,this) oops.message.on(GameEvent.MaxSkill,this.use_max_skill,this) @@ -51,7 +48,7 @@ export class SkillConComp extends CCComp { if(!smc.mission.play||smc.mission.pause) return if(this.HeroView.DEBUFF_STUN <= 0&&this.HeroView.DEBUFF_FROST <= 0) this.HeroView.at += dt; - let cd = this.get_cd(this.HeroView.cd,this.HeroView) + let cd = this.count_cd(this.HeroView.cd,this.HeroView) if (this.HeroView.is_atking &&(this.HeroView.at > cd)) { if(this.HeroView.is_dead) return const config = SkillSet[this.HeroView.atk_skill]; @@ -95,7 +92,7 @@ export class SkillConComp extends CCComp { if(!this.HeroView.is_master) return //console.log("hart cast_skill",uuid ,e) const config = SkillSet[uuid]; - this.castSkill(config,false,this.FIGHTCON.hero_buff.SKILL_DMG) + this.castSkill(config,false,this.HeroView.skill_dmg) } /** 施放技能 */ castSkill(config: typeof SkillSet[keyof typeof SkillSet],is_wfuny:boolean=false,dmg:number=0) { @@ -176,10 +173,8 @@ export class SkillConComp extends CCComp { } check_wfuny(){ - let buff=this.get_buff(this.HeroView) - if(buff==null) return false let random = Math.random()*100 - if(random < buff.WFUNY){ + if(random < this.HeroView.wfuny){ return true } return false @@ -287,11 +282,7 @@ export class SkillConComp extends CCComp { // //console.log("clear_timer"); Object.values(this._timers).forEach(clearTimeout); } - get_cd(cd:number,view:HeroViewComp){ - - let buff=this.get_buff(view) - let buff_cd=0 - if(buff!=null) buff_cd=buff.ATK_CD + count_cd(cd:number,view:HeroViewComp){ // 汇总DEBUFF_DECD并处理count值 let decd = 0; @@ -311,21 +302,15 @@ export class SkillConComp extends CCComp { view.BUFF_CDS.splice(i, 1); } } - return cd*(100-bcd-buff_cd+decd)/100 + return cd*(100-bcd+decd)/100 } get_count(count:number,view:HeroViewComp){ - let buff=this.get_buff(view) - if(buff==null) return count - let re=count+(buff.WFUNY) + let re=count+view.wfuny if(re<1) re=1 return re } - get_buff(view:HeroViewComp){ - if(view.is_master) return this.FIGHTCON.hero_buff - if(view.is_boss||view.is_kalami) return this.FIGHTCON.enemy_buff - return null - } + reset() { this.clear_timer(); this.aoe_queues = [] // 清空技能队列 diff --git a/assets/script/game/skills/Skill.ts b/assets/script/game/skills/Skill.ts index 49a67aae..e15326f6 100644 --- a/assets/script/game/skills/Skill.ts +++ b/assets/script/game/skills/Skill.ts @@ -4,14 +4,12 @@ import { BoxSet, FacSet } from "../common/config/BoxSet"; import { SkillSet } from "../common/config/SkillSet"; import { smc } from "../common/SingletonModuleComp"; import { HeroViewComp } from "../hero/HeroViewComp"; -import { FightConComp } from "../map/FightConComp"; import { SkillCom } from "./SkillCom"; import { instantiate, Node, Prefab, Vec3 ,tween, v3,animation,Label,resources,SpriteFrame,Sprite} from "cc"; /** Skill 模块 */ @ecs.register(`Skill`) export class Skill extends ecs.Entity { - FIGHTCON:FightConComp=null! SkillView!: SkillCom; /** 实始添加的数据层组件 */ protected init() { @@ -33,7 +31,6 @@ export class Skill extends ecs.Entity { dmg:number=0 ) { - let FIGHTCON=parent.getComponent(FightConComp); const config = SkillSet[uuid]; if (!config) { console.error("[Skill] 技能配置不存在:", uuid); @@ -82,7 +79,7 @@ export class Skill extends ecs.Entity { return; } - let ap_data = this.get_ap(caster,dmg,uuid,FIGHTCON) + let ap_data = this.get_ap(caster,dmg,uuid) SComp.ap = ap_data.ap SComp.caster_crit = ap_data.crit SComp.caster_crit_d = ap_data.crit_d @@ -115,12 +112,11 @@ export class Skill extends ecs.Entity { this.add(SComp); } - get_ap(view:HeroViewComp,dmg:number=0,uuid:number=0,FIGHTCON:FightConComp=null!){ + get_ap(view:HeroViewComp,dmg:number=0,uuid:number=0){ let ap=0 let crit=0 let crit_d=0 let buffap=1 - let buff=null let puncture=0 let puncture_damage=0 let burn_count=0 @@ -129,12 +125,6 @@ export class Skill extends ecs.Entity { let stun_ratto=0 let frost_time=0 let frost_ratto=0 - if(view.is_master) buff=FIGHTCON.hero_buff - if(view.is_boss) buff=FIGHTCON.enemy_buff - if(view.is_kalami) buff=FIGHTCON.enemy_buff - if(buff!==null) { - buffap=(100+buff.ATK)/100 //装备区 总加成 - } // 汇总DEBUFF_DECD并处理count值 let BUFF_ATK = 0 let DEBUFF_DEATK = 0 @@ -158,17 +148,17 @@ export class Skill extends ecs.Entity { } let BUFF_AP=(100-DEBUFF_DEATK+BUFF_ATK+dmg)/100 //buff区 总加成 - puncture =buff.PUNCTURE+view.puncture - puncture_damage=buff.PUNCTURE_DMG+view.puncture_damage + puncture =view.puncture + puncture_damage=view.puncture_damage ap=view.ap*buffap*BUFF_AP*SkillSet[uuid].ap/100 - crit=view.crit+buff.CRITICAL - crit_d=view.crit_d+buff.CRITICAL_DMG - burn_count=buff.BURN_COUNT+view.burn_count - burn_value=buff.BURN_VALUE+view.burn_value - stun_time=buff.STUN_TIME+view.stun_time - stun_ratto=buff.STUN_RATTO+view.stun_ratto - frost_time=buff.FROST_TIME+view.frost_time - frost_ratto=buff.FROST_RATTO+view.frost_ratto + crit=view.crit + crit_d=view.crit_d + burn_count=view.burn_count + burn_value=view.burn_value + stun_time=view.stun_time + stun_ratto=view.stun_ratto + frost_time=view.frost_time + frost_ratto=view.frost_ratto return {ap,crit,crit_d,puncture,puncture_damage,burn_count,burn_value,stun_time,stun_ratto,frost_time,frost_ratto} } } diff --git a/assets/script/game/skills/SkillCom.ts b/assets/script/game/skills/SkillCom.ts index a7d997b5..254c0133 100644 --- a/assets/script/game/skills/SkillCom.ts +++ b/assets/script/game/skills/SkillCom.ts @@ -8,7 +8,6 @@ import { AType, DTType, EType, RType, SkillSet, SType, TGroup } from "../common/ import { BoxSet, FacSet } from "../common/config/BoxSet"; import { HeroViewComp } from "../hero/HeroViewComp"; import { BezierMove } from "../BezierMove/BezierMove"; -import { FightConComp } from "../map/FightConComp"; import { MonModelComp } from "../hero/MonModelComp"; import { FightSet } from "../common/config/Mission"; import { HeroModelComp } from "../hero/HeroModelComp"; @@ -49,7 +48,6 @@ export class SkillCom extends CCComp { stun_ratto:number=0; frost_ratto:number=0; frost_time:number=0; - FIGHTCON:FightConComp=null; run_time:number=0; hited_time:number=0; hit_count:number=0; @@ -65,7 +63,6 @@ export class SkillCom extends CCComp { private moveDirection: Vec3 | null = null; // 添加一个属性来存储移动方向 protected onLoad(): void { - this.FIGHTCON=this.node.parent.getComponent(FightConComp) } @@ -183,12 +180,11 @@ export class SkillCom extends CCComp { this.frost_time,this.frost_ratto) // ap 及暴击 属性已经在skill.ts 处理 // console.log("[SkillCom]:single_damage t:tp:rtp",this.node.position,this.targetPos,target.node.position) if(SkillSet[this.s_uuid].debuff>0){ - let deUP =this.get_debuff() // 因为不是每个技能都需要,debuff的增益在这里处理, ap 及暴击 属性已经在skill.ts 处理 let debuff=SkillSet[this.s_uuid] - let dev=debuff.deV*(100+deUP.deV)/100 - let deR=debuff.deR+deUP.deR + let dev=debuff.deV*(100+this.caster.DEBUFF_VALUE)/100 + let deR=debuff.deR+this.caster.DEBUFF_UP dev=Math.round(dev*100)/100 - let deC=debuff.deC+deUP.deC //dec只作为次数叠加 + let deC=debuff.deC+this.caster.DEBUFF_COUNT //dec只作为次数叠加 // //console.log("[SkillCom]:debuff",SkillSet[this.s_uuid].name,debuff.debuff,deUP.deV,deUP.deC) target.add_debuff(debuff.debuff,dev,deC,deR) } @@ -208,18 +204,8 @@ export class SkillCom extends CCComp { // this.ent.destroy() } } - get_debuff(){ //debuff 加成 - let debuff = {deV:0,deC:0,deR:0} - let buff=null - if(this.caster.is_master) buff = this.FIGHTCON.hero_buff - if(this.caster.is_boss||this.caster.is_kalami) buff = this.FIGHTCON.enemy_buff - if(buff==null) return debuff - debuff.deV=buff.DEBUFF_VALUE - debuff.deC=buff.DEBUFF_COUNT - debuff.deR=buff.DEBUFF_UP - return debuff - } - + + /** * 执行2段位移:先升高,然后移到目的地 */