Owner-thread coordinator for grant and activation state. 更多...
#include <AbilityRuntime.h>
Public 成员函数 | |
| AbilityRuntime (ActionRuntime &runtime) | |
| Construct a system borrowing the action runtime used for submissions. | |
| Result< void > | registerDefinition (AbilityDefinition definition) |
| Register one canonical definition; duplicate ids are rejected. | |
| Result< void > | replaceDefinition (AbilityDefinition definition) |
| Transactionally replace one registered definition for future activations. | |
| Result< AbilityGrantId > | grant (std::string ownerId, const LogicalId &definitionId) |
| Grant a registered definition to a non-empty owner identity. | |
| Result< void > | revoke (AbilityGrantId grantId) |
| Revoke an inactive grant. Active grants must be synchronized/cancelled first. | |
| Result< AbilityGrantState > | findGrant (AbilityGrantId grantId) const |
| Return an owning grant-state snapshot. | |
| Result< AbilityDefinition > | findDefinition (const LogicalId &definitionId) const |
| Return an owning copy of a registered definition. | |
| Result< AbilityActivation > | activate (AbilityGrantId grantId, ActionRequest request, SimulationTick tick) |
| Submit an activation after cooldown, instancing and group checks. | |
| Result< AbilityActivation > | activate (AbilityGrantId grantId, SimulationTick tick) |
| Activate a grant with a request whose action id and tick come from the definition. | |
| Result< void > | cancel (AbilityActivationId activationId, SimulationTick tick) |
| Cancel one active activation through ActionRuntime, then synchronize links. | |
| Result< AbilityStepReport > | step (SimulationTick tick, Duration delta) |
| Advance every active execution, cool downs, and drop terminal links. | |
| std::vector< AbilityGrantId > | matchingGrants (std::string_view ownerId, std::string_view gameplayEventTag) const |
| Return grants whose declared gameplay-event triggers match an event tag. | |
| Result< void > | advanceCooldowns (Duration delta) |
| Decrease every cooldown using injected deterministic time. | |
| Result< std::size_t > | synchronize () |
| Remove links whose ActionRuntime execution reached a terminal phase. | |
| std::vector< AbilityActivation > | activeActivations () const |
| Return owning active-link snapshots in activation-id order. | |
详细描述
Owner-thread coordinator for grant and activation state.
Owns definitions, grants, cooldowns and activation links. Borrows ActionRuntime for phase submission/advance/cancel; never owns phase timers itself. Script and combat façades must project into this API rather than re-implementing step or timeline assembly. No method reads a wall clock or invokes scripts.
在文件 AbilityRuntime.h 第 100 行定义.
构造及析构函数说明
◆ AbilityRuntime()
|
inlineexplicit |
Construct a system borrowing the action runtime used for submissions.
在文件 AbilityRuntime.h 第 103 行定义.
成员函数说明
◆ activate() [1/2]
| Result< AbilityActivation > eve::action::AbilityRuntime::activate | ( | AbilityGrantId | grantId, |
| ActionRequest | request, | ||
| SimulationTick | tick | ||
| ) |
Submit an activation after cooldown, instancing and group checks.
- 参数
-
grantId Granted ability selected by the caller. request Fully owned request matching the definition's action id. tick Injected deterministic tick used when replacing an exclusive activation.
在文件 AbilityRuntime.cpp 第 189 行定义.
引用了 active, eve::Applied, eve::action::ActionRuntime::cancel(), cancelled, eve::Conflict, eve::Diagnostic::error(), eve::action::ExclusiveBlocking, eve::Result< T >::failure(), eve::action::ActionRuntime::find(), grant(), eve::action::Independent, instanceId, eve::InvalidArgument, eve::NotFound, eve::action::PerExecution, eve::action::PerOwner, eve::PreconditionViolation, request, eve::action::ActionRuntime::submit(), eve::Status::success(), eve::Result< T >::success(), tick, eve::detail::StrongUint64< Tag >::value() , 以及 eve::Duration::zero().
被这些函数引用 activate(), eve::action::ScriptActionRuntime::activateAbility() , 以及 eve::action::AbilityControllerRuntime::processNext().
◆ activate() [2/2]
| Result< AbilityActivation > eve::action::AbilityRuntime::activate | ( | AbilityGrantId | grantId, |
| SimulationTick | tick | ||
| ) |
Activate a grant with a request whose action id and tick come from the definition.
- 参数
-
grantId Granted ability selected by the caller. tick Injected deterministic tick used for exclusive replacement and request time.
- 备注
- Builds ActionRequest from the registered definition; callers that need targets or costs must use the ActionRequest overload instead.
在文件 AbilityRuntime.cpp 第 125 行定义.
引用了 eve::action::ActionRequest::actionId, activate(), eve::Diagnostic::error(), eve::Result< T >::failure(), grant(), eve::NotFound, request , 以及 tick.
◆ activeActivations()
| std::vector< AbilityActivation > eve::action::AbilityRuntime::activeActivations | ( | ) | const |
Return owning active-link snapshots in activation-id order.
在文件 AbilityRuntime.cpp 第 303 行定义.
引用了 result.
被这些函数引用 step().
◆ advanceCooldowns()
Decrease every cooldown using injected deterministic time.
在文件 AbilityRuntime.cpp 第 280 行定义.
引用了 eve::Applied, eve::Diagnostic::error(), eve::Result< T >::failure(), eve::Duration::fromNanoseconds(), grant(), eve::InvalidArgument, eve::Duration::isZero(), eve::Duration::nanoseconds(), eve::NoOp, eve::Status::success(), eve::Result< T >::success() , 以及 eve::Duration::zero().
被这些函数引用 step().
◆ cancel()
| Result< void > eve::action::AbilityRuntime::cancel | ( | AbilityActivationId | activationId, |
| SimulationTick | tick | ||
| ) |
Cancel one active activation through ActionRuntime, then synchronize links.
- 参数
-
activationId Active activation selected by the caller. tick Injected deterministic tick of the cancel.
在文件 AbilityRuntime.cpp 第 140 行定义.
引用了 eve::Applied, eve::action::ActionRuntime::cancel(), cancelled, eve::Diagnostic::error(), eve::Result< T >::failure(), found, eve::NotFound, status, eve::Status::success(), eve::Result< T >::success(), synchronize() , 以及 tick.
◆ findDefinition()
| Result< AbilityDefinition > eve::action::AbilityRuntime::findDefinition | ( | const LogicalId & | definitionId | ) | const |
Return an owning copy of a registered definition.
在文件 AbilityRuntime.cpp 第 117 行定义.
引用了 eve::Diagnostic::error(), eve::Result< T >::failure(), eve::LogicalId::format(), found, eve::NotFound , 以及 eve::Result< T >::success().
◆ findGrant()
| Result< AbilityGrantState > eve::action::AbilityRuntime::findGrant | ( | AbilityGrantId | grantId | ) | const |
Return an owning grant-state snapshot.
在文件 AbilityRuntime.cpp 第 109 行定义.
引用了 eve::Diagnostic::error(), eve::Result< T >::failure(), found, eve::NotFound , 以及 eve::Result< T >::success().
◆ grant()
| Result< AbilityGrantId > eve::action::AbilityRuntime::grant | ( | std::string | ownerId, |
| const LogicalId & | definitionId | ||
| ) |
Grant a registered definition to a non-empty owner identity.
在文件 AbilityRuntime.cpp 第 76 行定义.
引用了 eve::Applied, eve::Diagnostic::error(), eve::Result< T >::failure(), eve::LogicalId::format(), eve::InvalidArgument, eve::NotFound, eve::action::PerOwner, state, eve::Status::success(), eve::Result< T >::success(), eve::detail::StrongUint64< Tag >::value() , 以及 eve::Duration::zero().
被这些函数引用 activate(), activate(), advanceCooldowns(), eve::action::ScriptActionRuntime::grantAbility() , 以及 matchingGrants().
◆ matchingGrants()
| std::vector< AbilityGrantId > eve::action::AbilityRuntime::matchingGrants | ( | std::string_view | ownerId, |
| std::string_view | gameplayEventTag | ||
| ) | const |
Return grants whose declared gameplay-event triggers match an event tag.
在文件 AbilityRuntime.cpp 第 264 行定义.
被这些函数引用 eve::action::ScriptActionRuntime::matchingAbilities().
◆ registerDefinition()
| Result< void > eve::action::AbilityRuntime::registerDefinition | ( | AbilityDefinition | definition | ) |
Register one canonical definition; duplicate ids are rejected.
在文件 AbilityRuntime.cpp 第 44 行定义.
引用了 eve::AlreadyExists, eve::Applied, eve::Diagnostic::error(), eve::Result< T >::failure(), key, eve::Status::success(), eve::Result< T >::success() , 以及 valid.
被这些函数引用 eve::action::ScriptActionRuntime::registerAbilityDefinition().
◆ replaceDefinition()
| Result< void > eve::action::AbilityRuntime::replaceDefinition | ( | AbilityDefinition | definition | ) |
Transactionally replace one registered definition for future activations.
Existing grants and cooldowns remain valid. Active ActionExecution objects retain the owning definition snapshot captured when they were submitted. A definition with grants cannot change its instancing policy.
在文件 AbilityRuntime.cpp 第 55 行定义.
引用了 eve::Applied, eve::Conflict, eve::Diagnostic::error(), eve::Result< T >::failure(), found, key, eve::NotFound, eve::Status::success(), eve::Result< T >::success() , 以及 valid.
被这些函数引用 eve::action::ScriptActionRuntime::replaceAbilityDefinition().
◆ revoke()
| Result< void > eve::action::AbilityRuntime::revoke | ( | AbilityGrantId | grantId | ) |
Revoke an inactive grant. Active grants must be synchronized/cancelled first.
在文件 AbilityRuntime.cpp 第 97 行定义.
引用了 eve::Applied, eve::Conflict, eve::Diagnostic::error(), eve::Result< T >::failure(), found, eve::NotFound, eve::Status::success() , 以及 eve::Result< T >::success().
◆ step()
| Result< AbilityStepReport > eve::action::AbilityRuntime::step | ( | SimulationTick | tick, |
| Duration | delta | ||
| ) |
Advance every active execution, cool downs, and drop terminal links.
- 参数
-
tick Injected deterministic tick passed to ActionRuntime::advance. delta Injected deterministic duration for phase advance and cooldowns.
- 返回
- Owning step report; if any advance fails, still synchronizes then returns that failure.
- 备注
- Each SimulationTick may be stepped at most once. A second step at the same tick returns Conflict without mutating activations or cooldowns; ticks must not move backwards. @cost Relative to active activation count; amortize per simulation step, not per grant.
在文件 AbilityRuntime.cpp 第 152 行定义.
引用了 activeActivations(), eve::action::AbilityStepReport::activeCount, eve::action::ActionRuntime::advance(), advanceCooldowns(), eve::action::AbilityStepReport::advances, eve::Applied, eve::action::AbilityStepReport::completedCount, eve::Conflict, eve::Diagnostic::error(), eve::action::AbilityStepAdvance::executionId, eve::Result< T >::failure(), eve::InvalidArgument, status, eve::Status::success(), eve::Result< T >::success(), synchronize(), tick, eve::detail::StrongUint64< Tag >::value() , 以及 eve::Duration::zero().
被这些函数引用 eve::action::ScriptActionRuntime::advanceAbilities().
◆ synchronize()
| Result< std::size_t > eve::action::AbilityRuntime::synchronize | ( | ) |
Remove links whose ActionRuntime execution reached a terminal phase.
在文件 AbilityRuntime.cpp 第 292 行定义.
引用了 eve::Applied, eve::action::ActionRuntime::find(), eve::NoOp, removed, eve::Status::success() , 以及 eve::Result< T >::success().
该类的文档由以下文件生成:
- src/modules/action/AbilityRuntime.h
- src/modules/action/AbilityRuntime.cpp