diff --git a/assets/script/game/hero/Hero.ts b/assets/script/game/hero/Hero.ts index ccae4c84..aa04d47c 100644 --- a/assets/script/game/hero/Hero.ts +++ b/assets/script/game/hero/Hero.ts @@ -104,6 +104,14 @@ export class Hero extends ecs.Entity { model.type = hero.type; model.fac = FacSet.HERO; + // 复制触发技能配置 + model.call = hero.call; + model.dead = hero.dead; + model.fstart = hero.fstart; + model.fend = hero.fend; + model.atking = hero.atking; + model.atked = hero.atked; + // 基础属性按等级倍率初始化 // 使用指数增长公式,等级2时为原来的3倍,等级3时为原来的9倍 (若需线性增长可改为 hero.ap * (1 + (model.lv - 1) * (FightSet.H_HERO_POW - 1))) model.ap = hero.ap * Math.pow(FightSet.MERGE_NEED, model.lv - 1); @@ -165,8 +173,8 @@ export class Hero extends ecs.Entity { } // 落地后触发 call 技能 - if (hero.call && hero.call.length > 0) { - hero.call.forEach(uuid => { + if (model.call && model.call.length > 0) { + model.call.forEach(uuid => { oops.message.dispatchEvent(GameEvent.TriggerSkill, { s_uuid: uuid, heroAttrs: model, diff --git a/assets/script/game/hero/HeroAtkSystem.ts b/assets/script/game/hero/HeroAtkSystem.ts index 9e3a6e56..8363b534 100644 --- a/assets/script/game/hero/HeroAtkSystem.ts +++ b/assets/script/game/hero/HeroAtkSystem.ts @@ -93,10 +93,9 @@ export class HeroAtkSystem extends ecs.ComblockSystem implements ecs.ISystemUpd /** 检查并触发受击附加技能 (atked) */ private checkAndTriggerAtkedSkills(heroAttrs: HeroAttrsComp, heroView: HeroViewComp) { - const heroInfo = HeroInfo[heroAttrs.hero_uuid]; - if (!heroInfo || !heroInfo.atked || heroInfo.atked.length === 0) return; + if (!heroAttrs.atked || heroAttrs.atked.length === 0) return; - heroInfo.atked.forEach(atkConfig => { + heroAttrs.atked.forEach(atkConfig => { if (heroAttrs.atked_count > 0 && heroAttrs.atked_count % atkConfig.t_num === 0) { oops.message.dispatchEvent(GameEvent.TriggerSkill, { s_uuid: atkConfig.s_uuid, @@ -274,11 +273,10 @@ export class HeroAtkSystem extends ecs.ComblockSystem implements ecs.ISystemUpd TAttrsComp.is_dead = true; // 触发死亡技能 - const heroInfo = HeroInfo[TAttrsComp.hero_uuid]; - if (heroInfo && heroInfo.dead && heroInfo.dead.length > 0) { + if (TAttrsComp.dead && TAttrsComp.dead.length > 0) { const view = entity.get(HeroViewComp); if (view) { - heroInfo.dead.forEach((uuid: number) => { + TAttrsComp.dead.forEach((uuid: number) => { oops.message.dispatchEvent(GameEvent.TriggerSkill, { s_uuid: uuid, heroAttrs: TAttrsComp, diff --git a/assets/script/game/hero/HeroAttrsComp.ts b/assets/script/game/hero/HeroAttrsComp.ts index 5157faf8..d3c75d57 100644 --- a/assets/script/game/hero/HeroAttrsComp.ts +++ b/assets/script/game/hero/HeroAttrsComp.ts @@ -1,6 +1,4 @@ import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS"; -import { Attrs } from "../common/config/HeroAttrs"; -import { BuffConf } from "../common/config/SkillSet"; import { HeroDisVal, HSkillInfo, HType } from "../common/config/heroSet"; import { mLogger } from "../common/Logger"; import { Timer } from "db://oops-framework/core/common/timer/Timer"; @@ -27,6 +25,15 @@ export class HeroAttrsComp extends ecs.Comp { // ==================== 攻击属性 (补充) ==================== skills: Record = {}; + + // ==================== 触发类技能 ==================== + call?: number[]; + dead?: number[]; + fstart?: number[]; + fend?: number[]; + atking?: {s_uuid: number, t_num: number}[]; + atked?: {s_uuid: number, t_num: number}[]; + // ==================== 特殊属性 ==================== critical: number = 0; // 暴击率 freeze_chance: number = 0; // 冰冻概率 @@ -180,7 +187,6 @@ export class HeroAttrsComp extends ecs.Comp { - // ==================== 技能距离缓存管理 ==================== /** * 更新技能距离缓存 @@ -232,6 +238,12 @@ export class HeroAttrsComp extends ecs.Comp { // 重置新增属性 this.skills = {}; + this.call = undefined; + this.dead = undefined; + this.fstart = undefined; + this.fend = undefined; + this.atking = undefined; + this.atked = undefined; this.critical = 0; this.freeze_chance = 0; this.revive_count = 0; diff --git a/assets/script/game/hero/HeroViewComp.ts b/assets/script/game/hero/HeroViewComp.ts index 050c95ed..b012b8a6 100644 --- a/assets/script/game/hero/HeroViewComp.ts +++ b/assets/script/game/hero/HeroViewComp.ts @@ -428,9 +428,8 @@ export class HeroViewComp extends CCComp { this.realDeadTime = this.monDeadTime; } - // 如果角色带有死亡触发技能,则由 SCastSystem 播放 playReady("dead"),不播放原有的 deaded 特效 - const heroInfo = HeroInfo[this.model.hero_uuid]; - if (heroInfo && heroInfo.dead) { + // 如果角色带有死亡触发技能,则由 SCastSystem 播放 playReady("dead") + if (this.model && this.model.dead && this.model.dead.length > 0) { // SCastSystem will handle the "dead" ready animation } else { // 播放默认死亡特效 diff --git a/assets/script/game/hero/Mon.ts b/assets/script/game/hero/Mon.ts index 1280aefa..dd595a52 100644 --- a/assets/script/game/hero/Mon.ts +++ b/assets/script/game/hero/Mon.ts @@ -166,6 +166,15 @@ export class Monster extends ecs.Entity { model.speed = hero.speed; model.type = hero.type; model.fac = FacSet.MON; + + // 复制触发技能配置 + model.call = hero.call; + model.dead = hero.dead; + model.fstart = hero.fstart; + model.fend = hero.fend; + model.atking = hero.atking; + model.atked = hero.atked; + // 标记是否 Boss,非 Boss 默认记作杂兵 model.is_boss =is_boss if(!model.is_boss){ @@ -219,8 +228,8 @@ export class Monster extends ecs.Entity { } // 落地后触发 call 技能 - if (hero.call && hero.call.length > 0) { - hero.call.forEach((uuid: number) => { + if (model.call && model.call.length > 0) { + model.call.forEach((uuid: number) => { oops.message.dispatchEvent(GameEvent.TriggerSkill, { s_uuid: uuid, heroAttrs: model, diff --git a/assets/script/game/hero/SCastSystem.ts b/assets/script/game/hero/SCastSystem.ts index 9862bd77..a7c9c20a 100644 --- a/assets/script/game/hero/SCastSystem.ts +++ b/assets/script/game/hero/SCastSystem.ts @@ -338,10 +338,9 @@ export class SCastSystem extends ecs.ComblockSystem implements ecs.ISystemUpdate /** 检查并触发攻击附加技能 (atking) */ private checkAndTriggerAtkingSkills(heroAttrs: HeroAttrsComp, heroView: HeroViewComp) { - const heroInfo = HeroInfo[heroAttrs.hero_uuid]; - if (!heroInfo || !heroInfo.atking || heroInfo.atking.length === 0) return; + if (!heroAttrs.atking || heroAttrs.atking.length === 0) return; - heroInfo.atking.forEach(atkConfig => { + heroAttrs.atking.forEach(atkConfig => { if (heroAttrs.atk_count > 0 && heroAttrs.atk_count % atkConfig.t_num === 0) { oops.message.dispatchEvent(GameEvent.TriggerSkill, { s_uuid: atkConfig.s_uuid, diff --git a/assets/script/game/map/MissionComp.ts b/assets/script/game/map/MissionComp.ts index 81a5f5c1..2dc8f8e3 100644 --- a/assets/script/game/map/MissionComp.ts +++ b/assets/script/game/map/MissionComp.ts @@ -439,15 +439,15 @@ export class MissionComp extends CCComp { const attrs = entity.get(HeroAttrsComp); const view = entity.get(HeroViewComp); if (!attrs || !view || attrs.is_dead || attrs.fac !== FacSet.HERO) return; - const info = HeroInfo[attrs.hero_uuid]; - if (!info) return; - const skillUuid = isStart ? info.fstart : info.fend; - if (skillUuid) { - oops.message.dispatchEvent(GameEvent.TriggerSkill, { - s_uuid: skillUuid, - heroAttrs: attrs, - heroView: view, - triggerType: isStart ? 'fstart' : 'fend' + const skillUuids = isStart ? attrs.fstart : attrs.fend; + if (skillUuids && skillUuids.length > 0) { + skillUuids.forEach(uuid => { + oops.message.dispatchEvent(GameEvent.TriggerSkill, { + s_uuid: uuid, + heroAttrs: attrs, + heroView: view, + triggerType: isStart ? 'fstart' : 'fend' + }); }); } });