载入中...
搜索中...
未找到
Settlement.h
浏览该文件的文档.
70[[nodiscard]] EVENGINE_API_FOUNDATION const char* settlementDispositionName(SettlementDisposition disposition) noexcept;
84 std::uint32_t emittedCount = 0;
136[[nodiscard]] EVENGINE_API_FOUNDATION eve::Result<void> validateSettlementRequest(const SettlementRequest& request);
229[[nodiscard]] EVENGINE_API_FOUNDATION eve::Result<std::vector<std::string>> verifySettlementResult(
260[[nodiscard]] EVENGINE_API_FOUNDATION eve::Result<std::vector<std::string>> verifySettlementReplayRecord(
438 [[nodiscard]] PreparedApply* pendingApply() noexcept { return pendingApply_ ? &*pendingApply_ : nullptr; }
461 SettlementContext(const SettlementRequest& request, SettlementResult& result, ISettlementPolicy& policy);
521 [[nodiscard]] virtual eve::Result<PreparedApply> prepareApply(const SettlementContext& context) = 0;
552 [[nodiscard]] eve::Result<void> addStage(StageKind kind, std::string name, int priority, StageFunction function);
563 [[nodiscard]] eve::Result<SettlementResult> settle(const SettlementRequest& request, ISettlementPolicy& policy,
638 [[nodiscard]] eve::Result<void> prepare(SettlementContext& context, SettlementResult& result) const;
Strong identity values shared by persistence, content and logical-name APIs.
Move-only, checked operation results for the common layer.
Versioned, integrity-checked persistence envelopes.
Stable reference to a runtime gameplay subject.
Common time values and an injectable deterministic simulation clock.
Owning, renderer-independent dynamic values.
A structured explanation of a failed, degraded, or noteworthy result.
Definition Diagnostic.h:94
Human-readable, scoped identifier in the form namespace:name.
Definition Identity.h:411
Tagged direct causation reference to an event or command.
Definition GameEvent.h:96
Strong business-workflow correlation identity.
Definition GameEvent.h:49
Deterministic in-memory stream of topic-neutral event envelopes.
Definition GameEvent.h:261
Domain-owned policy hooks used by the common settlement pipeline.
Definition Settlement.h:497
virtual eve::Result< void > targetMitigation(SettlementContext &context)=0
Apply target mitigation such as resistance or penetration rules.
virtual eve::Result< void > validate(SettlementContext &context)=0
Validate request and target-owned state without mutating it.
virtual eve::Result< void > armorShield(SettlementContext &context)=0
Apply armor and shield policy, recording absorbed amount.
virtual eve::Result< PreparedApply > prepareApply(const SettlementContext &context)=0
Build an atomic candidate mutation without publishing it.
virtual eve::Result< void > sourceModifiers(SettlementContext &context)=0
Apply source-side modifiers such as critical or elemental power.
virtual eve::Result< void > clamp(SettlementContext &context)=0
Configure policy-specific amount bounds for the generic clamp.
virtual ~ISettlementPolicy()=default
I settlement policy.
Prepared domain mutation used to make settlement application atomic.
Definition Settlement.h:281
PreparedApply(const PreparedApply &)=delete
std::function< eve::Result< void >()> CommitFunction
Definition Settlement.h:283
PreparedApply & operator=(const PreparedApply &)=delete
PreparedApply()=default
Construct an empty invalid mutation.
std::function< void()> RollbackFunction
Definition Settlement.h:284
Mutable calculation frame visible to policy and custom stage code.
Definition Settlement.h:338
SettlementDisposition disposition() const noexcept
Return the current semantic outcome.
Definition Settlement.h:391
const Value::Object & stageDetails() const noexcept
Return the current stage's owned explanation fields.
Definition Settlement.h:416
const SettlementRequest & request() const noexcept
Return the immutable request currently being settled.
Definition Settlement.h:341
void setCritical(bool value) noexcept
Mark the result as critical; late writes are rejected.
Definition Settlement.h:371
double magnitude() const noexcept
Return the current amount after all preceding stages.
Definition Settlement.h:347
const SettlementResult & projectedResult() const noexcept
Return the projected result visible to trigger preparation.
Definition Settlement.h:419
const game_event::GameEvent * pendingEvent() const noexcept
Return the prepared event, if the event stage created one.
Definition Settlement.h:448
PreparedApply * pendingApply() noexcept
Return the staged mutation, if the apply stage prepared one.
Definition Settlement.h:438
bool critical() const noexcept
Return whether a source policy marked this settlement critical.
Definition Settlement.h:381
const eve::Diagnostic * mutationViolation() const noexcept
Return a contract violation recorded by a late frame mutation.
Definition Settlement.h:411
double resisted() const noexcept
Return the accumulated amount removed by policy mitigation.
Definition Settlement.h:353
ISettlementPolicy & policy() const noexcept
Return the policy participating in this synchronous call.
Definition Settlement.h:344
double absorbed() const noexcept
Return the accumulated amount absorbed by policy barriers.
Definition Settlement.h:350
double clamped() const noexcept
Return the accumulated amount removed by the generic clamp.
Definition Settlement.h:356
Deterministically ordered, composable settlement pipeline.
Definition Settlement.h:542
std::function< eve::Result< void >(SettlementContext &)> StageFunction
Definition Settlement.h:544
std::function< eve::Result< SettlementResult >(const SettlementRequest &)> RequestExecutor
Executes one owning chain request using its request-specific policy and rule snapshot.
Definition Settlement.h:546
Definition Settlement.cpp:10
const char * settlementDispositionName(SettlementDisposition disposition) noexcept
Return the stable lowercase spelling of a settlement disposition.
Definition Settlement.cpp:256
@ SourceModifiers
@ TargetMitigation
@ Decision
@ Validate
@ Trigger
@ ArmorShield
const char * stageKindName(StageKind kind) noexcept
Return the stable lowercase spelling of a stage kind.
Definition Settlement.cpp:241
SettlementTraceLevel
Amount of stage explanation retained by one settlement request.
Definition Settlement.h:60
eve::Result< void > validateSettlementRequest(const SettlementRequest &request)
Validate the canonical semantic invariants of a settlement request.
Definition Settlement.cpp:40
SettlementDisposition
Semantic outcome of a completed settlement, distinct from its numeric amount.
Definition Settlement.h:49
@ PartiallyApplied
@ InvalidTarget
std::function< Result< ContentId >(std::string_view canonicalInput)> SnapshotHashProvider
Injected content-digest implementation used by snapshots.
Definition Snapshot.h:36
Definition Container.h:602
Indexed owning outcome for one independently committed settlement item.
Definition Settlement.h:265
std::optional< SettlementResult > result
Definition Settlement.h:269
SettlementRequest request
Definition Settlement.h:267
Bounded trigger-chain metadata carried by an owning settlement request.
Definition Settlement.h:82
std::vector< std::string > triggerPath
Definition Settlement.h:85
Caller-owned deterministic random decision recorded for replay and verification.
Definition Settlement.h:73
Domain-neutral input to one settlement operation.
Definition Settlement.h:107
std::string resource
Optional domain resource/channel key, for example hp, mana, armor, or fire.
Definition Settlement.h:113
std::string trigger
Stable re-entry key for a derived request; empty only for a root request.
Definition Settlement.h:119
game_event::CorrelationId correlation
Definition Settlement.h:125
std::vector< SettlementRandomDecision > decisions
Definition Settlement.h:117
game_event::CausationRef causation
Definition Settlement.h:124
Complete observable outcome of one successful settlement.
Definition Settlement.h:163
std::vector< SettlementRequest > derived
Owning derived requests emitted by the policy in deterministic order.
Definition Settlement.h:175
std::vector< SettlementStageResult > stages
Definition Settlement.h:172
std::optional< game_event::GameEvent > event
Definition Settlement.h:173
Explanation emitted for one executed stage.
Definition Settlement.h:145