From b42cc2e6623993e2dd1d3084802e2753189c56bc Mon Sep 17 00:00:00 2001 From: panw Date: Wed, 4 Feb 2026 16:42:46 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E6=88=98=E6=96=97):=20=E8=B0=83=E6=95=B4?= =?UTF-8?q?=E5=87=BB=E9=80=80=E6=9C=BA=E5=88=B6=E5=92=8C=E6=8A=80=E8=83=BD?= =?UTF-8?q?=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 新增后退范围配置项,统一管理击退距离 - 提高英雄击退几率从20%到50% - 调整"蓄力一击"技能冷却时间从1秒到3秒 - 优化击退逻辑,仅对怪物生效并应用配置的后退范围 - 启用调试模式以方便战斗系统调试 --- assets/script/game/common/config/GameSet.ts | 1 + assets/script/game/common/config/SkillSet.ts | 2 +- assets/script/game/hero/Hero.ts | 6 ++-- assets/script/game/hero/HeroAtkSystem.ts | 38 ++++++++++---------- assets/script/game/hero/HeroViewComp.ts | 24 ++++++------- 5 files changed, 36 insertions(+), 35 deletions(-) diff --git a/assets/script/game/common/config/GameSet.ts b/assets/script/game/common/config/GameSet.ts index ae498059..e235c4cf 100644 --- a/assets/script/game/common/config/GameSet.ts +++ b/assets/script/game/common/config/GameSet.ts @@ -118,6 +118,7 @@ export enum FightSet { LVUP_GOLD=50,//升级需要的金币 LVUP_GOLD_UP=50,//升级需要的金币 CHOU_GOLD=100,//抽卡需要的金币 + BACK_RANG=30,//后退范围 } export enum IndexSet { /** 英雄基础层级 */ diff --git a/assets/script/game/common/config/SkillSet.ts b/assets/script/game/common/config/SkillSet.ts index e3a41f54..710989cc 100644 --- a/assets/script/game/common/config/SkillSet.ts +++ b/assets/script/game/common/config/SkillSet.ts @@ -220,7 +220,7 @@ export const SkillSet: Record = { }, 6004: { uuid:6004,name:"蓄力一击",sp_name:"atk_s4",icon:"1173",TGroup:TGroup.Enemy,SType:SType.damage,act:"atk",DTType:DTType.single, - ap:100,cd:1,t_num:1,hit_num:1,hit:1,hitcd:0.2,speed:720,with:0,dis:SkillDisVal[SkillRange.Melee], + ap:100,cd:3,t_num:1,hit_num:1,hit:1,hitcd:0.2,speed:720,with:0,dis:SkillDisVal[SkillRange.Melee], ready:0,EAnm:0,DAnm:9001,RType:RType.fixed,EType:EType.animationEnd, buffs:[],neAttrs:[],info:"对前方目标造成150%攻击的伤害", }, diff --git a/assets/script/game/hero/Hero.ts b/assets/script/game/hero/Hero.ts index dd94ac56..ee86ef67 100644 --- a/assets/script/game/hero/Hero.ts +++ b/assets/script/game/hero/Hero.ts @@ -116,9 +116,9 @@ export class Hero extends ecs.Entity { // 初始化 buff/debuff 系统 model.initAttrs(); - model.Attrs[Attrs.REVIVE_COUNT]=1 - model.Attrs[Attrs.BACK_CHANCE]=20 - model.Attrs[Attrs.CON_RES]=10 + model.Attrs[Attrs.REVIVE_COUNT]=1 // 复活次数 + model.Attrs[Attrs.BACK_CHANCE]=50 // 击退对手几率 + model.Attrs[Attrs.CON_RES]=10 // 控制抗性 this.add(hv); oops.message.dispatchEvent(GameEvent.MasterCalled,{uuid:uuid}) const move = this.get(HeroMoveComp); diff --git a/assets/script/game/hero/HeroAtkSystem.ts b/assets/script/game/hero/HeroAtkSystem.ts index e8e53102..3456ae5d 100644 --- a/assets/script/game/hero/HeroAtkSystem.ts +++ b/assets/script/game/hero/HeroAtkSystem.ts @@ -41,7 +41,7 @@ interface FinalData { @ecs.register('HeroAtkSystem') export class HeroAtkSystem extends ecs.ComblockSystem implements ecs.ISystemUpdate { - private debugMode: boolean = false; // 是否启用调试模式 + private debugMode: boolean = true; // 是否启用调试模式 /** * 过滤器:处理拥有伤害队列的实体 @@ -77,7 +77,7 @@ export class HeroAtkSystem extends ecs.ComblockSystem implements ecs.ISystemUpd damageQueue.processedCount++; // 如果目标已死亡,停止处理后续伤害 if (TAttrsComp.is_dead) { - mLogger.log(this.debugMode, 'HeroAtkSystem', `[HeroAtkSystem] ${TAttrsComp.hero_name} 已死亡,停止处理剩余伤害`); + mLogger.log(this.debugMode, 'HeroAtkSystem', ` ${TAttrsComp.hero_name} 已死亡,停止处理剩余伤害`); damageQueue.clear(); // 清空剩余伤害 break; } @@ -88,7 +88,7 @@ export class HeroAtkSystem extends ecs.ComblockSystem implements ecs.ISystemUpd e.remove(DamageQueueComp); if (processedCount > 0) { - mLogger.log(this.debugMode, 'HeroAtkSystem', `[HeroAtkSystem] ${TAttrsComp.hero_name} 伤害队列处理完成,共处理 ${processedCount} 个伤害事件`); + mLogger.log(this.debugMode, 'HeroAtkSystem', ` ${TAttrsComp.hero_name} 伤害队列处理完成,共处理 ${processedCount} 个伤害事件`); } } } @@ -156,7 +156,7 @@ export class HeroAtkSystem extends ecs.ComblockSystem implements ecs.ISystemUpd const isCrit = this.checkChance(damageEvent.Attrs[Attrs.CRITICAL]-TAttrsComp.Attrs[Attrs.CRITICAL_RES]); // 计算基础伤害 let damage = this.dmgCount(damageEvent,TAttrsComp); - mLogger.log(this.debugMode, 'HeroAtkSystem', "[HeroAtkSystem] dmgCount",damage) + mLogger.log(this.debugMode, 'HeroAtkSystem', " dmgCount",damage) if (isCrit) { // 暴击伤害计算 // 使用施法者的暴击伤害加成属性(damageEvent.Attrs 快照) @@ -167,11 +167,11 @@ export class HeroAtkSystem extends ecs.ComblockSystem implements ecs.ISystemUpd CAttrsComp?.useValueTalByAttr(Attrs.CRITICAL); // 清除施法者的暴击buff } - mLogger.log(this.debugMode, 'HeroAtkSystem', "[HeroAtkSystem] after crit",damage) + mLogger.log(this.debugMode, 'HeroAtkSystem', " after crit",damage) // 护盾吸收 const shieldResult = this.absorbShield(TAttrsComp, damage); damage = shieldResult.remainingDamage; - mLogger.log(this.debugMode, 'HeroAtkSystem', "[HeroAtkSystem] after shield",damage) + mLogger.log(this.debugMode, 'HeroAtkSystem', " after shield",damage) // 显示护盾吸收飘字 if (shieldResult.absorbedDamage > 0 && targetView) { targetView.shield_tip(shieldResult.absorbedDamage); @@ -189,7 +189,7 @@ export class HeroAtkSystem extends ecs.ComblockSystem implements ecs.ISystemUpd smc.updateHeroInfo(TAttrsComp); // 更新英雄数据到 VM const casterName = CAttrsComp?.hero_name || "未知"; - mLogger.log(this.debugMode, 'HeroAtkSystem', `[HeroAtkSystem] 英雄${TAttrsComp.hero_name} (uuid: ${TAttrsComp.hero_uuid}) 受到 ${casterName}(eid: ${casterEid})的 伤害 ${damage},${isCrit?"暴击":"普通"}攻击,技能ID ${damageEvent.s_uuid}`); + mLogger.log(this.debugMode, 'HeroAtkSystem', ` 英雄${TAttrsComp.hero_name} (uuid: ${TAttrsComp.hero_uuid}) 受到 ${casterName}(eid: ${casterEid})的 伤害 ${damage},${isCrit?"暴击":"普通"}攻击,技能ID ${damageEvent.s_uuid}`); //反伤判定 并应用到施法者 this.check_thorns(TAttrsComp, caster, damage); @@ -221,7 +221,7 @@ export class HeroAtkSystem extends ecs.ComblockSystem implements ecs.ISystemUpd targetView.scheduleRevive(1.0); } - mLogger.log(this.debugMode, 'HeroAtkSystem', `[HeroAtkSystem] Hero waiting to revive! Lives left: ${TAttrsComp.Attrs[Attrs.REVIVE_COUNT]}`); + mLogger.log(this.debugMode, 'HeroAtkSystem', ` Hero waiting to revive! Lives left: ${TAttrsComp.Attrs[Attrs.REVIVE_COUNT]}`); return reDate; } @@ -232,7 +232,7 @@ export class HeroAtkSystem extends ecs.ComblockSystem implements ecs.ISystemUpd if (TAttrsComp.is_master&&TAttrsComp.Attrs[Attrs.REVIVE_COUNT] <= 0) { smc.mission.stop_mon_action = true; oops.message.dispatchEvent(GameEvent.HeroDead, { hero_uuid: TAttrsComp.hero_uuid}); - mLogger.log(this.debugMode, 'HeroAtkSystem', "[HeroAtkSystem] Hero died, stopping monster action (spawn/move)"+TAttrsComp.Attrs[Attrs.REVIVE_COUNT]); + mLogger.log(this.debugMode, 'HeroAtkSystem', " Hero died, stopping monster action (spawn/move)"+TAttrsComp.Attrs[Attrs.REVIVE_COUNT]); } this.doDead(target); @@ -242,7 +242,7 @@ export class HeroAtkSystem extends ecs.ComblockSystem implements ecs.ISystemUpd } } - mLogger.log(this.debugMode, 'HeroAtkSystem', `[HeroAtkSystem] ${TAttrsComp.hero_name} 受到 ${damage} 点伤害 (暴击: ${isCrit})`); + mLogger.log(this.debugMode, 'HeroAtkSystem', ` ${TAttrsComp.hero_name} 受到 ${damage} 点伤害 (暴击: ${isCrit})`); reDate.damage=damage; @@ -278,7 +278,7 @@ export class HeroAtkSystem extends ecs.ComblockSystem implements ecs.ISystemUpd CView.scheduleRevive(1.0); } - mLogger.log(this.debugMode, 'HeroAtkSystem', `[HeroAtkSystem] Hero waiting to revive from Thorns! Lives left: ${CAttrs.Attrs[Attrs.REVIVE_COUNT]}`); + mLogger.log(this.debugMode, 'HeroAtkSystem', ` Hero waiting to revive from Thorns! Lives left: ${CAttrs.Attrs[Attrs.REVIVE_COUNT]}`); return; } @@ -286,7 +286,7 @@ export class HeroAtkSystem extends ecs.ComblockSystem implements ecs.ISystemUpd if (CAttrs.is_master&&CAttrs.Attrs[Attrs.REVIVE_COUNT] <= 0) { smc.mission.stop_mon_action = true; oops.message.dispatchEvent(GameEvent.HeroDead, { hero_uuid: CAttrs.hero_uuid}); - mLogger.log(this.debugMode, 'HeroAtkSystem', "[HeroAtkSystem] Hero died from thorns, stopping monster action (spawn/move)"); + mLogger.log(this.debugMode, 'HeroAtkSystem', " Hero died from thorns, stopping monster action (spawn/move)"); } this.doDead(caster); @@ -322,11 +322,11 @@ export class HeroAtkSystem extends ecs.ComblockSystem implements ecs.ISystemUpd const TAttrs=TAttrsComp.Attrs; let sConf = SkillSet[damageEvent.s_uuid]; if (!sConf) return 0; - mLogger.log(this.debugMode, 'HeroAtkSystem', `[HeroAtkSystem] 伤害处理对象`,CAttrs,TAttrs); + mLogger.log(this.debugMode, 'HeroAtkSystem', ` 伤害处理对象`,CAttrs,TAttrs); // 2. 计算原始物理伤害和魔法伤害 // 物理伤害基础值 = 技能物理倍率 * (施法者物理攻击力 + 额外伤害) / 100 * 额外伤害比例 let apBase = (sConf.ap||0)*(CAttrs[Attrs.AP]+damageEvent.ext_dmg)/100*damageEvent.dmg_ratio; - mLogger.log(this.debugMode, 'HeroAtkSystem', `[HeroAtkSystem] 物理伤害基础值: ${apBase}, 技能ap=${sConf.ap},施法者物理攻击力: ${CAttrs[Attrs.AP]},} + mLogger.log(this.debugMode, 'HeroAtkSystem', ` 物理伤害基础值: ${apBase}, 技能ap=${sConf.ap},施法者物理攻击力: ${CAttrs[Attrs.AP]},} 额外伤害:${damageEvent.ext_dmg}, 额外伤害比例:${damageEvent.dmg_ratio}`); // 易伤 let DMG_INVUL = TAttrs[Attrs.DMG_INVUL]||0 @@ -343,7 +343,7 @@ export class HeroAtkSystem extends ecs.ComblockSystem implements ecs.ISystemUpd total = Math.floor(total * damageRatio); - if (this.debugMode) mLogger.log(this.debugMode, 'HeroAtkSystem', `[HeroAtkSystem] 最终伤害: ${total} (Base: ${apBase}, Def: ${DMG_RED}%, Invul: ${DMG_INVUL}%, Ratio: ${damageRatio})`); + if (this.debugMode) mLogger.log(this.debugMode, 'HeroAtkSystem', ` 最终伤害: ${total} (Base: ${apBase}, Def: ${DMG_RED}%, Invul: ${DMG_INVUL}%, Ratio: ${damageRatio})`); return total; } @@ -409,7 +409,7 @@ export class HeroAtkSystem extends ecs.ComblockSystem implements ecs.ISystemUpd this.onDeath(entity); if (this.debugMode) { - mLogger.log(this.debugMode, 'HeroAtkSystem', `[HeroAtkSystem] ${TAttrsComp.hero_name} 死亡`); + mLogger.log(this.debugMode, 'HeroAtkSystem', ` ${TAttrsComp.hero_name} 死亡`); } } @@ -459,7 +459,7 @@ export class HeroAtkSystem extends ecs.ComblockSystem implements ecs.ISystemUpd private absorbShield(TAttrsComp: HeroAttrsComp, damage: number): {remainingDamage: number, absorbedDamage: number} { if (TAttrsComp.shield <= 0) { - mLogger.log(this.debugMode, 'HeroAtkSystem', "[HeroAtkSystem] 护盾值小于等于0,无法吸收伤害"); + mLogger.log(this.debugMode, 'HeroAtkSystem', " 护盾值小于等于0,无法吸收伤害"); return {remainingDamage: damage, absorbedDamage: 0}; }; @@ -470,7 +470,7 @@ export class HeroAtkSystem extends ecs.ComblockSystem implements ecs.ISystemUpd TAttrsComp.Attrs[Attrs.SHIELD_MAX] = 0; } TAttrsComp.dirty_shield = true; - mLogger.log(this.debugMode, 'HeroAtkSystem', `[HeroAtkSystem] 护盾值完全吸收伤害 ${damage}`); + mLogger.log(this.debugMode, 'HeroAtkSystem', ` 护盾值完全吸收伤害 ${damage}`); return {remainingDamage: 0, absorbedDamage: damage}; } else { const absorbedDamage = TAttrsComp.shield; @@ -478,7 +478,7 @@ export class HeroAtkSystem extends ecs.ComblockSystem implements ecs.ISystemUpd TAttrsComp.shield = 0; TAttrsComp.Attrs[Attrs.SHIELD_MAX] = 0; TAttrsComp.dirty_shield = true; - mLogger.log(this.debugMode, 'HeroAtkSystem', `[HeroAtkSystem] 护盾值部分吸收伤害 ${absorbedDamage}`); + mLogger.log(this.debugMode, 'HeroAtkSystem', ` 护盾值部分吸收伤害 ${absorbedDamage}`); return {remainingDamage, absorbedDamage}; } } diff --git a/assets/script/game/hero/HeroViewComp.ts b/assets/script/game/hero/HeroViewComp.ts index 4944e7d9..0f58f8be 100644 --- a/assets/script/game/hero/HeroViewComp.ts +++ b/assets/script/game/hero/HeroViewComp.ts @@ -3,7 +3,7 @@ import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ec import { CCComp } from "../../../../extensions/oops-plugin-framework/assets/module/common/CCComp"; import { mLogger } from "../common/Logger"; import { HeroSpine } from "./HeroSpine"; -import { BoxSet, FacSet } from "../common/config/GameSet"; +import { BoxSet, FacSet, FightSet } from "../common/config/GameSet"; import { smc } from "../common/SingletonModuleComp"; import { EAnmConf, SkillSet,} from "../common/config/SkillSet"; import { oops } from "db://oops-framework/core/Oops"; @@ -461,7 +461,7 @@ export class HeroViewComp extends CCComp { this.isBackingUp = true; // 🔥 设置后退状态 if(this.model.fac==FacSet.MON) { - let tx=this.node.position.x+5 + let tx=this.node.position.x+FightSet.BACK_RANG if(tx > 320) tx=320 tween(this.node) .to(0.1, { position:v3(tx,this.node.position.y,0)}) @@ -471,16 +471,16 @@ export class HeroViewComp extends CCComp { .start() } - if(this.model.fac==FacSet.HERO) { - let tx=this.node.position.x-5 - if(tx < -320) tx=-320 - tween(this.node) - .to(0.1, { position:v3(tx,this.node.position.y,0)}) - .call(() => { - this.isBackingUp = false; // 🔥 动画完成后重置状态 - }) - .start() - } + // if(this.model.fac==FacSet.HERO) { + // let tx=this.node.position.x-5 + // if(tx < -320) tx=-320 + // tween(this.node) + // .to(0.1, { position:v3(tx,this.node.position.y,0)}) + // .call(() => { + // this.isBackingUp = false; // 🔥 动画完成后重置状态 + // }) + // .start() + // } } // 伤害计算和战斗逻辑已迁移到 HeroBattleSystem