Owns tactics short-root entities and coordinates checked battle setup. 更多...
#include <Tactics.h>
Public 成员函数 | |
| Module_REG (Tactics) | |
| Tactics () | |
| Construct an empty tactics composition profile. | |
| ~Tactics () override | |
| Destroy live entities created through this facade. | |
| std::string_view | gameplayDomain () const noexcept override |
| Stable provider domain used for discovery and routing. | |
| std::vector< SubjectRef > | gameplayInstances () const override |
| Instances currently served, in publication order. | |
| Result< GameplayObservation > | observeGameplay (const GameplaySession &session, SubjectRef instance) const override |
| Observe one provider-owned gameplay instance without mutation. | |
| Result< std::vector< GameplayActionDescriptor > > | availableGameplayActions (const GameplaySession &session, SubjectRef instance, SubjectRef subject) const override |
| Discover currently legal player-semantic actions for one subject. | |
| Result< GameplayCommandReceipt > | submitGameplay (const GameplaySession &session, SubjectRef instance, const GameplayCommand &command) override |
| Validate authority and atomically submit one domain command. | |
| Result< GameplayObservation > | advanceGameplay (const GameplaySession &session, SubjectRef instance, const SimulationStep &step) override |
| Advance one provider-owned instance using injected deterministic time. | |
| 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. | |
| Result< ecs::EntityHandle > | newBattle (SubjectRef subject, std::uint64_t seed=0) |
| Create a battle root with a valid stable subject and explicit seed. | |
| Result< ecs::EntityHandle > | newSide (ecs::EntityHandle battle, SubjectRef subject) |
| Create and register a side with a module-owned setup battle. | |
| Result< ecs::EntityHandle > | newUnit (ecs::EntityHandle battle, ecs::EntityHandle side, SubjectRef subject, LogicalId definition, Cell cell, TurnResourceSpec resources={}) |
| Create, register and place a tactical unit atomically. | |
| Result< void > | addCell (ecs::EntityHandle battle, Cell cell, CellState state={}) |
| Add one authoritative cell to a module-owned setup battle. | |
| Result< void > | setTopology (ecs::EntityHandle battle, BoardTopology topology) |
| Select square-four, square-eight, or axial-hex topology during setup. | |
| Result< void > | start (ecs::EntityHandle battle, std::string_view policyId) |
| Start a module-owned battle with a registered turn policy. | |
| Result< BattlePhase > | advance (ecs::EntityHandle battle, const SimulationStep &step) |
| Advance one automatic phase using injected deterministic time. | |
| Result< void > | endTurn (ecs::EntityHandle battle, SubjectRef actor) |
| End the active actor turn. | |
| Result< AbilityReceipt > | useAbility (ecs::EntityHandle battle, SubjectRef actor, const LogicalId &action, Cell targetCell, SubjectRef targetUnit={}, std::string payload={}) |
| Declare an ability activation for the active unit. | |
| Result< AbilityReceipt > | previewAbility (ecs::EntityHandle battle, SubjectRef actor, const LogicalId &action, Cell targetCell, SubjectRef targetUnit={}, std::string_view payload={}) |
| Ask whether an ability declaration would be accepted, without declaring it. | |
| Result< MoveReceipt > | moveUnit (ecs::EntityHandle battle, SubjectRef actor, Cell destination) |
| Validate and commit movement for the active unit. | |
| Result< void > | faceUnit (ecs::EntityHandle battle, SubjectRef actor, int facing) |
| Change the active unit's logical facing. | |
| Result< void > | waitUnit (ecs::EntityHandle battle, SubjectRef actor) |
| End the active unit's activation through the wait resolver. | |
| Result< void > | finish (ecs::EntityHandle battle) |
| Finish a running battle. | |
| Result< MoveReceipt > | previewMove (ecs::EntityHandle battle, SubjectRef actor, Cell destination) |
| Validate a move with the exact validator used by commit, without mutating. | |
| Result< void > | previewFace (ecs::EntityHandle battle, SubjectRef actor, int facing) |
| Validate a facing change with the exact validator used by commit. | |
| Result< void > | previewWait (ecs::EntityHandle battle, SubjectRef actor) |
| Validate a wait activation with the exact validator used by commit. | |
| Result< Reachability > | reachable (ecs::EntityHandle battle, SubjectRef subject, int budget) |
| Return the cells a placed subject can reach within an explicit budget. | |
| Result< std::vector< Cell > > | cellsInRange (ecs::EntityHandle battle, Cell origin, int minimum, int maximum, CellRangeMetric metric) |
| Enumerate existing cells whose logical distance falls in an inclusive range. @cost Linear in the number of board cells. | |
| Result< TacticalUnit::TurnResources > | unitResources (ecs::EntityHandle battle, SubjectRef unit) |
| Return an owning snapshot of a placed unit's per-turn resources. | |
| Result< void > | addEdge (ecs::EntityHandle battle, Cell from, Cell to, EdgeState state={}) |
| Declare a directed edge between two adjacent cells during setup. | |
| Result< EdgeState > | edge (ecs::EntityHandle battle, Cell from, Cell to) |
| Return a declared directed edge, or NotFound when none is declared. | |
| std::optional< EdgeState > | tryEdge (ecs::EntityHandle battle, Cell from, Cell to) |
| Return a declared directed edge, or empty when none is declared. | |
| Result< std::string > | policyId (ecs::EntityHandle battle) |
| Return the stable id of the policy scheduling this battle. | |
| Result< std::size_t > | openReaction (ecs::EntityHandle battle, std::uint64_t triggerSequence, std::vector< ReactionCandidate > candidates) |
| Open a deterministic reaction window. | |
| Result< ReactionReceipt > | acceptReaction (ecs::EntityHandle battle, SubjectRef reactor, const LogicalId &action) |
| Accept one eligible reaction. | |
| Result< void > | declineReaction (ecs::EntityHandle battle) |
| Decline the top reaction window. | |
| Result< void > | addObjective (ecs::EntityHandle battle, ObjectiveSpec objective) |
| Add one built-in objective during battle setup. | |
| Result< void > | defeatUnit (ecs::EntityHandle battle, SubjectRef unit) |
| Apply a defeat outcome from an RPG/game settlement adapter. | |
| Result< std::uint64_t > | roll (ecs::EntityHandle battle, const LogicalId &stream) |
| Consume one value from a named battle random stream. | |
| Result< BattleStatus > | status (ecs::EntityHandle battle) |
| Return an owning snapshot of the current battle status. | |
| Result< BattlePhase > | phase (ecs::EntityHandle battle) |
| Return an owning snapshot of the current battle phase. | |
| Result< SubjectRef > | activeUnit (ecs::EntityHandle battle) |
| Return an owning snapshot of the current active unit subject. | |
| Result< SnapshotEnvelope > | snapshot (ecs::EntityHandle battle, const SnapshotHashProvider &hashProvider) |
| Capture a sealed complete snapshot of a module-owned battle. | |
| Result< void > | restore (ecs::EntityHandle battle, const SnapshotEnvelope &snapshot, const SnapshotHashProvider &hashProvider) |
| Transactionally restore a module-owned identity-compatible battle snapshot. | |
| Result< std::vector< BattleCommand > > | commandsFrom (ecs::EntityHandle battle, Revision revision) |
| Return accepted commands newer than the supplied battle revision. | |
| Result< void > | replay (ecs::EntityHandle battle, std::span< const BattleCommand > commands) |
| Replay checked commands against a module-owned battle. | |
| Result< std::string > | snapshotJson (ecs::EntityHandle battle) |
| Seal a snapshot and serialize it as one JSON string. | |
| Result< void > | restoreJson (ecs::EntityHandle battle, std::string_view json) |
| Parse, verify and transactionally restore a snapshot from JSON text. | |
| Result< std::string > | commandLogJson (ecs::EntityHandle battle, Revision revision) |
Serialize the accepted command log after revision in its persisted shape. | |
| Result< void > | replayJson (ecs::EntityHandle battle, std::string_view json) |
Replay a command log produced by commandLogJson. | |
| Result< std::vector< Cell > > | visibleCellsInRange (ecs::EntityHandle battle, Cell origin, int minimum, int maximum, CellRangeMetric metric) |
Cells within a metric range of origin that actually see it. | |
| Result< InteractionContext > | interactionContext (ecs::EntityHandle battle, SubjectRef controlledUnit) |
| Build the interaction projection for one controlled unit. | |
| std::string_view | lineOfSightAlgorithm () const noexcept |
Id of the line-of-sight policy visibleCellsInRange currently uses. | |
| Result< void > | attachLineOfSightBoard (ecs::EntityHandle battle) |
| Bind one battle as the board that grid line-of-sight queries answer for. | |
| Result< void > | detachLineOfSightBoard (ecs::EntityHandle battle) |
Release the line-of-sight binding when battle is the bound one; otherwise NoOp. | |
| Result< std::vector< PresentationCommand > > | presentationIntents (ecs::EntityHandle battle, std::uint64_t afterSequence, std::uint64_t transientTicks=20) |
Project authoritative events after afterSequence into presentable intents. | |
| std::string_view | snapshotHashAlgorithm () const noexcept |
| Id of the content-digest algorithm snapshots currently use. | |
| std::size_t | battleCount () const noexcept |
| Return the number of live facade-owned battles. | |
| std::size_t | unitCount () const noexcept |
| Return the number of live facade-owned units. | |
| std::size_t | sideCount () const noexcept |
| Return the number of live facade-owned sides. | |
Public 成员函数 继承自 eve::Module | |
| virtual | ~Module () |
| Module. | |
| virtual std::string | getName () const =0 |
| Returns the name. | |
Public 成员函数 继承自 eve::IGameplayControlProvider | |
| virtual | ~IGameplayControlProvider ()=default |
| Releases IGameplayControlProvider resources. | |
Public 成员函数 继承自 eve::IGameplayInstanceCatalog | |
| virtual | ~IGameplayInstanceCatalog ()=default |
| Releases IGameplayInstanceCatalog resources. | |
静态 Public 成员函数 | |
| static Result< TacticsBattleSessionRef > | newSession (SubjectRef subject, std::uint64_t seed=0) |
| Allocate a script-owned battle session with generation/epoch stale detection. | |
| static script::Borrowed< TacticsBattleSession > | resolve (TacticsBattleSessionRef reference) noexcept |
| Resolve a live script battle session as a synchronous borrowed view. | |
| static Result< void > | release (TacticsBattleSessionRef reference) |
| Release a script battle session and its ECS aggregate. | |
| static bool | isStale (TacticsBattleSessionRef reference) noexcept |
| Return whether a script battle-session reference is stale. | |
额外继承的成员函数 | |
静态 Public 属性 继承自 eve::IGameplayControlProvider | |
| static constexpr const char * | capabilityName = "IGameplayControlProvider" |
静态 Public 属性 继承自 eve::IGameplayInstanceCatalog | |
| static constexpr const char * | capabilityName = "IGameplayInstanceCatalog" |
详细描述
Owns tactics short-root entities and coordinates checked battle setup.
The ECS world owns entity storage; this facade owns the responsibility to destroy handles it creates. Destruction removes units before sides and battles. Links are generation checked, so either explicit destruction order becomes observably stale rather than dangling. Snapshots persist stable identities only; runtime handles are rebuilt by the identity-compatible target.
All methods are simulation-thread-affine and invoke no unknown callbacks.
构造及析构函数说明
◆ Tactics()
| eve::tactics::Tactics::Tactics | ( | ) |
Construct an empty tactics composition profile.
在文件 Tactics.cpp 第 470 行定义.
引用了 eve::Result< void >::ignore() , 以及 eve::tactics::registerTacticsLineOfSightProvider().
◆ ~Tactics()
|
override |
Destroy live entities created through this facade.
在文件 Tactics.cpp 第 489 行定义.
成员函数说明
◆ acceptReaction()
| Result< ReactionReceipt > eve::tactics::Tactics::acceptReaction | ( | ecs::EntityHandle | battle, |
| SubjectRef | reactor, | ||
| const LogicalId & | action | ||
| ) |
Accept one eligible reaction.
在文件 Tactics.cpp 第 920 行定义.
引用了 eve::tactics::BattleSystem::acceptReaction(), action, eve::Diagnostic::error(), eve::Result< T >::failure() , 以及 eve::StaleHandle.
◆ activeUnit()
| Result< SubjectRef > eve::tactics::Tactics::activeUnit | ( | ecs::EntityHandle | battle | ) |
Return an owning snapshot of the current active unit subject.
在文件 Tactics.cpp 第 1071 行定义.
引用了 eve::Diagnostic::error(), eve::Result< T >::failure(), eve::NotFound, eve::StaleHandle, eve::Result< T >::success() , 以及 unit.
◆ addCell()
| Result< void > eve::tactics::Tactics::addCell | ( | ecs::EntityHandle | battle, |
| Cell | cell, | ||
| CellState | state = {} |
||
| ) |
Add one authoritative cell to a module-owned setup battle.
在文件 Tactics.cpp 第 803 行定义.
引用了 eve::Applied, eve::Diagnostic::error(), eve::Result< T >::failure(), eve::PreconditionViolation, eve::tactics::Setup, eve::StaleHandle, state, eve::Status::success() , 以及 eve::Result< T >::success().
◆ addEdge()
| Result< void > eve::tactics::Tactics::addEdge | ( | ecs::EntityHandle | battle, |
| Cell | from, | ||
| Cell | to, | ||
| EdgeState | state = {} |
||
| ) |
Declare a directed edge between two adjacent cells during setup.
- 返回
- Applied, or a structured validation/conflict/phase failure.
- 备注
- Setup-only and revision-bumping, exactly like
addCell: an edge changes traversal, so it must not appear once the battle runs.
在文件 Tactics.cpp 第 1022 行定义.
引用了 eve::Applied, eve::Diagnostic::error(), eve::Result< T >::failure(), from, eve::PreconditionViolation, eve::tactics::Setup, eve::StaleHandle, state, eve::Status::success(), eve::Result< T >::success() , 以及 to.
◆ addObjective()
| Result< void > eve::tactics::Tactics::addObjective | ( | ecs::EntityHandle | battle, |
| ObjectiveSpec | objective | ||
| ) |
Add one built-in objective during battle setup.
在文件 Tactics.cpp 第 936 行定义.
引用了 eve::tactics::BattleSystem::addObjective(), eve::Diagnostic::error(), eve::Result< T >::failure() , 以及 eve::StaleHandle.
◆ advance()
| Result< BattlePhase > eve::tactics::Tactics::advance | ( | ecs::EntityHandle | battle, |
| const SimulationStep & | step | ||
| ) |
Advance one automatic phase using injected deterministic time.
在文件 Tactics.cpp 第 848 行定义.
引用了 eve::tactics::BattleSystem::advance(), eve::Diagnostic::error(), eve::Result< T >::failure(), eve::StaleHandle , 以及 step.
◆ advanceGameplay()
|
overridevirtual |
Advance one provider-owned instance using injected deterministic time.
Advance gameplay.
实现了 eve::IGameplayControlProvider.
在文件 Tactics.cpp 第 685 行定义.
引用了 eve::tactics::BattleSystem::advance(), eve::Diagnostic::error(), eve::Result< T >::failure(), eve::NotFound, observeGameplay(), session , 以及 step.
◆ attachLineOfSightBoard()
| Result< void > eve::tactics::Tactics::attachLineOfSightBoard | ( | ecs::EntityHandle | battle | ) |
Bind one battle as the board that grid line-of-sight queries answer for.
- 返回
- Applied, NoOp when it is already bound, Conflict when a different battle is bound, or StaleHandle when the handle is not a live battle.
- 备注
- Mirrors the physics adapter's explicit world registration: the adapter serves one board at a time, so a project states which board the targeting pipeline should see instead of getting an answer that depends on binding order. Nothing is bound by default, and a query while nothing is bound is
Unsupported, never "not visible".
在文件 Tactics.cpp 第 1222 行定义.
引用了 eve::tactics::TacticsLineOfSightAdapter::bindBattle() , 以及 eve::tactics::tacticsLineOfSightAdapter().
◆ availableGameplayActions()
|
overridevirtual |
Discover currently legal player-semantic actions for one subject.
Available gameplay actions.
实现了 eve::IGameplayControlProvider.
在文件 Tactics.cpp 第 562 行定义.
引用了 eve::tactics::Acting, actions, active, eve::Diagnostic::error(), eve::NotFound, eve::PreconditionViolation, session , 以及 subject.
◆ battleCount()
|
noexcept |
Return the number of live facade-owned battles.
在文件 Tactics.cpp 第 1283 行定义.
◆ cellsInRange()
| Result< std::vector< Cell > > eve::tactics::Tactics::cellsInRange | ( | ecs::EntityHandle | battle, |
| Cell | origin, | ||
| int | minimum, | ||
| int | maximum, | ||
| CellRangeMetric | metric | ||
| ) |
Enumerate existing cells whose logical distance falls in an inclusive range. @cost Linear in the number of board cells.
在文件 Tactics.cpp 第 1013 行定义.
引用了 eve::tactics::PathQuery::cellsInRange(), eve::Diagnostic::error(), maximum, minimum, origin , 以及 eve::StaleHandle.
◆ commandLogJson()
| Result< std::string > eve::tactics::Tactics::commandLogJson | ( | ecs::EntityHandle | battle, |
| Revision | revision | ||
| ) |
Serialize the accepted command log after revision in its persisted shape.
- 返回
- JSON text that
replayJsonaccepts, or a structured failure.
在文件 Tactics.cpp 第 1142 行定义.
引用了 eve::tactics::TacticsPersistence::commandLogValue(), eve::Diagnostic::error(), eve::Result< T >::failure(), revision , 以及 eve::StaleHandle.
◆ commandsFrom()
| Result< std::vector< BattleCommand > > eve::tactics::Tactics::commandsFrom | ( | ecs::EntityHandle | battle, |
| Revision | revision | ||
| ) |
Return accepted commands newer than the supplied battle revision.
在文件 Tactics.cpp 第 1103 行定义.
引用了 eve::tactics::BattleReplay::commandsFrom(), eve::Diagnostic::error(), revision , 以及 eve::StaleHandle.
◆ declineReaction()
| Result< void > eve::tactics::Tactics::declineReaction | ( | ecs::EntityHandle | battle | ) |
Decline the top reaction window.
在文件 Tactics.cpp 第 929 行定义.
引用了 eve::tactics::BattleSystem::declineReaction(), eve::Diagnostic::error(), eve::Result< T >::failure() , 以及 eve::StaleHandle.
◆ defeatUnit()
| Result< void > eve::tactics::Tactics::defeatUnit | ( | ecs::EntityHandle | battle, |
| SubjectRef | unit | ||
| ) |
Apply a defeat outcome from an RPG/game settlement adapter.
在文件 Tactics.cpp 第 943 行定义.
引用了 eve::tactics::BattleSystem::defeatUnit(), eve::Diagnostic::error(), eve::Result< T >::failure(), eve::StaleHandle , 以及 unit.
◆ detachLineOfSightBoard()
| Result< void > eve::tactics::Tactics::detachLineOfSightBoard | ( | ecs::EntityHandle | battle | ) |
Release the line-of-sight binding when battle is the bound one; otherwise NoOp.
在文件 Tactics.cpp 第 1228 行定义.
引用了 eve::tactics::tacticsLineOfSightAdapter() , 以及 eve::tactics::TacticsLineOfSightAdapter::unbindBattle().
◆ edge()
Return a declared directed edge, or NotFound when none is declared.
在文件 Tactics.cpp 第 1037 行定义.
引用了 eve::Diagnostic::error(), eve::Result< T >::failure(), from, eve::StaleHandle , 以及 to.
◆ endTurn()
| Result< void > eve::tactics::Tactics::endTurn | ( | ecs::EntityHandle | battle, |
| SubjectRef | actor | ||
| ) |
End the active actor turn.
在文件 Tactics.cpp 第 856 行定义.
引用了 eve::tactics::BattleSystem::endTurn(), eve::Diagnostic::error(), eve::Result< T >::failure() , 以及 eve::StaleHandle.
◆ faceUnit()
| Result< void > eve::tactics::Tactics::faceUnit | ( | ecs::EntityHandle | battle, |
| SubjectRef | actor, | ||
| int | facing | ||
| ) |
Change the active unit's logical facing.
在文件 Tactics.cpp 第 890 行定义.
引用了 eve::Diagnostic::error(), eve::tactics::BattleSystem::faceUnit(), facing, eve::Result< T >::failure() , 以及 eve::StaleHandle.
◆ finish()
| Result< void > eve::tactics::Tactics::finish | ( | ecs::EntityHandle | battle | ) |
Finish a running battle.
在文件 Tactics.cpp 第 904 行定义.
引用了 eve::Diagnostic::error(), eve::Result< T >::failure(), eve::tactics::BattleSystem::finish() , 以及 eve::StaleHandle.
◆ gameplayDomain()
|
overridevirtualnoexcept |
Stable provider domain used for discovery and routing.
Gameplay domain.
实现了 eve::IGameplayControlProvider.
在文件 Tactics.cpp 第 497 行定义.
◆ gameplayEvents()
|
overridevirtual |
Return events strictly newer than an instance-local sequence cursor.
Gameplay events.
实现了 eve::IGameplayControlProvider.
在文件 Tactics.cpp 第 697 行定义.
引用了 events, observeGameplay(), eve::tactics::phaseName(), eve::GameplayEvent::sequence, session , 以及 source.
◆ gameplayInstances()
|
overridevirtual |
Instances currently served, in publication order.
Gameplay instances.
实现了 eve::IGameplayInstanceCatalog.
在文件 Tactics.cpp 第 499 行定义.
◆ interactionContext()
| Result< InteractionContext > eve::tactics::Tactics::interactionContext | ( | ecs::EntityHandle | battle, |
| SubjectRef | controlledUnit | ||
| ) |
Build the interaction projection for one controlled unit.
- 返回
- A context carrying the phase, the active unit, the controlled unit's cell, the cells it may legally move to, and which unit occupies each cell.
- 备注
- The result is a projection of the current battle revision and must be rebuilt after any state change, exactly like every other query in this module. Building it here (rather than inside the script binding) keeps the one authority for "what the UI is allowed to know" in C++ and testable.
在文件 Tactics.cpp 第 1182 行定义.
引用了 active, context, eve::Diagnostic::error(), eve::Result< T >::failure(), eve::InvalidArgument, eve::SubjectRef::isValid(), eve::NotFound, eve::tactics::PathQuery::reachable(), reachable(), eve::StaleHandle, eve::tactics::InteractionContext::status, eve::Result< T >::success() , 以及 unit.
◆ isStale()
|
staticnoexcept |
Return whether a script battle-session reference is stale.
在文件 Tactics.cpp 第 1310 行定义.
引用了 reference.
◆ lineOfSightAlgorithm()
|
noexcept |
Id of the line-of-sight policy visibleCellsInRange currently uses.
在文件 Tactics.cpp 第 1217 行定义.
引用了 eve::tactics::gridLineOfSightPolicy() , 以及 eve::tactics::ILineOfSightPolicy::id().
◆ Module_REG()
| eve::tactics::Tactics::Module_REG | ( | Tactics | ) |
◆ moveUnit()
| Result< MoveReceipt > eve::tactics::Tactics::moveUnit | ( | ecs::EntityHandle | battle, |
| SubjectRef | actor, | ||
| Cell | destination | ||
| ) |
Validate and commit movement for the active unit.
在文件 Tactics.cpp 第 882 行定义.
引用了 eve::Diagnostic::error(), eve::Result< T >::failure(), eve::tactics::BattleSystem::moveUnit() , 以及 eve::StaleHandle.
◆ newBattle()
| Result< ecs::EntityHandle > eve::tactics::Tactics::newBattle | ( | SubjectRef | subject, |
| std::uint64_t | seed = 0 |
||
| ) |
Create a battle root with a valid stable subject and explicit seed.
在文件 Tactics.cpp 第 724 行定义.
引用了 eve::Applied, eve::Diagnostic::error(), eve::Result< T >::failure(), eve::InvalidArgument, seed, subject, eve::Status::success() , 以及 eve::Result< T >::success().
◆ newSession()
|
static |
Allocate a script-owned battle session with generation/epoch stale detection.
在文件 Tactics.cpp 第 1287 行定义.
引用了 eve::Result< T >::failure(), session , 以及 status().
◆ newSide()
| Result< ecs::EntityHandle > eve::tactics::Tactics::newSide | ( | ecs::EntityHandle | battle, |
| SubjectRef | subject | ||
| ) |
Create and register a side with a module-owned setup battle.
在文件 Tactics.cpp 第 743 行定义.
引用了 eve::tactics::BattleSystem::addSide(), eve::Applied, eve::Diagnostic::error(), eve::Result< T >::failure(), eve::InvalidArgument, side, eve::StaleHandle, status, subject, eve::Status::success() , 以及 eve::Result< T >::success().
◆ newUnit()
| Result< ecs::EntityHandle > eve::tactics::Tactics::newUnit | ( | ecs::EntityHandle | battle, |
| ecs::EntityHandle | side, | ||
| SubjectRef | subject, | ||
| LogicalId | definition, | ||
| Cell | cell, | ||
| TurnResourceSpec | resources = {} |
||
| ) |
Create, register and place a tactical unit atomically.
- 返回
- Unit handle; failure destroys the candidate and leaves the battle unchanged.
在文件 Tactics.cpp 第 764 行定义.
引用了 eve::tactics::BattleSystem::addUnit(), eve::Applied, eve::Diagnostic::error(), eve::Result< T >::failure(), eve::InvalidArgument, resources, eve::StaleHandle, status, subject, eve::Status::success(), eve::Result< T >::success() , 以及 unit.
◆ observeGameplay()
|
overridevirtual |
Observe one provider-owned gameplay instance without mutation.
Observe gameplay.
实现了 eve::IGameplayControlProvider.
在文件 Tactics.cpp 第 511 行定义.
引用了 active, eve::GameplayObservation::domain, eve::Diagnostic::error(), eve::Result< T >::failure(), handle, eve::GameplayObservation::instance, eve::NotFound, eve::tactics::phaseName(), eve::PlayerEquivalent, eve::PreconditionViolation, eve::GameplayObservation::revision, session, eve::GameplayObservation::state, eve::tactics::statusName(), eve::Result< T >::success(), eve::GameplayObservation::tick, unit , 以及 units.
被这些函数引用 advanceGameplay() , 以及 gameplayEvents().
◆ openReaction()
| Result< std::size_t > eve::tactics::Tactics::openReaction | ( | ecs::EntityHandle | battle, |
| std::uint64_t | triggerSequence, | ||
| std::vector< ReactionCandidate > | candidates | ||
| ) |
Open a deterministic reaction window.
在文件 Tactics.cpp 第 911 行定义.
引用了 eve::Diagnostic::error(), eve::Result< T >::failure(), eve::tactics::BattleSystem::openReaction() , 以及 eve::StaleHandle.
◆ phase()
| Result< BattlePhase > eve::tactics::Tactics::phase | ( | ecs::EntityHandle | battle | ) |
Return an owning snapshot of the current battle phase.
在文件 Tactics.cpp 第 966 行定义.
引用了 eve::Diagnostic::error(), eve::Result< T >::failure(), eve::StaleHandle , 以及 eve::Result< T >::success().
◆ policyId()
| Result< std::string > eve::tactics::Tactics::policyId | ( | ecs::EntityHandle | battle | ) |
Return the stable id of the policy scheduling this battle.
- 返回
- The id recorded by
start; the read side of the policy choice, so a UI or a test can observe it without inferring it from ordering.
在文件 Tactics.cpp 第 1051 行定义.
引用了 eve::Diagnostic::error(), eve::Result< T >::failure(), eve::StaleHandle , 以及 eve::Result< T >::success().
◆ presentationIntents()
| Result< std::vector< PresentationCommand > > eve::tactics::Tactics::presentationIntents | ( | ecs::EntityHandle | battle, |
| std::uint64_t | afterSequence, | ||
| std::uint64_t | transientTicks = 20 |
||
| ) |
Project authoritative events after afterSequence into presentable intents.
- 参数
-
afterSequence Only events with a greater sequence are projected. transientTicks How long a transient intent stays valid, in simulation ticks.
- 返回
- Intents with their explicit revert contract, or a structured refusal.
- 备注
- Presentation is derived, never authoritative: each intent carries the revision it came from and the tick after which it is stale, so a consumer may drop it. Geometry is taken from the accepted command the event points at, never guessed.
在文件 Tactics.cpp 第 1232 行定义.
引用了 commands, eve::tactics::Destroyed, eve::Diagnostic::error(), eve::tactics::Finished, handle, eve::tactics::Idle, eve::tactics::PresentationProjector::project(), projected, eve::tactics::PresentationFrame::restingState, eve::tactics::PresentationFrame::revision, eve::StaleHandle, eve::tactics::PresentationFrame::transientTicks , 以及 unit.
◆ previewAbility()
| Result< AbilityReceipt > eve::tactics::Tactics::previewAbility | ( | ecs::EntityHandle | battle, |
| SubjectRef | actor, | ||
| const LogicalId & | action, | ||
| Cell | targetCell, | ||
| SubjectRef | targetUnit = {}, |
||
| std::string_view | payload = {} |
||
| ) |
Ask whether an ability declaration would be accepted, without declaring it.
- 返回
- The receipt the commit would produce, or the same refusal the commit would return.
- 备注
- Shares one validator with
useAbility, so a UI can show a legal activation and then commit it without a second rule set that could disagree.
在文件 Tactics.cpp 第 872 行定义.
引用了 action, eve::Diagnostic::error(), eve::Result< T >::failure(), payload, eve::tactics::BattleSystem::previewAbility() , 以及 eve::StaleHandle.
◆ previewFace()
| Result< void > eve::tactics::Tactics::previewFace | ( | ecs::EntityHandle | battle, |
| SubjectRef | actor, | ||
| int | facing | ||
| ) |
Validate a facing change with the exact validator used by commit.
在文件 Tactics.cpp 第 991 行定义.
引用了 eve::Diagnostic::error(), facing, eve::Result< T >::failure(), eve::tactics::BattleSystem::previewFace() , 以及 eve::StaleHandle.
◆ previewMove()
| Result< MoveReceipt > eve::tactics::Tactics::previewMove | ( | ecs::EntityHandle | battle, |
| SubjectRef | actor, | ||
| Cell | destination | ||
| ) |
Validate a move with the exact validator used by commit, without mutating.
- 返回
- The same receipt
moveUnitwould return, or its refusal.
- 备注
- Callers must treat the receipt as a projection of the observed board revision; a successful preview does not reserve anything.
在文件 Tactics.cpp 第 983 行定义.
引用了 eve::Diagnostic::error(), eve::Result< T >::failure(), eve::tactics::BattleSystem::previewMove() , 以及 eve::StaleHandle.
◆ previewWait()
| Result< void > eve::tactics::Tactics::previewWait | ( | ecs::EntityHandle | battle, |
| SubjectRef | actor | ||
| ) |
Validate a wait activation with the exact validator used by commit.
在文件 Tactics.cpp 第 998 行定义.
引用了 eve::Diagnostic::error(), eve::Result< T >::failure(), eve::tactics::BattleSystem::previewWait() , 以及 eve::StaleHandle.
◆ reachable()
| Result< Reachability > eve::tactics::Tactics::reachable | ( | ecs::EntityHandle | battle, |
| SubjectRef | subject, | ||
| int | budget | ||
| ) |
Return the cells a placed subject can reach within an explicit budget.
- 参数
-
budget Non-negative fixed-point movement budget.
- 备注
- Pure query: it neither reserves resources nor advances any random stream. @cost Proportional to the number of cells expanded; bounded by the board cell count.
在文件 Tactics.cpp 第 1005 行定义.
引用了 eve::Diagnostic::error(), eve::Result< T >::failure(), eve::tactics::PathQuery::reachable(), eve::StaleHandle , 以及 subject.
被这些函数引用 interactionContext().
◆ release()
|
static |
Release a script battle session and its ECS aggregate.
在文件 Tactics.cpp 第 1303 行定义.
引用了 eve::Diagnostic::error(), eve::Result< T >::failure() , 以及 eve::StaleHandle.
◆ replay()
| Result< void > eve::tactics::Tactics::replay | ( | ecs::EntityHandle | battle, |
| std::span< const BattleCommand > | commands | ||
| ) |
Replay checked commands against a module-owned battle.
在文件 Tactics.cpp 第 1111 行定义.
引用了 commands, eve::Diagnostic::error(), eve::Result< T >::failure(), eve::tactics::BattleReplay::replay() , 以及 eve::StaleHandle.
◆ replayJson()
| Result< void > eve::tactics::Tactics::replayJson | ( | ecs::EntityHandle | battle, |
| std::string_view | json | ||
| ) |
Replay a command log produced by commandLogJson.
- 返回
- Applied, or a structured refusal; commands are validated before any is applied.
- 备注
- The log is parsed by the same codec that restore uses, so replay cannot drift from the persisted command format. A log whose revision does not match this battle is refused rather than re-applied onto the wrong state.
在文件 Tactics.cpp 第 1152 行定义.
引用了 eve::Diagnostic::error(), eve::Result< T >::failure(), eve::Value::fromJson(), eve::tactics::TacticsPersistence::parseCommandLog(), eve::tactics::BattleReplay::replay() , 以及 eve::StaleHandle.
◆ resolve()
|
staticnoexcept |
Resolve a live script battle session as a synchronous borrowed view.
在文件 Tactics.cpp 第 1298 行定义.
◆ restore()
| Result< void > eve::tactics::Tactics::restore | ( | ecs::EntityHandle | battle, |
| const SnapshotEnvelope & | snapshot, | ||
| const SnapshotHashProvider & | hashProvider | ||
| ) |
Transactionally restore a module-owned identity-compatible battle snapshot.
在文件 Tactics.cpp 第 1095 行定义.
引用了 eve::Diagnostic::error(), eve::Result< T >::failure(), eve::tactics::TacticsPersistence::restore() , 以及 eve::StaleHandle.
◆ restoreJson()
| Result< void > eve::tactics::Tactics::restoreJson | ( | ecs::EntityHandle | battle, |
| std::string_view | json | ||
| ) |
Parse, verify and transactionally restore a snapshot from JSON text.
- 返回
- Applied, or a parse/version/identity/digest refusal; the battle is unchanged on failure, including when the envelope parses but its payload does not.
在文件 Tactics.cpp 第 1130 行定义.
引用了 eve::Diagnostic::error(), eve::Result< T >::failure(), eve::parseSnapshotEnvelope(), eve::tactics::TacticsPersistence::restore(), eve::snapshotContentHashProvider() , 以及 eve::StaleHandle.
◆ roll()
| Result< std::uint64_t > eve::tactics::Tactics::roll | ( | ecs::EntityHandle | battle, |
| const LogicalId & | stream | ||
| ) |
Consume one value from a named battle random stream.
在文件 Tactics.cpp 第 950 行定义.
引用了 eve::Diagnostic::error(), eve::Result< T >::failure(), eve::tactics::BattleSystem::roll() , 以及 eve::StaleHandle.
◆ setTopology()
| Result< void > eve::tactics::Tactics::setTopology | ( | ecs::EntityHandle | battle, |
| BoardTopology | topology | ||
| ) |
Select square-four, square-eight, or axial-hex topology during setup.
在文件 Tactics.cpp 第 818 行定义.
引用了 eve::Applied, eve::Conflict, eve::Diagnostic::error(), eve::tactics::ExplicitGraph, eve::Result< T >::failure(), eve::tactics::HexAxial, eve::InvalidArgument, eve::NoOp, eve::PreconditionViolation, revision, eve::tactics::Setup, eve::tactics::Square4, eve::tactics::Square8, eve::StaleHandle, eve::Status::success(), eve::Result< T >::success() , 以及 topology.
◆ sideCount()
|
noexcept |
Return the number of live facade-owned sides.
在文件 Tactics.cpp 第 1285 行定义.
◆ snapshot()
| Result< SnapshotEnvelope > eve::tactics::Tactics::snapshot | ( | ecs::EntityHandle | battle, |
| const SnapshotHashProvider & | hashProvider | ||
| ) |
Capture a sealed complete snapshot of a module-owned battle.
在文件 Tactics.cpp 第 1086 行定义.
引用了 eve::Diagnostic::error(), eve::Result< T >::failure(), eve::tactics::TacticsPersistence::snapshot() , 以及 eve::StaleHandle.
◆ snapshotHashAlgorithm()
|
noexcept |
Id of the content-digest algorithm snapshots currently use.
- 返回
- The active hasher's stable id, so a caller can record which algorithm produced a stored hash instead of assuming one.
在文件 Tactics.cpp 第 1165 行定义.
◆ snapshotJson()
| Result< std::string > eve::tactics::Tactics::snapshotJson | ( | ecs::EntityHandle | battle | ) |
Seal a snapshot and serialize it as one JSON string.
- 返回
- Canonical envelope JSON, or a structured failure. The digest comes from
snapshotHashAlgorithm: a registered hasher when a module provided one, otherwise the engine's built-in non-cryptographic one.
- 备注
- This is the form that can cross the script, file and network boundaries: the envelope is self-describing (schema, version, instance, revision, tick, digest), so a reader does not need out-of-band context to accept or reject it.
在文件 Tactics.cpp 第 1118 行定义.
引用了 eve::Diagnostic::error(), eve::Result< T >::failure(), eve::serializeSnapshotEnvelope(), eve::tactics::TacticsPersistence::snapshot(), eve::snapshotContentHashProvider() , 以及 eve::StaleHandle.
◆ start()
| Result< void > eve::tactics::Tactics::start | ( | ecs::EntityHandle | battle, |
| std::string_view | policyId | ||
| ) |
Start a module-owned battle with a registered turn policy.
- 参数
-
policyId Stable id of a policy in TurnPolicyRegistry::builtins(); the built-in spellings are inTurnPolicyKind.
- 返回
- Applied, or NotFound when the id is not registered (the battle is left in Setup, so a bad id can be corrected and retried).
在文件 Tactics.cpp 第 841 行定义.
引用了 eve::Diagnostic::error(), eve::Result< T >::failure(), policyId, eve::StaleHandle , 以及 eve::tactics::BattleSystem::start().
◆ status()
| Result< BattleStatus > eve::tactics::Tactics::status | ( | ecs::EntityHandle | battle | ) |
Return an owning snapshot of the current battle status.
在文件 Tactics.cpp 第 958 行定义.
引用了 eve::Diagnostic::error(), eve::Result< T >::failure(), eve::StaleHandle , 以及 eve::Result< T >::success().
被这些函数引用 newSession().
◆ submitGameplay()
|
overridevirtual |
Validate authority and atomically submit one domain command.
Submit gameplay.
实现了 eve::IGameplayControlProvider.
在文件 Tactics.cpp 第 600 行定义.
引用了 eve::GameplayCommandReceipt::acceptedTick, eve::GameplayCommand::action, eve::tactics::AbilityReceipt::action, eve::Applied, eve::GameplayCommandReceipt::commandId, eve::Conflict, eve::tactics::MoveReceipt::cost, eve::GameplayCommandReceipt::details, ended, eve::tactics::BattleSystem::endTurn(), eve::Diagnostic::error(), eve::GameplayCommandReceipt::executionId, eve::GameplayCommand::expectedRevision, eve::tactics::BattleSystem::faceUnit(), facing, eve::Result< T >::failure(), eve::SubjectRef::format(), eve::LogicalId::format(), eve::GameplayCommand::id, eve::InvalidArgument, eve::SubjectRef::isValid(), layer, eve::tactics::BattleSystem::moveUnit(), eve::NotFound, eve::GameplayCommand::observedTick, eve::GameplayCommand::parameters, payload, eve::PreconditionViolation, eve::tactics::AbilityReceipt::remainingActionPoints, eve::tactics::MoveReceipt::remainingMovePoints, eve::GameplayCommandReceipt::resultingRevision, session, eve::GameplayCommand::subject, eve::Status::success(), eve::Result< T >::success(), target, eve::tactics::AbilityReceipt::targetUnit, eve::Unsupported, eve::tactics::BattleSystem::useAbility(), eve::tactics::BattleSystem::waitUnit(), x , 以及 y.
◆ tryEdge()
| std::optional< EdgeState > eve::tactics::Tactics::tryEdge | ( | ecs::EntityHandle | battle, |
| Cell | from, | ||
| Cell | to | ||
| ) |
Return a declared directed edge, or empty when none is declared.
在文件 Tactics.cpp 第 1045 行定义.
◆ unitCount()
|
noexcept |
Return the number of live facade-owned units.
在文件 Tactics.cpp 第 1284 行定义.
◆ unitResources()
| Result< TacticalUnit::TurnResources > eve::tactics::Tactics::unitResources | ( | ecs::EntityHandle | battle, |
| SubjectRef | unit | ||
| ) |
Return an owning snapshot of a placed unit's per-turn resources.
This is the read side of the action economy: it exposes the same values the turn resolvers consume, including the acted flag and the scheduling charge, without granting script code a write path.
在文件 Tactics.cpp 第 1059 行定义.
引用了 eve::Diagnostic::error(), eve::Result< T >::failure(), found, eve::NotFound, eve::StaleHandle, eve::Result< T >::success() , 以及 unit.
◆ useAbility()
| Result< AbilityReceipt > eve::tactics::Tactics::useAbility | ( | ecs::EntityHandle | battle, |
| SubjectRef | actor, | ||
| const LogicalId & | action, | ||
| Cell | targetCell, | ||
| SubjectRef | targetUnit = {}, |
||
| std::string | payload = {} |
||
| ) |
Declare an ability activation for the active unit.
- 参数
-
action Ability identity the effect owner will resolve. targetCell Target cell; it must exist and share the actor's layer. targetUnit Optional targeted unit; when valid it must be a living unit of this battle. payload Opaque caller-owned effect parameters, stored and replayed verbatim, bounded by kMaxAbilityPayloadBytes.
- 返回
- The declaration receipt (actor, action, both targets and remaining action points), or a structured refusal; the battle is unchanged on failure.
- 备注
- Spends one action point and emits
action.declared. Effect resolution belongs to the RPG or game adapter, not to tactics, so a script cannot route damage through this call.
在文件 Tactics.cpp 第 863 行定义.
引用了 action, eve::Diagnostic::error(), eve::Result< T >::failure(), payload, eve::StaleHandle , 以及 eve::tactics::BattleSystem::useAbility().
◆ visibleCellsInRange()
| Result< std::vector< Cell > > eve::tactics::Tactics::visibleCellsInRange | ( | ecs::EntityHandle | battle, |
| Cell | origin, | ||
| int | minimum, | ||
| int | maximum, | ||
| CellRangeMetric | metric | ||
| ) |
Cells within a metric range of origin that actually see it.
- 返回
- The visible cells in deterministic order, or a structured refusal.
- 备注
- Uses the registered
ILineOfSightPolicywhen a module provided one, otherwise the module's built-in grid policy.lineOfSightAlgorithmreports which, so a caller never has to assume. This is the query that fillsInteractionContext::targetableCellsfor a sight-aware UI.
在文件 Tactics.cpp 第 1167 行定义.
引用了 eve::Diagnostic::error(), eve::tactics::gridLineOfSightPolicy(), maximum, minimum, origin, eve::StaleHandle , 以及 eve::tactics::visibleCellsInRange().
◆ waitUnit()
| Result< void > eve::tactics::Tactics::waitUnit | ( | ecs::EntityHandle | battle, |
| SubjectRef | actor | ||
| ) |
End the active unit's activation through the wait resolver.
在文件 Tactics.cpp 第 897 行定义.
引用了 eve::Diagnostic::error(), eve::Result< T >::failure(), eve::StaleHandle , 以及 eve::tactics::BattleSystem::waitUnit().
该类的文档由以下文件生成:
- src/modules/tactics/Tactics.h
- src/modules/tactics/Tactics.cpp
Public 成员函数 继承自