载入中...
搜索中...
未找到
eve::rpg::StatusSystem类 参考

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()

◆ clearApplyConditions()

void eve::rpg::StatusSystem::clearApplyConditions ( )
static

Clears apply conditions.

在文件 StatusSystem.cpp 第 282 行定义.

◆ clearLifecycleHooks()

void eve::rpg::StatusSystem::clearLifecycleHooks ( )
static

Clears lifecycle hooks.

在文件 StatusSystem.cpp 第 302 行定义.

◆ clearStackPolicies()

void eve::rpg::StatusSystem::clearStackPolicies ( )
static

Clears stack policies.

在文件 StatusSystem.cpp 第 292 行定义.

◆ getActiveCount()

int eve::rpg::StatusSystem::getActiveCount ( RPGActor *  actor)
static

Returns the active count.

在文件 StatusSystem.cpp 第 673 行定义.

被这些函数引用 eve::rpg::RPGActor::getStatusCount().

◆ getActiveEffectId()

std::string eve::rpg::StatusSystem::getActiveEffectId ( RPGActor *  actor,
int  index 
)
static

Returns the active effect id.

在文件 StatusSystem.cpp 第 675 行定义.

引用了 effect , 以及 index.

被这些函数引用 eve::rpg::RPGActor::getStatusEffectId().

◆ getActiveInstanceId()

int eve::rpg::StatusSystem::getActiveInstanceId ( RPGActor *  actor,
int  index 
)
static

Returns the active instance id.

在文件 StatusSystem.cpp 第 696 行定义.

引用了 effect , 以及 index.

被这些函数引用 eve::rpg::RPGActor::getStatusInstanceId().

◆ getActiveRemaining()

float eve::rpg::StatusSystem::getActiveRemaining ( RPGActor *  actor,
int  index 
)
static

Returns the active remaining.

在文件 StatusSystem.cpp 第 690 行定义.

引用了 effect , 以及 index.

被这些函数引用 eve::rpg::RPGActor::getStatusRemaining().

◆ getActiveSource()

std::string eve::rpg::StatusSystem::getActiveSource ( RPGActor *  actor,
int  index 
)
static

Returns the active source.

在文件 StatusSystem.cpp 第 702 行定义.

引用了 effect , 以及 index.

被这些函数引用 eve::rpg::RPGActor::getStatusSource().

◆ getActiveStacks()

int eve::rpg::StatusSystem::getActiveStacks ( RPGActor *  actor,
int  index 
)
static

Returns the active stacks.

在文件 StatusSystem.cpp 第 681 行定义.

引用了 effect , 以及 index.

被这些函数引用 eve::rpg::RPGActor::getStatusStacks().

◆ getProp()

std::string eve::rpg::StatusSystem::getProp ( RPGActor *  actor,
int  instanceId,
const std::string &  key,
const std::string &  fallback = {} 
)
static

按实例 id 读写 props;找不到实例时 get 返回 fallback,set 返回 false。

在文件 StatusSystem.cpp 第 708 行定义.

引用了 effect , 以及 key.

被这些函数引用 eve::rpg::RPGActor::getStatusProp().

◆ hasApplyCondition()

bool eve::rpg::StatusSystem::hasApplyCondition ( const std::string &  name)
static

True when apply condition.

在文件 StatusSystem.cpp 第 280 行定义.

引用了 name.

◆ hasEffect()

bool eve::rpg::StatusSystem::hasEffect ( RPGActor *  actor,
const std::string &  effectId 
)
static

True when effect.

在文件 StatusSystem.cpp 第 660 行定义.

被这些函数引用 eve::rpg::RPGActor::hasEffect().

◆ hasLifecycleHook()

bool eve::rpg::StatusSystem::hasLifecycleHook ( const std::string &  name)
static

True when lifecycle hook.

在文件 StatusSystem.cpp 第 300 行定义.

引用了 name.

◆ hasStackPolicy()

bool eve::rpg::StatusSystem::hasStackPolicy ( const std::string &  name)
static

True when stack policy.

在文件 StatusSystem.cpp 第 290 行定义.

引用了 name.

◆ hasTag()

bool eve::rpg::StatusSystem::hasTag ( RPGActor *  actor,
const std::string &  tag 
)
static

是否存在任一效果定义带有该 tag 的活动实例。

在文件 StatusSystem.cpp 第 664 行定义.

引用了 effect , 以及 tag.

被这些函数引用 eve::rpg::RPGActor::hasStatusTag().

◆ pollChanges()

void eve::rpg::StatusSystem::pollChanges ( std::vector< StatusChangeEvent > &  out)
static

取出并清空自上次调用以来累积的生命周期变更事件。

在文件 StatusSystem.cpp 第 842 行定义.

被这些函数引用 eve::rpg::RPG::update().

◆ pollTicks()

void eve::rpg::StatusSystem::pollTicks ( std::vector< StatusTickEvent > &  out)
static

取出并清空自上次调用以来累积的周期 tick 事件(push/poll 风格,见 event 模块)。

在文件 StatusSystem.cpp 第 836 行定义.

被这些函数引用 eve::rpg::RPG::update().

◆ registerApplyCondition()

void eve::rpg::StatusSystem::registerApplyCondition ( const std::string &  name,
ApplyCondition  fn 
)
static

Registers apply condition.

在文件 StatusSystem.cpp 第 274 行定义.

引用了 fn , 以及 name.

◆ registerLifecycleHook()

void eve::rpg::StatusSystem::registerLifecycleHook ( const std::string &  name,
LifecycleHook  fn 
)
static

Registers lifecycle hook.

在文件 StatusSystem.cpp 第 294 行定义.

引用了 fn , 以及 name.

◆ registerStackPolicy()

void eve::rpg::StatusSystem::registerStackPolicy ( const std::string &  name,
StackPolicyFn  fn 
)
static

Registers stack policy.

在文件 StatusSystem.cpp 第 284 行定义.

引用了 fn , 以及 name.

◆ remove()

eve::Result< void > eve::rpg::StatusSystem::remove ( RPGActor *  actor,
int  instanceId 
)
static

◆ removeByEffect()

int eve::rpg::StatusSystem::removeByEffect ( RPGActor *  actor,
const std::string &  effectId 
)
static

移除该 actor 身上所有 effectId 匹配的实例;返回移除数量。

在文件 StatusSystem.cpp 第 639 行定义.

引用了 effect, ids, eve::rpg::matchingIds() , 以及 eve::rpg::removeMatching().

被这些函数引用 eve::rpg::RPGActor::removeStatusByEffect().

◆ removeBySource()

int eve::rpg::StatusSystem::removeBySource ( RPGActor *  actor,
const std::string &  source 
)
static

移除该 actor 身上所有 source 匹配的实例;返回移除数量。

在文件 StatusSystem.cpp 第 646 行定义.

引用了 effect, ids, eve::rpg::matchingIds(), eve::rpg::removeMatching() , 以及 source.

被这些函数引用 eve::rpg::RPGActor::removeStatusBySource().

◆ removeByTag()

int eve::rpg::StatusSystem::removeByTag ( RPGActor *  actor,
const std::string &  tag 
)
static

移除该 actor 身上所有 tag 匹配(效果定义带该 tag)的实例;返回移除数量。

在文件 StatusSystem.cpp 第 653 行定义.

引用了 effect, ids, eve::rpg::matchingIds(), eve::rpg::removeMatching() , 以及 tag.

被这些函数引用 eve::rpg::RPGActor::removeStatusByTag().

◆ setProp()

bool eve::rpg::StatusSystem::setProp ( RPGActor *  actor,
int  instanceId,
const std::string &  key,
const std::string &  value 
)
static

Sets the prop.

在文件 StatusSystem.cpp 第 719 行定义.

引用了 effect, key , 以及 value.

被这些函数引用 eve::rpg::RPGActor::setStatusProp().

◆ unregisterApplyCondition()

void eve::rpg::StatusSystem::unregisterApplyCondition ( const std::string &  name)
static

Unregisters apply condition.

在文件 StatusSystem.cpp 第 278 行定义.

引用了 name.

◆ unregisterLifecycleHook()

void eve::rpg::StatusSystem::unregisterLifecycleHook ( const std::string &  name)
static

Unregisters lifecycle hook.

在文件 StatusSystem.cpp 第 298 行定义.

引用了 name.

◆ unregisterStackPolicy()

void eve::rpg::StatusSystem::unregisterStackPolicy ( const std::string &  name)
static

Unregisters stack policy.

在文件 StatusSystem.cpp 第 288 行定义.

引用了 name.

◆ update()


该类的文档由以下文件生成: