Two-participant action encounter with generation-safe links and retryable kill delivery. @ownership Host owns this coordinator; ECS owns actors, GameState owns reward facts. @lifetime Retains handles and identity values only. Destroying either actor invalidates attacks. Recreate and bind after restore; no transient combat state is serialized. @thread Simulation owner thread only. @reentrancy Native provider supports queries must not mutate participants or registrations; no scripts are invoked by this coordinator. 更多...
#include <ActionEncounter.h>
类 | |
| struct | Impl |
Public 成员函数 | |
| ActionEncounter () | |
| Create an unbound encounter and scoped action damage provider. | |
| ~ActionEncounter () | |
| Unregister the provider before destroying its link mapping. | |
| void | close () noexcept |
| Abandon this transient encounter and unregister immediately before restart/load. | |
| ActionEncounter (const ActionEncounter &)=delete | |
| ActionEncounter & | operator= (const ActionEncounter &)=delete |
| Result< void > | bind (RPGActor &player, RPGActor &enemy, std::string_view playerId, std::string_view enemyId) |
| Bind borrowed actors to stable per-life UUID strings. | |
| Result< double > | hit (bool playerAttacks, double amount, int tick) |
| Dispatch a physical hit through the action registry and authoritative RPG Vitals. | |
| Result< void > | claim (GameState &state, Tracker &tracker, std::string_view encounterId) |
| Deliver the pending player kill to the canonical reward transaction. | |
| bool | hasPendingReward () const |
| True while a committed death still needs reward delivery; saving is unsafe then. | |
| bool | isClosed () const |
| True after close() or before the first construction of the provider. | |
| bool | isBound () const |
| True after a successful bind while the encounter remains open. | |
| int | lastTick () const |
| Last injected tick that successfully committed a hit, or -1 when none. @cost Cheap read of host-facing observation; does not touch Vitals or inventory. | |
详细描述
Two-participant action encounter with generation-safe links and retryable kill delivery. @ownership Host owns this coordinator; ECS owns actors, GameState owns reward facts. @lifetime Retains handles and identity values only. Destroying either actor invalidates attacks. Recreate and bind after restore; no transient combat state is serialized. @thread Simulation owner thread only. @reentrancy Native provider supports queries must not mutate participants or registrations; no scripts are invoked by this coordinator.
在文件 ActionEncounter.h 第 20 行定义.
构造及析构函数说明
◆ ActionEncounter() [1/2]
| eve::rpg::ActionEncounter::ActionEncounter | ( | ) |
Create an unbound encounter and scoped action damage provider.
在文件 ActionEncounter.cpp 第 24 行定义.
◆ ~ActionEncounter()
|
default |
Unregister the provider before destroying its link mapping.
◆ ActionEncounter() [2/2]
|
delete |
成员函数说明
◆ bind()
| Result< void > eve::rpg::ActionEncounter::bind | ( | RPGActor & | player, |
| RPGActor & | enemy, | ||
| std::string_view | playerId, | ||
| std::string_view | enemyId | ||
| ) |
Bind borrowed actors to stable per-life UUID strings.
- 返回
- Failure for invalid links or outstanding reward; success replaces both links atomically.
- 备注
- Never reuse an enemy ID for a new life. Both destruction orders are safe.
在文件 ActionEncounter.cpp 第 27 行定义.
引用了 eve::Conflict, eve::Diagnostic::error(), eve::Result< T >::failure(), eve::SubjectRef::fromPersistentId(), eve::InvalidArgument, eve::SubjectRef::isValid(), eve::detail::Id128< Tag >::parse(), source, eve::Result< T >::success() , 以及 target.
◆ claim()
| Result< void > eve::rpg::ActionEncounter::claim | ( | GameState & | state, |
| Tracker & | tracker, | ||
| std::string_view | encounterId | ||
| ) |
Deliver the pending player kill to the canonical reward transaction.
- 返回
- Applied or duplicate NoOp; failures retain the receipt for retry. @ownership State and tracker are borrowed for this call only. @cost Copies quest and game state once per kill through BattleVictory.
在文件 ActionEncounter.cpp 第 94 行定义.
引用了 eve::Result< T >::failure(), eve::NoOp, result, eve::rpg::ActionKillReward::settle(), state, eve::Status::success() , 以及 eve::Result< T >::success().
◆ close()
|
noexcept |
Abandon this transient encounter and unregister immediately before restart/load.
- 备注
- Explicit lifecycle end; discards pending delivery intentionally. For continuation, claim first. Rebind creates a fresh provider. Idempotent, no participant mutation.
在文件 ActionEncounter.cpp 第 26 行定义.
◆ hasPendingReward()
| bool eve::rpg::ActionEncounter::hasPendingReward | ( | ) | const |
True while a committed death still needs reward delivery; saving is unsafe then.
在文件 ActionEncounter.cpp 第 101 行定义.
◆ hit()
| Result< double > eve::rpg::ActionEncounter::hit | ( | bool | playerAttacks, |
| double | amount, | ||
| int | tick | ||
| ) |
Dispatch a physical hit through the action registry and authoritative RPG Vitals.
- 返回
- Actual applied damage or failure without HP mutation.
- 备注
- Host owns range, cooldown and windup admission. Tick is injected and nondecreasing; no random stream is used. Pending player kill receipts block further hits until claimed. Multiple accepting providers are rejected before dispatch, independent of registration order. @cost One settlement transaction per admitted hit, substantially more than reading HP.
在文件 ActionEncounter.cpp 第 45 行定义.
引用了 eve::Conflict, context, eve::Diagnostic::error(), eve::Result< T >::failure(), eve::InvalidArgument, eve::InvariantViolation, lastTick(), eve::LogicalId::parse(), eve::PreconditionViolation, registry, source, eve::action::ActionNotifyContext::source, eve::StaleHandle, eve::Result< T >::success(), eve::action::IActionDamageSink::supports(), target, tick, eve::action::ActionTimelineEvent::type , 以及 eve::action::ActionNotifyRegistry::withBuiltins().
◆ isBound()
| bool eve::rpg::ActionEncounter::isBound | ( | ) | const |
True after a successful bind while the encounter remains open.
在文件 ActionEncounter.cpp 第 103 行定义.
◆ isClosed()
| bool eve::rpg::ActionEncounter::isClosed | ( | ) | const |
True after close() or before the first construction of the provider.
在文件 ActionEncounter.cpp 第 102 行定义.
◆ lastTick()
| int eve::rpg::ActionEncounter::lastTick | ( | ) | const |
Last injected tick that successfully committed a hit, or -1 when none. @cost Cheap read of host-facing observation; does not touch Vitals or inventory.
在文件 ActionEncounter.cpp 第 104 行定义.
被这些函数引用 hit().
◆ operator=()
|
delete |
该类的文档由以下文件生成:
- src/modules/rpg/ActionEncounter.h
- src/modules/rpg/ActionEncounter.cpp