载入中...
搜索中...
未找到
BattleControl.h
浏览该文件的文档.
1#pragma once
2#include "common/Export.h"
3
4
12
13#include <unordered_map>
14
15namespace eve::rpg {
16
17class Battle;
18class RPGActor;
19
29public:
31 BattleControl(Battle& battle, SubjectRef instance);
33 ~BattleControl() override;
34
35 BattleControl(const BattleControl&) = delete;
37
39 [[nodiscard]] Result<void> bindParticipant(SubjectRef subject, RPGActor* actor);
40
43 [[nodiscard]] std::string_view gameplayDomain() const noexcept override;
46 [[nodiscard]] std::vector<SubjectRef> gameplayInstances() const override;
49 [[nodiscard]] Result<GameplayObservation> observeGameplay(const GameplaySession& session,
50 SubjectRef instance) const override;
53 [[nodiscard]] Result<std::vector<GameplayActionDescriptor>> availableGameplayActions(
54 const GameplaySession& session, SubjectRef instance, SubjectRef subject) const override;
57 [[nodiscard]] Result<GameplayCommandReceipt> submitGameplay(const GameplaySession& session,
58 SubjectRef instance,
59 const GameplayCommand& command) override;
62 [[nodiscard]] Result<GameplayObservation> advanceGameplay(const GameplaySession& session,
63 SubjectRef instance,
64 const SimulationStep& step) override;
67 [[nodiscard]] Result<std::vector<GameplayEvent>> gameplayEvents(const GameplaySession& session,
68 SubjectRef instance,
69 std::uint64_t afterSequence) const override;
70
71private:
72 [[nodiscard]] RPGActor* resolve(SubjectRef subject) const;
73 [[nodiscard]] SubjectRef subjectOf(RPGActor* actor) const;
74 [[nodiscard]] bool controls(const GameplaySession& session, SubjectRef subject) const;
75
76 Battle& battle_;
77 SubjectRef instance_;
78 SimulationTick tick_ = SimulationTick::zero();
79 std::uint64_t revision_ = 0;
80 std::uint64_t nextEventSequence_ = 1;
81 std::unordered_map<SubjectRef, RPGActor*> actors_;
82 std::unordered_map<RPGActor*, std::string> lastCommandByActor_;
83 std::vector<GameplayEvent> events_;
84};
85
86} // namespace eve::rpg
int subject
Definition AnimSmr.cpp:163
#define EVENGINE_API_PLATFORM
Definition Export.h:107
Host-neutral player-equivalent command and observation protocol.
Optional companion surface for gameplay providers that can enumerate instances.
std::optional< InteractionSession > session
Definition Tactics.cpp:39
float step
Definition TreeMesh.cpp:314
Multi-provider gameplay boundary consumed by input, scripts and automation.
Optional read-only discovery surface implemented beside a gameplay provider.
Move-only operation result carrying either a value or Status.
Definition Result.h:155
Strong, domain-neutral reference to a runtime subject.
Definition SubjectRef.h:26
Explicit stable-identity adapter over one caller-owned RPG battle.
BattleControl & operator=(const BattleControl &)=delete
BattleControl(const BattleControl &)=delete
一场回合制战斗(任意阵营数)。 @ownership 由调用方创建/销毁;Battle 不持有参与者的所有权(参与者为借用 ECS actor)。 @thread 在单一模拟线程上驱动整场战斗。
Definition Battle.h:54
属性 / 状态 / 技能三表合一的 ECS 实体。
Definition RPGActor.h:34
RPG 模块的基础实体:把属性 / 状态 / 技能三张表挂到一个 ECS 实体上。
One discoverable domain action and its owning schema projection.
Owning evidence that a gameplay authority accepted one command.
One player-semantic command submitted to a domain authority.
Owning event projection safe across frames and process boundaries.
Immutable owning observation of one authoritative gameplay instance.
Owning authorization context shared by player, script and automation adapters.
One deterministic fixed-step emitted by SimulationClock.
Definition Time.h:158