$npx -y skills add HOBOBO/AbilityKit --skill ability-kitAbilityKit MOBA 技能框架速查与实现约束。涵盖两套触发器引擎(旧字符串键引擎 + 新 Plan 行为树引擎)、技能施放管线(SkillPipelineRunner/SkillCastCoordinator)、Pipeline(com.abilitykit.pipeline 独立包)、Effect 系统(替代旧 EffectSource)、BUFF 生命周期、Combat/Damage Pipeline、Continuous、Host/WorldBlueprints 多包装配、Console Demo 运行调试。触发场景:用户提到 abili
| 1 | # ability-kit skill |
| 2 | |
| 3 | 基于当前源码核校(2026-07-20)。本目录按业务域分子目录,避免扁平化难维护。 |
| 4 | |
| 5 | ## 最重要的架构事实(必读) |
| 6 | |
| 7 | ### 1. 存在两套完全独立、互不依赖的触发器 |
| 8 | |
| 9 | | 维度 | 旧引擎(第一套) | 新引擎(第二套,moba 实际生产用) | |
| 10 | |------|-----------------|--------------------------------| |
| 11 | | 位置 | `com.abilitykit.ability/Runtime/Ability/Triggering/` | `com.abilitykit.triggering/Runtime/` | |
| 12 | | EventBus 键 | `string eventId` + `TriggerEvent(Id, payload, args:IReadOnlyDictionary)` | 强类型 `EventKey<TArgs>` | |
| 13 | | TriggerRunner | 非泛型 `TriggerRunner`,`Compile(TriggerDef)→Register/RunOnce` | 泛型 `TriggerRunner<TCtx>`,phase+priority 排序,Cue/Lifecycle/Observer/Tracer | |
| 14 | | 行为定义 | `TriggerDef/ConditionDef/ActionDef` + `TriggerCompiler` | `TriggerPlan` 行为树(Sequence/Selector/Parallel/If/Repeat/Until/Scheduled/ActionCall...) | |
| 15 | | 数据来源 | `AbilityTriggerJsonDatabase`(弱类型 JSON) | `TriggerPlanJsonDatabase`(Plan JSON,多形态 + 校验器) | |
| 16 | | 服务范围 | 仅 ability 包自己的 Effect 层 | moba demo 的技能/被动/BUFF/伤害/投射/区域 全部事件 | |
| 17 | |
| 18 | **陷阱**:订阅旧 EventBus、在新 EventBus 上 Publish(或反过来)事件永远收不到。两者命名空间也不同:`AbilityKit.Ability.Triggering.IEventBus` vs `AbilityKit.Triggering.Eventing.IEventBus`。详见 [triggering/two_engines.md](triggering/two_engines.md)。 |
| 19 | |
| 20 | ### 2. EffectSource 已被完全删除 |
| 21 | |
| 22 | 旧 skill 提到的 `EffectSourceRegistry/EffectSourceSnapshot/EffectSourceLiveRegistry/EffectSourceDebuggerWindow/ContextId/RootId/ParentId` 全部从代码中消失。替代方案是新的 Effect 系统:`com.abilitykit.ability/Runtime/Ability/Effect/`(`EffectService` + `EffectInstance` + `GameplayEffectSpec` + `EffectTriggering` + `IEffectEventSink`)。详见 [effect/README.md](effect/README.md)。 |
| 23 | |
| 24 | ### 3. Pipeline 已独立成单独的包 |
| 25 | |
| 26 | `com.abilitykit.pipeline/` 是独立 UPM 包(不再在 `Runtime/Ability/Share/Pipeline/` 下)。Pipeline 的接口全部泛型化 `<TCtx>`;调试基础设施改名:旧 `AbilityPipelineLiveRegistry` → `EditorPipelineRegistry`;旧 `PipelineGraphAsset`(ScriptableObject)不存在了,现在是 `PipelineGraph` 静态工厂类。详见 [pipeline/README.md](pipeline/README.md)。 |
| 27 | |
| 28 | ### 4. Host 装配拆分到 4 个包 |
| 29 | |
| 30 | | 包 | 职责 | |
| 31 | |----|------| |
| 32 | | `com.abilitykit.host` | WorldBlueprints 装配、HostRuntime、WorldHostBuilder | |
| 33 | | `com.abilitykit.world.di` | World 抽象(IWorld/WorldId/WorldCreateOptions)+ DI 容器 + WorldManager | |
| 34 | | `com.abilitykit.world.entitas` | Entitas 适配(EntitasWorld/IEntitasContextsFactory) | |
| 35 | | `com.abilitykit.host.extension` | FrameSync/BattleHost/RoomSync/CatchUp/GameStartSource 等扩展 | |
| 36 | |
| 37 | 旧 skill 把 `LogicWorldServer` 当框架类,**实际它只是示例** `LogicWorldServerExample`。详见 [host/README.md](host/README.md)。 |
| 38 | |
| 39 | ### 5. 旧 skill 引用过的已删除/已改名类(精选) |
| 40 | |
| 41 | | 旧引用 | 当前状态 | |
| 42 | |--------|---------| |
| 43 | | `SkillExecutor` | **已删除**,无替代同名类。技能执行入口是 `SkillCastCoordinator` + `SkillPipelineRunner` | |
| 44 | | `BattleServices`(Console Demo) | **已删除** | |
| 45 | | `MobaBuffApplySystem/MobaBuffTickSystem/MobaBuffRemoveSystem` | **已删除**,入口改为 `MobaBuffService.ApplyBuffImmediate/RemoveBuffImmediate` + `BuffLifecycleExecutor` + `BuffEventPublisher` | |
| 46 | | `TriggerDef.AllowExternal` | `AllowExternal` 已下移到配置/DTO 层(`TriggerSourceConfig`、`TriggerPlanJsonDatabase`、`ExecutableDto`) | |
| 47 | | `PipelineGraphAsset/PipelineGraphDto` | **不存在**,现为 `PipelineGraph` 静态类 | |
| 48 | | `AbilityPipelineRunDebuggerWindow`(EditorWindow) | **不存在**;调试通过 `EditorPipelineRegistry` + `EditorPipelineTraceRecorder` API | |
| 49 | | `EffectSourceRegistry/EffectSourceSnapshot/...` | **全部删除** | |
| 50 | | `EntitasContextsFactory` | 实际接口名是 `IEntitasContextsFactory`(实现:`MobaEntitasContextsFactory`) | |
| 51 | | `LogicWorldServer` | 仅示例类 `LogicWorldServerExample` | |
| 52 | |
| 53 | ## 目录结构(按业务域细分) |
| 54 | |
| 55 | ``` |
| 56 | ability-kit/ |
| 57 | ├── SKILL.md ← 本文件(主入口) |
| 58 | ├── common/ ← 跨业务通用 |
| 59 | │ ├── when_to_use.md ← 何时启用本 skill |
| 60 | │ ├── required_context.md ← 改动前必须明确的信息 |
| 61 | │ ├── output_expectations.md ← 输出应包含的内容 |
| 62 | │ ├── invariants.md ← 已验证的工程约定 |
| 63 | │ ├── procedure.md ← 标准排查步骤 |
| 64 | │ ├── upm_asmdef_notes.md ← UPM/asmdef 注意事项 |
| 65 | │ └── examples_and_troubleshooting.md ← 跨模块排查实例 |
| 66 | ├── triggering/ ← 触发器引擎 |
| 67 | │ ├── README.md ← 触发器总览 + key_files + 调用链 |
| 68 | │ └── two_engines.md ← 两套引擎深度对比 |
| 69 | ├── skill_buff/ ← 技能施放 + BUFF 业务 |
| 70 | │ └── README.md ← 调用链 + key_files + Plan 动词 |
| 71 | ├── pipeline/ ← com.abilitykit.pipeline 模块 |
| 72 | │ └── README.md |
| 73 | ├── effect/ ← Effect 系统(替代旧 EffectSource) |
| 74 | │ └── README.md |
| 75 | ├── combat_continuous/ ← 战斗伤害 + 持续行为 |
| 76 | │ └── README.md |
| 77 | ├── host/ ← Host/WorldBlueprints 装配 |
| 78 | │ └── READ |