feat: 新增麻痹控制机制,优化击晕与技能CD逻辑

1.  新增麻痹控制相关属性、buff配置与逻辑实现
2.  调整击晕时长与CD削减机制,优化技能CD更新逻辑
3.  修正多个技能预制件的参数与动画配置
4.  扩展控制类型检测与游戏配置项
This commit is contained in:
pan
2026-08-19 16:40:10 +08:00
parent d6e8cb4828
commit 5585149b12
11 changed files with 109 additions and 49 deletions

View File

@@ -7,11 +7,11 @@
"embeddedPlayerGroups": [] "embeddedPlayerGroups": []
}, },
"_native": "", "_native": "",
"sample": 24, "sample": 20,
"speed": 1, "speed": 1,
"wrapMode": 1, "wrapMode": 1,
"enableTrsBlending": false, "enableTrsBlending": false,
"_duration": 0.2916666666666667, "_duration": 0.35,
"_hash": 500763545, "_hash": 500763545,
"_tracks": [ "_tracks": [
{ {
@@ -19,7 +19,18 @@
} }
], ],
"_exoticAnimation": null, "_exoticAnimation": null,
"_events": [], "_events": [
{
"frame": 0.15,
"func": "",
"params": []
},
{
"frame": 0.15,
"func": "atk",
"params": []
}
],
"_embeddedPlayers": [], "_embeddedPlayers": [],
"_additiveSettings": { "_additiveSettings": {
"__id__": 7 "__id__": 7
@@ -69,12 +80,12 @@
"__type__": "cc.ObjectCurve", "__type__": "cc.ObjectCurve",
"_times": [ "_times": [
0, 0,
0.041666666666666664, 0.05,
0.08333333333333333, 0.1,
0.125, 0.15,
0.16666666666666666, 0.2,
0.20833333333333334, 0.25,
0.25 0.3
], ],
"_values": [ "_values": [
{ {

View File

@@ -96,7 +96,7 @@
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
"x": 0, "x": 0,
"y": 0, "y": -55,
"z": 0 "z": 0
}, },
"_lrot": { "_lrot": {
@@ -137,7 +137,7 @@
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
"width": 65, "width": 65,
"height": 600 "height": 330
}, },
"_anchorPoint": { "_anchorPoint": {
"__type__": "cc.Vec2", "__type__": "cc.Vec2",
@@ -178,7 +178,7 @@
}, },
"_type": 0, "_type": 0,
"_fillType": 0, "_fillType": 0,
"_sizeMode": 0, "_sizeMode": 1,
"_fillCenter": { "_fillCenter": {
"__type__": "cc.Vec2", "__type__": "cc.Vec2",
"x": 0, "x": 0,
@@ -251,10 +251,10 @@
"__prefab": { "__prefab": {
"__id__": 11 "__id__": 11
}, },
"atk_x": 20, "atk_x": 0,
"atk_y": 20, "atk_y": 0,
"runType": 3, "runType": 3,
"endType": 2, "endType": 0,
"speed": 720, "speed": 720,
"time": 0, "time": 0,
"distance": 0, "distance": 0,
@@ -323,7 +323,7 @@
"_offset": { "_offset": {
"__type__": "cc.Vec2", "__type__": "cc.Vec2",
"x": 0, "x": 0,
"y": 0 "y": 50
}, },
"_size": { "_size": {
"__type__": "cc.Size", "__type__": "cc.Size",

View File

@@ -96,7 +96,7 @@
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
"x": 0, "x": 0,
"y": 0, "y": -30,
"z": 0 "z": 0
}, },
"_lrot": { "_lrot": {
@@ -108,7 +108,7 @@
}, },
"_lscale": { "_lscale": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
"x": 1, "x": 0.9,
"y": 1, "y": 1,
"z": 1 "z": 1
}, },
@@ -137,7 +137,7 @@
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
"width": 65, "width": 65,
"height": 600 "height": 330
}, },
"_anchorPoint": { "_anchorPoint": {
"__type__": "cc.Vec2", "__type__": "cc.Vec2",
@@ -178,7 +178,7 @@
}, },
"_type": 0, "_type": 0,
"_fillType": 0, "_fillType": 0,
"_sizeMode": 0, "_sizeMode": 1,
"_fillCenter": { "_fillCenter": {
"__type__": "cc.Vec2", "__type__": "cc.Vec2",
"x": 0, "x": 0,
@@ -251,10 +251,10 @@
"__prefab": { "__prefab": {
"__id__": 11 "__id__": 11
}, },
"atk_x": 20, "atk_x": 0,
"atk_y": 20, "atk_y": 0,
"runType": 3, "runType": 3,
"endType": 2, "endType": 0,
"speed": 720, "speed": 720,
"time": 0, "time": 0,
"distance": 0, "distance": 0,

View File

@@ -761,13 +761,17 @@
"__prefab": { "__prefab": {
"__id__": 33 "__id__": 33
}, },
"atk_x": 20, "atk_x": 60,
"atk_y": 40, "atk_y": 40,
"runType": 2, "runType": 2,
"endType": 0, "endType": 0,
"speed": 720, "speed": 720,
"time": 0, "time": 0,
"distance": 0, "distance": 0,
"forceStartX": -1,
"forceStartY": -1,
"summon_count": 1,
"height_offset": 0,
"_id": "" "_id": ""
}, },
{ {

View File

@@ -2120,8 +2120,8 @@
"__prefab": { "__prefab": {
"__id__": 97 "__id__": 97
}, },
"atk_x": 20, "atk_x": 0,
"atk_y": 40, "atk_y": 10,
"runType": 2, "runType": 2,
"endType": 0, "endType": 0,
"speed": 720, "speed": 720,
@@ -2129,6 +2129,8 @@
"distance": 0, "distance": 0,
"forceStartX": 0, "forceStartX": 0,
"forceStartY": -1, "forceStartY": -1,
"summon_count": 1,
"height_offset": 0,
"_id": "" "_id": ""
}, },
{ {

View File

@@ -59,6 +59,7 @@ export const DEBUFF_ICON_MAP: Record<number, DebuffIcon> = {
7006: DebuffIcon.AttackDebuff, // 减攻 7006: DebuffIcon.AttackDebuff, // 减攻
7007: DebuffIcon.Blood, // 出血 7007: DebuffIcon.Blood, // 出血
7008: DebuffIcon.Penetration, // 破甲 7008: DebuffIcon.Penetration, // 破甲
7025: DebuffIcon.LightningDamag, // 麻痹(雷系图标,注意 prefab 原始拼写少个 e
}; };
/** 易伤 buff 的 idHeroAtkSystem 结算时按此 id 汇总易伤值) */ /** 易伤 buff 的 idHeroAtkSystem 结算时按此 id 汇总易伤值) */
@@ -79,7 +80,7 @@ export interface BuffConfig {
modifiers?: BuffModifier[]; modifiers?: BuffModifier[];
tick?: BuffTickEffect; tick?: BuffTickEffect;
is_control?: boolean; is_control?: boolean;
control_kind?: 'frost' | 'stun' | 'none'; control_kind?: 'frost' | 'stun' | 'paralyze' | 'none';
info: string; info: string;
} }
@@ -107,12 +108,12 @@ export const BuffList: Record<number, BuffConfig> = {
is_control: true, control_kind: 'frost', is_control: true, control_kind: 'frost',
info: "冰冻目标,无法行动", info: "冰冻目标,无法行动",
}, },
// 击晕(控制 // 击晕(短控:施加瞬间技能 CD 削减 20%,持续期间 CD 停止增长
7004: { 7004: {
id: 7004, name: "击晕", icon: "Stat_Stun", id: 7004, name: "击晕", icon: "Stat_Stun",
category: BuffCategory.Control, duration: 2, max_stack: 1, category: BuffCategory.Control, duration: 1, max_stack: 1,
is_control: true, control_kind: 'stun', is_control: true, control_kind: 'stun',
info: "击晕目标,无法行动", info: "击晕目标 1 秒,无法行动,技能 CD 削减 20% 并停止增长",
}, },
// 中毒(纯伤害 DoT可叠层 // 中毒(纯伤害 DoT可叠层
7005: { 7005: {
@@ -242,4 +243,20 @@ export const BuffList: Record<number, BuffConfig> = {
modifiers: [{ attr: Attrs.defense, op: ModOp.PercentAdd, value: 100 }], modifiers: [{ attr: Attrs.defense, op: ModOp.PercentAdd, value: 100 }],
info: "防御提升 100持续 5 秒", info: "防御提升 100持续 5 秒",
}, },
// ==================== 控制 / 麻痹系 ====================
// 麻痹(控制:技能 CD 增长减速 50%,可被麻痹强化 buff 提升,累计达 100% 则停止增长)
7025: {
id: 7025, name: "麻痹", icon: "Stat_LightningDamag",
category: BuffCategory.Control, duration: 5, max_stack: 1,
is_control: true, control_kind: 'paralyze',
info: "麻痹目标,技能 CD 增长减慢 50%,持续 5 秒",
},
// 麻痹强化(提升麻痹对技能 CD 的减速量,与麻痹基础减速按百分点叠加)
7026: {
id: 7026, name: "麻痹强化", icon: "Stat_LightningDamag",
category: BuffCategory.Buff, duration: 5, max_stack: 1,
modifiers: [{ attr: Attrs.paralyze_power, op: ModOp.PercentAdd, value: 30 }],
info: "麻痹对技能 CD 的减速量额外提升 30%,持续 5 秒",
},
}; };

View File

@@ -40,7 +40,13 @@ export enum FightSet {
BACK_RANG = 20,//后退范围 BACK_RANG = 20,//后退范围
FiIGHT_TIME = 30,//战斗时间 FiIGHT_TIME = 30,//战斗时间
FROST_TIME = 3,//冰冻时间 FROST_TIME = 3,//冰冻时间
STUN_TIME = 2,//击晕时间 STUN_TIME = 1,//击晕时间(短控:施加瞬间 CD 削减,期间 CD 停止增长)
/** 麻痹持续时间(秒) */
PARALYZE_TIME = 5,
/** 麻痹对技能 CD 增长的基础减速量(百分点,可被麻痹强化 buff 提升,达 100 则停止增长) */
PARALYZE_CD_SLOW = 50,
/** 击晕施加瞬间的技能 CD 削减量百分点20 表示 ccd × 0.8 */
STUN_CD_CUT = 20,
SKILL_CAST_DELAY = 0.15, SKILL_CAST_DELAY = 0.15,
/** 多发/召唤技能每次实例化之间的间隔(秒),首个立即执行 */ /** 多发/召唤技能每次实例化之间的间隔(秒),首个立即执行 */
SUMMON_INTERVAL = 0.12, SUMMON_INTERVAL = 0.12,

View File

@@ -40,6 +40,7 @@ export enum Attrs {
puncture_dmg_bonus = "puncture_dmg_bonus", // 穿透后伤害增量(百分点;最终穿透系数 = PUNCTURE_DMG_RATIO * (1 + bonus/100) puncture_dmg_bonus = "puncture_dmg_bonus", // 穿透后伤害增量(百分点;最终穿透系数 = PUNCTURE_DMG_RATIO * (1 + bonus/100)
wfuny = "wfuny", // 风怒 wfuny = "wfuny", // 风怒
vulnerable_res = "vulnerable_res", // 易伤抗性(百分比减免易伤附加伤害) vulnerable_res = "vulnerable_res", // 易伤抗性(百分比减免易伤附加伤害)
paralyze_power = "paralyze_power", // 麻痹强化(百分点;提升麻痹对技能 CD 的减速量,累计达 100 则 CD 停止增长)
} }
/** /**

View File

@@ -110,7 +110,7 @@ class BuffManagerImpl {
* 判断目标是否处于指定类型的控制状态下。 * 判断目标是否处于指定类型的控制状态下。
* 唯一判定来源BuffComp 中是否存在对应 control_kind 的活跃控制 buff。 * 唯一判定来源BuffComp 中是否存在对应 control_kind 的活跃控制 buff。
*/ */
hasControl(target: ecs.Entity, kind: 'frost' | 'stun'): boolean { hasControl(target: ecs.Entity, kind: 'frost' | 'stun' | 'paralyze'): boolean {
if (!target.has(BuffComp)) return false; if (!target.has(BuffComp)) return false;
const buffComp = target.get(BuffComp); const buffComp = target.get(BuffComp);
for (const [buffId, layers] of buffComp.buffs) { for (const [buffId, layers] of buffComp.buffs) {

View File

@@ -13,6 +13,7 @@ import { buffManager } from "./BuffManager";
/** 控制类 buff 配置 id对应 BuffList */ /** 控制类 buff 配置 id对应 BuffList */
const BUFF_ID_FROST = 7003; const BUFF_ID_FROST = 7003;
const BUFF_ID_STUN = 7004; const BUFF_ID_STUN = 7004;
const BUFF_ID_PARALYZE = 7025;
@ecs.register('HeroAttrs') @ecs.register('HeroAttrs')
export class HeroAttrsComp extends ecs.Comp { export class HeroAttrsComp extends ecs.Comp {
public debugMode: boolean = false; public debugMode: boolean = false;
@@ -197,33 +198,39 @@ export class HeroAttrsComp extends ecs.Comp {
buffManager.applyBuff(this.ent, BUFF_ID_FROST, 0, 0, { duration: FightSet.FROST_TIME * time }); buffManager.applyBuff(this.ent, BUFF_ID_FROST, 0, 0, { duration: FightSet.FROST_TIME * time });
} }
/** 施加击晕:委托 buffManager 写入 BuffComp清零技能 CD */ /** 施加击晕:委托 buffManager 写入 BuffComp削减技能 CD(持续期间 CD 停止增长) */
toStun(time: number = 1) { toStun(time: number = 1) {
if (!this.ent) return; if (!this.ent) return;
buffManager.applyBuff(this.ent, BUFF_ID_STUN, 0, 0, { duration: FightSet.STUN_TIME * time }); buffManager.applyBuff(this.ent, BUFF_ID_STUN, 0, 0, { duration: FightSet.STUN_TIME * time });
// 击晕时 CD 清零 // 击晕瞬间技能 CD 削减 STUN_CD_CUT%(保留剩余进度,不再清零
const cutRate = 1 - FightSet.STUN_CD_CUT / 100;
for (const key in this.skills) { for (const key in this.skills) {
const skill = this.skills[key]; const skill = this.skills[key];
if (skill) { if (skill) {
skill.ccd = 0; skill.ccd = Math.max(0, skill.ccd * cutRate);
} }
} }
} }
updateCD(dt: number) { /** 施加麻痹:委托 buffManager 写入 BuffComp麻痹期间技能 CD 增长减速 */
// 如果处于冰冻状态,则技能 CD 暂停刷新 toParalyze(time: number = 1) {
if (this.isFrost()) return; if (!this.ent) return;
buffManager.applyBuff(this.ent, BUFF_ID_PARALYZE, 0, 0, { duration: FightSet.PARALYZE_TIME * time });
}
// 如果处于击晕状态,则技能 CD 暂停刷新(且保持清零状态) updateCD(dt: number) {
if (this.isStun()) { // 冰冻不影响 CD 值:冰冻状态下技能 CD 照常增长
for (const key in this.skills) {
const skill = this.skills[key]; // 击晕CD 已在施加瞬间削减,击晕期间停止增长
if (skill) { if (this.isStun()) return;
skill.ccd = 0;
} // 麻痹CD 增长减速 = 基础减速 + 麻痹强化;累计达 100% 则停止增长
} let cdRate = 1;
return; if (this.isParalyze()) {
const slowPct = Math.min(100, FightSet.PARALYZE_CD_SLOW + this.getFinalParalyzePower());
cdRate = 1 - slowPct / 100;
if (cdRate <= 0) return;
} }
for (const key in this.skills) { for (const key in this.skills) {
@@ -238,7 +245,7 @@ export class HeroAttrsComp extends ecs.Comp {
skill.ccd = actualCd; skill.ccd = actualCd;
continue; continue;
} }
skill.ccd = Math.min(actualCd, skill.ccd + dt); skill.ccd = Math.min(actualCd, skill.ccd + dt * cdRate);
} }
} }
/** 是否处于冰冻状态(统一走 BuffComp 判定) */ /** 是否处于冰冻状态(统一走 BuffComp 判定) */
@@ -249,6 +256,10 @@ export class HeroAttrsComp extends ecs.Comp {
isStun(): boolean { isStun(): boolean {
return !!this.ent && buffManager.hasControl(this.ent, 'stun'); return !!this.ent && buffManager.hasControl(this.ent, 'stun');
} }
/** 是否处于麻痹状态(统一走 BuffComp 判定) */
isParalyze(): boolean {
return !!this.ent && buffManager.hasControl(this.ent, 'paralyze');
}
getSkillLevel(skillId: number): number { getSkillLevel(skillId: number): number {
if (!skillId) return 0; if (!skillId) return 0;
return this.skills[skillId]?.lv ?? 0; return this.skills[skillId]?.lv ?? 0;
@@ -518,6 +529,12 @@ export class HeroAttrsComp extends ecs.Comp {
return this.vulnerable_res + mods.flatSum + mods.pctSum; return this.vulnerable_res + mods.flatSum + mods.pctSum;
} }
/** 最终麻痹强化 = 限时修饰(加法模型),提升麻痹对技能 CD 的减速量(百分点) */
public getFinalParalyzePower(): number {
const mods = this.aggregateTimedMods(Attrs.paralyze_power);
return mods.flatSum + mods.pctSum;
}
/** 最终防御值 = 基础 + 限时修饰(加法模型),供除法递减减伤公式使用 */ /** 最终防御值 = 基础 + 限时修饰(加法模型),供除法递减减伤公式使用 */
public getFinalDefense(): number { public getFinalDefense(): number {
const mods = this.aggregateTimedMods(Attrs.defense); const mods = this.aggregateTimedMods(Attrs.defense);

View File

@@ -250,9 +250,11 @@ export class SCastSystem extends ecs.ComblockSystem implements ecs.ISystemUpdate
const heroView = e.get(HeroViewComp); const heroView = e.get(HeroViewComp);
if (!heroAttrs || !heroView || !heroView.node) return; if (!heroAttrs || !heroView || !heroView.node) return;
if (this.isOutOfBattleBounds(heroView.node.position.x)) return; if (this.isOutOfBattleBounds(heroView.node.position.x)) return;
if (heroAttrs.is_dead || heroAttrs.is_reviving || heroAttrs.isFrost()) return; if (heroAttrs.is_dead || heroAttrs.is_reviving) return;
// 冰冻不影响 CD 值:冰冻/击晕期间 CD 照常刷新(击晕内部停涨),但不允许施法
heroAttrs.updateCD(this.dt); heroAttrs.updateCD(this.dt);
heroView.cd_show(); heroView.cd_show();
if (heroAttrs.isFrost() || heroAttrs.isStun()) return;
const castPlan = this.pickCastSkill(heroAttrs, heroView); const castPlan = this.pickCastSkill(heroAttrs, heroView);
if (!this.hasCastTarget(castPlan)) return; if (!this.hasCastTarget(castPlan)) return;