载入中...
搜索中...
未找到
BattleControl.cpp
浏览该文件的文档.
45 DiagnosticCode::InvalidArgument, "battle, subject, and actor identities must be valid", "participant"));
51 Diagnostic::error(DiagnosticCode::NotFound, "actor is not a participant in the adapted battle", "actor"));
55 Diagnostic::error(DiagnosticCode::Conflict, "subject is already bound to another participant", "subject"));
58 Diagnostic::error(DiagnosticCode::Conflict, "actor is already bound to another subject", "actor"));
94 Diagnostic::error(DiagnosticCode::NotFound, "RPG battle gameplay instance was not found", "instance"));
135 Diagnostic::error(DiagnosticCode::NotFound, "RPG battle gameplay instance was not found", "instance"));
139 Diagnostic::error(DiagnosticCode::NotFound, "RPG battle participant was not found", "subject"));
142 DiagnosticCode::PreconditionViolation, "session does not control this RPG participant", "subject"));
146 const Value skillSchema(Value::Object{{"skillId", Value(Value::Object{{"type", Value("string")}})},
159 Diagnostic::error(DiagnosticCode::NotFound, "RPG battle gameplay instance was not found", "instance"));
163 Diagnostic::error(DiagnosticCode::NotFound, "RPG battle participant was not found", "command.subject"));
166 DiagnosticCode::PreconditionViolation, "session does not control this RPG participant", "command.subject"));
169 Diagnostic::error(DiagnosticCode::InvalidArgument, "command id must not be empty", "command.id"));
172 DiagnosticCode::Conflict, "RPG command was based on a stale observation", "command.expectedRevision"));
179 Diagnostic::error(DiagnosticCode::NotFound, "RPG command target was not found", "parameters.target"));
187 Diagnostic::error(DiagnosticCode::Unsupported, "unsupported RPG gameplay action", "command.action"));
219 Diagnostic::error(DiagnosticCode::NotFound, "RPG battle gameplay instance was not found", "instance"));
Player-equivalent, host-neutral control adapter for one RPG Battle.
回合制战斗对象:参战者、行动顺序、目标选取、行动执行。
static Diagnostic error(DiagnosticCode code, std::string message, std::string path={}, DiagnosticDetails details={}, std::string source={})
Construct an error diagnostic with the standard error severity.
Definition Diagnostic.h:125
const std::string & format() const noexcept
Returns the canonical namespace:name representation.
Definition Identity.h:436
static std::optional< LogicalId > parse(std::string_view text)
Parses a scoped logical name.
Definition Identity.cpp:36
static Result failure(Status status)
Construct a failed result from a structured status.
Definition Result.h:175
static Status success(StatusCode code=StatusCode::Ok)
Construct a successful status with an explicit non-error outcome.
Definition Status.h:81
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 std::optional< Id128 > parse(std::string_view text) noexcept
Parses canonical UUID text.
Definition Identity.h:151
BattleControl(Battle &battle, SubjectRef instance)
Construct an adapter over a borrowed battle and stable instance identity.
Definition BattleControl.cpp:31
std::vector< SubjectRef > gameplayInstances() const override
Instances currently served, in publication order.
Definition BattleControl.cpp:66
Result< void > bindParticipant(SubjectRef subject, RPGActor *actor)
Bind a stable subject to an existing battle participant.
Definition BattleControl.cpp:42
Result< GameplayObservation > observeGameplay(const GameplaySession &session, SubjectRef instance) const override
Observe one provider-owned gameplay instance without mutation.
Definition BattleControl.cpp:90
Result< GameplayObservation > advanceGameplay(const GameplaySession &session, SubjectRef instance, const SimulationStep &step) override
Advance one provider-owned instance using injected deterministic time.
Definition BattleControl.cpp:214
~BattleControl() override
Unpublish the capability without destroying the borrowed battle.
Definition BattleControl.cpp:37
std::string_view gameplayDomain() const noexcept override
Stable provider domain used for discovery and routing.
Definition BattleControl.cpp:64
Result< std::vector< GameplayEvent > > gameplayEvents(const GameplaySession &session, SubjectRef instance, std::uint64_t afterSequence) const override
Return events strictly newer than an instance-local sequence cursor.
Definition BattleControl.cpp:254
Result< GameplayCommandReceipt > submitGameplay(const GameplaySession &session, SubjectRef instance, const GameplayCommand &command) override
Validate authority and atomically submit one domain command.
Definition BattleControl.cpp:154
Result< std::vector< GameplayActionDescriptor > > availableGameplayActions(const GameplaySession &session, SubjectRef instance, SubjectRef subject) const override
Discover currently legal player-semantic actions for one subject.
Definition BattleControl.cpp:131
一场回合制战斗(任意阵营数)。 @ownership 由调用方创建/销毁;Battle 不持有参与者的所有权(参与者为借用 ECS actor)。 @thread 在单一模拟线程上驱动整场战斗。
Definition Battle.h:54
RPGActor * getActor(int index) const
Return a participant actor by index, or null when out of range.
Definition Battle.cpp:467
RPGActor * getEventCaster(int index) const
Return the caster of a polled event, or null when out of range.
Definition Battle.cpp:494
RPGActor * getEventTarget(int index) const
Return the target of a polled event, or null when out of range.
Definition Battle.cpp:498
eve::Result< void > setActionChecked(RPGActor *actor, const std::string &skillId, RPGActor *target=nullptr)
Validate and queue exactly one action for a living participant this round.
Definition Battle.cpp:203
double getCurrent(const std::string &resource)
生命等当前资源(VitalsSystem 的薄转发,max 取同名最终属性)。
Definition RPGActor.cpp:247
@ InvalidArgument
@ NotFound
@ PreconditionViolation
@ Unsupported
@ Conflict
@ NoOp
@ Applied
@ PlayerEquivalent
Owning evidence that a gameplay authority accepted one command.
Definition GameplayControl.h:62
std::uint64_t resultingRevision
Definition GameplayControl.h:66
One player-semantic command submitted to a domain authority.
Definition GameplayControl.h:52
Owning event projection safe across frames and process boundaries.
Definition GameplayControl.h:71
Immutable owning observation of one authoritative gameplay instance.
Definition GameplayControl.h:43
Owning authorization context shared by player, script and automation adapters.
Definition GameplayControl.h:30