RPG 模块入口:属性 / 效果 / 状态 / 技能 / 结算五套系统的脚本绑定与帧调度点。 更多...
类 | |
| struct | AttributeModifier |
| 单条修改器。附加在某个属性上,参与最终值计算。 更多... | |
| class | AttributeOpTable |
| 自定义 op 注册表:opName -> f(currentResult, modifierValue) -> newResult。 更多... | |
| class | AttributeSystem |
| 面向 RPGActor 的属性操作静态入口。数据本身存放在 RPGActor::Attributes 组件里, 这里只是围绕组件的一组无状态操作函数(+ 一张全局自定义 op 表)。 更多... | |
| struct | AttributeValue |
| 单个属性的完整状态:基础值 + 修改器列表 + 计算结果缓存。 更多... | |
| struct | CastingState |
| 施法状态:同一时间每个 actor 只有一个进行中的引导/读条(可按需扩展为多槽)。 更多... | |
| struct | EffectDefinition |
| struct | EffectModifierSpec |
| 效果里携带的一条属性修改规格(应用到 AttributeSystem::addModifier)。 更多... | |
| class | EffectRegistry |
| 全局效果定义表:进程级单例,供任意模块 / 脚本按 id 引用。 更多... | |
| class | RPG |
| RPG 模块(eve.RPG):Actor 工厂 + 定义注册 + 帧调度 + 事件缓存。 更多... | |
| class | RPGActor |
| 属性 / 状态 / 技能三表合一的 ECS 实体。 更多... | |
| struct | SettlementContext |
| 结算上下文:通用的读写数据袋,字段完全由调用方与各阶段自行约定。 更多... | |
| class | SettlementPipeline |
| struct | SkillCastEvent |
| 技能释放结算事件:由 SkillSystem 在读条完成 / 瞬发技能释放时产生。 更多... | |
| struct | SkillCostSpec |
| struct | SkillDefinition |
| class | SkillRegistry |
| struct | SkillRuntime |
| 单个已学会技能的运行时状态(冷却)。 更多... | |
| class | SkillSystem |
| struct | StatusChangeEvent |
| 状态生命周期变更事件(施加 / 刷新 / 叠层 / 延长 / 移除 / 到期 / 拒绝)。 与 StatusTickEvent 分开:tick 是周期性数值触发,change 是实例结构变化。 更多... | |
| struct | StatusInstance |
| 状态实例:某个 Effect 施加到某个 actor 后的运行时记录。 更多... | |
| class | StatusSystem |
| struct | StatusTickEvent |
| 周期性状态触发的 tick 事件。周期效果(period > 0)不会自动修改属性, 而是每个周期产生一个 tick 事件交给上层(脚本或 C++ 结算系统)处理—— 这样伤害/治疗类周期效果可以完整地走 Settlement 流水线(护甲、抗性、暴击……), 而不是被引擎硬编码为直接扣血。 更多... | |
函数 | |
| double | computeAttributeValue (const AttributeValue &attr, const AttributeOpTable *customOps) |
| double | computeAttributeValue (const AttributeValue &attr, const struct AttributeOpTable *customOps=nullptr) |
| 纯函数:根据 base + modifiers 计算最终值。不依赖任何 ECS / 全局状态, 自定义 op 通过 customOps 传入(AttributeSystem 内部会传入全局注册表)。 | |
| Module_IMPL (RPG, new RPG()) | |
| bool | captureRpgState (StateValue &out) |
| RPGActor skill-state serialization for state hot reload. | |
| bool | restoreRpgState (const StateValue &in, std::string *err=nullptr) |
| bool | resetRpgState () |
详细描述
RPG 模块入口:属性 / 效果 / 状态 / 技能 / 结算五套系统的脚本绑定与帧调度点。
RPG 模块的基础实体:把属性 / 状态 / 技能三张表挂到一个 ECS 实体上。
各系统的完整设计说明见对应头文件: AttributeSystem.h / AttributeTypes.h — 属性 Effect.h — 效果(数据驱动定义) StatusSystem.h / StatusTypes.h — 状态(运行时实例,buff/debuff) Skill.h / SkillSystem.h / SkillTypes.h — 技能 Settlement.h — 结算流水线 以及总体设计文档:docs/2026-08-08-rpg-module-design.md
与引擎其他模块一致(参考 particles/ParticleEmitter、map/TileLayer), 组件是纯数据结构体,行为都放在对应的 *System 静态类里。
可扩展性:游戏可以直接使用 RPGActor,也可以仿照 docs/游戏模型设计.md 的示例,从 RPGActor 派生出自己的实体类型 (例如 Player : public RPGActor / Monster : public RPGActor), 在子类上追加自己的组件,同时天然复用属性/状态/技能三大组件与配套 System (View<RPGActor, RPGActor::Attributes> 等能看到所有派生实体)。
函数说明
◆ captureRpgState()
| bool eve::rpg::captureRpgState | ( | StateValue & | out | ) |
RPGActor skill-state serialization for state hot reload.
Captures per-actor known-skill cooldowns and the in-flight casting state. Casting targets are raw pointers and are not serialized (restored as null).
在文件 RpgStateProvider.cpp 第 37 行定义.
引用了 eve::StateValue::array(), eve::StateValue::boolean(), c, eve::rpg::RPGActor::liveActors(), eve::StateValue::number(), eve::StateValue::object(), eve::StateValue::pushBack(), eve::StateValue::set() , 以及 eve::StateValue::string().
◆ computeAttributeValue() [1/2]
| double eve::rpg::computeAttributeValue | ( | const AttributeValue & | attr, |
| const AttributeOpTable * | customOps | ||
| ) |
◆ computeAttributeValue() [2/2]
| double eve::rpg::computeAttributeValue | ( | const AttributeValue & | attr, |
| const struct AttributeOpTable * | customOps = nullptr |
||
| ) |
纯函数:根据 base + modifiers 计算最终值。不依赖任何 ECS / 全局状态, 自定义 op 通过 customOps 传入(AttributeSystem 内部会传入全局注册表)。
◆ Module_IMPL()
| eve::rpg::Module_IMPL | ( | RPG | , |
| new | RPG() | ||
| ) |
◆ resetRpgState()
| bool eve::rpg::resetRpgState | ( | ) |
在文件 RpgStateProvider.cpp 第 111 行定义.
引用了 eve::rpg::SkillSystem::cancelCast() , 以及 eve::rpg::RPGActor::liveActors().
◆ restoreRpgState()
| bool eve::rpg::restoreRpgState | ( | const StateValue & | in, |
| std::string * | err = nullptr |
||
| ) |
在文件 RpgStateProvider.cpp 第 62 行定义.
引用了 active, eve::rpg::CastingState::active, eve::StateValue::arraySize(), eve::StateValue::asString(), eve::StateValue::at(), c, eve::StateValue::find(), id, eve::StateValue::isArray(), eve::StateValue::isObject(), eve::StateValue::isString(), eve::rpg::SkillSystem::knows(), eve::rpg::RPGActor::liveActors(), n, eve::rpg::CastingState::remaining, eve::rpg::SkillSystem::setCooldownRemaining(), eve::rpg::CastingState::skillId, eve::rpg::CastingState::target, eve::rpg::CastingState::totalCastTime , 以及 v.