载入中...
搜索中...
未找到
ActionEncounter.cpp
浏览该文件的文档.
47 return Result<double>::failure(Diagnostic::error(DiagnosticCode::PreconditionViolation, "Encounter is closed"));
50 Diagnostic::error(DiagnosticCode::InvalidArgument, "Positive finite damage and monotonic tick required"));
52 return Result<double>::failure(Diagnostic::error(DiagnosticCode::Conflict, "Reward delivery is pending"));
89 Diagnostic::error(DiagnosticCode::InvariantViolation, "Encounter requires sole damage provider ownership"));
94Result<void> ActionEncounter::claim(GameState& state, Tracker& tracker, std::string_view encounterId) {
96 auto result = ActionKillReward::settle(impl_->player, state, tracker, *impl_->pending, encounterId);
const eve::script::BindingContractRegistry & registry
Definition ProjectIndexAutomatic.cpp:24
static Diagnostic error(DiagnosticCode code, std::string message, std::string path={})
Construct an error diagnostic with the standard error severity.
Definition Diagnostic.cpp:21
static std::optional< LogicalId > parse(std::string_view text)
Parses a scoped logical name.
Definition Identity.cpp:37
static Result failure(Status status)
Construct a failed result from a structured status.
Definition Result.h:196
static Status success(StatusCode code=StatusCode::Ok)
Construct a successful status with an explicit non-error outcome.
Definition Status.cpp:19
static SubjectRef fromPersistentId(PersistentId id) noexcept
Wrap a persistent identity without changing its bytes.
Definition SubjectRef.h:32
bool isValid() const noexcept
Return whether this reference is valid and non-nil.
Definition SubjectRef.h:38
static Result< ActionNotifyRegistry > withBuiltins()
Build a registry containing the engine's standard semantic notify types.
Definition ActionNotifyRegistry.cpp:172
Optional target-domain adapter for timeline damage.
Definition ActionDamageBlock.h:54
virtual bool supports(ecs::EntityHandle target) const =0
Whether this sink can resolve the supplied target handle now.
static std::optional< Id128 > parse(std::string_view text) noexcept
Parses canonical UUID text.
Definition Identity.h:150
bool isClosed() const
True after close() or before the first construction of the provider.
Definition ActionEncounter.cpp:102
int lastTick() const
Last injected tick that successfully committed a hit, or -1 when none. @cost Cheap read of host-facin...
Definition ActionEncounter.cpp:104
Result< void > claim(GameState &state, Tracker &tracker, std::string_view encounterId)
Deliver the pending player kill to the canonical reward transaction.
Definition ActionEncounter.cpp:94
bool isBound() const
True after a successful bind while the encounter remains open.
Definition ActionEncounter.cpp:103
bool hasPendingReward() const
True while a committed death still needs reward delivery; saving is unsafe then.
Definition ActionEncounter.cpp:101
void close() noexcept
Abandon this transient encounter and unregister immediately before restart/load.
Definition ActionEncounter.cpp:26
~ActionEncounter()
Unregister the provider before destroying its link mapping.
Result< double > hit(bool playerAttacks, double amount, int tick)
Dispatch a physical hit through the action registry and authoritative RPG Vitals.
Definition ActionEncounter.cpp:45
Result< void > bind(RPGActor &player, RPGActor &enemy, std::string_view playerId, std::string_view enemyId)
Bind borrowed actors to stable per-life UUID strings.
Definition ActionEncounter.cpp:27
ActionEncounter()
Create an unbound encounter and scoped action damage provider.
Definition ActionEncounter.cpp:24
static Result< BattleVictoryReceipt > settle(const RPGDamageTarget &recipient, GameState &gameState, Tracker &tracker, const RPGActionDamageReceipt &death, std::string_view encounterId)
Grant XP, class skills, gold and quest progress once for a committed death.
Definition ActionKillReward.cpp:13
Scoped action damage provider using RPG Vitals as the sole health authority. @ownership Host owns thi...
Definition ActionDamageSink.h:51
@ InvalidArgument
@ PreconditionViolation
@ InvariantViolation
@ StaleHandle
@ Conflict
@ NoOp
detail::StrongUint64< detail::SimulationTickTag > SimulationTick
Deterministic simulation time step; it is not wall-clock time.
Definition Time.h:31
Definition Container.h:602
Context linking a routed event to its action execution.
Definition ActionNotifyRegistry.h:41
std::optional< ecs::EntityHandle > source
Optional source entity; resolved by consumers at call time.
Definition ActionNotifyRegistry.h:45
Owning event projection returned by the runtime sampler.
Definition ActionTimeline.h:160
std::optional< RPGActionDamageReceipt > pending
Definition ActionEncounter.cpp:11
Owning identity projection; the host owns the mapping, ECS owns the actor.
Definition ActionDamageSink.h:15