Stateless systems over the tactics short-root ECS family. 更多...
#include <TacticsBattle.h>
静态 Public 成员函数 | |
| static Result< void > | addSide (Battle &battle, ecs::EntityHandle side) |
| Register a side during setup using a generation-checked handle. | |
| static Result< void > | addUnit (Battle &battle, ecs::EntityHandle unit, ecs::EntityHandle side, Cell cell) |
| Register and place a unit during setup atomically. | |
| static Result< void > | start (Battle &battle, std::string policyId) |
| Start a configured battle and emit battle.started. | |
| static Result< BattlePhase > | advance (Battle &battle, const SimulationStep &step) |
| Advance exactly one observable automatic phase transition. | |
| static Result< void > | endTurn (Battle &battle, SubjectRef actor) |
| End the currently acting unit's turn and enter TurnEnd. | |
| static Result< MoveReceipt > | moveUnit (Battle &battle, SubjectRef actor, Cell destination) |
| Validate and atomically commit movement for the active unit. | |
| static Result< MoveReceipt > | moveUnit (Battle &battle, SubjectRef actor, Cell destination, SimulationTick commandTick) |
| Commit movement at an explicit non-decreasing command tick (ActionRuntime adapter path). | |
| static Result< void > | faceUnit (Battle &battle, SubjectRef actor, int facing) |
| Change the active unit's logical facing without consuming movement points. | |
| static Result< void > | faceUnit (Battle &battle, SubjectRef actor, int facing, SimulationTick commandTick) |
| Commit facing at an explicit non-decreasing command tick. | |
| static Result< void > | previewFace (Battle &battle, SubjectRef actor, int facing) |
| Preview a facing action with the exact validator used by commit. | |
| static Result< void > | waitUnit (Battle &battle, SubjectRef actor) |
| Commit a wait action and enter TurnEnd for the active unit. | |
| static Result< void > | waitUnit (Battle &battle, SubjectRef actor, SimulationTick commandTick) |
| Commit wait at an explicit non-decreasing command tick. | |
| static Result< void > | previewWait (Battle &battle, SubjectRef actor) |
| Preview a wait action with the exact validator used by commit. | |
| static Result< AbilityReceipt > | useAbility (Battle &battle, SubjectRef actor, const LogicalId &action, Cell targetCell, SubjectRef targetUnit={}, std::string payload={}) |
| Declare an ability activation by the active unit. | |
| static Result< AbilityReceipt > | previewAbility (Battle &battle, SubjectRef actor, const LogicalId &action, Cell targetCell, SubjectRef targetUnit={}, std::string_view payload={}) |
| Preview an ability declaration with the exact validator used by commit. | |
| static Result< MoveReceipt > | previewMove (Battle &battle, SubjectRef actor, Cell destination) |
| Preview movement with the exact validator used by commit, without mutation. | |
| static Result< void > | finish (Battle &battle) |
| End a running battle and enter BattleEnd. | |
| static Result< std::size_t > | openReaction (Battle &battle, std::uint64_t triggerSequence, std::vector< ReactionCandidate > candidates) |
| Open a sorted reaction window for an existing battle event sequence. | |
| static Result< ReactionReceipt > | acceptReaction (Battle &battle, SubjectRef reactor, const LogicalId &action) |
| Accept one eligible reaction, consume one reaction point and close the top window. | |
| static Result< void > | declineReaction (Battle &battle) |
| Decline and close the top reaction window without consuming resources. | |
| static Result< void > | addObjective (Battle &battle, ObjectiveSpec objective) |
| Register a validated built-in objective during setup. | |
| static Result< void > | defeatUnit (Battle &battle, SubjectRef unit) |
| Apply a tactical defeat outcome and evaluate affected objectives atomically. | |
| static Result< std::uint64_t > | roll (Battle &battle, const LogicalId &stream) |
| Consume one value from a battle-owned named deterministic stream. | |
详细描述
Stateless systems over the tactics short-root ECS family.
Entity scope: Battle, TacticalSide and TacticalUnit roots linked to the supplied Battle. Read set: identities, membership, turn resources and board facts. Write set: Battle turn/events/board and TacticalUnit membership, position and acted flag. Structural mutation: none. Events are appended to Battle::Events. Services: none. Phase: owner simulation thread only. Determinism: bit-exact for equal setup, handles, SubjectRefs and steps.
在文件 TacticsBattle.h 第 49 行定义.
成员函数说明
◆ acceptReaction()
|
static |
Accept one eligible reaction, consume one reaction point and close the top window.
在文件 TacticsBattle.cpp 第 821 行定义.
引用了 eve::tactics::AcceptReaction, eve::tactics::Acting, action, eve::tactics::BattleCommand::action, eve::tactics::BattleCommand::actor, eve::Applied, eve::Conflict, eve::Diagnostic::error(), eve::tactics::BattleCommand::expectedRevision, eve::Result< T >::failure(), eve::SubjectRef::format(), handle, key, eve::tactics::BattleCommand::kind, eve::NotFound, eve::PreconditionViolation, eve::tactics::Reaction, reactions, record, revision, eve::tactics::Running, eve::Status::success(), eve::Result< T >::success(), eve::tactics::BattleCommand::triggerSequence, turn, unit , 以及 value.
◆ addObjective()
|
static |
Register a validated built-in objective during setup.
在文件 TacticsBattle.cpp 第 897 行定义.
引用了 eve::Applied, eve::tactics::ObjectiveSpec::beneficiarySide, cell, eve::Conflict, eve::tactics::EliminateSide, eve::Diagnostic::error(), eve::Result< T >::failure(), handle, eve::tactics::ObjectiveSpec::id, eve::InvalidArgument, eve::LogicalId::isValid(), eve::SubjectRef::isValid(), eve::tactics::ObjectiveSpec::kind, eve::NotFound, eve::tactics::OccupyCells, eve::tactics::Pending, eve::PreconditionViolation, eve::tactics::ObjectiveSpec::requiredCells, eve::tactics::ObjectiveSpec::requiredRound, revision, eve::tactics::Setup, subject, eve::Status::success(), eve::Result< T >::success(), eve::tactics::SurviveRounds, eve::tactics::ObjectiveSpec::targetSide, turn , 以及 value.
◆ addSide()
|
static |
Register a side during setup using a generation-checked handle.
在文件 TacticsBattle.cpp 第 235 行定义.
引用了 eve::Applied, eve::Conflict, eve::Diagnostic::error(), eve::Result< T >::failure(), eve::PreconditionViolation, revision, eve::tactics::Setup, sides, eve::StaleHandle, eve::Status::success() , 以及 eve::Result< T >::success().
被这些函数引用 eve::tactics::Tactics::newSide().
◆ addUnit()
|
static |
Register and place a unit during setup atomically.
- 返回
- Applied, or failure with board/unit/battle state unchanged.
在文件 TacticsBattle.cpp 第 258 行定义.
引用了 eve::Applied, eve::Conflict, eve::Diagnostic::error(), eve::Result< T >::failure(), eve::InvalidArgument, eve::NotFound, placed, eve::PreconditionViolation, revision, eve::tactics::Setup, eve::StaleHandle, eve::Status::success(), eve::Result< T >::success() , 以及 unit.
被这些函数引用 eve::tactics::Tactics::newUnit().
◆ advance()
|
static |
Advance exactly one observable automatic phase transition.
- 参数
-
battle Owner-thread-affine authoritative battle. step Strictly increasing injected simulation tick and non-negative duration.
在文件 TacticsBattle.cpp 第 433 行定义.
引用了 eve::tactics::Acting, eve::tactics::Advance, eve::tactics::BattleEnd, eve::tactics::BattleStart, eve::tactics::Ended, eve::Diagnostic::error(), eve::tactics::BattleCommand::expectedRevision, eve::Result< T >::failure(), handle, eve::InvalidArgument, eve::InvariantViolation, eve::tactics::BattleCommand::kind, eve::NoOp, ordered, eve::PreconditionViolation, eve::tactics::Reaction, record, revision, eve::tactics::RoundEnd, eve::tactics::RoundStart, eve::tactics::Running, eve::tactics::Setup, eve::StaleHandle, step, eve::tactics::BattleCommand::step, eve::Status::success(), eve::Result< T >::success(), turn, eve::tactics::TurnEnd, eve::tactics::TurnStart , 以及 unit.
被这些函数引用 eve::tactics::Tactics::advance() , 以及 eve::tactics::Tactics::advanceGameplay().
◆ declineReaction()
Decline and close the top reaction window without consuming resources.
在文件 TacticsBattle.cpp 第 876 行定义.
引用了 eve::tactics::Acting, eve::Applied, eve::tactics::DeclineReaction, eve::Diagnostic::error(), eve::tactics::BattleCommand::expectedRevision, eve::Result< T >::failure(), eve::tactics::BattleCommand::kind, eve::PreconditionViolation, eve::tactics::Reaction, reactions, record, revision, eve::tactics::Running, eve::Status::success(), eve::Result< T >::success(), eve::tactics::BattleCommand::triggerSequence , 以及 turn.
◆ defeatUnit()
|
static |
Apply a tactical defeat outcome and evaluate affected objectives atomically.
在文件 TacticsBattle.cpp 第 936 行定义.
引用了 eve::tactics::BattleCommand::actor, eve::Applied, eve::tactics::BattleEnd, eve::tactics::DefeatUnit, eve::tactics::Ended, eve::Diagnostic::error(), eve::tactics::BattleCommand::expectedRevision, eve::Result< T >::failure(), from, eve::tactics::BattleCommand::kind, eve::NoOp, eve::NotFound, eve::PreconditionViolation, record, removed, revision, eve::tactics::Running, subject, eve::Status::success(), eve::Result< T >::success(), target , 以及 turn.
被这些函数引用 eve::tactics::Tactics::defeatUnit().
◆ endTurn()
|
static |
End the currently acting unit's turn and enter TurnEnd.
在文件 TacticsBattle.cpp 第 561 行定义.
引用了 eve::tactics::Acting, eve::tactics::BattleCommand::actor, eve::Applied, eve::tactics::EndTurn, eve::Diagnostic::error(), eve::tactics::BattleCommand::expectedRevision, eve::Result< T >::failure(), from, eve::tactics::BattleCommand::kind, eve::PreconditionViolation, record, revision, eve::tactics::Running, eve::StaleHandle, eve::Status::success(), eve::Result< T >::success(), turn, eve::tactics::TurnEnd , 以及 unit.
被这些函数引用 eve::tactics::Tactics::endTurn() , 以及 eve::tactics::Tactics::submitGameplay().
◆ faceUnit() [1/2]
|
static |
Change the active unit's logical facing without consuming movement points.
在文件 TacticsBattle.cpp 第 628 行定义.
引用了 faceUnit() , 以及 facing.
被这些函数引用 faceUnit(), eve::tactics::Tactics::faceUnit() , 以及 eve::tactics::Tactics::submitGameplay().
◆ faceUnit() [2/2]
|
static |
Commit facing at an explicit non-decreasing command tick.
在文件 TacticsBattle.cpp 第 632 行定义.
引用了 eve::tactics::Acting, eve::tactics::BattleCommand::actor, eve::Applied, eve::Diagnostic::error(), eve::tactics::BattleCommand::expectedRevision, eve::tactics::Face, facing, eve::tactics::BattleCommand::facing, eve::Result< T >::failure(), eve::InvalidArgument, eve::tactics::BattleCommand::kind, eve::NoOp, previewFace(), record, revision, eve::tactics::BattleCommand::step, eve::Status::success(), eve::Result< T >::success(), eve::SimulationStep::tick, turn , 以及 unit.
◆ finish()
End a running battle and enter BattleEnd.
在文件 TacticsBattle.cpp 第 746 行定义.
引用了 eve::Applied, eve::tactics::BattleEnd, eve::tactics::Ended, eve::Diagnostic::error(), eve::tactics::BattleCommand::expectedRevision, eve::Result< T >::failure(), eve::tactics::Finish, from, eve::tactics::BattleCommand::kind, eve::PreconditionViolation, record, revision, eve::tactics::Running, eve::Status::success(), eve::Result< T >::success() , 以及 turn.
被这些函数引用 eve::tactics::Tactics::finish().
◆ moveUnit() [1/2]
|
static |
Validate and atomically commit movement for the active unit.
- 返回
- Owning receipt; failure leaves board, position and resources unchanged.
在文件 TacticsBattle.cpp 第 586 行定义.
引用了 moveUnit().
被这些函数引用 moveUnit(), eve::tactics::Tactics::moveUnit() , 以及 eve::tactics::Tactics::submitGameplay().
◆ moveUnit() [2/2]
|
static |
Commit movement at an explicit non-decreasing command tick (ActionRuntime adapter path).
在文件 TacticsBattle.cpp 第 590 行定义.
引用了 eve::tactics::Acting, eve::tactics::BattleCommand::actor, eve::Applied, eve::tactics::BattleEnd, eve::tactics::BattleCommand::cell, eve::tactics::MoveReceipt::cost, eve::tactics::Ended, eve::Diagnostic::error(), eve::tactics::BattleCommand::expectedRevision, eve::Result< T >::failure(), eve::InvalidArgument, eve::tactics::BattleCommand::kind, eve::tactics::Move, previewMove(), record, eve::tactics::MoveReceipt::remainingMovePoints, revision, eve::tactics::BattleCommand::step, eve::Status::success(), eve::Result< T >::success(), eve::SimulationStep::tick, turn , 以及 unit.
◆ openReaction()
|
static |
Open a sorted reaction window for an existing battle event sequence.
在文件 TacticsBattle.cpp 第 765 行定义.
引用了 eve::tactics::Acting, eve::Applied, candidates, eve::tactics::BattleCommand::candidates, depth, eve::Diagnostic::error(), eve::tactics::BattleCommand::expectedRevision, eve::Result< T >::failure(), from, eve::InvalidArgument, eve::tactics::BattleCommand::kind, left, eve::NotFound, eve::tactics::OpenReaction, eve::PreconditionViolation, eve::tactics::Reaction, reactions, record, revision, right, eve::tactics::Running, eve::Status::success(), eve::Result< T >::success(), eve::tactics::BattleCommand::triggerSequence , 以及 turn.
◆ previewAbility()
|
static |
Preview an ability declaration with the exact validator used by commit.
- 返回
- The receipt the commit would produce, computed without mutation: no action point is spent, no event is emitted and no command is recorded.
- 备注
- Sharing one validator is what lets a UI show "this is legal and costs one point" and then commit it without a second, divergent rule set.
在文件 TacticsBattle.cpp 第 396 行定义.
引用了 action, payload , 以及 eve::tactics::validateAbility().
◆ previewFace()
|
static |
Preview a facing action with the exact validator used by commit.
在文件 TacticsBattle.cpp 第 657 行定义.
引用了 eve::tactics::Acting, eve::Diagnostic::error(), eve::tactics::ExplicitGraph, facing, eve::Result< T >::failure(), eve::InvalidArgument, eve::NoOp, eve::Ok, eve::PreconditionViolation, eve::tactics::Running, eve::tactics::Square4, eve::tactics::Square8, eve::StaleHandle, eve::Status::success(), eve::Result< T >::success(), turn, unit , 以及 eve::Unsupported.
被这些函数引用 faceUnit(), eve::tactics::TacticsActionExecutor::prepare() , 以及 eve::tactics::Tactics::previewFace().
◆ previewMove()
|
static |
Preview movement with the exact validator used by commit, without mutation.
在文件 TacticsBattle.cpp 第 719 行定义.
引用了 eve::tactics::Acting, cells, consumed, cost, eve::Diagnostic::error(), eve::Result< T >::failure(), eve::NoOp, path, eve::tactics::PathQuery::path(), eve::PreconditionViolation, eve::tactics::PathQuery::reachable(), eve::tactics::Running, eve::StaleHandle, eve::Status::success(), eve::Result< T >::success(), turn , 以及 unit.
被这些函数引用 moveUnit(), eve::tactics::TacticsActionExecutor::prepare() , 以及 eve::tactics::Tactics::previewMove().
◆ previewWait()
|
static |
Preview a wait action with the exact validator used by commit.
在文件 TacticsBattle.cpp 第 707 行定义.
引用了 eve::tactics::Acting, eve::Diagnostic::error(), eve::Result< T >::failure(), eve::PreconditionViolation, eve::tactics::Running, eve::StaleHandle, eve::Result< T >::success(), turn , 以及 unit.
被这些函数引用 eve::tactics::TacticsActionExecutor::prepare(), eve::tactics::Tactics::previewWait() , 以及 waitUnit().
◆ roll()
|
static |
Consume one value from a battle-owned named deterministic stream.
- 备注
- Only commit/resolver paths may call this; previews and queries must not advance streams.
在文件 TacticsBattle.cpp 第 968 行定义.
引用了 eve::tactics::BattleCommand::action, eve::Applied, eve::Diagnostic::error(), eve::tactics::BattleCommand::expectedRevision, eve::Result< T >::failure(), eve::LogicalId::format(), eve::InvalidArgument, eve::LogicalId::isValid(), eve::tactics::BattleCommand::kind, eve::PreconditionViolation, record, revision, eve::tactics::RollRandom, eve::tactics::Running, eve::Status::success(), eve::Result< T >::success(), turn , 以及 value.
被这些函数引用 eve::tactics::Tactics::roll().
◆ start()
Start a configured battle and emit battle.started.
在文件 TacticsBattle.cpp 第 297 行定义.
引用了 eve::Applied, eve::tactics::BattleStart, eve::tactics::TurnPolicyRegistry::builtins(), eve::Conflict, eve::Diagnostic::error(), eve::tactics::BattleCommand::expectedRevision, eve::Result< T >::failure(), eve::tactics::TurnPolicyRegistry::find(), eve::tactics::BattleCommand::kind, policyId, eve::tactics::BattleCommand::policyId, eve::PreconditionViolation, record, revision, eve::tactics::Running, eve::tactics::Setup, eve::tactics::Start, eve::Status::success(), eve::Result< T >::success(), turn, units , 以及 eve::detail::StrongUint64< detail::SimulationTickTag >::zero().
被这些函数引用 eve::tactics::Tactics::start().
◆ useAbility()
|
static |
Declare an ability activation by the active unit.
- 参数
-
action Ability identity; it must be a valid logical id. 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. It is kept independent of targetCell, because an ability may name a primary unit inside an area the caller centres elsewhere.payload Opaque caller-owned effect parameters, stored and replayed verbatim; it must not exceed kMaxAbilityPayloadBytes.
- 返回
- Owning receipt, or a structured refusal that leaves resources, events and the command log unchanged.
- 备注
- Tactics owns the activation opportunity, not the effect: it enforces the phase and the actor, spends one action point, emits
action.declaredand records the command for replay. Damage, status and hit resolution stay with the RPG or game adapter, which reports the tactical outcome back throughdefeatUnit. Ending the turn is the caller's decision, exactly as for a move. @ownership The returned receipt owns its values; nothing borrows from the battle.
在文件 TacticsBattle.cpp 第 402 行定义.
引用了 action, eve::tactics::BattleCommand::action, eve::tactics::BattleCommand::actor, eve::Applied, eve::tactics::BattleCommand::cell, eve::Diagnostic::error(), eve::tactics::BattleCommand::expectedRevision, eve::Result< T >::failure(), eve::tactics::BattleCommand::kind, payload, eve::tactics::BattleCommand::payload, record, revision, eve::StaleHandle, eve::Status::success(), eve::Result< T >::success(), eve::tactics::BattleCommand::targetUnit, turn, unit, eve::tactics::UseAbility , 以及 eve::tactics::validateAbility().
被这些函数引用 eve::tactics::Tactics::submitGameplay() , 以及 eve::tactics::Tactics::useAbility().
◆ waitUnit() [1/2]
|
static |
Commit a wait action and enter TurnEnd for the active unit.
在文件 TacticsBattle.cpp 第 679 行定义.
引用了 waitUnit().
被这些函数引用 eve::tactics::Tactics::submitGameplay(), waitUnit() , 以及 eve::tactics::Tactics::waitUnit().
◆ waitUnit() [2/2]
|
static |
Commit wait at an explicit non-decreasing command tick.
在文件 TacticsBattle.cpp 第 683 行定义.
引用了 eve::tactics::Acting, eve::tactics::BattleCommand::actor, eve::Applied, eve::Diagnostic::error(), eve::tactics::BattleCommand::expectedRevision, eve::Result< T >::failure(), eve::InvalidArgument, eve::tactics::BattleCommand::kind, previewWait(), record, revision, eve::tactics::BattleCommand::step, eve::Status::success(), eve::Result< T >::success(), eve::SimulationStep::tick, turn, eve::tactics::TurnEnd, unit , 以及 eve::tactics::Wait.
该类的文档由以下文件生成:
- src/modules/tactics/TacticsBattle.h
- src/modules/tactics/TacticsBattle.cpp