EVENGINE_API_PLATFORM public API. 更多...
#include <StatusSystem.h>
Public 类型 | |
| using | ApplyCondition = std::function< bool(RPGActor *actor, const EffectDefinition &def, const std::string &source, std::string &outReason)> |
| 施加前条件:返回 false 表示拒绝施加。 全部已注册条件按注册表遍历(AND);任一失败则 apply 返回 -1 并产生 action="reject" 事件。 | |
| using | StackPolicyFn = std::function< int(RPGActor *actor, StatusInstance &existing, const EffectDefinition &def, const std::string &source)> |
| 自定义叠加策略:在已有效果的临时 StatusInstance projection 上运行。 | |
| using | LifecycleHook = std::function< void(const StatusChangeEvent &ev)> |
| 生命周期钩子:每次产生 StatusChangeEvent 时同步回调(在事件入队之后)。 | |
静态 Public 成员函数 | |
| static void | registerApplyCondition (const std::string &name, ApplyCondition fn) |
| Registers apply condition. | |
| static void | unregisterApplyCondition (const std::string &name) |
| Unregisters apply condition. | |
| static bool | hasApplyCondition (const std::string &name) |
| True when apply condition. | |
| static void | clearApplyConditions () |
| Clears apply conditions. | |
| static void | registerStackPolicy (const std::string &name, StackPolicyFn fn) |
| Registers stack policy. | |
| static void | unregisterStackPolicy (const std::string &name) |
| Unregisters stack policy. | |
| static bool | hasStackPolicy (const std::string &name) |
| True when stack policy. | |
| static void | clearStackPolicies () |
| Clears stack policies. | |
| static void | registerLifecycleHook (const std::string &name, LifecycleHook fn) |
| Registers lifecycle hook. | |
| static void | unregisterLifecycleHook (const std::string &name) |
| Unregisters lifecycle hook. | |
| static bool | hasLifecycleHook (const std::string &name) |
| True when lifecycle hook. | |
| static void | clearLifecycleHooks () |
| Clears lifecycle hooks. | |
| static eve::Result< int > | apply (RPGActor *actor, const std::string &effectId, const std::string &source="") |
| Status application backed by the generic EffectContainer. | |
| static eve::Result< void > | remove (RPGActor *actor, int instanceId) |
| Removal of one status by its legacy adapter id. | |
| static int | removeByEffect (RPGActor *actor, const std::string &effectId) |
| 移除该 actor 身上所有 effectId 匹配的实例;返回移除数量。 | |
| static int | removeBySource (RPGActor *actor, const std::string &source) |
| 移除该 actor 身上所有 source 匹配的实例;返回移除数量。 | |
| static int | removeByTag (RPGActor *actor, const std::string &tag) |
| 移除该 actor 身上所有 tag 匹配(效果定义带该 tag)的实例;返回移除数量。 | |
| static bool | hasEffect (RPGActor *actor, const std::string &effectId) |
| True when effect. | |
| static bool | hasTag (RPGActor *actor, const std::string &tag) |
| 是否存在任一效果定义带有该 tag 的活动实例。 | |
| static int | getActiveCount (RPGActor *actor) |
| Returns the active count. | |
| static std::string | getActiveEffectId (RPGActor *actor, int index) |
| Returns the active effect id. | |
| static int | getActiveStacks (RPGActor *actor, int index) |
| Returns the active stacks. | |
| static float | getActiveRemaining (RPGActor *actor, int index) |
| Returns the active remaining. | |
| static int | getActiveInstanceId (RPGActor *actor, int index) |
| Returns the active instance id. | |
| static std::string | getActiveSource (RPGActor *actor, int index) |
| Returns the active source. | |
| static std::string | getProp (RPGActor *actor, int instanceId, const std::string &key, const std::string &fallback={}) |
| 按实例 id 读写 props;找不到实例时 get 返回 fallback,set 返回 false。 | |
| static bool | setProp (RPGActor *actor, int instanceId, const std::string &key, const std::string &value) |
| Sets the prop. | |
| static eve::Result< StatusUpdateSummary > | update (double dt) |
| Advance all live RPG status executors with an injected simulation delta. | |
| static void | pollTicks (std::vector< StatusTickEvent > &out) |
| 取出并清空自上次调用以来累积的周期 tick 事件(push/poll 风格,见 event 模块)。 | |
| static void | pollChanges (std::vector< StatusChangeEvent > &out) |
| 取出并清空自上次调用以来累积的生命周期变更事件。 | |
详细描述
EVENGINE_API_PLATFORM public API.
在文件 StatusSystem.h 第 28 行定义.
成员类型定义说明
◆ ApplyCondition
| using eve::rpg::StatusSystem::ApplyCondition = std::function<bool(RPGActor *actor, const EffectDefinition &def, const std::string &source, std::string &outReason)> |
施加前条件:返回 false 表示拒绝施加。 全部已注册条件按注册表遍历(AND);任一失败则 apply 返回 -1 并产生 action="reject" 事件。
在文件 StatusSystem.h 第 34 行定义.
◆ LifecycleHook
| using eve::rpg::StatusSystem::LifecycleHook = std::function<void(const StatusChangeEvent &ev)> |
生命周期钩子:每次产生 StatusChangeEvent 时同步回调(在事件入队之后)。
在文件 StatusSystem.h 第 49 行定义.
◆ StackPolicyFn
| using eve::rpg::StatusSystem::StackPolicyFn = std::function<int(RPGActor *actor, StatusInstance &existing, const EffectDefinition &def, const std::string &source)> |
自定义叠加策略:在已有效果的临时 StatusInstance projection 上运行。
返回值约定与 apply() 相同(成功返回 adapter-owned 实例 id)。传入的 existing 永远是候选副本;策略不得通过 actor 直接修改状态或属性。 只有回调成功且候选数据通过校验后,StatusSystem 才会一次性提交 EffectContainer、AttributeSet 和 executor metadata。
在文件 StatusSystem.h 第 45 行定义.
成员函数说明
◆ apply()
|
static |
Status application backed by the generic EffectContainer.
- 返回
- Success with the adapter-owned legacy integer id (zero for an instant effect), or a structured rejection. The string EffectInstance id remains the lifecycle identity.
在文件 StatusSystem.cpp 第 315 行定义.
引用了 action, eve::rpg::StatusChangeEvent::actor, eve::Applied, bindings, eve::effects::Clamp, condition, eve::Conflict, created, current, eve::rpg::RPGActor::Statuses::effectByLegacyId, end, eve::effects::Extend, eve::Failed, eve::Result< T >::failure(), eve::rpg::EffectRegistry::find(), eve::effects::Increment, eve::InvalidArgument, eve::InvariantViolation, eve::effects::Keep, name, eve::rpg::RPGActor::Statuses::nextInstanceId, eve::NoOp, eve::NotFound, eve::rpg::StatusInstance::periodAccum, eve::PreconditionViolation, eve::rpg::StatusInstance::props, eve::effects::Reject, eve::rpg::StatusInstance::remaining, eve::effects::Replace, eve::effects::Reuse, eve::effects::Set, source, eve::rpg::StatusInstance::source, eve::rpg::StatusInstance::stacks, eve::Status::success(), eve::Result< T >::success() , 以及 updated.
被这些函数引用 eve::rpg::RPGActor::applyEffect().
◆ clearApplyConditions()
|
static |
Clears apply conditions.
在文件 StatusSystem.cpp 第 282 行定义.
◆ clearLifecycleHooks()
|
static |
Clears lifecycle hooks.
在文件 StatusSystem.cpp 第 302 行定义.
◆ clearStackPolicies()
|
static |
Clears stack policies.
在文件 StatusSystem.cpp 第 292 行定义.
◆ getActiveCount()
|
static |
Returns the active count.
在文件 StatusSystem.cpp 第 673 行定义.
被这些函数引用 eve::rpg::RPGActor::getStatusCount().
◆ getActiveEffectId()
|
static |
Returns the active effect id.
在文件 StatusSystem.cpp 第 675 行定义.
◆ getActiveInstanceId()
|
static |
Returns the active instance id.
在文件 StatusSystem.cpp 第 696 行定义.
◆ getActiveRemaining()
|
static |
Returns the active remaining.
在文件 StatusSystem.cpp 第 690 行定义.
◆ getActiveSource()
|
static |
Returns the active source.
在文件 StatusSystem.cpp 第 702 行定义.
◆ getActiveStacks()
|
static |
Returns the active stacks.
在文件 StatusSystem.cpp 第 681 行定义.
◆ getProp()
|
static |
按实例 id 读写 props;找不到实例时 get 返回 fallback,set 返回 false。
在文件 StatusSystem.cpp 第 708 行定义.
被这些函数引用 eve::rpg::RPGActor::getStatusProp().
◆ hasApplyCondition()
|
static |
◆ hasEffect()
|
static |
◆ hasLifecycleHook()
|
static |
◆ hasStackPolicy()
|
static |
◆ hasTag()
|
static |
是否存在任一效果定义带有该 tag 的活动实例。
在文件 StatusSystem.cpp 第 664 行定义.
被这些函数引用 eve::rpg::RPGActor::hasStatusTag().
◆ pollChanges()
|
static |
◆ pollTicks()
|
static |
取出并清空自上次调用以来累积的周期 tick 事件(push/poll 风格,见 event 模块)。
在文件 StatusSystem.cpp 第 836 行定义.
被这些函数引用 eve::rpg::RPG::update().
◆ registerApplyCondition()
|
static |
◆ registerLifecycleHook()
|
static |
◆ registerStackPolicy()
|
static |
◆ remove()
|
static |
Removal of one status by its legacy adapter id.
- 返回
- Applied when removed, or NotFound/Rejected with diagnostics.
在文件 StatusSystem.cpp 第 573 行定义.
引用了 eve::rpg::StatusChangeEvent::actor, eve::Applied, effect, eve::rpg::StatusInstance::effectId, eve::Failed, eve::Result< T >::failure(), eve::rpg::StatusInstance::instanceId, eve::InvalidArgument, eve::InvariantViolation, eve::NotFound, removed, eve::rpg::StatusInstance::source, eve::rpg::StatusInstance::stacks, eve::Status::success() , 以及 eve::Result< T >::success().
被这些函数引用 eve::rpg::removeMatching() , 以及 eve::rpg::RPGActor::removeStatus().
◆ removeByEffect()
|
static |
移除该 actor 身上所有 effectId 匹配的实例;返回移除数量。
在文件 StatusSystem.cpp 第 639 行定义.
引用了 effect, ids, eve::rpg::matchingIds() , 以及 eve::rpg::removeMatching().
◆ removeBySource()
|
static |
移除该 actor 身上所有 source 匹配的实例;返回移除数量。
在文件 StatusSystem.cpp 第 646 行定义.
引用了 effect, ids, eve::rpg::matchingIds(), eve::rpg::removeMatching() , 以及 source.
◆ removeByTag()
|
static |
移除该 actor 身上所有 tag 匹配(效果定义带该 tag)的实例;返回移除数量。
在文件 StatusSystem.cpp 第 653 行定义.
引用了 effect, ids, eve::rpg::matchingIds(), eve::rpg::removeMatching() , 以及 tag.
◆ setProp()
|
static |
◆ unregisterApplyCondition()
|
static |
◆ unregisterLifecycleHook()
|
static |
◆ unregisterStackPolicy()
|
static |
◆ update()
|
static |
Advance all live RPG status executors with an injected simulation delta.
- 返回
- Expiry/tick summary; invalid deltas leave all actor state unchanged.
在文件 StatusSystem.cpp 第 729 行定义.
引用了 eve::rpg::StatusChangeEvent::action, eve::rpg::StatusTickEvent::actor, eve::rpg::StatusChangeEvent::actor, eve::Applied, eve::rpg::RPGActor::Statuses::container, effect, eve::effects::EffectContainer::effectAt(), eve::rpg::RPGActor::Statuses::effectByLegacyId, eve::effects::EffectContainer::effectCount(), eve::rpg::StatusChangeEvent::effectId, eve::rpg::StatusUpdateSummary::elapsedSeconds, eve::rpg::StatusUpdateSummary::expired, eve::Failed, eve::Result< T >::failure(), eve::effects::EffectContainer::find(), eve::rpg::EffectRegistry::find(), eve::rpg::StatusChangeEvent::instanceId, eve::InvalidArgument, eve::InvariantViolation, eve::rpg::RPGActor::Statuses::legacyIdByEffect, eve::rpg::RPGActor::liveActors(), eve::rpg::RPGActor::Statuses::metadata, eve::rpg::RPGActor::Statuses::nextInstanceId, eve::rpg::StatusChangeEvent::source, eve::rpg::StatusChangeEvent::stacks, eve::Status::success(), eve::Result< T >::success(), eve::Result< T >::takeValue(), tick , 以及 eve::rpg::StatusUpdateSummary::ticks.
被这些函数引用 eve::rpg::RPG::update().
该类的文档由以下文件生成:
- src/modules/rpg/StatusSystem.h
- src/modules/rpg/StatusSystem.cpp