diff --git a/assets/script/game/common/config/GameSet.ts b/assets/script/game/common/config/GameSet.ts index f4dfd981..a6c10ace 100644 --- a/assets/script/game/common/config/GameSet.ts +++ b/assets/script/game/common/config/GameSet.ts @@ -35,6 +35,7 @@ export enum FightSet { FiIGHT_TIME = 30,//战斗时间 // BACK_CHANCE=40,//击退概率 FROST_TIME = 3,//冰冻时间 + STUN_TIME = 2,//击晕时间 SKILL_CAST_DELAY = 0.15, CSKILL_START_X = -340, CSKILL_START_Y = 30, diff --git a/assets/script/game/common/config/HeroAttrs.ts b/assets/script/game/common/config/HeroAttrs.ts index 80c6e605..a0c3dadf 100644 --- a/assets/script/game/common/config/HeroAttrs.ts +++ b/assets/script/game/common/config/HeroAttrs.ts @@ -29,6 +29,8 @@ export enum Attrs { // ==================== 特殊效果属性 ==================== freeze_chance = "freeze_chance", // 冰冻概率 freeze_res = "freeze_res", // 冰冻抗性 + stun_chance = "stun_chance", // 击晕概率 + stun_res = "stun_res", // 击晕抗性 knockback_chance = "knockback_chance", // 击退概率 knockback_distance = "knockback_distance", // 击退距离强化 knockback_res = "knockback_res", // 击退抗性 diff --git a/assets/script/game/hero/HeroAtkSystem.ts b/assets/script/game/hero/HeroAtkSystem.ts index affd48d2..cee72d77 100644 --- a/assets/script/game/hero/HeroAtkSystem.ts +++ b/assets/script/game/hero/HeroAtkSystem.ts @@ -184,17 +184,31 @@ export class HeroAtkSystem extends ecs.ComblockSystem implements ecs.ISystemUpd const freezeChance = (damageEvent.Attrs[Attrs.freeze_chance] || 0) - (TAttrsComp.freeze_res || 0); const isFrost = !TAttrsComp.isFrost() && this.checkChance(freezeChance); + // 击晕判定 + const stunChance = (damageEvent.Attrs[Attrs.stun_chance] || 0) - (TAttrsComp.stun_res || 0); + const isStun = !TAttrsComp.isStun() && this.checkChance(stunChance); + // 击退判定 const knockbackChance = (damageEvent.Attrs[Attrs.knockback_chance] || 0) - (TAttrsComp.knockback_res || 0); const isKnockback = this.checkChance(knockbackChance); - // ✅ 触发视图层表现(伤害数字、受击动画、冰冻、击退) + // ✅ 触发视图层表现(伤害数字、受击动画、冰冻、击晕、击退) if (targetView) { targetView.do_atked(damage, isCrit, damageEvent.s_uuid, false); targetView.playEnd(skillConf.endAnm); if (isFrost) { TAttrsComp.toFrost(); targetView.in_iced(TAttrsComp.frost_end_time); + if (damageEvent.Attrs.fac === FacSet.HERO) { + smc.vmdata.scores.freeze_count++; + } + } + if (isStun) { + TAttrsComp.toStun(); + targetView.in_stun(TAttrsComp.stun_end_time); + if (damageEvent.Attrs.fac === FacSet.HERO) { + smc.vmdata.scores.stun_count++; + } } if (isKnockback) { targetView.back(damageEvent.Attrs[Attrs.knockback_distance] || 0); diff --git a/assets/script/game/hero/HeroAttrsComp.ts b/assets/script/game/hero/HeroAttrsComp.ts index 02fc0070..9462fce6 100644 --- a/assets/script/game/hero/HeroAttrsComp.ts +++ b/assets/script/game/hero/HeroAttrsComp.ts @@ -49,6 +49,8 @@ export class HeroAttrsComp extends ecs.Comp { critical_res: number = 0; // 暴击抗性 freeze_chance: number = 0; // 冰冻概率 freeze_res: number = 0; // 冰冻抗性 + stun_chance: number = 0; // 击晕概率 + stun_res: number = 0; // 击晕抗性 knockback_chance: number = 0; // 击退概率 knockback_distance: number = 0; // 击退距离强化 knockback_res: number = 0; // 击退抗性 @@ -61,6 +63,7 @@ export class HeroAttrsComp extends ecs.Comp { frost_end_time: number = 0; + stun_end_time: number = 0; boom: boolean = false; // 自爆怪 @@ -100,6 +103,7 @@ export class HeroAttrsComp extends ecs.Comp { */ initAttrs() { this.frost_end_time = 0; + this.stun_end_time = 0; } /*******************基础属性管理********************/ @@ -162,11 +166,35 @@ export class HeroAttrsComp extends ecs.Comp { const frostTime = FightSet.FROST_TIME * time; this.frost_end_time = Math.max(this.frost_end_time, frostTime); } + + toStun(time: number=1) { + const stunTime = FightSet.STUN_TIME * time; + this.stun_end_time = Math.max(this.stun_end_time, stunTime); + + // 击晕时 CD 清零 + for (const key in this.skills) { + const skill = this.skills[key]; + if (skill) { + skill.ccd = 0; + } + } + } updateCD(dt: number){ // 如果处于冰冻状态,则技能 CD 暂停刷新 if (this.isFrost()) return; + // 如果处于击晕状态,则技能 CD 暂停刷新(且保持清零状态) + if (this.isStun()) { + for (const key in this.skills) { + const skill = this.skills[key]; + if (skill) { + skill.ccd = 0; + } + } + return; + } + for (const key in this.skills) { const skill = this.skills[key]; if (!skill) continue; @@ -185,6 +213,9 @@ export class HeroAttrsComp extends ecs.Comp { isFrost(): boolean { return this.frost_end_time > 0 } + isStun(): boolean { + return this.stun_end_time > 0 + } getSkillLevel(skillId: number): number { if (!skillId) return 0; return this.skills[skillId]?.lv ?? 0; @@ -352,6 +383,8 @@ export class HeroAttrsComp extends ecs.Comp { this.critical_res = 0; this.freeze_chance = 0; this.freeze_res = 0; + this.stun_chance = 0; + this.stun_res = 0; this.knockback_chance = 0; this.knockback_distance = 0; this.knockback_res = 0; @@ -363,6 +396,7 @@ export class HeroAttrsComp extends ecs.Comp { this.boom = false; this.frost_end_time = 0; + this.stun_end_time = 0; // 重置技能距离缓存 this.maxSkillDistance = 0; @@ -406,7 +440,12 @@ export class HeroBuffSystem extends ecs.ComblockSystem implements ecs.ISystemUpd attrsComp.frost_end_time = 0; } } - + if(attrsComp.stun_end_time > 0){ + attrsComp.stun_end_time -= 0.1; + if(attrsComp.stun_end_time <= 0){ + attrsComp.stun_end_time = 0; + } + } } void e; } diff --git a/assets/script/game/hero/HeroViewComp.ts b/assets/script/game/hero/HeroViewComp.ts index 66085cd6..7e8e746f 100644 --- a/assets/script/game/hero/HeroViewComp.ts +++ b/assets/script/game/hero/HeroViewComp.ts @@ -308,6 +308,11 @@ export class HeroViewComp extends CCComp { this.spawnTimedFx("game/skill/buff/iced", this.node, t); } + /** 击晕特效 */ + in_stun(t: number = 1) { + this.spawnTimedFx("game/skill/buff/stun", this.node, t); + } + /** 技能提示 */ private tooltip(type: number = 1, value: string = "", s_uuid: number = 1001, y: number = 50) { let pos = v3(0, 60); diff --git a/assets/script/game/hero/SCastSystem.ts b/assets/script/game/hero/SCastSystem.ts index 43e76121..8eedc683 100644 --- a/assets/script/game/hero/SCastSystem.ts +++ b/assets/script/game/hero/SCastSystem.ts @@ -110,6 +110,7 @@ export class SCastSystem extends ecs.ComblockSystem implements ecs.ISystemUpdate mockAttrs.ap = highestAp; mockAttrs.critical = 0; mockAttrs.freeze_chance = 0; + mockAttrs.stun_chance = 0; mockAttrs.puncture_chance = 0; mockAttrs.fac = FacSet.HERO; mockAttrs.type = HType.Long; // 假定为远程,拥有较长索敌范围 diff --git a/assets/script/game/skill/Skill.ts b/assets/script/game/skill/Skill.ts index 2cacd91c..b29506f4 100644 --- a/assets/script/game/skill/Skill.ts +++ b/assets/script/game/skill/Skill.ts @@ -212,6 +212,7 @@ export class Skill extends ecs.Entity { sDataCom.Attrs[Attrs.critical] = cAttrsComp.getRuntimeCritical() + sCrt; sDataCom.Attrs[Attrs.critical_damage] = cAttrsComp.getRuntimeCritDamageBonus(); sDataCom.Attrs[Attrs.freeze_chance] = cAttrsComp.getRuntimeFreezeChance() + sFrz; + sDataCom.Attrs[Attrs.stun_chance] = cAttrsComp.stun_chance || 0; sDataCom.Attrs[Attrs.knockback_chance] = cAttrsComp.knockback_chance || 0; sDataCom.Attrs[Attrs.knockback_distance] = cAttrsComp.knockback_distance || 0; sDataCom.Attrs[Attrs.puncture_chance] = cAttrsComp.getRuntimePunctureChance(); // 初始化携带施法者的穿透概率