3 Commits

Author SHA1 Message Date
walkpan
e194132731 feat: 新增暴击抗性和冰冻抗性属性并完善暴击冰冻判定
1.  在HeroAttrs枚举中新增critical_res和freeze_res属性
2.  在HeroAttrsComp中添加对应抗性属性并在重置方法中初始化
3.  修改暴击和冰冻判定逻辑,加入抗性减免计算
2026-05-14 22:53:15 +08:00
walkpan
fdc5979484 feat: 添加击退效果相关逻辑
1. 新增击退概率、击退距离、击退抗性属性配置
2. 实现击退判定与击退位移逻辑,整合进受击流程
3. 重构后退方法支持自定义击退距离参数
2026-05-14 22:52:27 +08:00
walkpan
e97f2b0c48 chore: 调整hero配置注释并修复属性类型
1. 新增三种英雄流派的配置说明文档
2. 将HInfoComp中的Number属性类型替换为CCInteger
2026-05-14 22:40:39 +08:00
9 changed files with 63 additions and 29 deletions

View File

@@ -3,4 +3,5 @@ alwaysApply: true
scene: git_message scene: git_message
--- ---
在此处编写规则,自定义 AI 生成提交信息的风格。 采用中文提交信息

View File

@@ -26,6 +26,7 @@ export enum FightSet {
MERGE_MAX=3, //英雄最大等级 MERGE_MAX=3, //英雄最大等级
MERGE_NEED=3, //英雄升级需要的英雄数 MERGE_NEED=3, //英雄升级需要的英雄数
// BACK_RANG=30,//后退范围 // BACK_RANG=30,//后退范围
BACK_RANG=30,//后退范围
FiIGHT_TIME=30,//战斗时间 FiIGHT_TIME=30,//战斗时间
// BACK_CHANCE=40,//击退概率 // BACK_CHANCE=40,//击退概率
FROST_TIME=3,//冰冻时间 FROST_TIME=3,//冰冻时间

View File

@@ -24,9 +24,14 @@ export enum Attrs {
// ==================== 暴击与命中属性 ==================== // ==================== 暴击与命中属性 ====================
critical = "critical", // 暴击率 critical = "critical", // 暴击率
critical_damage = "critical_damage", // 暴击伤害 critical_damage = "critical_damage", // 暴击伤害
critical_res = "critical_res", // 暴击抗性
// ==================== 特殊效果属性 ==================== // ==================== 特殊效果属性 ====================
freeze_chance = "freeze_chance", // 冰冻概率 freeze_chance = "freeze_chance", // 冰冻概率
freeze_res = "freeze_res", // 冰冻抗性
knockback_chance = "knockback_chance", // 击退概率
knockback_distance = "knockback_distance", // 击退距离强化
knockback_res = "knockback_res", // 击退抗性
invincible_time = "invincible_time",// 无敌时间 invincible_time = "invincible_time",// 无敌时间
puncture = "puncture", // 穿刺次数 puncture = "puncture", // 穿刺次数
wfuny = "wfuny", // 风怒 wfuny = "wfuny", // 风怒

View File

@@ -85,3 +85,6 @@
怪物和boss 不配置 call fstart fend技能通过skills多技能触发 怪物和boss 不配置 call fstart fend技能通过skills多技能触发
## 4 流派初步 ## 4 流派初步
数值型: 主要强化ap 和 hp辅助其他特殊技能
技能型: 主要强化技能 范围伤害,穿刺,多目标,风怒 范围攻击的范围+大 等
控制型: 主要强化 冰冻+击退

View File

@@ -135,7 +135,8 @@ export class HeroAtkSystem extends ecs.ComblockSystem implements ecs.ISystemUpd
// 暴击判定 // 暴击判定
// 使用施法者的暴击率属性damageEvent.Attrs 快照),- 被攻击者的暴击抗性属 // 使用施法者的暴击率属性damageEvent.Attrs 快照),- 被攻击者的暴击抗性属
const isCrit = this.checkChance(damageEvent.Attrs[Attrs.critical]); const criticalChance = (damageEvent.Attrs[Attrs.critical] || 0) - (TAttrsComp.critical_res || 0);
const isCrit = this.checkChance(criticalChance);
// 计算基础伤害 // 计算基础伤害
let damage = this.dmgCount(damageEvent,TAttrsComp); let damage = this.dmgCount(damageEvent,TAttrsComp);
@@ -189,9 +190,14 @@ export class HeroAtkSystem extends ecs.ComblockSystem implements ecs.ISystemUpd
mLogger.log(this.debugMode, 'HeroAtkSystem', ` 英雄${TAttrsComp.hero_name} (uuid: ${TAttrsComp.hero_uuid}) 受到 eid:${casterEid} 的 伤害 ${damage},${isCrit?"暴击":"普通"}攻击,技能ID ${damageEvent.s_uuid}`); mLogger.log(this.debugMode, 'HeroAtkSystem', ` 英雄${TAttrsComp.hero_name} (uuid: ${TAttrsComp.hero_uuid}) 受到 eid:${casterEid} 的 伤害 ${damage},${isCrit?"暴击":"普通"}攻击,技能ID ${damageEvent.s_uuid}`);
// 冰冻判定 // 冰冻判定
const freezeChance = damageEvent.Attrs[Attrs.freeze_chance] || 0; const freezeChance = (damageEvent.Attrs[Attrs.freeze_chance] || 0) - (TAttrsComp.freeze_res || 0);
const isFrost = !TAttrsComp.isFrost() && this.checkChance(freezeChance); const isFrost = !TAttrsComp.isFrost() && this.checkChance(freezeChance);
// ✅ 触发视图层表现(伤害数字、受击动画、冰冻)
// 击退判定
const knockbackChance = (damageEvent.Attrs[Attrs.knockback_chance] || 0) - (TAttrsComp.knockback_res || 0);
const isKnockback = this.checkChance(knockbackChance);
// ✅ 触发视图层表现(伤害数字、受击动画、冰冻、击退)
if (targetView) { if (targetView) {
targetView.do_atked(damage, isCrit, damageEvent.s_uuid, false); targetView.do_atked(damage, isCrit, damageEvent.s_uuid, false);
targetView.playEnd(skillConf.endAnm); targetView.playEnd(skillConf.endAnm);
@@ -199,6 +205,9 @@ export class HeroAtkSystem extends ecs.ComblockSystem implements ecs.ISystemUpd
TAttrsComp.toFrost(); TAttrsComp.toFrost();
targetView.in_iced(TAttrsComp.frost_end_time); targetView.in_iced(TAttrsComp.frost_end_time);
} }
if (isKnockback) {
targetView.back(damageEvent.Attrs[Attrs.knockback_distance] || 0);
}
} }

View File

@@ -42,7 +42,12 @@ export class HeroAttrsComp extends ecs.Comp {
// ==================== 特殊属性 ==================== // ==================== 特殊属性 ====================
critical: number = 0; // 暴击率 critical: number = 0; // 暴击率
critical_res: number = 0; // 暴击抗性
freeze_chance: number = 0; // 冰冻概率 freeze_chance: number = 0; // 冰冻概率
freeze_res: number = 0; // 冰冻抗性
knockback_chance: number = 0; // 击退概率
knockback_distance: number = 0; // 击退距离强化
knockback_res: number = 0; // 击退抗性
crit_damage: number = 0; // 额外暴击伤害 crit_damage: number = 0; // 额外暴击伤害
puncture: number = 0; // 穿刺次数 puncture: number = 0; // 穿刺次数
wfuny: number = 0; // 风怒 wfuny: number = 0; // 风怒
@@ -296,7 +301,12 @@ export class HeroAttrsComp extends ecs.Comp {
this.atked = undefined; this.atked = undefined;
this.revive = undefined; this.revive = undefined;
this.critical = 0; this.critical = 0;
this.critical_res = 0;
this.freeze_chance = 0; this.freeze_chance = 0;
this.freeze_res = 0;
this.knockback_chance = 0;
this.knockback_distance = 0;
this.knockback_res = 0;
this.crit_damage = 0; this.crit_damage = 0;
this.revived_count = 0; this.revived_count = 0;
this.invincible_time = 0; this.invincible_time = 0;

View File

@@ -483,32 +483,35 @@ export class HeroViewComp extends CCComp {
private isBackingUp: boolean = false; // 🔥 添加后退状态标记 private isBackingUp: boolean = false; // 🔥 添加后退状态标记
//后退 //后退
back(){ back(distance: number = 0){
// 🔥 防止重复调用后退动画 // 🔥 防止重复调用后退动画
// if (this.isBackingUp) return; if (this.isBackingUp) return;
// this.isBackingUp = true; // 🔥 设置后退状态 this.isBackingUp = true; // 🔥 设置后退状态
// if(this.model.fac==FacSet.MON) { if(this.model.fac==FacSet.MON) {
// let tx=this.node.position.x+FightSet.BACK_RANG // 基础击退距离,加上额外的距离强化
// if(tx > 320) tx=320 let dist = FightSet.BACK_RANG + distance;
// tween(this.node) let tx=this.node.position.x + dist;
// .to(0.1, { position:v3(tx,this.node.position.y,0)}) if(tx > 320) tx=320;
// .call(() => { tween(this.node)
// this.isBackingUp = false; // 🔥 动画完成后重置状态 .to(0.1, { position:v3(tx,this.node.position.y,0)})
// }) .call(() => {
// .start() this.isBackingUp = false; // 🔥 动画完成后重置状态
// } })
.start();
}
// if(this.model.fac==FacSet.HERO) { if(this.model.fac==FacSet.HERO) {
// let tx=this.node.position.x-5 let dist = 5 + distance;
// if(tx < -320) tx=-320 let tx=this.node.position.x - dist;
// tween(this.node) if(tx < -320) tx=-320;
// .to(0.1, { position:v3(tx,this.node.position.y,0)}) tween(this.node)
// .call(() => { .to(0.1, { position:v3(tx,this.node.position.y,0)})
// this.isBackingUp = false; // 🔥 动画完成后重置状态 .call(() => {
// }) this.isBackingUp = false; // 🔥 动画完成后重置状态
// .start() })
// } .start();
}
} }
// 伤害计算和战斗逻辑已迁移到 HeroBattleSystem // 伤害计算和战斗逻辑已迁移到 HeroBattleSystem

View File

@@ -19,7 +19,7 @@
* - Hero —— 英雄 ECS 实体类(用于出售删除) * - Hero —— 英雄 ECS 实体类(用于出售删除)
* - UIID.IBox —— 英雄详情弹窗 ID * - UIID.IBox —— 英雄详情弹窗 ID
*/ */
import { _decorator, Animation, AnimationClip, Button, Event, Label, Node, NodeEventType, Sprite, resources } from "cc"; import { _decorator, Animation, AnimationClip, Button, Event, Label, Node, NodeEventType, Sprite, resources, CCInteger } from "cc";
import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS"; import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
import { CCComp } from "../../../../extensions/oops-plugin-framework/assets/module/common/CCComp"; import { CCComp } from "../../../../extensions/oops-plugin-framework/assets/module/common/CCComp";
import { HeroInfo } from "../common/config/heroSet"; import { HeroInfo } from "../common/config/heroSet";
@@ -63,7 +63,7 @@ export class HInfoComp extends CCComp {
@property(Node) @property(Node)
lv_node=null! lv_node=null!
@property(Number) @property(CCInteger)
node_index=0 node_index=0
/** 绑定的英雄 ECS 实体 ID */ /** 绑定的英雄 ECS 实体 ID */

View File

@@ -216,6 +216,8 @@ export class Skill extends ecs.Entity {
sDataCom.Attrs[Attrs.critical] = cAttrsComp.getRuntimeCritical() + sCrt; sDataCom.Attrs[Attrs.critical] = cAttrsComp.getRuntimeCritical() + sCrt;
sDataCom.Attrs[Attrs.critical_damage] = cAttrsComp.getRuntimeCritDamageBonus(); sDataCom.Attrs[Attrs.critical_damage] = cAttrsComp.getRuntimeCritDamageBonus();
sDataCom.Attrs[Attrs.freeze_chance] = cAttrsComp.getRuntimeFreezeChance() + sFrz; sDataCom.Attrs[Attrs.freeze_chance] = cAttrsComp.getRuntimeFreezeChance() + sFrz;
sDataCom.Attrs[Attrs.knockback_chance] = cAttrsComp.knockback_chance || 0;
sDataCom.Attrs[Attrs.knockback_distance] = cAttrsComp.knockback_distance || 0;
sDataCom.s_uuid=s_uuid sDataCom.s_uuid=s_uuid
sDataCom.skill_lv = Math.max(0, skill_lv); sDataCom.skill_lv = Math.max(0, skill_lv);
sDataCom.fac=cAttrsComp.fac sDataCom.fac=cAttrsComp.fac